ey_rails_wizard 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. data/.gitignore +8 -0
  2. data/.rspec +2 -0
  3. data/.travis.yml +6 -0
  4. data/ChangeLog.md +23 -0
  5. data/Gemfile +3 -0
  6. data/MIT_LICENSE +20 -0
  7. data/README.md +78 -0
  8. data/Rakefile +45 -0
  9. data/autotest/discover.rb +1 -0
  10. data/bin/ey_rails_wizard +7 -0
  11. data/ey_rails_wizard.gemspec +28 -0
  12. data/lib/rails_wizard/command.rb +79 -0
  13. data/lib/rails_wizard/config.rb +86 -0
  14. data/lib/rails_wizard/recipe.rb +106 -0
  15. data/lib/rails_wizard/recipes.rb +38 -0
  16. data/lib/rails_wizard/template.rb +67 -0
  17. data/lib/rails_wizard.rb +10 -0
  18. data/recipes/active_admin.rb +18 -0
  19. data/recipes/activerecord.rb +69 -0
  20. data/recipes/cancan.rb +16 -0
  21. data/recipes/capybara.rb +34 -0
  22. data/recipes/carrierwave.rb +42 -0
  23. data/recipes/carrierwave_direct.rb +13 -0
  24. data/recipes/cartographer.rb +33 -0
  25. data/recipes/cucumber.rb +17 -0
  26. data/recipes/delayed_job.rb +16 -0
  27. data/recipes/devise.rb +52 -0
  28. data/recipes/devise_invitable.rb +23 -0
  29. data/recipes/env_yaml.rb +53 -0
  30. data/recipes/event_calendar.rb +12 -0
  31. data/recipes/eycloud.rb +30 -0
  32. data/recipes/eycloud_recipes_on_deploy.rb +20 -0
  33. data/recipes/factory_girl.rb +38 -0
  34. data/recipes/ffaker.rb +22 -0
  35. data/recipes/fixture_builder.rb +35 -0
  36. data/recipes/forgery.rb +15 -0
  37. data/recipes/git.rb +15 -0
  38. data/recipes/haml.rb +11 -0
  39. data/recipes/heroku.rb +58 -0
  40. data/recipes/hoptoad.rb +34 -0
  41. data/recipes/inherited_resources.rb +12 -0
  42. data/recipes/jammit.rb +43 -0
  43. data/recipes/jasmine.rb +12 -0
  44. data/recipes/jquery.rb +20 -0
  45. data/recipes/mini_magick.rb +13 -0
  46. data/recipes/mongo_mapper.rb +20 -0
  47. data/recipes/mongohq.rb +61 -0
  48. data/recipes/mongoid.rb +20 -0
  49. data/recipes/mootools.rb +23 -0
  50. data/recipes/mysql.rb +19 -0
  51. data/recipes/nifty_generators.rb +21 -0
  52. data/recipes/oa_oauth.rb +12 -0
  53. data/recipes/omniauth.rb +17 -0
  54. data/recipes/paper_trail.rb +17 -0
  55. data/recipes/pow.rb +12 -0
  56. data/recipes/prototype.rb +11 -0
  57. data/recipes/puma.rb +10 -0
  58. data/recipes/rails_admin.rb +21 -0
  59. data/recipes/rails_basics.rb +45 -0
  60. data/recipes/rails_dev_tweaks.rb +10 -0
  61. data/recipes/rails_erd.rb +9 -0
  62. data/recipes/rails_footnotes.rb +14 -0
  63. data/recipes/ransack.rb +32 -0
  64. data/recipes/redis.rb +15 -0
  65. data/recipes/resque.rb +37 -0
  66. data/recipes/rmagick.rb +13 -0
  67. data/recipes/rspec.rb +21 -0
  68. data/recipes/sass.rb +13 -0
  69. data/recipes/sequel.rb +13 -0
  70. data/recipes/settingslogic.rb +43 -0
  71. data/recipes/shoulda_matchers.rb +11 -0
  72. data/recipes/simple_form.rb +19 -0
  73. data/recipes/slim.rb +11 -0
  74. data/recipes/sqlite3.rb +10 -0
  75. data/recipes/test_unit.rb +11 -0
  76. data/recipes/thin.rb +10 -0
  77. data/recipes/thinking_sphinx.rb +14 -0
  78. data/recipes/twitter_bootstrap_rails.rb +142 -0
  79. data/recipes/unicorn.rb +10 -0
  80. data/sample.rb +77 -0
  81. data/spec/rails_wizard/config_spec.rb +99 -0
  82. data/spec/rails_wizard/recipe_spec.rb +103 -0
  83. data/spec/rails_wizard/recipes/sanity_spec.rb +30 -0
  84. data/spec/rails_wizard/recipes_spec.rb +24 -0
  85. data/spec/rails_wizard/template_spec.rb +48 -0
  86. data/spec/spec_helper.rb +11 -0
  87. data/spec/support/rails_directory.rb +17 -0
  88. data/spec/support/template_runner.rb +28 -0
  89. data/templates/helpers.erb +45 -0
  90. data/templates/layout.erb +45 -0
  91. data/templates/recipe.erb +10 -0
  92. data/version.rb +3 -0
  93. metadata +232 -0
