live_ast 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.rdoc +4 -0
- data/devel/levitate.rb +5 -3
- data/lib/live_ast/reader.rb +9 -1
- data/lib/live_ast/version.rb +1 -1
- data/test/backtrace_test.rb +0 -1
- data/test/encoding_test.rb +4 -0
- data/test/encoding_test/utf8dos.rb +6 -0
- data/test/encoding_test/utf8mac.rb +6 -0
- data/test/encoding_test/utf8mac_alt.rb +6 -0
- data/test/encoding_test/utf8unix.rb +6 -0
- data/test/error_test.rb +1 -0
- data/test/main.rb +3 -0
- data/test/replace_eval_test.rb +4 -0
- data/test/rubygems_test.rb +7 -0
- metadata +24 -4
data/CHANGES.rdoc
CHANGED
data/devel/levitate.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
|
2
2
|
class Levitate
|
3
|
+
include Rake::DSL if defined? Rake::DSL
|
4
|
+
|
3
5
|
def initialize(gem_name)
|
4
6
|
@gem_name = gem_name
|
5
7
|
|
@@ -7,7 +9,7 @@ class Levitate
|
|
7
9
|
|
8
10
|
yield self
|
9
11
|
|
10
|
-
self.class.instance_methods(false).each do |name|
|
12
|
+
self.class.instance_methods(false).sort.each do |name|
|
11
13
|
if name.to_s =~ %r!\Adefine_!
|
12
14
|
send(name)
|
13
15
|
end
|
@@ -259,7 +261,7 @@ class Levitate
|
|
259
261
|
|
260
262
|
attribute :remote_levitate do
|
261
263
|
url = ENV["LEVITATE"] ||
|
262
|
-
"https://github.com/quix/levitate/
|
264
|
+
"https://raw.github.com/quix/levitate/master/levitate.rb"
|
263
265
|
IO.popen("curl -s #{url}") { |f| f.read }
|
264
266
|
end
|
265
267
|
|
@@ -497,7 +499,7 @@ class Levitate
|
|
497
499
|
puts "Already up-to-date."
|
498
500
|
else
|
499
501
|
File.open(__FILE__, "w") { |f| f.print(remote_levitate) }
|
500
|
-
git "commit", __FILE__, "-m", "update
|
502
|
+
git "commit", __FILE__, "-m", "update tools"
|
501
503
|
puts "Updated levitate."
|
502
504
|
end
|
503
505
|
end
|
data/lib/live_ast/reader.rb
CHANGED
@@ -12,7 +12,15 @@ module LiveAST
|
|
12
12
|
# magic comment overrides BOM
|
13
13
|
encoding = contents[MAGIC_COMMENT, 1] || utf8 || "US-ASCII"
|
14
14
|
|
15
|
-
contents.force_encoding(encoding)
|
15
|
+
contents.force_encoding(strip_special(encoding))
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.strip_special(encoding)
|
19
|
+
if encoding =~ /\Autf8-mac\Z/i
|
20
|
+
"UTF8-MAC"
|
21
|
+
else
|
22
|
+
encoding.sub(/-(unix|dos|mac)\Z/i, "")
|
23
|
+
end
|
16
24
|
end
|
17
25
|
end
|
18
26
|
end
|
data/lib/live_ast/version.rb
CHANGED
data/test/backtrace_test.rb
CHANGED
data/test/encoding_test.rb
CHANGED
data/test/error_test.rb
CHANGED
data/test/main.rb
CHANGED
data/test/replace_eval_test.rb
CHANGED
@@ -40,6 +40,7 @@ class ZZY_ReplaceEvalTest < ReplaceEvalTest
|
|
40
40
|
|
41
41
|
def moo
|
42
42
|
a = 22
|
43
|
+
ignore(a)
|
43
44
|
binding
|
44
45
|
end
|
45
46
|
|
@@ -265,6 +266,7 @@ class ZZY_ReplaceEvalTest < ReplaceEvalTest
|
|
265
266
|
|
266
267
|
def test_module_eval_binding
|
267
268
|
x = 33
|
269
|
+
ignore(x)
|
268
270
|
orig = Class.new
|
269
271
|
orig.live_ast_original_module_eval %{
|
270
272
|
define_method :value do
|
@@ -278,6 +280,7 @@ class ZZY_ReplaceEvalTest < ReplaceEvalTest
|
|
278
280
|
assert orig.new.f.is_a?(Proc)
|
279
281
|
|
280
282
|
y = 44
|
283
|
+
ignore(y)
|
281
284
|
live = Class.new
|
282
285
|
live.module_eval %{
|
283
286
|
define_method :value do
|
@@ -339,6 +342,7 @@ class ZZY_ReplaceEvalTest < ReplaceEvalTest
|
|
339
342
|
|
340
343
|
def test_local_var_collision
|
341
344
|
args = 33
|
345
|
+
ignore(args)
|
342
346
|
|
343
347
|
assert_equal 33, live_ast_original_eval("args")
|
344
348
|
assert_equal 33, eval("args")
|
data/test/rubygems_test.rb
CHANGED
@@ -4,8 +4,15 @@ require_relative '../devel/levitate'
|
|
4
4
|
class RubygemsTest < RegularTest
|
5
5
|
def test_rubygems
|
6
6
|
lib = File.expand_path(File.dirname(__FILE__) + "/../lib")
|
7
|
+
extra_req =
|
8
|
+
if defined?(LiveASTRipper) and LiveAST.parser == LiveASTRipper
|
9
|
+
%{require 'live_ast_ripper'}
|
10
|
+
else
|
11
|
+
""
|
12
|
+
end
|
7
13
|
result = Levitate.run_code_and_capture %{
|
8
14
|
$LOAD_PATH.unshift '#{lib}'
|
15
|
+
#{extra_req}
|
9
16
|
require 'live_ast/full'
|
10
17
|
LiveAST.parser::Test
|
11
18
|
f = eval %{
|
metadata
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: live_ast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
version: 1.0.2
|
6
10
|
platform: ruby
|
7
11
|
authors:
|
8
12
|
- James M. Lawrence
|
@@ -10,7 +14,8 @@ autorequire:
|
|
10
14
|
bindir: bin
|
11
15
|
cert_chain: []
|
12
16
|
|
13
|
-
date: 2011-
|
17
|
+
date: 2011-08-02 00:00:00 -04:00
|
18
|
+
default_executable:
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: live_ast_ruby_parser
|
@@ -20,6 +25,10 @@ dependencies:
|
|
20
25
|
requirements:
|
21
26
|
- - ">="
|
22
27
|
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
- 6
|
31
|
+
- 0
|
23
32
|
version: 0.6.0
|
24
33
|
type: :runtime
|
25
34
|
version_requirements: *id001
|
@@ -78,6 +87,10 @@ files:
|
|
78
87
|
- test/encoding_test/utf8.rb
|
79
88
|
- test/encoding_test/utf8bom.rb
|
80
89
|
- test/encoding_test/utf8bom_only.rb
|
90
|
+
- test/encoding_test/utf8dos.rb
|
91
|
+
- test/encoding_test/utf8mac.rb
|
92
|
+
- test/encoding_test/utf8mac_alt.rb
|
93
|
+
- test/encoding_test/utf8unix.rb
|
81
94
|
- test/error_test.rb
|
82
95
|
- test/eval_test.rb
|
83
96
|
- test/flush_cache_test.rb
|
@@ -101,6 +114,7 @@ files:
|
|
101
114
|
- test/to_ast_feature_test.rb
|
102
115
|
- test/to_ruby_feature_test.rb
|
103
116
|
- test/to_ruby_test.rb
|
117
|
+
has_rdoc: true
|
104
118
|
homepage: http://quix.github.com/live_ast
|
105
119
|
licenses: []
|
106
120
|
|
@@ -144,17 +158,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
144
158
|
requirements:
|
145
159
|
- - ">="
|
146
160
|
- !ruby/object:Gem::Version
|
161
|
+
segments:
|
162
|
+
- 1
|
163
|
+
- 9
|
164
|
+
- 2
|
147
165
|
version: 1.9.2
|
148
166
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
167
|
none: false
|
150
168
|
requirements:
|
151
169
|
- - ">="
|
152
170
|
- !ruby/object:Gem::Version
|
171
|
+
segments:
|
172
|
+
- 0
|
153
173
|
version: "0"
|
154
174
|
requirements: []
|
155
175
|
|
156
176
|
rubyforge_project:
|
157
|
-
rubygems_version: 1.7
|
177
|
+
rubygems_version: 1.3.7
|
158
178
|
signing_key:
|
159
179
|
specification_version: 3
|
160
180
|
summary: Live abstract syntax trees of methods and procs.
|