josevalim-thor 0.10.25 → 0.10.26
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/lib/thor/actions.rb +1 -1
- data/lib/thor/util.rb +23 -17
- metadata +1 -1
data/lib/thor/actions.rb
CHANGED
@@ -163,7 +163,7 @@ class Thor
|
|
163
163
|
#
|
164
164
|
def run(command, log_status=true)
|
165
165
|
return unless behavior == :invoke
|
166
|
-
say_status :run, "#{command} from #{relative_to_absolute_root(root, false)}", log_status
|
166
|
+
say_status :run, "\"#{command}\" from #{relative_to_absolute_root(root, false)}", log_status
|
167
167
|
`#{command}` unless options[:pretend]
|
168
168
|
end
|
169
169
|
|
data/lib/thor/util.rb
CHANGED
@@ -162,26 +162,32 @@ class Thor
|
|
162
162
|
yaml_changed
|
163
163
|
end
|
164
164
|
|
165
|
+
def self.user_home
|
166
|
+
@@user_home ||= if ENV["HOME"]
|
167
|
+
ENV["HOME"]
|
168
|
+
elsif ENV["USERPROFILE"]
|
169
|
+
ENV["USERPROFILE"]
|
170
|
+
elsif ENV["HOMEDRIVE"] && ENV["HOMEPATH"]
|
171
|
+
File.join(ENV["HOMEDRIVE"], ENV["HOMEPATH"])
|
172
|
+
elsif ENV["APPDATA"]
|
173
|
+
ENV["APPDATA"]
|
174
|
+
else
|
175
|
+
begin
|
176
|
+
File.expand_path("~")
|
177
|
+
rescue
|
178
|
+
if File::ALT_SEPARATOR
|
179
|
+
"C:/"
|
180
|
+
else
|
181
|
+
"/"
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
165
187
|
# Returns the root where thor files are located, dependending on the OS.
|
166
188
|
#
|
167
189
|
def self.thor_root
|
168
|
-
|
169
|
-
|
170
|
-
if ENV["HOMEDRIVE"] && ENV["HOMEPATH"]
|
171
|
-
return File.join(ENV["HOMEDRIVE"], ENV["HOMEPATH"], '.thor')
|
172
|
-
end
|
173
|
-
|
174
|
-
return File.join(ENV["APPDATA"], '.thor') if ENV["APPDATA"]
|
175
|
-
|
176
|
-
begin
|
177
|
-
File.expand_path("~")
|
178
|
-
rescue
|
179
|
-
if File::ALT_SEPARATOR
|
180
|
-
"C:/"
|
181
|
-
else
|
182
|
-
"/"
|
183
|
-
end
|
184
|
-
end
|
190
|
+
File.join(user_home, ".thor")
|
185
191
|
end
|
186
192
|
|
187
193
|
# Returns the files in the thor root. On Windows thor_root will be something
|