josevalim-thor 0.10.25 → 0.10.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/thor/actions.rb +1 -1
  2. data/lib/thor/util.rb +23 -17
  3. 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
- return File.join(ENV["HOME"], '.thor') if ENV["HOME"]
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: josevalim-thor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.25
4
+ version: 0.10.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yehuda Katz