Permalink
Browse files

Added a capistrano hook for Rails 3

  • Loading branch information...
1 parent 9970116 commit e6f87a5455fc860e5d8162e45e72768d00f69b17 @jferris jferris committed Mar 23, 2010
Showing with 12 additions and 0 deletions.
  1. +1 −0 features/rails.feature
  2. +11 −0 lib/rails_generators/hoptoad/hoptoad_generator.rb
View
@@ -56,6 +56,7 @@ Feature: Install the Gem in a Rails application
And I unpack the "hoptoad_notifier" gem
And I run the hoptoad generator with "-k myapikey"
And I uninstall the "hoptoad_notifier" gem
+ And I install cached gems
And I run "cap -T"
Then I should see "deploy:notify_hoptoad"
@@ -11,6 +11,7 @@ def self.source_root
def install
ensure_api_key_was_configured
ensure_plugin_is_not_present
+ append_capistrano_hook
generate_initializer unless api_key_configured?
test_hoptoad
end
@@ -31,6 +32,16 @@ def ensure_plugin_is_not_present
end
end
+ def append_capistrano_hook
+ if File.exists?('config/deploy.rb')
+ append_file('config/deploy.rb', <<-HOOK)
+
+ require 'config/boot'
+ require 'hoptoad_notifier/capistrano'
+ HOOK
+ end
+ end
+
def api_key
options[:api_key]
end

0 comments on commit e6f87a5

Please sign in to comment.