Skip to content

Instantly share code, notes, and snippets.

@kaze
Created October 1, 2011 18:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaze/1256450 to your computer and use it in GitHub Desktop.
Save kaze/1256450 to your computer and use it in GitHub Desktop.
Fixes problem with updating bundles in thor
---
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