Skip to content

Commit

Permalink
Update and fix a number of small issues with recipes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Bleigh committed Mar 31, 2011
1 parent fd68b07 commit c7a6676
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 17 deletions.
9 changes: 6 additions & 3 deletions recipes/hoptoad.rb
@@ -1,12 +1,14 @@

gem 'hoptoad_notifier'

after_bundler do
if config['use_heroku']
if config['use_heroku']
after_everything do
say_wizard "Adding hoptoad:basic Heroku addon (you can always upgrade later)"
run "heroku addons:add hoptoad:basic"
generate "hoptoad --heroku"
else
end
else
after_bundler do
generate "hoptoad --api-key #{config['api_key']}"
end
end
Expand All @@ -19,6 +21,7 @@
category: services
exclusive: exception_notification
tags: [exception_notification]
run_after: [heroku]

config:
- use_heroku:
Expand Down
18 changes: 9 additions & 9 deletions recipes/jquery.rb
@@ -1,15 +1,10 @@
inside "public/javascripts" do
get "https://github.com/rails/jquery-ujs/raw/master/src/rails.js", "rails.js"
get "http://code.jquery.com/jquery-1.5.1.min.js", "jquery.js"
end
gem 'jquery-rails'

application do
"\nconfig.action_view.javascript_expansions[:defaults] = %w(jquery rails)\n"
after_bundler do
ui = config['ui'] ? ' --ui' : ''
generate "jquery:install#{ui}"
end

gsub_file "config/application.rb", /# JavaScript.*\n/, ""
gsub_file "config/application.rb", /# config\.action_view\.javascript.*\n/, ""

__END__

name: jQuery
Expand All @@ -21,3 +16,8 @@
tags: [javascript, framework]

args: ["-J"]

config:
- ui:
type: boolean
prompt: Install jQuery UI?
4 changes: 2 additions & 2 deletions recipes/mongohq.rb
Expand Up @@ -12,7 +12,7 @@
<% end %>
YAML

after_bundler do
after_everything do
say_wizard 'Adding mongohq:free addon (you can always upgrade later)'
system 'heroku addons:add mongohq:free'
end
Expand Down Expand Up @@ -43,7 +43,7 @@
author: mbleigh

requires_any: [mongo_mapper, mongoid]
run_after: [mongo_mapper, mongoid]
run_after: [mongo_mapper, mongoid, heroku]
exclusive: mongodb_host
category: services
tags: [mongodb]
Expand Down
3 changes: 2 additions & 1 deletion recipes/redistogo.rb
Expand Up @@ -9,14 +9,15 @@

env("REDISTOGO_URL", "redis://localhost:6379")

after_bundler do
after_everything do
if config['use_heroku']
say_wizard "Adding redistogo:nano Heroku addon, you can always upgrade later."
run "heroku addons:add redistogo:nano"
else
env("REDISTOGO_URL", config['url'], 'production') if config['url']
end
end

__END__

name: RedisToGo
Expand Down
1 change: 1 addition & 0 deletions templates/helpers.erb
Expand Up @@ -35,6 +35,7 @@ def multiple_choice(question, choices)
end

@current_recipe = nil
@configs = {}

@after_blocks = []
def after_bundler(&block); @after_blocks << [@current_recipe, block]; end
Expand Down
7 changes: 5 additions & 2 deletions templates/layout.erb
Expand Up @@ -38,5 +38,8 @@ RUBY
say_wizard "Running Bundler install. This will take a while."
run 'bundle install'
say_wizard "Running after Bundler callbacks."
@after_blocks.each{|b| @current_recipe = b[0]; b[1].call}
@after_everything_blocks.each{|b| @current_recipe = b[0]; b[1].call}
@after_blocks.each{|b| config = @configs[b[0]] || {}; @current_recipe = b[0]; b[1].call}

@current_recipe = nil
say_wizard "Running after everything callbacks."
@after_everything_blocks.each{|b| config = @configs[b[0]] || {}; @current_recipe = b[0]; b[1].call}
1 change: 1 addition & 0 deletions templates/recipe.erb
Expand Up @@ -5,5 +5,6 @@
say_recipe '<%= name %>'

<%= config.compile if config %>
@configs[@current_recipe] = config

<%= template %>

0 comments on commit c7a6676

Please sign in to comment.