Permalink
Browse files

Force the --api-key or the initializer

  • Loading branch information...
mike-burns authored and jferris committed Jan 5, 2010
1 parent 67b0ec9 commit 9835e269e111b63c0a00264ada520024ea3fc329
Showing with 4 additions and 5 deletions.
  1. +4 −5 generators/hoptoad/hoptoad_generator.rb
@@ -7,17 +7,16 @@ def add_options!(opt)
end
def manifest
+ unless File.exists?('config/initializers/hoptoad.rb') || options[:api_key]
+ puts "Must pass --api-key or create config/initializers/hoptoad.rb"
+ exit
+ end
record do |m|
m.directory 'lib/tasks'
m.file 'hoptoad_notifier_tasks.rake', 'lib/tasks/hoptoad_notifier_tasks.rake'
if File.exists?('config/deploy.rb')
m.insert_into 'config/deploy.rb', "require 'hoptoad_notifier/recipes/hoptoad'"
end
- if File.exists?('app/controllers/application_controller.rb')
- m.insert_into 'app/controllers/application_controller.rb', 'include HoptoadNotifier::Catcher'
- elsif File.exists?('app/controllers/application.rb')
- m.insert_into 'app/controllers/application.rb', 'include HoptoadNotifier::Catcher'
- end
unless options[:api_key].nil?
m.template 'initializer.rb', 'config/initializers/hoptoad.rb',
:assigns => {:api_key => options[:api_key]}

0 comments on commit 9835e26

Please sign in to comment.