|
From: <caw...@us...> - 2007-08-09 13:01:19
|
Revision: 2949
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2949&view=rev
Author: cawilliams
Date: 2007-08-09 06:01:17 -0700 (Thu, 09 Aug 2007)
Log Message:
-----------
move core stubbing script to it's own subfolder to help try to avoid filename clashes.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVM.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.launching/ruby/standard_vm/core_stubber.rb
Removed Paths:
-------------
trunk/org.rubypeople.rdt.launching/ruby/core_stubber.rb
Deleted: trunk/org.rubypeople.rdt.launching/ruby/core_stubber.rb
===================================================================
--- trunk/org.rubypeople.rdt.launching/ruby/core_stubber.rb 2007-08-09 12:54:05 UTC (rev 2948)
+++ trunk/org.rubypeople.rdt.launching/ruby/core_stubber.rb 2007-08-09 13:01:17 UTC (rev 2949)
@@ -1,82 +0,0 @@
-OUTPUT_PATH = ARGV.first + "/"
-
-def file_name(klass)
- file_name = OUTPUT_PATH + klass.to_s.downcase
- file_name.gsub!("::", "/")
- file_name << ".rb"
- return file_name
-end
-
-def dir_names(file_name)
- last_slash = file_name.rindex("/")
- return nil if last_slash.nil?
- file_name[0...last_slash]
-end
-
-def print_method(f, method, method_name, singleton = false)
- f << " def "
- f << "self." if singleton
- f << method_name.to_s
- if !method.nil? and method.arity != 0
- # TODO We need to handle methods that take blocks!
- f << "("
- if method.arity < 0
- args = []
- (method.arity.abs + 1).times {|i| args << "arg#{i}" }
- args << "*rest"
- f << args.join(", ")
- else
- args = []
- method.arity.times {|i| args << "arg#{i}" }
- f << args.join(", ")
- end
- f << ")"
- end
- f << "\n end\n"
-end
-
-require 'FileUtils'
-@klasses = Module.constants.select {|c| ["Class", "Module"].include?(eval("#{c}.class").to_s) }
-@klasses = @klasses.collect {|k| eval("#{k}")}
-@klasses = @klasses.uniq.sort_by {|klass| klass.to_s }
-@klasses.each do |klass|
- next if klass.to_s[0].chr == "f" # TODO Skip if first char is lowercase
- file_name = file_name(klass)
- dirs = dir_names(file_name)
- FileUtils.mkdir_p(dirs) if !dirs.nil? and !File.exist?(file_name)
- open(file_name, 'w') do |f|
- f << "#{klass.class.to_s.downcase} #{klass}"
- f << " < #{klass.superclass.to_s }" if klass.respond_to?(:superclass) and !klass.superclass.nil?
- f << "\n"
- klass.included_modules.each {|mod| f << " include #{mod.to_s}\n" unless mod.to_s == "Kernel" && klass.to_s != "Object"}
- f << "\n"
- # FIXME We aren't grabbing some important methods inside Module (like "include")
- klass.methods(false).each do |method_name|
- method = eval("#{klass}").method(method_name) rescue nil
- print_method(f, method, method_name.to_s, true)
- end
- # TODO Fix it so we can get a hold of the module instance methods properly
- klass.instance_methods(false).each do |method_name|
- begin
- obj = if klass.class.to_s == "Module" then klass else klass.new end
- method = obj.method(method_name.to_s)
- rescue StandardError => e
- puts e
- # TODO If we can't create an instance of a class, generate dynamic subclass where we can, and then
- # grab methods from there
- begin
- # If we're a module, we may need to force the function to be more visible to grab it
- obj.module_eval do
- module_function(method_name.to_s)
- end
- method = obj.method(method_name.to_s)
- rescue StandardError => e
- puts e
- method = nil
- end
- end
- print_method(f, method, method_name.to_s)
- end
- f << "end\n"
- end
-end
\ No newline at end of file
Copied: trunk/org.rubypeople.rdt.launching/ruby/standard_vm/core_stubber.rb (from rev 2706, trunk/org.rubypeople.rdt.launching/ruby/core_stubber.rb)
===================================================================
--- trunk/org.rubypeople.rdt.launching/ruby/standard_vm/core_stubber.rb (rev 0)
+++ trunk/org.rubypeople.rdt.launching/ruby/standard_vm/core_stubber.rb 2007-08-09 13:01:17 UTC (rev 2949)
@@ -0,0 +1,82 @@
+OUTPUT_PATH = ARGV.first + "/"
+
+def file_name(klass)
+ file_name = OUTPUT_PATH + klass.to_s.downcase
+ file_name.gsub!("::", "/")
+ file_name << ".rb"
+ return file_name
+end
+
+def dir_names(file_name)
+ last_slash = file_name.rindex("/")
+ return nil if last_slash.nil?
+ file_name[0...last_slash]
+end
+
+def print_method(f, method, method_name, singleton = false)
+ f << " def "
+ f << "self." if singleton
+ f << method_name.to_s
+ if !method.nil? and method.arity != 0
+ # TODO We need to handle methods that take blocks!
+ f << "("
+ if method.arity < 0
+ args = []
+ (method.arity.abs + 1).times {|i| args << "arg#{i}" }
+ args << "*rest"
+ f << args.join(", ")
+ else
+ args = []
+ method.arity.times {|i| args << "arg#{i}" }
+ f << args.join(", ")
+ end
+ f << ")"
+ end
+ f << "\n end\n"
+end
+
+require 'FileUtils'
+@klasses = Module.constants.select {|c| ["Class", "Module"].include?(eval("#{c}.class").to_s) }
+@klasses = @klasses.collect {|k| eval("#{k}")}
+@klasses = @klasses.uniq.sort_by {|klass| klass.to_s }
+@klasses.each do |klass|
+ next if klass.to_s[0].chr == "f" # TODO Skip if first char is lowercase
+ file_name = file_name(klass)
+ dirs = dir_names(file_name)
+ FileUtils.mkdir_p(dirs) if !dirs.nil? and !File.exist?(file_name)
+ open(file_name, 'w') do |f|
+ f << "#{klass.class.to_s.downcase} #{klass}"
+ f << " < #{klass.superclass.to_s }" if klass.respond_to?(:superclass) and !klass.superclass.nil?
+ f << "\n"
+ klass.included_modules.each {|mod| f << " include #{mod.to_s}\n" unless mod.to_s == "Kernel" && klass.to_s != "Object"}
+ f << "\n"
+ # FIXME We aren't grabbing some important methods inside Module (like "include")
+ klass.methods(false).each do |method_name|
+ method = eval("#{klass}").method(method_name) rescue nil
+ print_method(f, method, method_name.to_s, true)
+ end
+ # TODO Fix it so we can get a hold of the module instance methods properly
+ klass.instance_methods(false).each do |method_name|
+ begin
+ obj = if klass.class.to_s == "Module" then klass else klass.new end
+ method = obj.method(method_name.to_s)
+ rescue StandardError => e
+ puts e
+ # TODO If we can't create an instance of a class, generate dynamic subclass where we can, and then
+ # grab methods from there
+ begin
+ # If we're a module, we may need to force the function to be more visible to grab it
+ obj.module_eval do
+ module_function(method_name.to_s)
+ end
+ method = obj.method(method_name.to_s)
+ rescue StandardError => e
+ puts e
+ method = nil
+ end
+ end
+ print_method(f, method, method_name.to_s)
+ end
+ f << "end\n"
+ end
+end
\ No newline at end of file
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVM.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVM.java 2007-08-09 12:54:05 UTC (rev 2948)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVM.java 2007-08-09 13:01:17 UTC (rev 2949)
@@ -133,7 +133,7 @@
private IPath generateCoreStubs(File rubyExecutable) {
if (rubyExecutable == null) return null;
//locate the script to generate our core stubs
- File coreStubber = LaunchingPlugin.getFileInPlugin(new Path("ruby" + fgSeparator + "core_stubber.rb")); //$NON-NLS-1$ //$NON-NLS-2$
+ File coreStubber = LaunchingPlugin.getFileInPlugin(new Path("ruby").append("standard_vm").append("core_stubber.rb")); //$NON-NLS-1$ //$NON-NLS-2$
if (coreStubber.exists()) {
IPath stubFolder = LaunchingPlugin.getDefault().getStateLocation().append(getId()).append("lib"); //$NON-NLS-1$
if (stubFolder.toFile().exists()) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|