@@ -0,0 +1,69 @@
1
+ if config['database']
2
+ say_wizard "Configuring '#{config['database']}' database settings..."
3
+ old_gem = gem_for_database
4
+ @options = @options.dup.merge(:database => config['database'])
5
+
6
+ # SQLite3 gem requires special treatment.
7
+ gem_string = case gem_for_database
8
+ when "sqlite3"; "gem 'sqlite3-ruby', :require => 'sqlite3'"
9
+ when "mysql2"; "gem 'mysql2', '>= 0.3.10'"
10
+ else "gem '#{gem_for_database}'"
11
+ end
12
+ gsub_file 'Gemfile', Regexp.new("gem '#{old_gem}'(, '[^']*')?(, :require => '[^']*')?"), gem_string
13
+
14
+ template "config/databases/#{@options[:database]}.yml", "config/database.yml.new"
15
+ run 'mv config/database.yml.new config/database.yml'
16
+ puts "db: #{@options[:database]}"
17
+ puts "postgres_role: #{config['postgres_role']}"
18
+ if @options[:database] == 'postgresql'
19
+ role = ask_wizard("Please enter role:")
20
+ run "createuser -U postgres -d #{role}" unless role.blank?
21
+ end
22
+ end
23
+
24
+ after_bundler do
25
+ rake "db:create:all" if config['auto_create']
26
+
27
+ if config['populate_rake_task']
28
+ populate_rake = <<-RB
29
+ require './config/environment'
30
+ namespace :db do
31
+ desc "Populate the database with sample data"
32
+ task :populate do
33
+ end
34
+ end
35
+ RB
36
+ File.open("lib/tasks/populate.rake", 'w') {|f| f.write(populate_rake)}
37
+ end
38
+ end
39
+
40
+ __END__
41
+
42
+ name: ActiveRecord
43
+ description: "Use the default ActiveRecord database store."
44
+ author: mbleigh
45
+
46
+ exclusive: orm
47
+ category: persistence
48
+ tags: [sql, defaults, orm]
49
+
50
+ config:
51
+ - database:
52
+ type: multiple_choice
53
+ prompt: "Which database are you using?"
54
+ choices:
55
+ - ["MySQL", mysql]
56
+ - ["Oracle", oracle]
57
+ - ["PostgreSQL", postgresql]
58
+ - ["SQLite", sqlite3]
59
+ - ["Frontbase", frontbase]
60
+ - ["IBM DB", ibm_db]
61
+
62
+ - auto_create:
63
+ type: boolean
64
+ prompt: "Automatically create database with default configuration?"
65
+
66
+ - populate_rake_task:
67
+ type: boolean
68
+ prompt: "Add db:populate rake task?"
69
+
data/recipes/cancan.rb ADDED
@@ -0,0 +1,16 @@
1
+ gem 'cancan'
2
+
3
+ after_bundler do
4
+ rake "db:migrate"
5
+ generate "cancan:ability"
6
+ end
7
+
8
+ __END__
9
+
10
+ name: Cancan
11
+ description: "Utilize Cancan for authorization."
12
+ author: amolk
13
+
14
+ category: authentication
15
+ exclusive: authorization
16
+ tags: [authorization, authentication]
@@ -0,0 +1,34 @@
1
+ gem 'capybara', :group => [:development, :test]
2
+
3
+ after_bundler do
4
+ create_file "spec/support/capybara.rb", <<-RUBY
5
+ require 'capybara/rails'
6
+ require 'capybara/rspec'
7
+ RUBY
8
+
9
+ create_file "spec/requests/home_spec.rb", <<-RUBY
10
+ require 'spec_helper'
11
+
12
+ describe 'visiting the homepage' do
13
+ before do
14
+ visit '/'
15
+ end
16
+
17
+ it 'should have a body' do
18
+ page.should have_css('body')
19
+ end
20
+ end
21
+ RUBY
22
+ end
23
+
24
+ __END__
25
+
26
+ name: Capybara
27
+ description: "Use the Capybara acceptance testing libraries with RSpec."
28
+ author: mbleigh
29
+
30
+ requires: [rspec]
31
+ run_after: [rspec]
32
+ exclusive: acceptance_testing
33
+ category: testing
34
+ tags: [acceptance]
@@ -0,0 +1,42 @@
1
+ gem 'fog'
2
+ gem 'carrierwave'
3
+
4
+ region = config['region']
5
+ bucket = ask_wizard("Please enter S3 bucket")
6
+
7
+ carrierwave_initializer = <<-RB
8
+ CarrierWave.configure do |config|
9
+ config.fog_credentials = {
10
+ :provider => 'AWS',
11
+ :aws_access_key_id => 'CHANGEME',
12
+ :aws_secret_access_key => 'CHANGEME',
13
+ :region => '#{region}'
14
+ }
15
+ config.fog_directory = '#{bucket}'
16
+ config.fog_public = true
17
+ # config.fog_host = 'https://assets.changeme.com.au'
18
+ # config.fog_attributes = {'Cache-Control' => 'max-age=315576000'}
19
+ end
20
+ RB
21
+
22
+ end
23
+
24
+ __END__
25
+
26
+ name: Carrierwave
27
+ description: "Use Carrierwave for file uploading"
28
+ author: jonochang
29
+
30
+ exclusive: file-uploads
31
+ tags: [file-uploads]
32
+
33
+ config:
34
+ - region:
35
+ type: multiple_choice
36
+ prompt: "Which region are you using?"
37
+ choices:
38
+ - ["US Standard", us-east-1]
39
+ - ["Oregon", us-west-2]
40
+ - ["Ireland", eu-west-1]
41
+ - ["Singapore", ap-southeast-1]
42
+ - ["Tokyo", ap-northeast-1]
@@ -0,0 +1,13 @@
1
+ gem 'carrierwave_direct'
2
+
3
+ __END__
4
+
5
+ name: Carrierwave Direct
6
+ description: "Use Carrierwave Direct for uploading carrierwave files directly to Amazon S3"
7
+ author: jonochang
8
+
9
+ exclusive: file-uploads
10
+ category: file-uploads
11
+ tags: [file-uploads]
12
+ run_after: [carrierwave]
13
+ requires: [carrierwave]
@@ -0,0 +1,33 @@
1
+ after_bundler do
2
+
3
+ #fixes missing Command error when running rails plugin
4
+ if File.open('script/rails').grep(/module Commands; end/) == []
5
+ source_rails = <<-RB
6
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
7
+ RB
8
+
9
+ add_commands = <<-RB
10
+ module Commands; end
11
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
12
+ RB
13
+
14
+ gsub_file 'script/rails', source_rails, add_commands
15
+ end
16
+
17
+ run 'rails plugin install git://github.com/jonochang/cartographer.git'
18
+
19
+ if File.open('config/environment.rb').grep(/CARTOGRAPHER_GMAP_VERSION/) == []
20
+ source = "require File.expand_path('../application', __FILE__)"
21
+ add_cartographer_const = "require File.expand_path('../application', __FILE__)\n\nCARTOGRAPHER_GMAP_VERSION = 3"
22
+ gsub_file 'config/environment.rb', source, add_cartographer_const
23
+ end
24
+ end
25
+
26
+ __END__
27
+
28
+ name: cartographer
29
+ description: "Google Maps on Rails"
30
+ author: jonochang
31
+
32
+ category: mapping
33
+
@@ -0,0 +1,17 @@
1
+ gem 'cucumber-rails', :group => [:development, :test]
2
+ gem 'capybara', :group => [:development, :test]
3
+ gem 'database_cleaner', :group => [:development, :test]
4
+
5
+ after_bundler do
6
+ generate "cucumber:install --capybara#{' --rspec' if recipes.include?('rspec')}#{' -D' unless recipes.include?('activerecord')}"
7
+ end
8
+
9
+ __END__
10
+
11
+ name: Cucumber
12
+ description: "Use Cucumber for integration testing with Capybara."
13
+ author: mbleigh
14
+
15
+ exclusive: acceptance_testing
16
+ category: testing
17
+ tags: [acceptance]
@@ -0,0 +1,16 @@
1
+ gem 'delayed_job'
2
+
3
+ after_bundler do
4
+ generate 'delayed_job'
5
+ end
6
+
7
+ __END__
8
+
9
+ name: Delayed Job
10
+ description: "Use Delayed Job to handle background jobs"
11
+ author: jonochang
12
+
13
+ exclusive: worker
14
+ category: worker
15
+ tags: [worker,background-tasks]
16
+
data/recipes/devise.rb ADDED
@@ -0,0 +1,52 @@
1
+ gem 'devise'
2
+
3
+ inject_into_file 'config/environments/development.rb', "\nconfig.action_mailer.default_url_options = { :host => 'localhost:3000' }\n", :after => "Application.configure do"
4
+ inject_into_file 'config/environments/test.rb', "\nconfig.action_mailer.default_url_options = { :host => 'localhost:7000' }\n", :after => "Application.configure do"
5
+ inject_into_file 'config/environments/production.rb', "\nconfig.action_mailer.default_url_options = { :host => '#{app_name}.com' }\n", :after => "Application.configure do"
6
+
7
+ inject_into_file 'config/routes.rb', "\nroot :to => 'home#index'\n", :after => "Testapp::Application.routes.draw do"
8
+
9
+ after_bundler do
10
+ generate 'devise:install'
11
+
12
+ if recipes.include? 'mongo_mapper'
13
+ gem 'mm-devise'
14
+ gsub_file 'config/initializers/devise.rb', 'devise/orm/', 'devise/orm/mongo_mapper_active_model'
15
+ generate 'mongo_mapper:devise User'
16
+ elsif recipes.include? 'mongoid'
17
+ gsub_file 'config/initializers/devise.rb', 'devise/orm/active_record', 'devise/orm/mongoid'
18
+ end
19
+
20
+ generate 'devise user'
21
+ generate "devise:views"
22
+
23
+ if config['add_app_helpers']
24
+ new_helpers = <<-RB
25
+ module ApplicationHelper
26
+
27
+ def current_user
28
+ @current_user
29
+ end
30
+
31
+ def logged_in?
32
+ @current_user != nil
33
+ end
34
+ RB
35
+ gsub_file 'app/helpers/application_helper.rb', 'module ApplicationHelper', new_helpers
36
+ end
37
+ end
38
+
39
+ __END__
40
+
41
+ name: Devise
42
+ description: Utilize Devise for authentication, automatically configured for your selected ORM.
43
+ author: mbleigh
44
+
45
+ category: authentication
46
+ exclusive: authentication
47
+
48
+ config:
49
+ - add_app_helpers:
50
+ type: boolean
51
+ prompt: "Add logged_in and current_user helpers?"
52
+
@@ -0,0 +1,23 @@
1
+ gem 'devise_invitable'
2
+
3
+ after_bundler do
4
+ generate 'devise_invitable:install'
5
+ generate 'devise_invitable user'
6
+ generate 'devise_invitable:views users'
7
+ end
8
+
9
+ __END__
10
+
11
+ name: Devise Invitable
12
+ description: Utilize Devise Invitable to allow users to invite other users to sign up to the system
13
+ author: jonochang
14
+
15
+ category: authentication
16
+ exclusive: authentication
17
+ run_after: [devise]
18
+
19
+ config:
20
+ - generate_user_scoped_view:
21
+ type: boolean
22
+ prompt: "Generate Devise Invitable user scoped views?"
23
+
@@ -0,0 +1,53 @@
1
+
2
+
3
+ say_wizard "Generating config/env.yaml..."
4
+
5
+ append_file "config/application.rb", <<-RUBY
6
+
7
+ require 'env_yaml'
8
+ RUBY
9
+
10
+ create_file "lib/env_yaml.rb", <<-RUBY
11
+ require 'yaml'
12
+ begin
13
+ env_yaml = YAML.load_file(File.dirname(__FILE__) + '/../config/env.yml')
14
+ if env_hash = env_yaml[ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development']
15
+ env_hash.each_pair do |k,v|
16
+ ENV[k] = v.to_s
17
+ end
18
+ end
19
+ rescue StandardError => e
20
+ end
21
+
22
+ RUBY
23
+
24
+ create_file "config/env.yml", <<-YAML
25
+ defaults: &defaults
26
+ ENV_YAML: true
27
+
28
+ development:
29
+ <<: *defaults
30
+
31
+ test:
32
+ <<: *defaults
33
+
34
+ production:
35
+ <<: *defaults
36
+ YAML
37
+
38
+ def env(k,v,rack_env='development')
39
+ inject_into_file "config/env.yml", :after => "#{rack_env}:\n <<: *defaults" do
40
+ <<-YAML
41
+ #{k}: #{v.inspect}
42
+ YAML
43
+ end
44
+ end
45
+
46
+ __END__
47
+
48
+ name: EnvYAML
49
+ description: "Allows you to set environment variables in a YAML file at config/env.yaml"
50
+ author: mbleigh
51
+
52
+ category: other
53
+ tags: [utilities, configuration]
@@ -0,0 +1,12 @@
1
+ gem 'event-calendar', :require => 'event_calendar'
2
+
3
+ __END__
4
+
5
+ name: Event Calendar
6
+ description: "Use Event Calendar to show multiple overlapping events across calendar days and rows"
7
+ author: jonochang
8
+
9
+ exclusive: calendar
10
+ category: calendar
11
+ tags: [calendar]
12
+
@@ -0,0 +1,30 @@
1
+ gem 'engineyard'
2
+ gem 'ey_config'
3
+
4
+ after_bundler do
5
+ create_file "EngineYardCloud.md", <<-README
6
+ # Using Engine Yard Cloud
7
+
8
+ ## Initial Deployment
9
+
10
+ * Host this git repository (such as on [GitHub](https://github.com))
11
+ * From the [Dashboard](https://cloud.engineyard.com/), click "New an Application"
12
+ * Add the "Git Repository URI"
13
+ * Click "Create Application"
14
+ * Add an Environment Name
15
+ * Click "Create Environment"
16
+ * Click "Boot this Configuration"
17
+
18
+ README
19
+
20
+ end
21
+
22
+ __END__
23
+
24
+ name: Engine Yard Cloud
25
+ description: The Most Powerful Ruby Cloud
26
+ author: drnic
27
+
28
+ requires: [git]
29
+ category: deployment
30
+ exclusive: deployment
@@ -0,0 +1,20 @@
1
+ gem "engineyard-recipes", :group => [:development]
2
+
3
+ after_bundler do
4
+ say_custom "eycloud", "Setting up deploy hooks..."
5
+ run "bundle exec ey-recipes init --on-deploy --chef"
6
+ run "bundle update"
7
+ end
8
+
9
+
10
+ __END__
11
+
12
+ name: Recipes on Deploy
13
+ description: Run Engine Yard Cloud recipes during deployment instead of independently.
14
+ author: drnic
15
+ website: https://github.com/engineyard/engineyard-recipes
16
+
17
+ requires: [eycloud]
18
+ run_after: [eycloud]
19
+ category: deployment
20
+ tags: [background, worker]
@@ -0,0 +1,38 @@
1
+ gem 'factory_girl', :group => [:development, :test]
2
+ gem 'factory_girl_rails', :group => [:development, :test]
3
+
4
+ after_bundler do
5
+ File.open('spec/factories.rb', 'w') {|f| f.write("FactoryGirl.define do
6
+ end")}
7
+
8
+ factory_user = <<-RB
9
+ FactoryGirl.define do
10
+ factory :user do
11
+ factory_password = Forgery(:basic).password
12
+ email { Forgery(:internet).email_address }
13
+ password factory_password
14
+ password_confirmation factory_password
15
+ end
16
+
17
+ RB
18
+ if config['use_devise']
19
+ gsub_file 'spec/factories.rb', 'FactoryGirl.define do', factory_user
20
+ end
21
+ end
22
+
23
+ __END__
24
+
25
+ name: Factory Girl
26
+ description: "Use Factory Girl to replace fixtures"
27
+ author: jonochang
28
+
29
+ exclusive: fixtures
30
+ category: testing
31
+ tags: [fixtures, testing]
32
+
33
+ config:
34
+ - use_devise:
35
+ type: boolean
36
+ prompt: "Add factory for devise user?"
37
+ if_recipe: devise
38
+
data/recipes/ffaker.rb ADDED
@@ -0,0 +1,22 @@
1
+ gem 'ffaker'
2
+
3
+ after_bundler do
4
+ # TODO - necessary to add this? or will bundler do it?
5
+ inject_into_file "spec/spec_helper.rb", :after => "require 'rspec/rails'\n" do
6
+ "require 'ffaker'\n"
7
+ end
8
+ end
9
+
10
+ __END__
11
+
12
+ name: ffaker
13
+ description: "Fast Faker: Faker refactored for speed"
14
+ author: lightyrs
15
+
16
+ # necessary?
17
+ requires: [rspec]
18
+ run_after: [rspec]
19
+
20
+ category: testing
21
+ exclusive: fake-data
22
+ tags: [fake-data]
@@ -0,0 +1,35 @@
1
+ gem 'fixture_builder', :group => [:test]
2
+ gem 'mocha', :group => [:test]
3
+
4
+ after_everything do
5
+
6
+ create_file "spec/support/fixture_builder.rb", <<-RUBY
7
+ FixtureBuilder.configure do |fbuilder|
8
+ # rebuild fixtures automatically when these files change:
9
+ fbuilder.files_to_check += Dir["spec/factories/*.rb", "spec/support/fixture_builder.rb"]
10
+
11
+ # now declare objects
12
+ fbuilder.factory do
13
+
14
+ end
15
+ end
16
+ RUBY
17
+
18
+ inject_into_file "spec/spec_helper.rb", :after => "require 'rspec/rails'\n" do
19
+ "require 'spec/support/fixture_builder.rb'\n"
20
+ end
21
+
22
+ gsub_file "spec/spec_helper.rb", "config.mock_with :rspec", "# config.mock_with :rspec"
23
+ gsub_file "spec/spec_helper.rb", "# config.mock_with :mocha", " config.mock_with :mocha"
24
+
25
+ end
26
+
27
+ __END__
28
+
29
+ name: FixtureBuilder
30
+ description: "Allows you to build file fixtures from an object mother factory."
31
+ author: lightyrs
32
+
33
+ category: testing
34
+ run_after: [rspec]
35
+ requires: [rspec]
@@ -0,0 +1,15 @@
1
+ gem 'forgery'
2
+
3
+ after_bundler do
4
+ generate "forgery"
5
+ end
6
+
7
+ __END__
8
+
9
+ name: Forgery
10
+ description: A fake data generator that provides not only a host of basics and a rememberable syntax, but a customizable library to boot.
11
+
12
+ category: testing
13
+ exclusive: fake-data
14
+ tags: [fake-data]
15
+
data/recipes/git.rb ADDED
@@ -0,0 +1,15 @@
1
+ after_everything do
2
+ git :init
3
+ git :add => '.'
4
+ git :commit => '-m "Initial import."'
5
+ end
6
+
7
+ __END__
8
+
9
+ name: Git
10
+ description: "Provides basic Git setup for the Rails app and commits the initial repository."
11
+ author: mbleigh
12
+
13
+ exclusive: scm
14
+ category: other
15
+ tags: [scm]
data/recipes/haml.rb ADDED
@@ -0,0 +1,11 @@
1
+ gem 'haml', '>= 3.0.0'
2
+ gem 'haml-rails'
3
+
4
+ __END__
5
+
6
+ name: HAML
7
+ description: "Utilize HAML for templating."
8
+ author: mbleigh
9
+
10
+ category: templating
11
+ exclusive: templating
data/recipes/heroku.rb ADDED
@@ -0,0 +1,58 @@
1
+ heroku_name = app_name.gsub('_','')
2
+
3
+ after_everything do
4
+ if config['create']
5
+ say_wizard "Creating Heroku app '#{heroku_name}.heroku.com'"
6
+ while !system("heroku create #{heroku_name}")
7
+ heroku_name = ask_wizard("What do you want to call your app? ")
8
+ end
9
+ end
10
+
11
+ if config['staging']
12
+ staging_name = "#{heroku_name}-staging"
13
+ say_wizard "Creating staging Heroku app '#{staging_name}.heroku.com'"
14
+ while !system("heroku create #{staging_name}")
15
+ staging_name = ask_wizard("What do you want to call your staging app?")
16
+ end
17
+ git :remote => "rm heroku"
18
+ git :remote => "add production git@heroku.com:#{heroku_name}.git"
19
+ git :remote => "add staging git@heroku.com:#{staging_name}.git"
20
+ say_wizard "Created branches 'production' and 'staging' for Heroku deploy."
21
+ end
22
+
23
+ unless config['domain'].blank?
24
+ run "heroku addons:add custom_domains"
25
+ run "heroku domains:add #{config['domain']}"
26
+ end
27
+
28
+ git :push => "#{config['staging'] ? 'staging' : 'heroku'} master" if config['deploy']
29
+ end
30
+
31
+ __END__
32
+
33
+ name: Heroku
34
+ description: Create Heroku application and instantly deploy.
35
+ author: mbleigh
36
+
37
+ requires: [git]
38
+ run_after: [git]
39
+ exclusive: deployment
40
+ category: deployment
41
+ tags: [provider]
42
+
43
+ config:
44
+ - create:
45
+ prompt: "Automatically create appname.heroku.com?"
46
+ type: boolean
47
+ - staging:
48
+ prompt: "Create staging app? (appname-staging.heroku.com)"
49
+ type: boolean
50
+ if: create
51
+ - domain:
52
+ prompt: "Specify custom domain (or leave blank):"
53
+ type: string
54
+ if: create
55
+ - deploy:
56
+ prompt: "Deploy immediately?"
57
+ type: boolean
58
+ if: create
@@ -0,0 +1,34 @@
1
+
2
+ gem 'hoptoad_notifier'
3
+
4
+ if config['use_heroku']
5
+ after_everything do
6
+ say_wizard "Adding hoptoad:basic Heroku addon (you can always upgrade later)"
7
+ run "heroku addons:add hoptoad:basic"
8
+ generate "hoptoad --heroku"
9
+ end
10
+ else
11
+ after_bundler do
12
+ generate "hoptoad --api-key #{config['api_key']}"
13
+ end
14
+ end
15
+
16
+ __END__
17
+
18
+ name: Hoptoad
19
+ description: Add Hoptoad exception reporting to your application.
20
+
21
+ category: services
22
+ exclusive: exception_notification
23
+ tags: [exception_notification]
24
+ run_after: [heroku]
25
+
26
+ config:
27
+ - use_heroku:
28
+ type: boolean
29
+ prompt: "Use the Hoptoad Heroku addon?"
30
+ if_recipe: heroku
31
+ - api_key:
32
+ prompt: "Enter Hoptoad API Key:"
33
+ type: string
34
+ unless: use_heroku