rails_apps_composer 1.5.5 → 2.0.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.
- data/README.textile +185 -254
- data/lib/rails_wizard/command.rb +54 -13
- data/lib/rails_wizard/config.rb +1 -1
- data/lib/rails_wizard/diagnostics.rb +22 -0
- data/lib/rails_wizard/template.rb +36 -2
- data/lib/rails_wizard.rb +1 -0
- data/recipes/auth.rb +84 -0
- data/recipes/controllers.rb +58 -0
- data/recipes/{seed_database.rb → database.rb} +35 -22
- data/recipes/{action_mailer.rb → email.rb} +29 -50
- data/recipes/example.rb +70 -0
- data/recipes/extras.rb +91 -30
- data/recipes/frontend.rb +59 -0
- data/recipes/gems.rb +128 -0
- data/recipes/models.rb +61 -0
- data/recipes/prelaunch.rb +45 -0
- data/recipes/readme.rb +83 -0
- data/recipes/routes.rb +36 -0
- data/recipes/setup.rb +148 -0
- data/recipes/testing.rb +187 -0
- data/recipes/views.rb +39 -0
- data/spec/rails_wizard/template_spec.rb +4 -2
- data/templates/helpers.erb +53 -2
- data/templates/layout.erb +81 -20
- data/version.rb +1 -1
- metadata +19 -49
- data/recipes/active_admin.rb +0 -36
- data/recipes/activerecord.rb +0 -37
- data/recipes/add_user.rb +0 -140
- data/recipes/airbrake.rb +0 -34
- data/recipes/backbone.rb +0 -23
- data/recipes/capybara.rb +0 -34
- data/recipes/cleanup.rb +0 -40
- data/recipes/cloudfiles.rb +0 -36
- data/recipes/compass.rb +0 -46
- data/recipes/compass_960.rb +0 -48
- data/recipes/cucumber.rb +0 -75
- data/recipes/datamapper.rb +0 -111
- data/recipes/devise.rb +0 -114
- data/recipes/git.rb +0 -40
- data/recipes/guard.rb +0 -89
- data/recipes/haml.rb +0 -23
- data/recipes/heroku.rb +0 -61
- data/recipes/home_page.rb +0 -58
- data/recipes/home_page_users.rb +0 -47
- data/recipes/html5.rb +0 -152
- data/recipes/inherited_resources.rb +0 -23
- data/recipes/less.rb +0 -12
- data/recipes/mongohq.rb +0 -59
- data/recipes/mongoid.rb +0 -38
- data/recipes/mongolab.rb +0 -59
- data/recipes/omniauth.rb +0 -194
- data/recipes/omniauth_email.rb +0 -82
- data/recipes/paperclip.rb +0 -79
- data/recipes/prelaunch_signup.rb +0 -586
- data/recipes/rails_admin.rb +0 -29
- data/recipes/redis.rb +0 -23
- data/recipes/responders.rb +0 -10
- data/recipes/resque.rb +0 -25
- data/recipes/rspec.rb +0 -131
- data/recipes/sass.rb +0 -25
- data/recipes/settingslogic.rb +0 -43
- data/recipes/simple_form.rb +0 -54
- data/recipes/slim.rb +0 -46
- data/recipes/static_page.rb +0 -43
- data/recipes/subdomains.rb +0 -121
- data/recipes/turnip.rb +0 -18
- data/recipes/unicorn.rb +0 -29
- data/recipes/users_page.rb +0 -165
data/recipes/datamapper.rb
DELETED
@@ -1,111 +0,0 @@
|
|
1
|
-
# Application template recipe for the rails_apps_composer. Check for a newer version here:
|
2
|
-
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/datamapper.rb
|
3
|
-
RAILS_VERSION='~> 3.1.0'
|
4
|
-
DM_VERSION='~> 1.2.0'
|
5
|
-
|
6
|
-
if config['datamapper']
|
7
|
-
abort "DataMapper #{DM_VERSION} is only compatible with Rails #{RAILS_VERSION}" unless ::Rails::VERSION::MAJOR == 3 and ::Rails::VERSION::MINOR < 2
|
8
|
-
else
|
9
|
-
recipes.delete('datamapper')
|
10
|
-
end
|
11
|
-
|
12
|
-
if config['datamapper']
|
13
|
-
say_wizard "REMINDER: When creating a Rails app using DataMapper,"
|
14
|
-
say_wizard "you must add the '-O' flag to 'rails new'"
|
15
|
-
gem 'dm-rails', DM_VERSION
|
16
|
-
gem "dm-#{config['database']}-adapter", DM_VERSION
|
17
|
-
gem 'dm-migrations', DM_VERSION
|
18
|
-
gem 'dm-types', DM_VERSION
|
19
|
-
gem 'dm-constraints', DM_VERSION
|
20
|
-
gem 'dm-transactions', DM_VERSION
|
21
|
-
gem 'dm-aggregates', DM_VERSION
|
22
|
-
gem 'dm-timestamps', DM_VERSION
|
23
|
-
gem 'dm-observer', DM_VERSION
|
24
|
-
gem 'dm-validations', DM_VERSION if config['validations'] == 'dm-validations'
|
25
|
-
gem 'dm-devise', '>= 2.0.1' if recipes.include? 'devise'
|
26
|
-
|
27
|
-
inject_into_file 'config/application.rb', "require 'dm-rails/railtie'\n", :after => "require 'action_controller/railtie'\n"
|
28
|
-
prepend_file 'app/controllers/application_controller.rb', "require 'dm-rails/middleware/identity_map'\n"
|
29
|
-
inject_into_class 'app/controllers/application_controller.rb', 'ApplicationController', " use Rails::DataMapper::Middleware::IdentityMap\n"
|
30
|
-
create_file 'config/database.yml' do <<-YAML
|
31
|
-
defaults: &defaults
|
32
|
-
adapter: #{config['database']}
|
33
|
-
|
34
|
-
production:
|
35
|
-
<<: *defaults
|
36
|
-
|
37
|
-
development:
|
38
|
-
<<: *defaults
|
39
|
-
|
40
|
-
test:
|
41
|
-
<<: *defaults
|
42
|
-
YAML
|
43
|
-
end
|
44
|
-
case config['database']
|
45
|
-
when "mysql", "postgres", "oracle", "sqlserver"
|
46
|
-
sane_app_name = app_name.gsub(/[^a-zA-Z0-9_]/, '_')
|
47
|
-
dbname = ask_wizard "Database name \033[33m[#{sane_app_name}]\033[0m"
|
48
|
-
dbname = sane_app_name if dbname.empty?
|
49
|
-
dbhost = ask_wizard "Database host \033[33m[localhost]\033[0m"
|
50
|
-
dbhost = 'localhost' if dbhost.empty?
|
51
|
-
dbuser = ask_wizard "Database username \033[33m[root]\033[0m"
|
52
|
-
dbuser = 'root' if dbuser.empty?
|
53
|
-
dbpass = ask_wizard "Database password \033[33m[]\033[0m"
|
54
|
-
inject_into_file 'config/database.yml', " password: '#{dbpass}'\n", :after => " adapter: #{config['database']}\n"
|
55
|
-
inject_into_file 'config/database.yml', " username: #{dbuser}\n", :after => " adapter: #{config['database']}\n"
|
56
|
-
inject_into_file 'config/database.yml', " host: #{dbhost}\n", :after => " adapter: #{config['database']}\n"
|
57
|
-
inject_into_file 'config/database.yml', " database: #{dbname}\n", :before => "\ndevelopment:"
|
58
|
-
inject_into_file 'config/database.yml', " database: #{dbname}_development\n", :before => "\ntest:"
|
59
|
-
append_file 'config/database.yml', " database: #{dbname}_test"
|
60
|
-
when "sqlite"
|
61
|
-
inject_into_file 'config/database.yml', " database: db/production.db\n", :before => "\ndevelopment:"
|
62
|
-
inject_into_file 'config/database.yml', " database: db/development.db\n", :before => "\ntest:"
|
63
|
-
append_file 'config/database.yml', " database: db/test.db\n"
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
if config['datamapper']
|
68
|
-
after_bundler do
|
69
|
-
say_wizard "DataMapper recipe running 'after bundler'"
|
70
|
-
if recipes.include? 'devise'
|
71
|
-
generate 'data_mapper:devise_install'
|
72
|
-
gsub_file 'config/initializers/devise.rb', /# config.data_mapper_validation_lib = nil/, "config.data_mapper_validation_lib = '#{config['validations']}'"
|
73
|
-
end
|
74
|
-
rake "db:create:all" if config['auto_create']
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
__END__
|
79
|
-
|
80
|
-
name: DataMapper
|
81
|
-
description: "Use DataMapper to connect to a data store (requires Rails ~> 3.1.0)."
|
82
|
-
author: Peter Fern
|
83
|
-
|
84
|
-
category: persistence
|
85
|
-
exclusive: orm
|
86
|
-
tags: [orm, datamapper, sql]
|
87
|
-
|
88
|
-
args: ["-O"]
|
89
|
-
|
90
|
-
config:
|
91
|
-
- datamapper:
|
92
|
-
type: boolean
|
93
|
-
prompt: Would you like to use DataMapper to connect to a data store (requires Rails ~> 3.1.0)?
|
94
|
-
- database:
|
95
|
-
type: multiple_choice
|
96
|
-
prompt: "Which backend are you using?"
|
97
|
-
choices:
|
98
|
-
- ["SQLite", sqlite]
|
99
|
-
- ["MySQL", mysql]
|
100
|
-
- ["PostgreSQL", postgres]
|
101
|
-
- ["Oracle", oracle]
|
102
|
-
- ["MSSQL", sqlserver]
|
103
|
-
- validations:
|
104
|
-
type: multiple_choice
|
105
|
-
prompt: "Which validation method do you prefer?"
|
106
|
-
choices:
|
107
|
-
- ["DataMapper Validations", dm-validations]
|
108
|
-
- ["ActiveModel Validations", active_model]
|
109
|
-
- auto_create:
|
110
|
-
type: boolean
|
111
|
-
prompt: "Automatically create database with default configuration?"
|
data/recipes/devise.rb
DELETED
@@ -1,114 +0,0 @@
|
|
1
|
-
# Application template recipe for the rails_apps_composer. Check for a newer version here:
|
2
|
-
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/devise.rb
|
3
|
-
|
4
|
-
case config['devise']
|
5
|
-
when 'no'
|
6
|
-
recipes.delete('devise')
|
7
|
-
say_wizard "Devise recipe skipped."
|
8
|
-
when 'standard'
|
9
|
-
gem 'devise', '>= 2.1.2'
|
10
|
-
when 'confirmable'
|
11
|
-
gem 'devise', '>= 2.1.2'
|
12
|
-
recipes << 'devise-confirmable'
|
13
|
-
when 'invitable'
|
14
|
-
gem 'devise', '>= 2.1.2'
|
15
|
-
gem 'devise_invitable', '>= 1.0.2'
|
16
|
-
recipes << 'devise-confirmable'
|
17
|
-
recipes << 'devise-invitable'
|
18
|
-
else
|
19
|
-
recipes.delete('devise')
|
20
|
-
say_wizard "Devise recipe skipped."
|
21
|
-
end
|
22
|
-
|
23
|
-
if config['authorization']
|
24
|
-
gem 'cancan', '>= 1.6.8'
|
25
|
-
gem 'rolify', '>= 3.1.0'
|
26
|
-
recipes << 'authorization'
|
27
|
-
end
|
28
|
-
|
29
|
-
if recipes.include? 'devise'
|
30
|
-
after_bundler do
|
31
|
-
|
32
|
-
say_wizard "Devise recipe running 'after bundler'"
|
33
|
-
|
34
|
-
# Run the Devise generator
|
35
|
-
generate 'devise:install' unless recipes.include? 'datamapper'
|
36
|
-
generate 'devise_invitable:install' if recipes.include? 'devise-invitable'
|
37
|
-
|
38
|
-
if recipes.include? 'mongo_mapper'
|
39
|
-
gem 'mm-devise'
|
40
|
-
gsub_file 'config/initializers/devise.rb', 'devise/orm/', 'devise/orm/mongo_mapper_active_model'
|
41
|
-
generate 'mongo_mapper:devise User'
|
42
|
-
elsif recipes.include? 'mongoid'
|
43
|
-
# Nothing to do (Devise changes its initializer automatically when Mongoid is detected)
|
44
|
-
# gsub_file 'config/initializers/devise.rb', 'devise/orm/active_record', 'devise/orm/mongoid'
|
45
|
-
end
|
46
|
-
|
47
|
-
# Prevent logging of password_confirmation
|
48
|
-
gsub_file 'config/application.rb', /:password/, ':password, :password_confirmation'
|
49
|
-
|
50
|
-
if recipes.include? 'cucumber'
|
51
|
-
# Cucumber wants to test GET requests not DELETE requests for destroy_user_session_path
|
52
|
-
# (see https://github.com/RailsApps/rails3-devise-rspec-cucumber/issues/3)
|
53
|
-
gsub_file 'config/initializers/devise.rb', 'config.sign_out_via = :delete', 'config.sign_out_via = Rails.env.test? ? :get : :delete'
|
54
|
-
end
|
55
|
-
|
56
|
-
if config['authorization']
|
57
|
-
inject_into_file 'app/controllers/application_controller.rb', :before => 'end' do <<-RUBY
|
58
|
-
rescue_from CanCan::AccessDenied do |exception|
|
59
|
-
redirect_to root_path, :alert => exception.message
|
60
|
-
end
|
61
|
-
RUBY
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
end
|
66
|
-
|
67
|
-
after_everything do
|
68
|
-
|
69
|
-
say_wizard "Devise recipe running 'after everything'"
|
70
|
-
|
71
|
-
if recipes.include? 'rspec'
|
72
|
-
say_wizard "Copying RSpec files from the rails3-devise-rspec-cucumber examples"
|
73
|
-
begin
|
74
|
-
# copy all the RSpec specs files from the rails3-devise-rspec-cucumber example app
|
75
|
-
remove_file 'spec/factories/users.rb'
|
76
|
-
get 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/spec/factories/users.rb', 'spec/factories/users.rb'
|
77
|
-
gsub_file 'spec/factories/users.rb', /# confirmed_at/, "confirmed_at" if recipes.include? 'devise-confirmable'
|
78
|
-
remove_file 'spec/controllers/home_controller_spec.rb'
|
79
|
-
remove_file 'spec/controllers/users_controller_spec.rb'
|
80
|
-
get 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/spec/controllers/home_controller_spec.rb', 'spec/controllers/home_controller_spec.rb'
|
81
|
-
get 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/spec/controllers/users_controller_spec.rb', 'spec/controllers/users_controller_spec.rb'
|
82
|
-
remove_file 'spec/models/user_spec.rb'
|
83
|
-
get 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/spec/models/user_spec.rb', 'spec/models/user_spec.rb'
|
84
|
-
rescue OpenURI::HTTPError
|
85
|
-
say_wizard "Unable to obtain RSpec example files from the repo"
|
86
|
-
end
|
87
|
-
remove_file 'spec/views/home/index.html.erb_spec.rb'
|
88
|
-
remove_file 'spec/views/home/index.html.haml_spec.rb'
|
89
|
-
remove_file 'spec/views/users/show.html.erb_spec.rb'
|
90
|
-
remove_file 'spec/views/users/show.html.haml_spec.rb'
|
91
|
-
remove_file 'spec/helpers/home_helper_spec.rb'
|
92
|
-
remove_file 'spec/helpers/users_helper_spec.rb'
|
93
|
-
end
|
94
|
-
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
__END__
|
99
|
-
|
100
|
-
name: Devise
|
101
|
-
description: Utilize Devise for authentication, automatically configured for your selected ORM.
|
102
|
-
author: RailsApps
|
103
|
-
|
104
|
-
category: authentication
|
105
|
-
exclusive: authentication
|
106
|
-
|
107
|
-
config:
|
108
|
-
- devise:
|
109
|
-
type: multiple_choice
|
110
|
-
prompt: Would you like to use Devise for authentication?
|
111
|
-
choices: [["No", no], ["Devise with default modules", standard], ["Devise with Confirmable module", confirmable], ["Devise with Confirmable and Invitable modules", invitable]]
|
112
|
-
- authorization:
|
113
|
-
type: boolean
|
114
|
-
prompt: Would you like to manage authorization with CanCan & Rolify?
|
data/recipes/git.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
# Application template recipe for the rails_apps_composer. Check for a newer version here:
|
2
|
-
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/git.rb
|
3
|
-
|
4
|
-
after_everything do
|
5
|
-
|
6
|
-
say_wizard "Git recipe running 'after everything'"
|
7
|
-
|
8
|
-
# Git should ignore some files
|
9
|
-
remove_file '.gitignore'
|
10
|
-
get "https://raw.github.com/RailsApps/rails3-application-templates/master/files/gitignore.txt", ".gitignore"
|
11
|
-
|
12
|
-
if recipes.include? 'omniauth'
|
13
|
-
append_file '.gitignore' do <<-TXT
|
14
|
-
|
15
|
-
# keep OmniAuth service provider secrets out of the Git repo
|
16
|
-
config/initializers/omniauth.rb
|
17
|
-
TXT
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
# Initialize new Git repo
|
22
|
-
git :init
|
23
|
-
git :add => '.'
|
24
|
-
git :commit => "-aqm 'new Rails app generated by Rails Apps Composer gem'"
|
25
|
-
# Create a git branch
|
26
|
-
git :checkout => ' -b working_branch'
|
27
|
-
git :add => '.'
|
28
|
-
git :commit => "-m 'Initial commit of working_branch'"
|
29
|
-
git :checkout => 'master'
|
30
|
-
end
|
31
|
-
|
32
|
-
__END__
|
33
|
-
|
34
|
-
name: Git
|
35
|
-
description: "Set up Git and commit the initial repository."
|
36
|
-
author: RailsApps
|
37
|
-
|
38
|
-
exclusive: scm
|
39
|
-
category: other
|
40
|
-
tags: [scm]
|
data/recipes/guard.rb
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
case config['guard']
|
2
|
-
when 'no'
|
3
|
-
recipes.delete('guard')
|
4
|
-
say_wizard "Guard recipe skipped."
|
5
|
-
when 'standard'
|
6
|
-
# do nothing
|
7
|
-
when 'LiveReload'
|
8
|
-
recipes << 'guard-LiveReload'
|
9
|
-
else
|
10
|
-
recipes.delete('guard')
|
11
|
-
say_wizard "Guard recipe skipped."
|
12
|
-
end
|
13
|
-
|
14
|
-
|
15
|
-
if recipes.include? 'guard'
|
16
|
-
gem 'guard', '>= 0.6.2', :group => :development
|
17
|
-
|
18
|
-
prepend_file 'Gemfile' do <<-RUBY
|
19
|
-
require 'rbconfig'
|
20
|
-
HOST_OS = RbConfig::CONFIG['host_os']
|
21
|
-
|
22
|
-
RUBY
|
23
|
-
end
|
24
|
-
|
25
|
-
append_file 'Gemfile' do <<-RUBY
|
26
|
-
# need newline here!
|
27
|
-
case HOST_OS
|
28
|
-
when /darwin/i
|
29
|
-
gem 'rb-fsevent', :group => :development
|
30
|
-
gem 'growl', :group => :development
|
31
|
-
when /linux/i
|
32
|
-
gem 'libnotify', :group => :development
|
33
|
-
gem 'rb-inotify', :group => :development
|
34
|
-
when /mswin|windows/i
|
35
|
-
gem 'rb-fchange', :group => :development
|
36
|
-
gem 'win32console', :group => :development
|
37
|
-
gem 'rb-notifu', :group => :development
|
38
|
-
end
|
39
|
-
RUBY
|
40
|
-
end
|
41
|
-
|
42
|
-
def guard(name, version = nil)
|
43
|
-
args = []
|
44
|
-
if version
|
45
|
-
args << version
|
46
|
-
end
|
47
|
-
args << { :group => :development }
|
48
|
-
gem "guard-#{name}", *args
|
49
|
-
end
|
50
|
-
|
51
|
-
guard 'bundler', '>= 0.1.3'
|
52
|
-
|
53
|
-
guard 'rails', '>= 0.0.3'
|
54
|
-
|
55
|
-
if recipes.include? 'guard-LiveReload'
|
56
|
-
guard 'livereload', '>= 0.3.0'
|
57
|
-
end
|
58
|
-
|
59
|
-
if recipes.include? 'rspec'
|
60
|
-
guard 'rspec', '>= 0.4.3'
|
61
|
-
end
|
62
|
-
|
63
|
-
if recipes.include? 'cucumber'
|
64
|
-
guard 'cucumber', '>= 0.6.1'
|
65
|
-
end
|
66
|
-
|
67
|
-
after_bundler do
|
68
|
-
run 'guard init'
|
69
|
-
end
|
70
|
-
|
71
|
-
else
|
72
|
-
recipes.delete 'guard'
|
73
|
-
end
|
74
|
-
|
75
|
-
__END__
|
76
|
-
|
77
|
-
name: guard
|
78
|
-
description: "Automate your workflow with Guard"
|
79
|
-
author: ashley_woodard
|
80
|
-
|
81
|
-
run_after: [rspec, cucumber]
|
82
|
-
category: other
|
83
|
-
tags: [dev]
|
84
|
-
|
85
|
-
config:
|
86
|
-
- guard:
|
87
|
-
type: multiple_choice
|
88
|
-
prompt: Would you like to use Guard to automate your workflow?
|
89
|
-
choices: [["No", no], ["Guard default configuration", standard], ["Guard with LiveReload", LiveReload]]
|
data/recipes/haml.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# Application template recipe for the rails_apps_composer. Check for a newer version here:
|
2
|
-
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/haml.rb
|
3
|
-
|
4
|
-
if config['haml']
|
5
|
-
gem 'haml', '>= 3.1.6'
|
6
|
-
gem 'haml-rails', '>= 0.3.4', :group => :development
|
7
|
-
else
|
8
|
-
recipes.delete('haml')
|
9
|
-
end
|
10
|
-
|
11
|
-
__END__
|
12
|
-
|
13
|
-
name: HAML
|
14
|
-
description: "Utilize Haml instead of ERB."
|
15
|
-
author: RailsApps
|
16
|
-
|
17
|
-
category: templating
|
18
|
-
exclusive: templating
|
19
|
-
|
20
|
-
config:
|
21
|
-
- haml:
|
22
|
-
type: boolean
|
23
|
-
prompt: Would you like to use Haml instead of ERB?
|
data/recipes/heroku.rb
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
heroku_name = app_name.gsub('_','')
|
2
|
-
|
3
|
-
gem 'heroku', group: :development
|
4
|
-
|
5
|
-
after_everything do
|
6
|
-
if config['create']
|
7
|
-
say_wizard "Creating Heroku app '#{heroku_name}.heroku.com'"
|
8
|
-
# system "heroku apps:destroy --app #{heroku_name} --confirm #{heroku_name}"
|
9
|
-
|
10
|
-
while !system("heroku create #{heroku_name}")
|
11
|
-
heroku_name = ask_wizard("What do you want to call your app? ")
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
if config['staging']
|
16
|
-
staging_name = "#{heroku_name}-staging"
|
17
|
-
say_wizard "Creating staging Heroku app '#{staging_name}.heroku.com'"
|
18
|
-
while !system("heroku create #{staging_name}")
|
19
|
-
staging_name = ask_wizard("What do you want to call your staging app?")
|
20
|
-
end
|
21
|
-
git :remote => "rm heroku"
|
22
|
-
git :remote => "add production git@heroku.com:#{heroku_name}.git"
|
23
|
-
git :remote => "add staging git@heroku.com:#{staging_name}.git"
|
24
|
-
say_wizard "Created branches 'production' and 'staging' for Heroku deploy."
|
25
|
-
end
|
26
|
-
|
27
|
-
unless config['domain'].blank?
|
28
|
-
run "heroku domains:add #{config['domain']} --remote #{config['staging'] ? 'production' : 'heroku'}"
|
29
|
-
end
|
30
|
-
|
31
|
-
git :push => "#{config['staging'] ? 'staging' : 'heroku'} master" if config['deploy']
|
32
|
-
end
|
33
|
-
|
34
|
-
__END__
|
35
|
-
|
36
|
-
name: Heroku
|
37
|
-
description: Create Heroku application and instantly deploy.
|
38
|
-
author: mbleigh
|
39
|
-
|
40
|
-
requires: [git]
|
41
|
-
run_after: [git]
|
42
|
-
exclusive: deployment
|
43
|
-
category: deployment
|
44
|
-
tags: [provider]
|
45
|
-
|
46
|
-
config:
|
47
|
-
- create:
|
48
|
-
prompt: "Automatically create appname.heroku.com?"
|
49
|
-
type: boolean
|
50
|
-
- staging:
|
51
|
-
prompt: "Create staging app? (appname-staging.heroku.com)"
|
52
|
-
type: boolean
|
53
|
-
if: create
|
54
|
-
- domain:
|
55
|
-
prompt: "Specify custom domain (or leave blank):"
|
56
|
-
type: string
|
57
|
-
if: create
|
58
|
-
- deploy:
|
59
|
-
prompt: "Deploy immediately?"
|
60
|
-
type: boolean
|
61
|
-
if: create
|
data/recipes/home_page.rb
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
# Application template recipe for the rails_apps_composer. Check for a newer version here:
|
2
|
-
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/home_page.rb
|
3
|
-
|
4
|
-
after_bundler do
|
5
|
-
|
6
|
-
say_wizard "HomePage recipe running 'after bundler'"
|
7
|
-
|
8
|
-
# remove the default home page
|
9
|
-
remove_file 'public/index.html'
|
10
|
-
|
11
|
-
# create a home controller and view
|
12
|
-
generate(:controller, "home index")
|
13
|
-
|
14
|
-
# set up a simple home page (with placeholder content)
|
15
|
-
if recipes.include? 'haml'
|
16
|
-
remove_file 'app/views/home/index.html.haml'
|
17
|
-
# There is Haml code in this script. Changing the indentation is perilous between HAMLs.
|
18
|
-
# We have to use single-quote-style-heredoc to avoid interpolation.
|
19
|
-
create_file 'app/views/home/index.html.haml' do
|
20
|
-
<<-'HAML'
|
21
|
-
%h3 Home
|
22
|
-
HAML
|
23
|
-
end
|
24
|
-
elsif recipes.include? 'slim'
|
25
|
-
# skip
|
26
|
-
else
|
27
|
-
remove_file 'app/views/home/index.html.erb'
|
28
|
-
create_file 'app/views/home/index.html.erb' do
|
29
|
-
<<-ERB
|
30
|
-
<h3>Home</h3>
|
31
|
-
ERB
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
# set routes
|
36
|
-
gsub_file 'config/routes.rb', /get \"home\/index\"/, 'root :to => "home#index"'
|
37
|
-
|
38
|
-
if recipes.include? 'devise'
|
39
|
-
inject_into_file 'config/routes.rb', :before => " root :to" do
|
40
|
-
<<-RUBY
|
41
|
-
authenticated :user do
|
42
|
-
root :to => 'home#index'
|
43
|
-
end
|
44
|
-
\n
|
45
|
-
RUBY
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
__END__
|
52
|
-
|
53
|
-
name: HomePage
|
54
|
-
description: "Create a simple home page (creates a home controller and view)."
|
55
|
-
author: RailsApps
|
56
|
-
|
57
|
-
category: other
|
58
|
-
tags: [utilities, configuration]
|
data/recipes/home_page_users.rb
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
# Application template recipe for the rails_apps_composer. Check for a newer version here:
|
2
|
-
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/home_page_users.rb
|
3
|
-
|
4
|
-
after_bundler do
|
5
|
-
|
6
|
-
say_wizard "HomePageUsers recipe running 'after bundler'"
|
7
|
-
|
8
|
-
# Modify the home controller
|
9
|
-
gsub_file 'app/controllers/home_controller.rb', /def index/ do
|
10
|
-
<<-RUBY
|
11
|
-
def index
|
12
|
-
@users = User.all
|
13
|
-
RUBY
|
14
|
-
end
|
15
|
-
|
16
|
-
# Replace the home page
|
17
|
-
if recipes.include? 'haml'
|
18
|
-
remove_file 'app/views/home/index.html.haml'
|
19
|
-
# There is Haml code in this script. Changing the indentation is perilous between HAMLs.
|
20
|
-
# We have to use single-quote-style-heredoc to avoid interpolation.
|
21
|
-
create_file 'app/views/home/index.html.haml' do
|
22
|
-
<<-'HAML'
|
23
|
-
%h3 Home
|
24
|
-
- @users.each do |user|
|
25
|
-
%p User: #{user.name}
|
26
|
-
HAML
|
27
|
-
end
|
28
|
-
else
|
29
|
-
append_file 'app/views/home/index.html.erb' do <<-ERB
|
30
|
-
<h3>Home</h3>
|
31
|
-
<% @users.each do |user| %>
|
32
|
-
<p>User: <%= user.name %></p>
|
33
|
-
<% end %>
|
34
|
-
ERB
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
__END__
|
41
|
-
|
42
|
-
name: HomePageUsers
|
43
|
-
description: "Display a list of users on the home page."
|
44
|
-
author: RailsApps
|
45
|
-
|
46
|
-
category: other
|
47
|
-
tags: [utilities, configuration]
|