sourcify 0.2.1 → 0.2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.txt +4 -0
- data/README.rdoc +14 -3
- data/Rakefile +4 -4
- data/VERSION +1 -1
- data/lib/sourcify/proc.rb +10 -6
- data/sourcify.gemspec +5 -5
- data/spec/proc/created_on_the_fly_proc_spec.rb +1 -1
- data/spec/proc/to_source_from_multi_blocks_w_many_matches_spec.rb +1 -1
- data/spec/proc_scanner/block_comment_spec.rb +2 -0
- data/spec/proc_scanner/double_colons_spec.rb +2 -1
- data/spec/proc_scanner/double_quote_str_w_interpolation_spec.rb +2 -0
- data/spec/proc_scanner/double_quote_str_wo_interpolation_spec.rb +2 -0
- data/spec/proc_scanner/heredoc_spec.rb +2 -0
- data/spec/proc_scanner/kw_do_alias1_spec.rb +2 -0
- data/spec/proc_scanner/kw_do_alias2_spec.rb +2 -0
- data/spec/proc_scanner/per_line_comment_spec.rb +2 -0
- data/spec/proc_scanner/single_quote_str_spec.rb +2 -0
- data/spec/spec_helper.rb +5 -1
- metadata +7 -6
data/HISTORY.txt
CHANGED
data/README.rdoc
CHANGED
@@ -157,15 +157,26 @@ following bug[http://redmine.ruby-lang.org/issues/show/574] under 1.8.* may trip
|
|
157
157
|
This is another reason to install ParseTree when u are on 1.8.*. On JRuby, where u don't
|
158
158
|
have the choice, just avoid multiple procs per line.
|
159
159
|
|
160
|
+
=== 3. Occasional Racc::ParseError
|
161
|
+
|
162
|
+
Under the hood, sourcify relies on RubyParser to yield s-expression, and since RubyParser
|
163
|
+
does not yet fully handle 1.8.7/1.9.* syntax, you will get a nasty Racc::ParseError when
|
164
|
+
you have any code that is not compatible with 1.8.6.
|
165
|
+
|
160
166
|
== Is it working ??
|
161
167
|
|
162
|
-
|
168
|
+
Sourcify spec suite currently passes in the following rubies:
|
169
|
+
* MRI-1.8.6 (ParseTree mode ONLY)
|
170
|
+
* MRI-1.8.7, REE-1.8.7 (ParseTree & static scanner modes)
|
171
|
+
* JRuby-1.5.1+, MRI-1.9.1 (static scanner ONLY)
|
172
|
+
|
173
|
+
Besides its own spec suite, sourcify has also been tested to handle:
|
163
174
|
|
164
175
|
ObjectSpace.each_object(Proc) {|o| puts o.to_source }
|
165
176
|
|
166
177
|
For projects:
|
167
|
-
* Spree[http://github.com/railsdog/spree]
|
168
|
-
* Redmine[http://github.com/edavis10/redmine]
|
178
|
+
* Spree[http://github.com/railsdog/spree]
|
179
|
+
* Redmine[http://github.com/edavis10/redmine]
|
169
180
|
|
170
181
|
(TODO: the more the merrier)
|
171
182
|
|
data/Rakefile
CHANGED
@@ -11,16 +11,16 @@ begin
|
|
11
11
|
gem.email = "ngty77@gmail.com"
|
12
12
|
gem.homepage = "http://github.com/ngty/sourcify"
|
13
13
|
gem.authors = ["NgTzeYang"]
|
14
|
-
gem.add_dependency 'ruby2ruby', '>= 1.2.
|
14
|
+
gem.add_dependency 'ruby2ruby', '>= 1.2.5'
|
15
15
|
gem.add_development_dependency "bacon", ">= 0"
|
16
16
|
# Plus one of the following groups:
|
17
17
|
#
|
18
18
|
# 1). ParseTree (better performance + dynamic goodness, but not supported on java & 1.9.*)
|
19
|
-
# >> gem.add_dependency "ParseTree", ">= 3.0.
|
19
|
+
# >> gem.add_dependency "ParseTree", ">= 3.0.6"
|
20
20
|
#
|
21
21
|
# 2). RubyParser (supported for all)
|
22
|
-
# >> gem.add_dependency "ruby_parser", ">= 2.0.
|
23
|
-
# >> gem.add_dependency "sexp_processor", ">= 3.0.
|
22
|
+
# >> gem.add_dependency "ruby_parser", ">= 2.0.5"
|
23
|
+
# >> gem.add_dependency "sexp_processor", ">= 3.0.5"
|
24
24
|
# >> gem.add_dependency "file-tail", ">= 1.0.5"
|
25
25
|
end
|
26
26
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.1
|
1
|
+
0.2.2.1
|
data/lib/sourcify/proc.rb
CHANGED
@@ -11,7 +11,8 @@ module Sourcify
|
|
11
11
|
def self.included(base)
|
12
12
|
base.class_eval do
|
13
13
|
|
14
|
-
|
14
|
+
# Rubies of 1.8.6 & earlier doesn't support something.map(&:blah)
|
15
|
+
meths = instance_methods.map{|m| m.to_s }
|
15
16
|
|
16
17
|
unless meths.include?('source_location')
|
17
18
|
|
@@ -34,12 +35,15 @@ module Sourcify
|
|
34
35
|
end
|
35
36
|
|
36
37
|
[::Method, ::Symbol].each do |klass|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
begin
|
39
|
+
klass.class_eval do
|
40
|
+
alias_method :__pre_sourcified_to_proc, :to_proc
|
41
|
+
def to_proc
|
42
|
+
(_proc = __pre_sourcified_to_proc).created_on_the_fly = true
|
43
|
+
_proc
|
44
|
+
end
|
42
45
|
end
|
46
|
+
rescue NameError
|
43
47
|
end
|
44
48
|
end
|
45
49
|
|
data/sourcify.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{sourcify}
|
8
|
-
s.version = "0.2.1"
|
8
|
+
s.version = "0.2.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["NgTzeYang"]
|
12
|
-
s.date = %q{2010-09-
|
12
|
+
s.date = %q{2010-09-15}
|
13
13
|
s.description = %q{}
|
14
14
|
s.email = %q{ngty77@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -126,14 +126,14 @@ Gem::Specification.new do |s|
|
|
126
126
|
s.specification_version = 3
|
127
127
|
|
128
128
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
129
|
-
s.add_runtime_dependency(%q<ruby2ruby>, [">= 1.2.
|
129
|
+
s.add_runtime_dependency(%q<ruby2ruby>, [">= 1.2.5"])
|
130
130
|
s.add_development_dependency(%q<bacon>, [">= 0"])
|
131
131
|
else
|
132
|
-
s.add_dependency(%q<ruby2ruby>, [">= 1.2.
|
132
|
+
s.add_dependency(%q<ruby2ruby>, [">= 1.2.5"])
|
133
133
|
s.add_dependency(%q<bacon>, [">= 0"])
|
134
134
|
end
|
135
135
|
else
|
136
|
-
s.add_dependency(%q<ruby2ruby>, [">= 1.2.
|
136
|
+
s.add_dependency(%q<ruby2ruby>, [">= 1.2.5"])
|
137
137
|
s.add_dependency(%q<bacon>, [">= 0"])
|
138
138
|
end
|
139
139
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), 'spec_helper')
|
2
2
|
|
3
|
+
unless has_parsetree?
|
3
4
|
describe 'Double quote strings (w interpolation)' do
|
4
5
|
|
5
6
|
# NOTE: we skip %Q#...# cos %Q#..#{..}..# is invalid syntax.
|
@@ -60,3 +61,4 @@ describe 'Double quote strings (w interpolation)' do
|
|
60
61
|
end
|
61
62
|
|
62
63
|
end
|
64
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), 'spec_helper')
|
2
2
|
|
3
|
+
unless has_parsetree?
|
3
4
|
describe 'Double quote strings (wo interpolation)' do
|
4
5
|
|
5
6
|
%w{~ ` ! @ # $ % ^ & * _ - + = | \\ ; : ' " , . ? /}.map{|w| [w,w] }.concat(
|
@@ -86,3 +87,4 @@ describe 'Double quote strings (wo interpolation)' do
|
|
86
87
|
end
|
87
88
|
|
88
89
|
end
|
90
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), 'spec_helper')
|
2
2
|
|
3
|
+
unless has_parsetree?
|
3
4
|
describe 'Single quote strings (\', %q & %w)' do
|
4
5
|
|
5
6
|
%w{~ ` ! @ # $ % ^ & * _ - + = \\ | ; : ' " , . ? /}.map{|w| [w,w] }.concat(
|
@@ -79,3 +80,4 @@ describe 'Single quote strings (\', %q & %w)' do
|
|
79
80
|
end
|
80
81
|
|
81
82
|
end
|
83
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -20,12 +20,16 @@ end
|
|
20
20
|
|
21
21
|
Bacon.summary_on_exit
|
22
22
|
|
23
|
+
def has_parsetree?
|
24
|
+
Object.const_defined?(:ParseTree)
|
25
|
+
end
|
26
|
+
|
23
27
|
def watever(*args, &block)
|
24
28
|
Proc.new(&block)
|
25
29
|
end
|
26
30
|
|
27
31
|
def code_to_sexp(code)
|
28
|
-
if
|
32
|
+
if has_parsetree?
|
29
33
|
require 'parse_tree'
|
30
34
|
Unifier.new.process(ParseTree.translate(code))
|
31
35
|
else
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sourcify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 85
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
+
- 2
|
9
10
|
- 1
|
10
|
-
version: 0.2.1
|
11
|
+
version: 0.2.2.1
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- NgTzeYang
|
@@ -15,7 +16,7 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2010-09-
|
19
|
+
date: 2010-09-15 00:00:00 +08:00
|
19
20
|
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
@@ -26,12 +27,12 @@ dependencies:
|
|
26
27
|
requirements:
|
27
28
|
- - ">="
|
28
29
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
30
|
+
hash: 21
|
30
31
|
segments:
|
31
32
|
- 1
|
32
33
|
- 2
|
33
|
-
-
|
34
|
-
version: 1.2.
|
34
|
+
- 5
|
35
|
+
version: 1.2.5
|
35
36
|
type: :runtime
|
36
37
|
version_requirements: *id001
|
37
38
|
- !ruby/object:Gem::Dependency
|