Permalink
Browse files

LH-591 Notifier generator checks the presence of the hoptoad_notifier…

… plugin
  • Loading branch information...
1 parent e38b6a7 commit c1da35c45c76774529a9be94e91112943f755ed3 damselem committed Jan 25, 2010
View
10 features/rails.feature
@@ -53,3 +53,13 @@ Feature: Install the Gem in a Rails application
And I uninstall the "hoptoad_notifier" gem
And I run "cap -T"
Then I should see "deploy:notify_hoptoad"
+
+ Scenario: Try to install when the hoptoad_notifier plugin still exists
+ When I generate a new Rails application
+ And I install the "hoptoad_notifier" plugin
+ And I configure the Hoptoad shim
+ And I configure the notifier to use "myapikey" as an API key
+ And I configure my application to require the "hoptoad_notifier" gem
+ And I run "script/generate hoptoad"
+ Then I should see "You must first remove the hoptoad_notifier plugin from the vendor/plugins directory"
+
View
4 features/step_definitions/rails_application_steps.rb
@@ -114,3 +114,7 @@
end
end
end
+
+When /^I install the "([^\"]*)" plugin$/ do |plugin_name|
+ FileUtils.mkdir_p("#{RAILS_ROOT}/vendor/plugins/#{plugin_name}")
+end
View
8 generators/hoptoad/hoptoad_generator.rb
@@ -11,6 +11,10 @@ def manifest
puts "Must pass --api-key or create config/initializers/hoptoad.rb"
exit
end
+ if plugin_is_present?
+ puts "You must first remove the hoptoad_notifier plugin from the vendor/plugins directory"
+ exit
+ end
record do |m|
m.directory 'lib/tasks'
m.file 'hoptoad_notifier_tasks.rake', 'lib/tasks/hoptoad_notifier_tasks.rake'
@@ -43,4 +47,8 @@ def api_key_configured?
def capistrano_hook
IO.read(source_path('capistrano_hook.rb'))
end
+
+ def plugin_is_present?
+ File.exists?('vendor/plugins/hoptoad_notifier')
+ end
end

0 comments on commit c1da35c

Please sign in to comment.