thor 0.12.0 → 0.13.0
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.
- data/CHANGELOG.rdoc +5 -5
- data/README.rdoc +65 -2
- data/Thorfile +15 -9
- data/bin/thor +1 -0
- data/lib/thor/actions/create_file.rb +2 -2
- data/lib/thor/actions/directory.rb +2 -4
- data/lib/thor/actions/file_manipulation.rb +10 -6
- data/lib/thor/actions/inject_into_file.rb +10 -7
- data/lib/thor/actions.rb +6 -5
- data/lib/thor/base.rb +45 -32
- data/lib/thor/core_ext/file_binary_read.rb +9 -0
- data/lib/thor/group.rb +46 -37
- data/lib/thor/runner.rb +49 -42
- data/lib/thor/shell/basic.rb +49 -29
- data/lib/thor/shell/color.rb +1 -1
- data/lib/thor/shell.rb +1 -1
- data/lib/thor/task.rb +27 -38
- data/lib/thor/util.rb +4 -22
- data/lib/thor/version.rb +1 -1
- data/lib/thor.rb +43 -45
- data/spec/actions/create_file_spec.rb +7 -7
- data/spec/actions/directory_spec.rb +5 -4
- data/spec/actions/file_manipulation_spec.rb +29 -16
- data/spec/actions/inject_into_file_spec.rb +29 -0
- data/spec/actions_spec.rb +14 -13
- data/spec/base_spec.rb +16 -1
- data/spec/fixtures/bundle/main.thor +1 -0
- data/spec/fixtures/doc/%file_name%.rb.tt +1 -0
- data/spec/fixtures/doc/README +3 -0
- data/spec/fixtures/group.thor +83 -0
- data/spec/fixtures/invoke.thor +112 -0
- data/spec/fixtures/script.thor +134 -0
- data/spec/fixtures/task.thor +10 -0
- data/spec/group_spec.rb +1 -7
- data/spec/runner_spec.rb +35 -39
- data/spec/shell/basic_spec.rb +56 -62
- data/spec/shell/color_spec.rb +6 -6
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +5 -4
- data/spec/task_spec.rb +14 -32
- data/spec/thor_spec.rb +21 -22
- data/spec/util_spec.rb +7 -31
- metadata +28 -19
data/spec/util_spec.rb
CHANGED
|
@@ -129,7 +129,7 @@ describe Thor::Util do
|
|
|
129
129
|
|
|
130
130
|
describe "#user_home" do
|
|
131
131
|
before(:each) do
|
|
132
|
-
stub(
|
|
132
|
+
ENV.stub!(:[])
|
|
133
133
|
Thor::Util.clear_user_home!
|
|
134
134
|
end
|
|
135
135
|
|
|
@@ -138,7 +138,7 @@ describe Thor::Util do
|
|
|
138
138
|
end
|
|
139
139
|
|
|
140
140
|
it "returns the *unix system path if file cannot be expanded and separator does not exist" do
|
|
141
|
-
|
|
141
|
+
File.should_receive(:expand_path).with("~").and_raise(RuntimeError)
|
|
142
142
|
previous_value = File::ALT_SEPARATOR
|
|
143
143
|
capture(:stderr){ File.const_set(:ALT_SEPARATOR, false) }
|
|
144
144
|
Thor::Util.user_home.must == "/"
|
|
@@ -146,7 +146,7 @@ describe Thor::Util do
|
|
|
146
146
|
end
|
|
147
147
|
|
|
148
148
|
it "returns the windows system path if file cannot be expanded and a separator exists" do
|
|
149
|
-
|
|
149
|
+
File.should_receive(:expand_path).with("~").and_raise(RuntimeError)
|
|
150
150
|
previous_value = File::ALT_SEPARATOR
|
|
151
151
|
capture(:stderr){ File.const_set(:ALT_SEPARATOR, true) }
|
|
152
152
|
Thor::Util.user_home.must == "C:/"
|
|
@@ -154,43 +154,19 @@ describe Thor::Util do
|
|
|
154
154
|
end
|
|
155
155
|
|
|
156
156
|
it "returns HOME/.thor if set" do
|
|
157
|
-
stub(
|
|
157
|
+
ENV.stub!(:[]).with("HOME").and_return("/home/user/")
|
|
158
158
|
Thor::Util.user_home.must == "/home/user/"
|
|
159
159
|
end
|
|
160
160
|
|
|
161
161
|
it "returns path with HOMEDRIVE and HOMEPATH if set" do
|
|
162
|
-
stub(
|
|
163
|
-
stub(
|
|
162
|
+
ENV.stub!(:[]).with("HOMEDRIVE").and_return("D:/")
|
|
163
|
+
ENV.stub!(:[]).with("HOMEPATH").and_return("Documents and Settings/James")
|
|
164
164
|
Thor::Util.user_home.must == "D:/Documents and Settings/James"
|
|
165
165
|
end
|
|
166
166
|
|
|
167
167
|
it "returns APPDATA/.thor if set" do
|
|
168
|
-
stub(
|
|
168
|
+
ENV.stub!(:[]).with("APPDATA").and_return("/home/user/")
|
|
169
169
|
Thor::Util.user_home.must == "/home/user/"
|
|
170
170
|
end
|
|
171
171
|
end
|
|
172
|
-
|
|
173
|
-
describe "#convert_constants_to_namespaces" do
|
|
174
|
-
before(:each) do
|
|
175
|
-
@hash = {
|
|
176
|
-
:git => {
|
|
177
|
-
:constants => [Object, "Thor::Sandbox::Package", Thor::CoreExt::OrderedHash]
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
end
|
|
181
|
-
|
|
182
|
-
it "converts constants in the hash to namespaces" do
|
|
183
|
-
Thor::Util.convert_constants_to_namespaces(@hash)
|
|
184
|
-
@hash[:git][:namespaces].must == [ "object", "package", "thor:core_ext:ordered_hash" ]
|
|
185
|
-
end
|
|
186
|
-
|
|
187
|
-
it "returns true if the hash changed" do
|
|
188
|
-
Thor::Util.convert_constants_to_namespaces(@hash).must be_true
|
|
189
|
-
end
|
|
190
|
-
|
|
191
|
-
it "does not add namespaces to the hash if namespaces were already added" do
|
|
192
|
-
Thor::Util.convert_constants_to_namespaces(@hash)
|
|
193
|
-
Thor::Util.convert_constants_to_namespaces(@hash).must be_false
|
|
194
|
-
end
|
|
195
|
-
end
|
|
196
172
|
end
|
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.13.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:
|
|
13
|
+
date: 2010-02-03 00:00:00 +01:00
|
|
14
14
|
default_executable:
|
|
15
15
|
dependencies: []
|
|
16
16
|
|
|
@@ -41,6 +41,7 @@ files:
|
|
|
41
41
|
- lib/thor/actions/file_manipulation.rb
|
|
42
42
|
- lib/thor/actions/inject_into_file.rb
|
|
43
43
|
- lib/thor/base.rb
|
|
44
|
+
- lib/thor/core_ext/file_binary_read.rb
|
|
44
45
|
- lib/thor/core_ext/hash_with_indifferent_access.rb
|
|
45
46
|
- lib/thor/core_ext/ordered_hash.rb
|
|
46
47
|
- lib/thor/error.rb
|
|
@@ -88,30 +89,38 @@ signing_key:
|
|
|
88
89
|
specification_version: 3
|
|
89
90
|
summary: A scripting framework that replaces rake, sake and rubigen
|
|
90
91
|
test_files:
|
|
91
|
-
- spec/
|
|
92
|
+
- spec/actions/create_file_spec.rb
|
|
92
93
|
- spec/actions/directory_spec.rb
|
|
93
94
|
- spec/actions/empty_directory_spec.rb
|
|
94
|
-
- spec/actions/create_file_spec.rb
|
|
95
|
-
- spec/actions/inject_into_file_spec.rb
|
|
96
95
|
- spec/actions/file_manipulation_spec.rb
|
|
97
|
-
- spec/
|
|
98
|
-
- spec/invocation_spec.rb
|
|
99
|
-
- spec/base_spec.rb
|
|
100
|
-
- spec/task_spec.rb
|
|
101
|
-
- spec/spec_helper.rb
|
|
96
|
+
- spec/actions/inject_into_file_spec.rb
|
|
102
97
|
- spec/actions_spec.rb
|
|
103
|
-
- spec/
|
|
104
|
-
- spec/
|
|
105
|
-
- spec/
|
|
106
|
-
- spec/thor_spec.rb
|
|
98
|
+
- spec/base_spec.rb
|
|
99
|
+
- spec/core_ext/hash_with_indifferent_access_spec.rb
|
|
100
|
+
- spec/core_ext/ordered_hash_spec.rb
|
|
107
101
|
- spec/fixtures/application.rb
|
|
108
|
-
- spec/fixtures/doc/config.rb
|
|
109
102
|
- spec/fixtures/bundle/execute.rb
|
|
110
|
-
- spec/
|
|
103
|
+
- spec/fixtures/doc/config.rb
|
|
104
|
+
- spec/group_spec.rb
|
|
105
|
+
- spec/invocation_spec.rb
|
|
111
106
|
- spec/parser/argument_spec.rb
|
|
107
|
+
- spec/parser/arguments_spec.rb
|
|
112
108
|
- spec/parser/option_spec.rb
|
|
113
109
|
- spec/parser/options_spec.rb
|
|
114
|
-
- spec/
|
|
110
|
+
- spec/rake_compat_spec.rb
|
|
115
111
|
- spec/runner_spec.rb
|
|
116
|
-
- spec/
|
|
117
|
-
- spec/
|
|
112
|
+
- spec/shell/basic_spec.rb
|
|
113
|
+
- spec/shell/color_spec.rb
|
|
114
|
+
- spec/shell_spec.rb
|
|
115
|
+
- spec/spec_helper.rb
|
|
116
|
+
- spec/task_spec.rb
|
|
117
|
+
- spec/thor_spec.rb
|
|
118
|
+
- spec/util_spec.rb
|
|
119
|
+
- spec/fixtures/bundle/main.thor
|
|
120
|
+
- spec/fixtures/doc/%file_name%.rb.tt
|
|
121
|
+
- spec/fixtures/doc/README
|
|
122
|
+
- spec/fixtures/group.thor
|
|
123
|
+
- spec/fixtures/invoke.thor
|
|
124
|
+
- spec/fixtures/script.thor
|
|
125
|
+
- spec/fixtures/task.thor
|
|
126
|
+
- spec/spec.opts
|