ruby2ruby 2.6.0 → 2.6.1
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/History.rdoc +6 -0
- data/Rakefile +10 -6
- data/lib/ruby2ruby.rb +6 -2
- data/test/test_ruby2ruby.rb +9 -3
- data.tar.gz.sig +0 -0
- metadata +15 -15
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 47b02eac6d9da093ec8d57bd84e3b6d4d9e18120280b21de3265fa6e65cd87ae
|
|
4
|
+
data.tar.gz: ad4413f10e596d3e6f7130c80f9dbda8e27c6899009f5c3a1da3b9f1cd59b249
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 06adf0bca90a2226800500f505de13a9432139d3472996f68377614c0eaca0a8e893055ca2fc8584e68dbdc8c8043eef7f9f91bd1b7c446c935803bcc5e101ba
|
|
7
|
+
data.tar.gz: ac08f4635b66aca9005ab9f1c04d8f3a4b9a8aab863e250e6348ace8bb913858f7ca44385f82ca91bce4ac6b7bc08bbf790b983bb92a772131b8944d9709cb16
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/History.rdoc
CHANGED
data/Rakefile
CHANGED
|
@@ -4,7 +4,6 @@ require 'rubygems'
|
|
|
4
4
|
require 'hoe'
|
|
5
5
|
|
|
6
6
|
Hoe.add_include_dirs("lib",
|
|
7
|
-
"../../ruby_parser/dev/lib",
|
|
8
7
|
"../../sexp_processor/dev/lib")
|
|
9
8
|
|
|
10
9
|
Hoe.plugin :seattlerb
|
|
@@ -25,10 +24,13 @@ Hoe.spec 'ruby2ruby' do
|
|
|
25
24
|
end
|
|
26
25
|
|
|
27
26
|
def process ruby, file="stdin"
|
|
28
|
-
require "
|
|
27
|
+
require "prism"
|
|
28
|
+
require "prism/translation/ruby_parser"
|
|
29
29
|
require "ruby2ruby"
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
not_ruby_parser = Class.new Prism::Translation::RubyParser
|
|
32
|
+
|
|
33
|
+
parser = not_ruby_parser.new
|
|
32
34
|
ruby2ruby = Ruby2Ruby.new
|
|
33
35
|
|
|
34
36
|
begin
|
|
@@ -44,7 +46,6 @@ end
|
|
|
44
46
|
|
|
45
47
|
task :stress do
|
|
46
48
|
$: << "lib"
|
|
47
|
-
$: << "../../ruby_parser/dev/lib"
|
|
48
49
|
require "pp"
|
|
49
50
|
|
|
50
51
|
files = Dir["../../*/dev/**/*.rb"].reject { |s| s =~ %r%/gems/% }
|
|
@@ -84,10 +85,13 @@ task :debug => :isolate do
|
|
|
84
85
|
end
|
|
85
86
|
|
|
86
87
|
task :parse => :isolate do
|
|
87
|
-
require "
|
|
88
|
+
require "prism"
|
|
89
|
+
require "prism/translation/ruby_parser"
|
|
88
90
|
require "pp"
|
|
89
91
|
|
|
90
|
-
|
|
92
|
+
not_ruby_parser = Class.new Prism::Translation::RubyParser
|
|
93
|
+
|
|
94
|
+
parser = not_ruby_parser.new
|
|
91
95
|
|
|
92
96
|
file = ENV["F"]
|
|
93
97
|
ruby = ENV["R"]
|
data/lib/ruby2ruby.rb
CHANGED
|
@@ -31,7 +31,7 @@ end
|
|
|
31
31
|
# Generate ruby code from a sexp.
|
|
32
32
|
|
|
33
33
|
class Ruby2Ruby < SexpProcessor
|
|
34
|
-
VERSION = "2.6.
|
|
34
|
+
VERSION = "2.6.1" # :nodoc:
|
|
35
35
|
|
|
36
36
|
# cutoff for one-liners
|
|
37
37
|
LINE_LENGTH = 78
|
|
@@ -411,7 +411,11 @@ class Ruby2Ruby < SexpProcessor
|
|
|
411
411
|
|
|
412
412
|
def process_defined exp # :nodoc:
|
|
413
413
|
_, rhs = exp
|
|
414
|
-
|
|
414
|
+
if context[1] == :if then # HACK?
|
|
415
|
+
"defined?(#{process rhs})"
|
|
416
|
+
else
|
|
417
|
+
"defined? #{process rhs}"
|
|
418
|
+
end
|
|
415
419
|
end
|
|
416
420
|
|
|
417
421
|
def process_defn(exp) # :nodoc:
|
data/test/test_ruby2ruby.rb
CHANGED
|
@@ -10,8 +10,10 @@ require "pt_testcase"
|
|
|
10
10
|
require "fileutils"
|
|
11
11
|
require "tmpdir"
|
|
12
12
|
require "prism"
|
|
13
|
+
require "timeout" # remove once upstreamed
|
|
14
|
+
# require "prism/translation/ruby_parser" # not until upstreamed
|
|
13
15
|
|
|
14
|
-
class NotRubyParser < Prism::Translation::RubyParser
|
|
16
|
+
class NotRubyParser < Prism::Translation::RubyParser # remove once upstreamed
|
|
15
17
|
attr_accessor :scopes
|
|
16
18
|
|
|
17
19
|
def initialize scopes:nil
|
|
@@ -691,6 +693,12 @@ class TestRuby2Ruby < R2RTestCase
|
|
|
691
693
|
assert_parse inn, out
|
|
692
694
|
end
|
|
693
695
|
|
|
696
|
+
def test_if_defined
|
|
697
|
+
inn = s(:if, s(:defined, s(:const, :Foo)), s(:lit, 1), s(:lit, 2))
|
|
698
|
+
out = "defined?(Foo) ? (1) : (2)" # TODO: remove parens on 1/2
|
|
699
|
+
assert_parse inn, out
|
|
700
|
+
end
|
|
701
|
+
|
|
694
702
|
def test_if_empty
|
|
695
703
|
inn = s(:if, s(:call, nil, :x), nil, nil)
|
|
696
704
|
out = "if x then\n # do nothing\nend"
|
|
@@ -1172,8 +1180,6 @@ end
|
|
|
1172
1180
|
tr2r = File.read(__FILE__).lines[start + 1..__LINE__ - 2].join
|
|
1173
1181
|
ir2r = File.read("lib/ruby2ruby.rb")
|
|
1174
1182
|
|
|
1175
|
-
require "ruby_parser"
|
|
1176
|
-
|
|
1177
1183
|
def morph_and_eval src, from, to, processor
|
|
1178
1184
|
new_src = processor.new.process(NotRubyParser.new.process(src.sub(from, to)))
|
|
1179
1185
|
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby2ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.6.
|
|
4
|
+
version: 2.6.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryan Davis
|
|
@@ -9,9 +9,9 @@ bindir: bin
|
|
|
9
9
|
cert_chain:
|
|
10
10
|
- |
|
|
11
11
|
-----BEGIN CERTIFICATE-----
|
|
12
|
-
|
|
12
|
+
MIIDPjCCAiagAwIBAgIBCjANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
|
|
13
13
|
ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
|
|
14
|
-
|
|
14
|
+
GRYDY29tMB4XDTI2MDEwNzAxMDkxNFoXDTI3MDEwNzAxMDkxNFowRTETMBEGA1UE
|
|
15
15
|
AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
|
|
16
16
|
JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
|
|
17
17
|
b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
|
|
@@ -21,12 +21,12 @@ cert_chain:
|
|
|
21
21
|
qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
|
|
22
22
|
gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
|
|
23
23
|
HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBCwUAA4IB
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
AQA/X8/PKTTc/IkYQEUL6XWtfK8fAfbuLJzmLcz6f2ZWrtBvPsYvqRuwI1bWUtil
|
|
25
|
+
2ibJEfIuSIHX6BsUTX18+hlaIussf6EWq/YkE7e2BKmgQE42vSOZMce0kCEAPbx0
|
|
26
|
+
rQtqonfWTHQ8UbQ7GqCL3gDQ0QDD2B+HUlb4uaCZ2icxqa/eOtxMvHC2tj+h0xKY
|
|
27
|
+
xL84ipM5kr0bHGf9/MRZJWcw51urueNycBXu1Xh+pEN8qBmYsFRR4SIODLClybAO
|
|
28
|
+
6cbm2PyPQgKNiqE4H+IQrDVHd9bJs1XgLElk3qoaJBWXc/5fy0J1imYb25UqmiHG
|
|
29
|
+
snGe1hrppvBRdcyEzvhfIPjI
|
|
30
30
|
-----END CERTIFICATE-----
|
|
31
31
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
32
32
|
dependencies:
|
|
@@ -64,34 +64,34 @@ dependencies:
|
|
|
64
64
|
requirements:
|
|
65
65
|
- - ">="
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: '
|
|
67
|
+
version: '6.0'
|
|
68
68
|
- - "<"
|
|
69
69
|
- !ruby/object:Gem::Version
|
|
70
|
-
version: '
|
|
70
|
+
version: '8'
|
|
71
71
|
type: :development
|
|
72
72
|
prerelease: false
|
|
73
73
|
version_requirements: !ruby/object:Gem::Requirement
|
|
74
74
|
requirements:
|
|
75
75
|
- - ">="
|
|
76
76
|
- !ruby/object:Gem::Version
|
|
77
|
-
version: '
|
|
77
|
+
version: '6.0'
|
|
78
78
|
- - "<"
|
|
79
79
|
- !ruby/object:Gem::Version
|
|
80
|
-
version: '
|
|
80
|
+
version: '8'
|
|
81
81
|
- !ruby/object:Gem::Dependency
|
|
82
82
|
name: hoe
|
|
83
83
|
requirement: !ruby/object:Gem::Requirement
|
|
84
84
|
requirements:
|
|
85
85
|
- - "~>"
|
|
86
86
|
- !ruby/object:Gem::Version
|
|
87
|
-
version: '4.
|
|
87
|
+
version: '4.5'
|
|
88
88
|
type: :development
|
|
89
89
|
prerelease: false
|
|
90
90
|
version_requirements: !ruby/object:Gem::Requirement
|
|
91
91
|
requirements:
|
|
92
92
|
- - "~>"
|
|
93
93
|
- !ruby/object:Gem::Version
|
|
94
|
-
version: '4.
|
|
94
|
+
version: '4.5'
|
|
95
95
|
description: |-
|
|
96
96
|
ruby2ruby provides a means of generating pure ruby code easily from
|
|
97
97
|
RubyParser compatible Sexps. This makes making dynamic language
|
metadata.gz.sig
CHANGED
|
Binary file
|