live_ast_ripper 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.rdoc +4 -0
- data/Rakefile +2 -1
- data/devel/levitate.rb +128 -101
- data/lib/live_ast_ripper/version.rb +1 -1
- metadata +6 -5
data/CHANGES.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -2,7 +2,8 @@ require_relative 'devel/levitate'
|
|
2
2
|
|
3
3
|
Levitate.new "live_ast_ripper" do |s|
|
4
4
|
s.developers << ["James M. Lawrence", "quixoticsycophant@gmail.com"]
|
5
|
-
s.
|
5
|
+
s.username = "quix"
|
6
|
+
s.required_ruby_version = ">= 1.9.2"
|
6
7
|
s.camel_name = "LiveASTRipper"
|
7
8
|
s.description = s.summary
|
8
9
|
end
|
data/devel/levitate.rb
CHANGED
@@ -5,79 +5,47 @@ class Levitate
|
|
5
5
|
require 'fileutils'
|
6
6
|
require 'rbconfig'
|
7
7
|
require 'find'
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
else
|
19
|
-
dest = File.join(dest_root, source.sub(%r!\A\./lib!, ""))
|
20
|
-
|
21
|
-
install = lambda {
|
22
|
-
if File.directory?(source)
|
23
|
-
unless File.directory?(dest)
|
24
|
-
puts "mkdir #{dest}"
|
25
|
-
FileUtils.mkdir(dest)
|
26
|
-
end
|
27
|
-
else
|
28
|
-
puts "install #{source} --> #{dest}"
|
29
|
-
FileUtils.install(source, dest)
|
30
|
-
end
|
31
|
-
}
|
32
|
-
|
33
|
-
uninstall = lambda {
|
34
|
-
if File.directory?(source)
|
35
|
-
if File.directory?(dest)
|
36
|
-
puts "rmdir #{dest}"
|
37
|
-
FileUtils.rmdir(dest)
|
38
|
-
end
|
39
|
-
else
|
40
|
-
if File.file?(dest)
|
41
|
-
puts "rm #{dest}"
|
42
|
-
FileUtils.rm(dest)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
}
|
46
|
-
|
47
|
-
acc << {
|
48
|
-
:source => source,
|
49
|
-
:dest => dest,
|
50
|
-
:install => install,
|
51
|
-
:uninstall => uninstall,
|
52
|
-
}
|
53
|
-
end
|
54
|
-
}
|
8
|
+
|
9
|
+
rb_root = RbConfig::CONFIG["sitelibdir"]
|
10
|
+
@spec = []
|
11
|
+
|
12
|
+
Find.find "lib" do |source|
|
13
|
+
next if source == "lib"
|
14
|
+
next unless File.directory?(source) || File.extname(source) == ".rb"
|
15
|
+
dest = File.join(rb_root, source.sub(%r!\Alib/!, ""))
|
16
|
+
@spec << { :source => source, :dest => dest }
|
17
|
+
end
|
55
18
|
end
|
56
19
|
|
57
|
-
def install_file?(source)
|
58
|
-
File.directory?(source) or
|
59
|
-
(File.file?(source) and File.extname(source) == ".rb")
|
60
|
-
end
|
61
|
-
|
62
20
|
def install
|
63
|
-
@spec.each
|
64
|
-
entry
|
65
|
-
|
21
|
+
@spec.each do |entry|
|
22
|
+
source, dest = entry.values_at(:source, :dest)
|
23
|
+
if File.directory?(source)
|
24
|
+
unless File.directory?(dest)
|
25
|
+
puts "mkdir #{dest}"
|
26
|
+
FileUtils.mkdir(dest)
|
27
|
+
end
|
28
|
+
else
|
29
|
+
puts "install #{source} --> #{dest}"
|
30
|
+
FileUtils.install(source, dest)
|
31
|
+
end
|
32
|
+
end
|
66
33
|
end
|
67
34
|
|
68
35
|
def uninstall
|
69
|
-
@spec.reverse.each
|
70
|
-
entry
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
36
|
+
@spec.reverse.each do |entry|
|
37
|
+
source, dest = entry.values_at(:source, :dest)
|
38
|
+
if File.directory?(source)
|
39
|
+
if File.directory?(dest)
|
40
|
+
puts "rmdir #{dest}"
|
41
|
+
FileUtils.rmdir(dest)
|
42
|
+
end
|
43
|
+
else
|
44
|
+
if File.file?(dest)
|
45
|
+
puts "rm #{dest}"
|
46
|
+
FileUtils.rm(dest)
|
47
|
+
end
|
48
|
+
end
|
81
49
|
end
|
82
50
|
end
|
83
51
|
end
|
@@ -219,38 +187,25 @@ class Levitate
|
|
219
187
|
}
|
220
188
|
contents
|
221
189
|
end
|
222
|
-
end
|
223
|
-
|
224
|
-
module InstanceEvalWithArgs
|
225
|
-
module_function
|
226
190
|
|
227
|
-
def
|
228
|
-
|
229
|
-
|
191
|
+
def instance_exec2(obj, *args, &block)
|
192
|
+
method_name = ["_", obj.object_id, "_", Thread.current.object_id].join
|
193
|
+
(class << obj ; self ; end).class_eval do
|
194
|
+
define_method method_name, &block
|
230
195
|
begin
|
231
|
-
|
196
|
+
obj.send(method_name, *args)
|
232
197
|
ensure
|
233
|
-
remove_method
|
198
|
+
remove_method method_name
|
234
199
|
end
|
235
200
|
end
|
236
201
|
end
|
237
|
-
|
238
|
-
def call_temp_method(instance, method_name, *args, &method_block)
|
239
|
-
with_temp_method(instance, method_name, method_block) {
|
240
|
-
instance.send(method_name, *args)
|
241
|
-
}
|
242
|
-
end
|
243
|
-
|
244
|
-
def instance_eval_with_args(instance, *args, &block)
|
245
|
-
call_temp_method(instance, :__temp_method, *args, &block)
|
246
|
-
end
|
247
202
|
end
|
248
203
|
|
249
204
|
include AttrLazy
|
250
205
|
include Util
|
251
206
|
|
252
207
|
def initialize(gem_name)
|
253
|
-
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
|
208
|
+
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
|
254
209
|
|
255
210
|
require 'rubygems/package_task'
|
256
211
|
|
@@ -296,6 +251,10 @@ class Levitate
|
|
296
251
|
mod.const_get(version_constant_name)
|
297
252
|
end or "0.0.0"
|
298
253
|
end
|
254
|
+
|
255
|
+
attribute :required_ruby_version do
|
256
|
+
">= 0"
|
257
|
+
end
|
299
258
|
|
300
259
|
attribute :readme_file do
|
301
260
|
"README.rdoc"
|
@@ -362,6 +321,10 @@ class Levitate
|
|
362
321
|
[]
|
363
322
|
end
|
364
323
|
|
324
|
+
attribute :extra_gemspec do
|
325
|
+
lambda { |spec| }
|
326
|
+
end
|
327
|
+
|
365
328
|
attribute :files do
|
366
329
|
if File.file? manifest_file
|
367
330
|
File.read(manifest_file).split("\n")
|
@@ -381,7 +344,7 @@ class Levitate
|
|
381
344
|
end
|
382
345
|
|
383
346
|
attribute :rdoc_title do
|
384
|
-
"#{gem_name}: #{summary}"
|
347
|
+
"#{gem_name}: #{summary}".sub(/\.\Z/, "")
|
385
348
|
end
|
386
349
|
|
387
350
|
attribute :require_paths do
|
@@ -402,7 +365,7 @@ class Levitate
|
|
402
365
|
end
|
403
366
|
|
404
367
|
attribute :extra_rdoc_files do
|
405
|
-
File.file?(
|
368
|
+
[readme_file, history_file].select { |file| File.file?(file) }
|
406
369
|
end
|
407
370
|
|
408
371
|
attribute :browser do
|
@@ -426,6 +389,8 @@ class Levitate
|
|
426
389
|
rdoc_options
|
427
390
|
extra_rdoc_files
|
428
391
|
require_paths
|
392
|
+
required_ruby_version
|
393
|
+
extensions
|
429
394
|
].each do |param|
|
430
395
|
t = send(param) and g.send("#{param}=", t)
|
431
396
|
end
|
@@ -438,6 +403,7 @@ class Levitate
|
|
438
403
|
development_dependencies.each { |dep|
|
439
404
|
g.add_development_dependency(*dep)
|
440
405
|
}
|
406
|
+
extra_gemspec.call(g)
|
441
407
|
end
|
442
408
|
end
|
443
409
|
|
@@ -478,9 +444,11 @@ class Levitate
|
|
478
444
|
begin
|
479
445
|
sections[send("#{section}_section")].
|
480
446
|
gsub("\n", " ").
|
481
|
-
split(%r!\.\s
|
447
|
+
split(%r!\.\s+!m).
|
482
448
|
first(send("#{section}_sentences")).
|
483
|
-
join(".
|
449
|
+
join(". ").
|
450
|
+
concat(".").
|
451
|
+
sub(%r!\.+\Z!, ".")
|
484
452
|
rescue
|
485
453
|
"FIXME: #{section}"
|
486
454
|
end
|
@@ -488,22 +456,22 @@ class Levitate
|
|
488
456
|
}
|
489
457
|
|
490
458
|
attribute :url do
|
491
|
-
"http://#{
|
459
|
+
"http://#{username}.github.com/#{gem_name}"
|
492
460
|
end
|
493
461
|
|
494
|
-
attribute :
|
495
|
-
raise "
|
462
|
+
attribute :username do
|
463
|
+
raise "username not set"
|
496
464
|
end
|
497
465
|
|
498
466
|
attribute :rubyforge_info do
|
499
467
|
nil
|
500
468
|
end
|
501
469
|
|
502
|
-
|
470
|
+
def authors
|
503
471
|
developers.map { |d| d[0] }
|
504
472
|
end
|
505
473
|
|
506
|
-
|
474
|
+
def email
|
507
475
|
developers.map { |d| d[1] }
|
508
476
|
end
|
509
477
|
|
@@ -519,6 +487,17 @@ class Levitate
|
|
519
487
|
[]
|
520
488
|
end
|
521
489
|
|
490
|
+
attribute :extensions do
|
491
|
+
["ext/#{gem_name}/extconf.rb"].select { |f| File.file? f }
|
492
|
+
end
|
493
|
+
|
494
|
+
attribute :so_file do
|
495
|
+
unless extensions.empty?
|
496
|
+
require 'rbconfig'
|
497
|
+
"lib/" + gem_name + "." + RbConfig::CONFIG["DLEXT"]
|
498
|
+
end
|
499
|
+
end
|
500
|
+
|
522
501
|
def define_clean
|
523
502
|
require 'rake/clean'
|
524
503
|
task :clean do
|
@@ -695,12 +674,28 @@ class Levitate
|
|
695
674
|
def define_install
|
696
675
|
desc "direct install (no gem)"
|
697
676
|
task :install do
|
698
|
-
Installer.new.
|
677
|
+
Installer.new.install
|
699
678
|
end
|
700
679
|
|
701
680
|
desc "direct uninstall (no gem)"
|
702
681
|
task :uninstall do
|
703
|
-
Installer.new.
|
682
|
+
Installer.new.uninstall
|
683
|
+
end
|
684
|
+
|
685
|
+
if so_file
|
686
|
+
dest = File.join(RbConfig::CONFIG["sitearchdir"], File.basename(so_file))
|
687
|
+
|
688
|
+
task :install => so_file do
|
689
|
+
puts "install #{so_file} --> #{dest}"
|
690
|
+
FileUtils.install(so_file, dest)
|
691
|
+
end
|
692
|
+
|
693
|
+
task :uninstall do
|
694
|
+
if File.file?(dest)
|
695
|
+
puts "rm #{dest}"
|
696
|
+
FileUtils.rm(dest)
|
697
|
+
end
|
698
|
+
end
|
704
699
|
end
|
705
700
|
end
|
706
701
|
|
@@ -749,7 +744,11 @@ class Levitate
|
|
749
744
|
|
750
745
|
def define_changes
|
751
746
|
task :changes do
|
752
|
-
|
747
|
+
if File.read(history_file).index version
|
748
|
+
raise "version not updated"
|
749
|
+
end
|
750
|
+
|
751
|
+
header = "\n\n== Version #{version}\n\n"
|
753
752
|
|
754
753
|
bullets = `git log --format=%s #{last_release}..HEAD`.lines.map { |line|
|
755
754
|
"* #{line}"
|
@@ -794,6 +793,34 @@ class Levitate
|
|
794
793
|
puts gemspec.to_ruby
|
795
794
|
end
|
796
795
|
end
|
796
|
+
|
797
|
+
def define_extension
|
798
|
+
if so_file and (source_control? or !File.file?(so_file))
|
799
|
+
require 'rbconfig'
|
800
|
+
require 'rake/extensiontask'
|
801
|
+
|
802
|
+
Rake::ExtensionTask.new gem_name, gemspec do |ext|
|
803
|
+
ext.cross_compile = true
|
804
|
+
ext.cross_platform = 'i386-mswin32'
|
805
|
+
ext.cross_compiling do |gemspec|
|
806
|
+
gemspec.post_install_message =
|
807
|
+
"U got dat binary versionation of this gemination!"
|
808
|
+
end
|
809
|
+
end
|
810
|
+
|
811
|
+
if Rake::Task[so_file].needed?
|
812
|
+
task :test => so_file
|
813
|
+
end
|
814
|
+
|
815
|
+
task :cross_native_gem do
|
816
|
+
Rake::Task[:gem].reenable
|
817
|
+
Rake.application.top_level_tasks.replace %w[cross native gem]
|
818
|
+
Rake.application.top_level
|
819
|
+
end
|
820
|
+
|
821
|
+
task :gem => :cross_native_gem
|
822
|
+
end
|
823
|
+
end
|
797
824
|
|
798
825
|
def open_browser(*files)
|
799
826
|
sh(*([browser].flatten + files))
|
@@ -821,7 +848,6 @@ class Levitate
|
|
821
848
|
|
822
849
|
class << self
|
823
850
|
include Util
|
824
|
-
include InstanceEvalWithArgs
|
825
851
|
|
826
852
|
# From minitest, part of the Ruby source; by Ryan Davis.
|
827
853
|
def capture_io
|
@@ -861,7 +887,7 @@ class Levitate
|
|
861
887
|
actual = Ruby.run_file_and_capture(temp_file.path).chomp
|
862
888
|
}
|
863
889
|
|
864
|
-
|
890
|
+
instance_exec2(instance, expected, actual, index, &block)
|
865
891
|
end
|
866
892
|
|
867
893
|
def run_doc_section(file, section, instance, &block)
|
@@ -881,6 +907,7 @@ class Levitate
|
|
881
907
|
raise "parse error"
|
882
908
|
end
|
883
909
|
)
|
910
|
+
code.gsub!(/^\s*%.*$/, "") # ignore shell command examples
|
884
911
|
run_doc_code(code, expected, index, instance, &block)
|
885
912
|
index += 1
|
886
913
|
}
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: live_ast_ripper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.6.
|
5
|
+
version: 0.6.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- James M. Lawrence
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-03-15 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|
@@ -23,6 +23,7 @@ extensions: []
|
|
23
23
|
|
24
24
|
extra_rdoc_files:
|
25
25
|
- README.rdoc
|
26
|
+
- CHANGES.rdoc
|
26
27
|
files:
|
27
28
|
- CHANGES.rdoc
|
28
29
|
- README.rdoc
|
@@ -41,7 +42,7 @@ rdoc_options:
|
|
41
42
|
- --main
|
42
43
|
- README.rdoc
|
43
44
|
- --title
|
44
|
-
- "live_ast_ripper: A Ripper-based parser plugin for LiveAST
|
45
|
+
- "live_ast_ripper: A Ripper-based parser plugin for LiveAST"
|
45
46
|
require_paths:
|
46
47
|
- lib
|
47
48
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -49,7 +50,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
49
50
|
requirements:
|
50
51
|
- - ">="
|
51
52
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
53
|
+
version: 1.9.2
|
53
54
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
55
|
none: false
|
55
56
|
requirements:
|
@@ -59,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
59
60
|
requirements: []
|
60
61
|
|
61
62
|
rubyforge_project:
|
62
|
-
rubygems_version: 1.
|
63
|
+
rubygems_version: 1.6.2
|
63
64
|
signing_key:
|
64
65
|
specification_version: 3
|
65
66
|
summary: A Ripper-based parser plugin for LiveAST.
|