ruby2ruby 1.2.5 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data.tar.gz.sig +0 -0
- data/.autotest +2 -3
- data/.gemtest +0 -0
- data/History.txt +6 -0
- data/README.txt +3 -3
- data/Rakefile +5 -4
- data/lib/ruby2ruby.rb +4 -4
- data/test/test_ruby2ruby.rb +21 -0
- metadata +22 -41
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/.autotest
CHANGED
@@ -6,9 +6,8 @@ Autotest.add_hook :initialize do |at|
|
|
6
6
|
at.order = :random
|
7
7
|
at.testlib = "minitest/autorun"
|
8
8
|
|
9
|
-
at.extra_files << "../../
|
10
|
-
at.
|
11
|
-
at.libs << ":../../sexp_processor/dev/lib:../../ParseTree/dev/lib:../../ParseTree/dev/test"
|
9
|
+
at.extra_files << "../../sexp_processor/dev/lib/pt_testcase.rb"
|
10
|
+
at.libs << ":../../sexp_processor/dev/lib:../../ruby_parser/dev/lib"
|
12
11
|
|
13
12
|
(1..4).each do |n|
|
14
13
|
at.extra_class_map["TestRuby2Ruby#{n}"] = "test/test_ruby2ruby.rb"
|
data/.gemtest
ADDED
File without changes
|
data/History.txt
CHANGED
data/README.txt
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
= ruby2ruby
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
home :: https://github.com/seattlerb/ruby2ruby
|
4
|
+
rdoc :: http://seattlerb.rubyforge.org/ruby2ruby
|
5
5
|
|
6
6
|
== DESCRIPTION:
|
7
7
|
|
@@ -52,7 +52,7 @@ processors in ruby easier than ever!
|
|
52
52
|
|
53
53
|
(The MIT License)
|
54
54
|
|
55
|
-
Copyright (c) Ryan Davis,
|
55
|
+
Copyright (c) Ryan Davis, seattle.rb
|
56
56
|
|
57
57
|
Permission is hereby granted, free of charge, to any person obtaining
|
58
58
|
a copy of this software and associated documentation files (the
|
data/Rakefile
CHANGED
@@ -2,22 +2,23 @@
|
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'hoe'
|
5
|
+
require 'isolate/rake'
|
5
6
|
|
6
7
|
Hoe.add_include_dirs("lib",
|
7
|
-
"../../ParseTree/dev/test",
|
8
8
|
"../../ruby_parser/dev/lib",
|
9
9
|
"../../sexp_processor/dev/lib")
|
10
10
|
|
11
11
|
Hoe.plugin :seattlerb
|
12
|
+
Hoe.plugin :isolate
|
12
13
|
|
13
14
|
Hoe.spec 'ruby2ruby' do
|
14
15
|
developer 'Ryan Davis', 'ryand-ruby@zenspider.com'
|
15
16
|
|
16
17
|
self.rubyforge_name = 'seattlerb'
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
19
|
+
dependency "sexp_processor", "~> 3.0"
|
20
|
+
dependency "ruby_parser", "~> 2.0"
|
21
|
+
dependency "ParseTree", "~> 3.0", :developer
|
21
22
|
end
|
22
23
|
|
23
24
|
task :stress do
|
data/lib/ruby2ruby.rb
CHANGED
@@ -4,7 +4,7 @@ require 'rubygems'
|
|
4
4
|
require 'sexp_processor'
|
5
5
|
|
6
6
|
class Ruby2Ruby < SexpProcessor
|
7
|
-
VERSION = '1.
|
7
|
+
VERSION = '1.3.0'
|
8
8
|
LINE_LENGTH = 78
|
9
9
|
|
10
10
|
BINARY = [:<=>, :==, :<, :>, :<=, :>=, :-, :+, :*, :/, :%, :<<, :>>, :**]
|
@@ -247,7 +247,7 @@ class Ruby2Ruby < SexpProcessor
|
|
247
247
|
end
|
248
248
|
|
249
249
|
def process_class(exp)
|
250
|
-
"class #{util_module_or_class(exp, true)}"
|
250
|
+
"#{exp.comments}class #{util_module_or_class(exp, true)}"
|
251
251
|
end
|
252
252
|
|
253
253
|
def process_colon2(exp)
|
@@ -306,7 +306,7 @@ class Ruby2Ruby < SexpProcessor
|
|
306
306
|
body << indent(process(exp.shift))
|
307
307
|
end
|
308
308
|
body = body.join("\n")
|
309
|
-
return "def #{name}#{args}\n#{body}\nend".gsub(/\n\s*\n+/, "\n")
|
309
|
+
return "#{exp.comments}def #{name}#{args}\n#{body}\nend".gsub(/\n\s*\n+/, "\n")
|
310
310
|
else
|
311
311
|
raise "Unknown defn type: #{type1} for #{exp.inspect}"
|
312
312
|
end
|
@@ -592,7 +592,7 @@ class Ruby2Ruby < SexpProcessor
|
|
592
592
|
end
|
593
593
|
|
594
594
|
def process_module(exp)
|
595
|
-
"module #{util_module_or_class(exp)}"
|
595
|
+
"#{exp.comments}module #{util_module_or_class(exp)}"
|
596
596
|
end
|
597
597
|
|
598
598
|
def process_next(exp)
|
data/test/test_ruby2ruby.rb
CHANGED
@@ -197,6 +197,27 @@ class TestRuby2Ruby < R2RTestCase
|
|
197
197
|
util_compare inn, out
|
198
198
|
end
|
199
199
|
|
200
|
+
def test_class_comments
|
201
|
+
inn = s(:class, :Z, nil, s(:scope))
|
202
|
+
inn.comments = "# x\n# y\n"
|
203
|
+
out = "# x\n# y\nclass Z\nend"
|
204
|
+
util_compare inn, out
|
205
|
+
end
|
206
|
+
|
207
|
+
def test_module_comments
|
208
|
+
inn = s(:module, :Z, s(:scope))
|
209
|
+
inn.comments = "# x\n# y\n"
|
210
|
+
out = "# x\n# y\nmodule Z\nend"
|
211
|
+
util_compare inn, out
|
212
|
+
end
|
213
|
+
|
214
|
+
def test_method_comments
|
215
|
+
inn = s(:defn, :z, s(:args), s(:scope, s(:block, s(:nil))))
|
216
|
+
inn.comments = "# x\n# y\n"
|
217
|
+
out = "# x\n# y\ndef z\n # do nothing\nend"
|
218
|
+
util_compare inn, out
|
219
|
+
end
|
220
|
+
|
200
221
|
def util_compare sexp, expected_ruby, expected_eval = nil
|
201
222
|
assert_equal expected_ruby, @processor.process(sexp)
|
202
223
|
assert_equal expected_eval, eval(expected_ruby) if expected_eval
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby2ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 1.
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
version: 1.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Davis
|
@@ -36,8 +36,7 @@ cert_chain:
|
|
36
36
|
FBHgymkyj/AOSqKRIpXPhjC6
|
37
37
|
-----END CERTIFICATE-----
|
38
38
|
|
39
|
-
date:
|
40
|
-
default_executable:
|
39
|
+
date: 2011-09-01 00:00:00 Z
|
41
40
|
dependencies:
|
42
41
|
- !ruby/object:Gem::Dependency
|
43
42
|
name: sexp_processor
|
@@ -70,41 +69,24 @@ dependencies:
|
|
70
69
|
type: :runtime
|
71
70
|
version_requirements: *id002
|
72
71
|
- !ruby/object:Gem::Dependency
|
73
|
-
name:
|
72
|
+
name: minitest
|
74
73
|
prerelease: false
|
75
74
|
requirement: &id003 !ruby/object:Gem::Requirement
|
76
75
|
none: false
|
77
76
|
requirements:
|
78
|
-
- -
|
77
|
+
- - ~>
|
79
78
|
- !ruby/object:Gem::Version
|
80
|
-
hash:
|
79
|
+
hash: 9
|
81
80
|
segments:
|
82
81
|
- 2
|
83
|
-
-
|
84
|
-
|
85
|
-
version: 2.0.4
|
82
|
+
- 5
|
83
|
+
version: "2.5"
|
86
84
|
type: :development
|
87
85
|
version_requirements: *id003
|
88
|
-
- !ruby/object:Gem::Dependency
|
89
|
-
name: minitest
|
90
|
-
prerelease: false
|
91
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
92
|
-
none: false
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
hash: 9
|
97
|
-
segments:
|
98
|
-
- 1
|
99
|
-
- 7
|
100
|
-
- 1
|
101
|
-
version: 1.7.1
|
102
|
-
type: :development
|
103
|
-
version_requirements: *id004
|
104
86
|
- !ruby/object:Gem::Dependency
|
105
87
|
name: ParseTree
|
106
88
|
prerelease: false
|
107
|
-
requirement: &
|
89
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
108
90
|
none: false
|
109
91
|
requirements:
|
110
92
|
- - ~>
|
@@ -115,23 +97,22 @@ dependencies:
|
|
115
97
|
- 0
|
116
98
|
version: "3.0"
|
117
99
|
type: :development
|
118
|
-
version_requirements: *
|
100
|
+
version_requirements: *id004
|
119
101
|
- !ruby/object:Gem::Dependency
|
120
102
|
name: hoe
|
121
103
|
prerelease: false
|
122
|
-
requirement: &
|
104
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
123
105
|
none: false
|
124
106
|
requirements:
|
125
|
-
- -
|
107
|
+
- - ~>
|
126
108
|
- !ruby/object:Gem::Version
|
127
|
-
hash:
|
109
|
+
hash: 27
|
128
110
|
segments:
|
129
111
|
- 2
|
130
|
-
-
|
131
|
-
|
132
|
-
version: 2.6.2
|
112
|
+
- 12
|
113
|
+
version: "2.12"
|
133
114
|
type: :development
|
134
|
-
version_requirements: *
|
115
|
+
version_requirements: *id005
|
135
116
|
description: |-
|
136
117
|
ruby2ruby provides a means of generating pure ruby code easily from
|
137
118
|
RubyParser compatible Sexps. This makes making dynamic language
|
@@ -155,8 +136,8 @@ files:
|
|
155
136
|
- bin/r2r_show
|
156
137
|
- lib/ruby2ruby.rb
|
157
138
|
- test/test_ruby2ruby.rb
|
158
|
-
|
159
|
-
homepage:
|
139
|
+
- .gemtest
|
140
|
+
homepage: https://github.com/seattlerb/ruby2ruby
|
160
141
|
licenses: []
|
161
142
|
|
162
143
|
post_install_message:
|
@@ -186,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
167
|
requirements: []
|
187
168
|
|
188
169
|
rubyforge_project: seattlerb
|
189
|
-
rubygems_version: 1.
|
170
|
+
rubygems_version: 1.8.10
|
190
171
|
signing_key:
|
191
172
|
specification_version: 3
|
192
173
|
summary: ruby2ruby provides a means of generating pure ruby code easily from RubyParser compatible Sexps
|
metadata.gz.sig
CHANGED
Binary file
|