Created
October 1, 2011 18:21
-
-
Save kaze/1256450 to your computer and use it in GitHub Desktop.
Fixes problem with updating bundles in thor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
lib/thor/runner.rb | 12 +++++++++++- | |
1 files changed, 11 insertions(+), 1 deletions(-) | |
create mode 100644 fix_update_bundle.patch | |
diff --git a/lib/thor/runner.rb b/lib/thor/runner.rb | |
index 18c63c4..1eef304 100644 | |
--- a/lib/thor/runner.rb | |
+++ b/lib/thor/runner.rb | |
@@ -126,7 +126,17 @@ class Thor::Runner < Thor #:nodoc: | |
old_filename = thor_yaml[name][:filename] | |
self.options = self.options.merge("as" => name) | |
- filename = install(thor_yaml[name][:location]) | |
+ | |
+ if File.directory? File.expand_path(name) | |
+ FileUtils.rm_rf(File.join(thor_root, old_filename)) | |
+ | |
+ thor_yaml.delete(old_filename) | |
+ save_yaml(thor_yaml) | |
+ | |
+ filename = install(name) | |
+ else | |
+ filename = install(thor_yaml[name][:location]) | |
+ end | |
unless filename == old_filename | |
File.delete(File.join(thor_root, old_filename)) | |
-- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment