ruby-decompiler 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,8 @@
1
- require 'internal/node/as_code'
2
- require 'internal/vm/iseq/as_code'
3
1
  require 'internal/method'
4
- require 'internal/method/signature'
2
+
3
+ require 'decompiler/node/as_code'
4
+ require 'decompiler/vm/iseq/as_code'
5
+ require 'decompiler/method/signature'
5
6
 
6
7
  module MethodAsCode
7
8
  # Returns a string representation of the method definition/body.
@@ -1,8 +1,9 @@
1
- require 'internal/node/as_expression'
2
- require 'internal/vm/iseq/as_expression'
3
- require 'internal/method/signature'
4
1
  require 'internal/method'
5
2
 
3
+ require 'decompiler/node/as_expression'
4
+ require 'decompiler/vm/iseq/as_expression'
5
+ require 'decompiler/method/signature'
6
+
6
7
  module MethodAsExpression
7
8
  # Return a single-line string representation of a method
8
9
  # TODO: this method would be more aptly named "as_expression_string".
@@ -1,13 +1,14 @@
1
1
  require 'internal/method'
2
2
  require 'internal/node'
3
- require 'internal/node/as_expression'
4
- require 'internal/method/signature/argument'
5
- require 'internal/method/signature/node'
6
- require 'internal/method/signature/signature'
3
+
4
+ require 'decompiler/node/as_expression'
5
+ require 'decompiler/method/signature/argument'
6
+ require 'decompiler/method/signature/node'
7
+ require 'decompiler/method/signature/signature'
7
8
 
8
9
  if defined?(RubyVM) then
9
- require 'internal/vm/bytedecoder'
10
- require 'internal/method/signature/iseq'
10
+ require 'decompiler/vm/bytedecoder'
11
+ require 'decompiler/method/signature/iseq'
11
12
  end
12
13
 
13
14
  module MethodSig
@@ -1,6 +1,7 @@
1
- require 'internal/node/as_code'
2
1
  require 'internal/module'
3
2
 
3
+ require 'decompiler/node/as_code'
4
+
4
5
  class Module
5
6
  # TODO: it would be nice if we could go back and find the AST
6
7
  # for the class instead of recreating the code from the class's
@@ -1,6 +1,6 @@
1
1
  require 'internal/node'
2
- require 'internal/node/as_expression'
3
- require 'internal/object/as_code'
2
+ require 'decompiler/node/as_expression'
3
+ require 'decompiler/object/as_code'
4
4
  require 'rbconfig'
5
5
 
6
6
  class Node
@@ -0,0 +1,10 @@
1
+ require 'decompiler/node/as_code'
2
+ require 'internal/object'
3
+
4
+ class Object
5
+ def as_code(indent=0)
6
+ # TODO: this won't work for many objects
7
+ "#{' '*indent}#{self.inspect}"
8
+ end
9
+ end
10
+
@@ -1,6 +1,7 @@
1
- require 'internal/node/as_code'
2
1
  require 'internal/proc'
3
- require 'internal/proc/signature'
2
+
3
+ require 'decompiler/node/as_code'
4
+ require 'decompiler/proc/signature'
4
5
 
5
6
  class Proc
6
7
  # Return a string representation of a proc's definition/body,
@@ -1,7 +1,8 @@
1
- require 'internal/node/as_expression'
2
- require 'internal/proc/signature'
3
1
  require 'internal/proc'
4
2
 
3
+ require 'decompiler/node/as_expression'
4
+ require 'decompiler/proc/signature'
5
+
5
6
  class Proc
6
7
  # Return a single-line string representation of a proc's
7
8
  # definition/body, similarly to +Method#as_expression+.
@@ -1,7 +1,7 @@
1
1
  require 'internal/vm'
2
2
 
3
3
  if defined?(RubyVM::InstructionSequence) then
4
- require 'internal/vm/bytedecoder'
4
+ require 'decompiler/vm/bytedecoder'
5
5
 
6
6
  class RubyVM
7
7
  class InstructionSequence
@@ -1,7 +1,7 @@
1
1
  require 'internal/vm'
2
2
 
3
3
  if defined?(RubyVM::InstructionSequence) then
