thor 0.11.8 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +6 -1
- data/Thorfile +1 -1
- data/lib/thor/actions/create_file.rb +1 -0
- data/lib/thor/actions/directory.rb +9 -5
- data/lib/thor/actions/empty_directory.rb +1 -0
- data/lib/thor/group.rb +1 -1
- data/lib/thor/version.rb +1 -1
- data/spec/actions/create_file_spec.rb +2 -2
- data/spec/actions/directory_spec.rb +7 -0
- metadata +2 -2
data/CHANGELOG.rdoc
CHANGED
@@ -2,7 +2,12 @@
|
|
2
2
|
|
3
3
|
* Improve spec coverage for Thor::Runner
|
4
4
|
|
5
|
-
== 0.
|
5
|
+
== 0.12, released 2009-11-06
|
6
|
+
|
7
|
+
* [#7] Do not force white color on status
|
8
|
+
* [#8] Yield a block with the filename on directory
|
9
|
+
|
10
|
+
== 0.11, released 2009-07-01
|
6
11
|
|
7
12
|
* Added a rake compatibility layer. It allows you to use spec and rdoc tasks on
|
8
13
|
Thor classes.
|
data/Thorfile
CHANGED
@@ -56,7 +56,7 @@ class Default < Thor
|
|
56
56
|
s.test_files.exclude 'spec/sandbox/**/*'
|
57
57
|
end
|
58
58
|
|
59
|
-
Jeweler::
|
59
|
+
Jeweler::GemcutterTasks.new
|
60
60
|
rescue LoadError
|
61
61
|
puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
62
62
|
end
|
@@ -40,15 +40,16 @@ class Thor
|
|
40
40
|
# directory "doc"
|
41
41
|
# directory "doc", "docs", :recursive => false
|
42
42
|
#
|
43
|
-
def directory(source, destination=nil, config={})
|
44
|
-
action Directory.new(self, source, destination || source, config)
|
43
|
+
def directory(source, destination=nil, config={}, &block)
|
44
|
+
action Directory.new(self, source, destination || source, config, &block)
|
45
45
|
end
|
46
46
|
|
47
47
|
class Directory < EmptyDirectory #:nodoc:
|
48
48
|
attr_reader :source
|
49
49
|
|
50
|
-
def initialize(base, source, destination=nil, config={})
|
50
|
+
def initialize(base, source, destination=nil, config={}, &block)
|
51
51
|
@source = File.expand_path(base.find_in_source_paths(source.to_s))
|
52
|
+
@block = block
|
52
53
|
super(base, destination, { :recursive => true }.merge(config))
|
53
54
|
end
|
54
55
|
|
@@ -70,6 +71,7 @@ class Thor
|
|
70
71
|
Dir[lookup].each do |file_source|
|
71
72
|
next if File.directory?(file_source)
|
72
73
|
file_destination = File.join(given_destination, file_source.gsub(source, '.'))
|
74
|
+
file_destination.gsub!('/./', '/')
|
73
75
|
|
74
76
|
case file_source
|
75
77
|
when /\.empty_directory$/
|
@@ -77,9 +79,11 @@ class Thor
|
|
77
79
|
next if dirname == given_destination
|
78
80
|
base.empty_directory(dirname, config)
|
79
81
|
when /\.tt$/
|
80
|
-
base.template(file_source, file_destination[0..-4], config)
|
82
|
+
destination = base.template(file_source, file_destination[0..-4], config)
|
83
|
+
@block.call(destination) if @block
|
81
84
|
else
|
82
|
-
base.copy_file(file_source, file_destination, config)
|
85
|
+
destination = base.copy_file(file_source, file_destination, config)
|
86
|
+
@block.call(destination) if @block
|
83
87
|
end
|
84
88
|
end
|
85
89
|
end
|
data/lib/thor/group.rb
CHANGED
data/lib/thor/version.rb
CHANGED
@@ -50,9 +50,9 @@ describe Thor::Actions::CreateFile do
|
|
50
50
|
invoke!.must be_empty
|
51
51
|
end
|
52
52
|
|
53
|
-
it "returns the destination" do
|
53
|
+
it "returns the given destination" do
|
54
54
|
capture(:stdout) do
|
55
|
-
create_file("doc/config.rb").invoke!.must ==
|
55
|
+
create_file("doc/config.rb").invoke!.must == "doc/config.rb"
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
@@ -108,6 +108,13 @@ describe Thor::Actions::Directory do
|
|
108
108
|
content.must =~ /create doc\/rdoc\.rb/
|
109
109
|
content.must =~ /create doc\/components/
|
110
110
|
end
|
111
|
+
|
112
|
+
it "yields a block" do
|
113
|
+
invoke!("doc") do |f|
|
114
|
+
%(doc/README doc/config.rb doc/rdoc.rb).must include(f)
|
115
|
+
%(doc/components/).must_not include(f)
|
116
|
+
end
|
117
|
+
end
|
111
118
|
end
|
112
119
|
|
113
120
|
describe "#revoke!" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yehuda Katz
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-
|
13
|
+
date: 2009-11-09 00:00:00 -02:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|