Permalink
Browse files

Adding more recipes to get a feel for the configuration requirements.

  • Loading branch information...
Michael Bleigh
Michael Bleigh committed Mar 13, 2011
1 parent 8417d5f commit e50e61e68768a9d5d806714d7af76ecc4ffed678
Showing with 98 additions and 11 deletions.
  1. +8 −0 Rakefile
  2. +13 −10 recipes/hoptoad.rb
  3. +52 −0 recipes/mongohq.rb
  4. +11 −0 recipes/redis.rb
  5. +13 −0 recipes/sequel.rb
  6. +1 −1 spec/rails_wizard/template_spec.rb
View
@@ -33,3 +33,11 @@ task :run => :clean do
file.unlink
end
end
+
+desc "Prints out a template from the provided recipes."
+task :print do
+ require 'rails_wizard'
+
+ recipes = ENV['RECIPES'].split(',')
+ puts RailsWizard::Template.new(recipes).compile
+end
View
@@ -1,15 +1,14 @@
-if recipes.include? 'heroku'
- before_config do
- config['heroku'] = wizard_yes?("Use Heroku addon for Hoptoad?")
- end
-end
gem 'hoptoad_notifier'
-if config['heroku']
- generate "hoptoad --heroku"
-else
- generate "hoptoad --api-key #{config['api_key']}"
+after_bundler do
+ if config['use_heroku']
+ say_wizard "Adding hoptoad:basic Heroku addon (you can always upgrade later)"
+ run "heroku addons:add hoptoad:basic"
+ generate "hoptoad --heroku"
+ else
+ generate "hoptoad --api-key #{config['api_key']}"
+ end
end
__END__
@@ -22,7 +21,11 @@
tags: [exception_notification]
config:
+ - use_heroku:
+ type: boolean
+ prompt: "Use the Hoptoad Heroku addon?"
+
- api_key:
prompt: "Enter Hoptoad API Key:"
type: string
- unless: heroku
+ unless: use_heroku
View
@@ -0,0 +1,52 @@
+if config['use_heroku']
+ say_wizard 'Adding mongohq:free addon (you can always upgrade later)'
+
+ header = <<-YAML
+<% if ENV['MONGOHQ_URL'] %>
+<% mongohq = URI.parse(ENV['MONGOHQ_URL']) %>
+mongohq:
+ host: <%= mongohq.host %>
+ port: <%= mongohq.port %>
+ database: <%= mongohq.path.sub '/', '' %>
+ username: <%= mongohq.user %>
+ password: <%= mongohq.password %>
+<% end %>
+YAML
+
+ after_bundler do
+ system 'heroku addons:add mongohq:free'
+ end
+else
+ mongohq = URI.parse(config['uri'])
+
+ header = <<-YAML
+mongohq:
+ host: #{mongohq.host}
+ port: #{mongohq.port}
+ database: #{mongohq.path.sub '/',''}
+ username: #{mongohq.user}
+ password: #{mongohq.password}
+YAML
+end
+
+__END__
+
+name: MongoHQ
+description: "Utilize MongoHQ as the production data host for your application."
+author: mbleigh
+
+requires_any: [mongo_mapper, mongoid]
+run_after: [mongo_mapper, mongoid]
+exclusive: mongodb_host
+category: services
+tags: [mongodb]
+
+config:
+ - use_heroku:
+ type: boolean
+ prompt: "Use the MongoHQ Heroku addon?"
+ if_recipe: heroku
+ - uri:
+ type: string
+ prompt: "Enter your MongoHQ URI:"
+ unless: use_heroku
View
@@ -0,0 +1,11 @@
+gem 'redis'
+
+__END__
+
+name: Redis
+description: "Add Redis as a persistence engine to your application."
+author: mbleigh
+
+exclusive: key_value
+category: persistence
+tags: [key_value, cache, session_store]
View
@@ -0,0 +1,13 @@
+gem 'sequel-rails'
+
+application "require 'sequel-rails/railtie'"
+
+__END__
+
+name: Sequel
+description: "Utilize Sequel as the primary ORM for your application."
+author: mbleigh
+
+exclusive: orm
+category: persistence
+tags: [orm, sql]
@@ -2,6 +2,6 @@
describe RailsWizard::Template do
it do
- puts RailsWizard::Template.new(['jquery', 'heroku', 'mongo_mapper']).compile
+ # puts RailsWizard::Template.new(['jquery', 'heroku', 'mongo_mapper']).compile
end
end

0 comments on commit e50e61e

Please sign in to comment.