4
- require 'internal/vm/bytedecoder'
4
+ require 'decompiler/vm/bytedecoder'
5
5
 
6
6
  class RubyVM
7
7
  class InstructionSequence
data/test/test_as_code.rb CHANGED
@@ -6,10 +6,10 @@ $:.unshift(dir) if not $:.include?(dir)
6
6
  $:.unshift("#{dir}/../lib") if not $:.include?("#{dir}/../lib")
7
7
  $:.unshift("#{dir}/../ext") if not $:.include?("#{dir}/../ext")
8
8
 
9
- require 'internal/node/as_code'
10
- require 'internal/method/as_code'
11
- require 'internal/module/as_code'
12
- require 'internal/proc/as_code'
9
+ require 'decompiler/node/as_code'
10
+ require 'decompiler/method/as_code'
11
+ require 'decompiler/module/as_code'
12
+ require 'decompiler/proc/as_code'
13
13
 
14
14
  require 'expression_samples'
15
15
 
@@ -239,23 +239,23 @@ class TC_As_Code < Test::Unit::TestCase
239
239
  end
240
240
 
241
241
  if __FILE__ == $0 then
242
- require 'test/unit/ui/console/testrunner'
243
-
244
- if Test::Unit.const_defined?(:AutoRunner) then
245
- exit Test::Unit::AutoRunner.run
246
- else
247
- if ARGV.empty? then
248
- suite = TC_As_Code.suite
249
- else
250
- suite = Test::Unit::TestSuite.new('TC_As_Code')
251
- TC_As_Code.suite.tests.each do |test|
252
- ARGV.each do |arg|
253
- suite << test if /#{arg}/ =~ test.name
254
- end
255
- end
256
- end
257
- result = Test::Unit::UI::Console::TestRunner.run(suite)
258
- exit(result.error_count + result.failure_count)
259
- end
242
+ # require 'test/unit/ui/console/testrunner'
243
+
244
+ # if Test::Unit.const_defined?(:AutoRunner) then
245
+ # exit Test::Unit::AutoRunner.run
246
+ # else
247
+ # if ARGV.empty? then
248
+ # suite = TC_As_Code.suite
249
+ # else
250
+ # suite = Test::Unit::TestSuite.new('TC_As_Code')
251
+ # TC_As_Code.suite.tests.each do |test|
252
+ # ARGV.each do |arg|
253
+ # suite << test if /#{arg}/ =~ test.name
254
+ # end
255
+ # end
256
+ # end
257
+ # result = Test::Unit::UI::Console::TestRunner.run(suite)
258
+ # exit(result.error_count + result.failure_count)
259
+ # end
260
260
  end
261
261
 
@@ -6,9 +6,9 @@ $:.unshift(dir) if not $:.include?(dir)
6
6
  $:.unshift("#{dir}/../lib") if not $:.include?("#{dir}/../lib")
7
7
  $:.unshift("#{dir}/../ext") if not $:.include?("#{dir}/../ext")
8
8
 
9
- require 'internal/node/as_expression'
10
- require 'internal/method/as_expression'
11
- require 'internal/proc/as_expression'
9
+ require 'decompiler/node/as_expression'
10
+ require 'decompiler/method/as_expression'
11
+ require 'decompiler/proc/as_expression'
12
12
 
13
13
  require 'expression_samples'
14
14
 
@@ -207,23 +207,23 @@ class TC_As_Expression < Test::Unit::TestCase
207
207
  end
208
208
 
209
209
  if __FILE__ == $0 then
210
- require 'test/unit/ui/console/testrunner'
211
-
212
- if Test::Unit.const_defined?(:AutoRunner) then
213
- exit Test::Unit::AutoRunner.run
214
- else
215
- if ARGV.empty? then
216
- suite = TC_As_Expression.suite
217
- else
218
- suite = Test::Unit::TestSuite.new('TC_As_Expression')
219
- TC_As_Expression.suite.tests.each do |test|
220
- ARGV.each do |arg|
221
- suite << test if /#{arg}/ =~ test.name
222
- end
223
- end
224
- end
225
- result = Test::Unit::UI::Console::TestRunner.run(suite)
226
- exit(result.error_count + result.failure_count)
227
- end
210
+ # require 'test/unit/ui/console/testrunner'
211
+
212
+ # if Test::Unit.const_defined?(:AutoRunner) then
213
+ # exit Test::Unit::AutoRunner.run
214
+ # else
215
+ # if ARGV.empty? then
216
+ # suite = TC_As_Expression.suite
217
+ # else
218
+ # suite = Test::Unit::TestSuite.new('TC_As_Expression')
219
+ # TC_As_Expression.suite.tests.each do |test|
220
+ # ARGV.each do |arg|
221
+ # suite << test if /#{arg}/ =~ test.name
222
+ # end
223
+ # end
224
+ # end
225
+ # result = Test::Unit::UI::Console::TestRunner.run(suite)
226
+ # exit(result.error_count + result.failure_count)
227
+ # end
228
228
  end
229
229
 
@@ -261,7 +261,7 @@ class TC_Methodsig < Test::Unit::TestCase
261
261
  end
262
262
 
263
263
  if __FILE__ == $0 then
264
- require 'test_helpers'
265
- run_all_tests()
264
+ # require 'test_helpers'
265
+ # run_all_tests()
266
266
  end
267
267
 
metadata CHANGED
@@ -1,50 +1,43 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ruby-decompiler
3
- version: !ruby/object:Gem::Version
4
- hash: 29
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 1
10
- version: 0.0.1
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Paul Brannan
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-05-11 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-05-16 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: ruby-internal
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 57
29
- segments:
30
- - 0
31
- - 8
32
- - 3
33
- version: 0.8.3
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.8.4
34
22
  type: :runtime
35
- version_requirements: *id001
36
- description: |
37
- Ruby-decompiler is a decompiler for ruby code. Use it to deconstruct
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.8.4
30
+ description: ! 'Ruby-decompiler is a decompiler for ruby code. Use it to deconstruct
31
+
38
32
  method signatures and decompile bytecode (1.9.x) or the AST (1.8.x).
39
33
 
34
+ '
40
35
  email: curlypaul924@gmail.com
41
36
  executables: []
42
-
43
37
  extensions: []
44
-
45
- extra_rdoc_files:
38
+ extra_rdoc_files:
46
39
  - README.rdoc
47
- files:
40
+ files:
48
41
  - lib/decompiler/node/as_code.rb
49
42
  - lib/decompiler/node/as_expression.rb
50
43
  - lib/decompiler/vm/iseq/as_code.rb
@@ -58,6 +51,7 @@ files:
58
51
  - lib/decompiler/method/signature/node.rb
59
52
  - lib/decompiler/method/as_code.rb
60
53
  - lib/decompiler/method/as_expression.rb
54
+ - lib/decompiler/object/as_code.rb
61
55
  - lib/decompiler/module/as_code.rb
62
56
  - lib/decompiler/proc/signature.rb
63
57
  - lib/decompiler/proc/as_code.rb
@@ -68,38 +62,29 @@ files:
68
62
  - test/test_as_expression.rb
69
63
  homepage: http://github.com/cout/ruby-decompiler/
70
64
  licenses: []
71
-
72
65
  post_install_message:
73
66
  rdoc_options: []
74
-
75
- require_paths:
67
+ require_paths:
76
68
  - lib
77
- required_ruby_version: !ruby/object:Gem::Requirement
69
+ required_ruby_version: !ruby/object:Gem::Requirement
78
70
  none: false
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- hash: 3
83
- segments:
84
- - 0
85
- version: "0"
86
- required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ! '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
76
  none: false
88
- requirements:
89
- - - ">="
90
- - !ruby/object:Gem::Version
91
- hash: 3
92
- segments:
93
- - 0
94
- version: "0"
77
+ requirements:
78
+ - - ! '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
95
81
  requirements: []
96
-
97
82
  rubyforge_project:
98
83
  rubygems_version: 1.8.24
99
84
  signing_key:
100
85
  specification_version: 3
101
86
  summary: A decompiler for ruby (both YARV and MRI)
102
- test_files:
87
+ test_files:
103
88
  - test/test_methodsig.rb
104
89
  - test/test_as_code.rb
105
90
  - test/test_as_expression.rb