redmint_composer 2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.textile +10 -0
- data/bin/redmint_composer +7 -0
- data/lib/rails_wizard.rb +7 -0
- data/lib/rails_wizard/command.rb +204 -0
- data/lib/rails_wizard/config.rb +88 -0
- data/lib/rails_wizard/diagnostics.rb +58 -0
- data/lib/rails_wizard/recipe.rb +114 -0
- data/lib/rails_wizard/recipes.rb +56 -0
- data/lib/rails_wizard/template.rb +111 -0
- data/recipes/admin.rb +42 -0
- data/recipes/analytics.rb +41 -0
- data/recipes/core.rb +32 -0
- data/recipes/deployment.rb +178 -0
- data/recipes/devise.rb +34 -0
- data/recipes/email.rb +65 -0
- data/recipes/email_dev.rb +92 -0
- data/recipes/example.rb +63 -0
- data/recipes/extras.rb +283 -0
- data/recipes/frontend.rb +33 -0
- data/recipes/gems.rb +274 -0
- data/recipes/git.rb +27 -0
- data/recipes/init.rb +179 -0
- data/recipes/learn_rails.rb +89 -0
- data/recipes/locale.rb +31 -0
- data/recipes/omniauth.rb +38 -0
- data/recipes/pages.rb +91 -0
- data/recipes/rails_bootstrap.rb +29 -0
- data/recipes/rails_devise.rb +26 -0
- data/recipes/rails_devise_pundit.rb +25 -0
- data/recipes/rails_devise_roles.rb +25 -0
- data/recipes/rails_foundation.rb +29 -0
- data/recipes/rails_mailinglist_activejob.rb +76 -0
- data/recipes/rails_omniauth.rb +27 -0
- data/recipes/rails_signup_download.rb +69 -0
- data/recipes/rails_stripe_checkout.rb +84 -0
- data/recipes/rails_stripe_coupons.rb +125 -0
- data/recipes/rails_stripe_membership_saas.rb +112 -0
- data/recipes/railsapps.rb +77 -0
- data/recipes/readme.rb +161 -0
- data/recipes/roles.rb +40 -0
- data/recipes/setup.rb +162 -0
- data/recipes/tests.rb +59 -0
- data/spec/rails_wizard/config_spec.rb +108 -0
- data/spec/rails_wizard/recipe_spec.rb +115 -0
- data/spec/rails_wizard/recipes/sanity_spec.rb +30 -0
- data/spec/rails_wizard/recipes_spec.rb +41 -0
- data/spec/rails_wizard/template_spec.rb +92 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/support/rails_directory.rb +17 -0
- data/spec/support/template_runner.rb +28 -0
- data/spec/test_recipes/test_recipe_in_file.rb +9 -0
- data/templates/helpers.erb +138 -0
- data/templates/layout.erb +231 -0
- data/templates/recipe.erb +13 -0
- data/version.rb +3 -0
- metadata +201 -0
data/recipes/devise.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# Application template recipe for the rails_apps_composer. Change the recipe here:
|
2
|
+
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/devise.rb
|
3
|
+
|
4
|
+
stage_two do
|
5
|
+
say_wizard "recipe stage two"
|
6
|
+
if prefer :authentication, 'devise'
|
7
|
+
# prevent logging of password_confirmation
|
8
|
+
gsub_file 'config/initializers/filter_parameter_logging.rb', /:password/, ':password, :password_confirmation'
|
9
|
+
generate 'devise:install'
|
10
|
+
generate 'devise_invitable:install' if prefer :devise_modules, 'invitable'
|
11
|
+
generate 'devise user' # create the User model
|
12
|
+
unless :apps4.to_s.include? 'rails-stripe-'
|
13
|
+
generate 'migration AddNameToUsers name:string'
|
14
|
+
end
|
15
|
+
if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')
|
16
|
+
gsub_file 'app/models/user.rb', /:registerable,/, ":registerable, :confirmable,"
|
17
|
+
generate 'migration AddConfirmableToUsers confirmation_token:string confirmed_at:datetime confirmation_sent_at:datetime unconfirmed_email:string'
|
18
|
+
end
|
19
|
+
run 'bundle exec rake db:migrate'
|
20
|
+
end
|
21
|
+
### GIT ###
|
22
|
+
git :add => '-A' if prefer :git, true
|
23
|
+
git :commit => '-qm "redmint_composer: devise"' if prefer :git, true
|
24
|
+
end
|
25
|
+
|
26
|
+
__END__
|
27
|
+
|
28
|
+
name: devise
|
29
|
+
description: "Add Devise for authentication"
|
30
|
+
author: RailsApps
|
31
|
+
|
32
|
+
requires: [setup, gems]
|
33
|
+
run_after: [setup, gems]
|
34
|
+
category: mvc
|
data/recipes/email.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# Application template recipe for the rails_apps_composer. Change the recipe here:
|
2
|
+
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/email.rb
|
3
|
+
|
4
|
+
stage_two do
|
5
|
+
say_wizard "recipe stage two"
|
6
|
+
unless prefer :email, 'none'
|
7
|
+
## ACTIONMAILER CONFIG
|
8
|
+
dev_email_text = <<-TEXT
|
9
|
+
# ActionMailer Config
|
10
|
+
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
|
11
|
+
config.action_mailer.delivery_method = :letter_opener
|
12
|
+
config.action_mailer.raise_delivery_errors = true
|
13
|
+
# Send email in development mode?
|
14
|
+
config.action_mailer.perform_deliveries = true
|
15
|
+
TEXT
|
16
|
+
prod_email_text = <<-TEXT
|
17
|
+
# ActionMailer Config
|
18
|
+
config.action_mailer.default_url_options = { :host => 'redmintlabs.com' }
|
19
|
+
config.action_mailer.delivery_method = :smtp
|
20
|
+
config.action_mailer.perform_deliveries = true
|
21
|
+
config.action_mailer.raise_delivery_errors = false
|
22
|
+
TEXT
|
23
|
+
inject_into_file 'config/environments/development.rb', dev_email_text, :after => "config.assets.debug = true"
|
24
|
+
inject_into_file 'config/environments/production.rb', prod_email_text, :after => "config.active_support.deprecation = :notify"
|
25
|
+
gsub_file 'config/environments/production.rb', /'redmintlabs.com'/, 'Rails.application.secrets.domain_name'
|
26
|
+
## SMTP_SETTINGS
|
27
|
+
email_configuration_text = <<-TEXT
|
28
|
+
\n
|
29
|
+
config.action_mailer.smtp_settings = {
|
30
|
+
address: "smtp.gmail.com",
|
31
|
+
port: 587,
|
32
|
+
domain: Rails.application.secrets.domain_name,
|
33
|
+
authentication: "plain",
|
34
|
+
enable_starttls_auto: true,
|
35
|
+
user_name: Rails.application.secrets.email_provider_username,
|
36
|
+
password: Rails.application.secrets.email_provider_password
|
37
|
+
}
|
38
|
+
TEXT
|
39
|
+
inject_into_file 'config/environments/development.rb', email_configuration_text, :after => "config.assets.debug = true"
|
40
|
+
inject_into_file 'config/environments/production.rb', email_configuration_text, :after => "config.active_support.deprecation = :notify"
|
41
|
+
case prefs[:email]
|
42
|
+
when 'sendgrid'
|
43
|
+
gsub_file 'config/environments/development.rb', /smtp.gmail.com/, 'smtp.sendgrid.net'
|
44
|
+
gsub_file 'config/environments/production.rb', /smtp.gmail.com/, 'smtp.sendgrid.net'
|
45
|
+
when 'mandrill'
|
46
|
+
gsub_file 'config/environments/development.rb', /smtp.gmail.com/, 'smtp.mandrillapp.com'
|
47
|
+
gsub_file 'config/environments/production.rb', /smtp.gmail.com/, 'smtp.mandrillapp.com'
|
48
|
+
gsub_file 'config/environments/development.rb', /email_provider_password/, 'email_provider_apikey'
|
49
|
+
gsub_file 'config/environments/production.rb', /email_provider_password/, 'email_provider_apikey'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
### GIT
|
53
|
+
git :add => '-A' if prefer :git, true
|
54
|
+
git :commit => '-qm "redmint_composer: set email accounts"' if prefer :git, true
|
55
|
+
end
|
56
|
+
|
57
|
+
__END__
|
58
|
+
|
59
|
+
name: email
|
60
|
+
description: "Configure email accounts."
|
61
|
+
author: RailsApps
|
62
|
+
|
63
|
+
requires: [setup]
|
64
|
+
run_after: [setup]
|
65
|
+
category: configuration
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# Application template recipe for the rails_apps_composer. Change the recipe here:
|
2
|
+
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/email_dev.rb
|
3
|
+
|
4
|
+
prefs[:mailcatcher] = true if config['mailcatcher']
|
5
|
+
prefs[:mail_view] = true if config['mail_view']
|
6
|
+
|
7
|
+
if prefs[:mailcatcher]
|
8
|
+
add_gem 'mailcatcher', group: :development
|
9
|
+
end
|
10
|
+
add_gem 'mail_view', group: :development if prefs[:mail_view]
|
11
|
+
|
12
|
+
stage_two do
|
13
|
+
say_wizard "recipe stage two"
|
14
|
+
if prefs[:mailcatcher]
|
15
|
+
say_wizard "recipe installing mailcatcher"
|
16
|
+
create_file 'config/initializers/mailcatcher.rb' do <<-RUBY
|
17
|
+
# Detect if mailcatcher is running and use that if available
|
18
|
+
if Rails.env.development?
|
19
|
+
begin
|
20
|
+
sock = TCPSocket.new("localhost", 1025)
|
21
|
+
sock.close
|
22
|
+
catcher = true
|
23
|
+
rescue
|
24
|
+
catcher = false
|
25
|
+
end
|
26
|
+
|
27
|
+
if catcher
|
28
|
+
ActionMailer::Base.smtp_settings = { :host => "localhost", :port => '1025', }
|
29
|
+
ActionMailer::Base.perform_deliveries = true
|
30
|
+
end
|
31
|
+
end
|
32
|
+
RUBY
|
33
|
+
end
|
34
|
+
if prefer(:local_env_file, 'foreman') && File.exists?('Procfile.dev')
|
35
|
+
append_file 'Procfile.dev', "mail: mailcatcher --foreground\n"
|
36
|
+
end
|
37
|
+
### GIT
|
38
|
+
git :add => '-A' if prefer :git, true
|
39
|
+
git :commit => '-qm "redmint_composer: set up mailcatcher for development"' if prefer :git, true
|
40
|
+
end
|
41
|
+
if prefs[:mail_view]
|
42
|
+
say_wizard "recipe installing mail_view"
|
43
|
+
create_file 'app/mailers/mail_preview.rb' do <<-RUBY
|
44
|
+
class MailPreview < MailView
|
45
|
+
# Pull data from existing fixtures
|
46
|
+
#def invitation
|
47
|
+
# account = Account.first
|
48
|
+
# inviter, invitee = account.users[0, 2]
|
49
|
+
# Notifier.invitation(inviter, invitee)
|
50
|
+
#end
|
51
|
+
|
52
|
+
# Factory-like pattern
|
53
|
+
#def welcome
|
54
|
+
# user = User.create!
|
55
|
+
# mail = Notifier.welcome(user)
|
56
|
+
# user.destroy
|
57
|
+
# mail
|
58
|
+
#end
|
59
|
+
|
60
|
+
# Stub-like
|
61
|
+
#def forgot_password
|
62
|
+
# user = Struct.new(:email, :name).new('name@example.com', 'Jill Smith')
|
63
|
+
# mail = UserMailer.forgot_password(user)
|
64
|
+
#end
|
65
|
+
end
|
66
|
+
RUBY
|
67
|
+
end
|
68
|
+
inject_into_file 'config/routes.rb', "mount MailPreview => 'mail_view' if Rails.env.development?", :before => "end"
|
69
|
+
### GIT
|
70
|
+
git :add => '-A' if prefer :git, true
|
71
|
+
git :commit => '-qm "redmint_composer: set up mail_view for development"' if prefer :git, true
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
__END__
|
76
|
+
|
77
|
+
name: email_dev
|
78
|
+
description: "Add gems to help develop and debug emails locally sent by your app."
|
79
|
+
author: JangoSteve
|
80
|
+
|
81
|
+
category: development
|
82
|
+
requires: [setup]
|
83
|
+
run_after: [email, extras]
|
84
|
+
args: -T
|
85
|
+
|
86
|
+
config:
|
87
|
+
- mailcatcher:
|
88
|
+
type: boolean
|
89
|
+
prompt: Use Mailcatcher to catch sent emails in development and display in web interface?
|
90
|
+
- mail_view:
|
91
|
+
type: boolean
|
92
|
+
prompt: Add MailView routes to preview email layouts in development?
|
data/recipes/example.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# Application template recipe for the rails_apps_composer. Change the recipe here:
|
2
|
+
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/example.rb
|
3
|
+
|
4
|
+
before_config do
|
5
|
+
# Code here is run before any configuration prompts.
|
6
|
+
say_wizard "recipe running before configuration"
|
7
|
+
end
|
8
|
+
|
9
|
+
if config['space_test']
|
10
|
+
say_wizard "running a space test"
|
11
|
+
test_count = config['test_count']
|
12
|
+
say_wizard "will run the test #{test_count} times"
|
13
|
+
say_wizard "will run the test in #{config['orbit']} orbit"
|
14
|
+
unless config['mars_test']
|
15
|
+
say_wizard "Mars test not available"
|
16
|
+
end
|
17
|
+
# the @config@ hash is only available to the recipe
|
18
|
+
# the @prefs{}@ hash is available to all the recipes
|
19
|
+
prefs[:test_orbit] = config['orbit']
|
20
|
+
end
|
21
|
+
|
22
|
+
stage_two do
|
23
|
+
# Code here is run after Bundler installs all the gems for the project.
|
24
|
+
# Use this section to run generators and rake tasks.
|
25
|
+
# Download any files from a repository for models, controllers, views, and routes.
|
26
|
+
say_wizard "recipe stage two"
|
27
|
+
end
|
28
|
+
|
29
|
+
stage_three do
|
30
|
+
# This block is run after the 'stage_two' block.
|
31
|
+
# Use this section to finalize the application.
|
32
|
+
# Run database migrations or make a final git commit.
|
33
|
+
say_wizard "recipe stage three"
|
34
|
+
end
|
35
|
+
|
36
|
+
# A recipe has two parts: the Ruby code and YAML matter that comes after a blank line with the __END__ keyword.
|
37
|
+
|
38
|
+
__END__
|
39
|
+
|
40
|
+
name: example
|
41
|
+
description: "Example of a recipe."
|
42
|
+
author: githubname
|
43
|
+
|
44
|
+
category: example
|
45
|
+
|
46
|
+
config:
|
47
|
+
- space_test:
|
48
|
+
type: boolean
|
49
|
+
prompt: Do you want to test your application in space?
|
50
|
+
- mars_test:
|
51
|
+
type: boolean
|
52
|
+
prompt: Do you also want to test your application on Mars?
|
53
|
+
if: space_test
|
54
|
+
if_recipe: mars_lander
|
55
|
+
- test_count:
|
56
|
+
type: string
|
57
|
+
prompt: How many times would you like to repeat the test?
|
58
|
+
if: space_test
|
59
|
+
- orbit:
|
60
|
+
type: multiple_choice
|
61
|
+
prompt: "What orbit do you want?"
|
62
|
+
choices: [ [Low Earth orbit, leo], [Sun-synchronous, spy], [Geostationary, gps] ]
|
63
|
+
if: space_test
|
data/recipes/extras.rb
ADDED
@@ -0,0 +1,283 @@
|
|
1
|
+
# Application template recipe for the rails_apps_composer. Change the recipe here:
|
2
|
+
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/extras.rb
|
3
|
+
|
4
|
+
## RVMRC
|
5
|
+
rvmrc_detected = false
|
6
|
+
if File.exist?('.rvmrc')
|
7
|
+
rvmrc_file = File.read('.rvmrc')
|
8
|
+
rvmrc_detected = rvmrc_file.include? app_name
|
9
|
+
end
|
10
|
+
if File.exist?('.ruby-gemset')
|
11
|
+
rvmrc_file = File.read('.ruby-gemset')
|
12
|
+
rvmrc_detected = rvmrc_file.include? app_name
|
13
|
+
end
|
14
|
+
unless rvmrc_detected || (prefs.has_key? :rvmrc)
|
15
|
+
prefs[:rvmrc] = yes_wizard? "Use or create a project-specific rvm gemset?"
|
16
|
+
end
|
17
|
+
if prefs[:rvmrc]
|
18
|
+
if which("rvm")
|
19
|
+
say_wizard "recipe creating project-specific rvm gemset and .rvmrc"
|
20
|
+
# using the rvm Ruby API, see:
|
21
|
+
# http://blog.thefrontiergroup.com.au/2010/12/a-brief-introduction-to-the-rvm-ruby-api/
|
22
|
+
# https://rvm.io/integration/passenger
|
23
|
+
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
|
24
|
+
begin
|
25
|
+
gems_path = ENV['MY_RUBY_HOME'].split(/@/)[0].sub(/rubies/,'gems')
|
26
|
+
ENV['GEM_PATH'] = "#{gems_path}:#{gems_path}@global"
|
27
|
+
require 'rvm'
|
28
|
+
RVM.use_from_path! File.dirname(File.dirname(__FILE__))
|
29
|
+
rescue LoadError
|
30
|
+
raise "RVM gem is currently unavailable."
|
31
|
+
end
|
32
|
+
end
|
33
|
+
say_wizard "creating RVM gemset '#{app_name}'"
|
34
|
+
RVM.gemset_create app_name
|
35
|
+
say_wizard "switching to gemset '#{app_name}'"
|
36
|
+
# RVM.gemset_use! requires rvm version 1.11.3.5 or newer
|
37
|
+
rvm_spec =
|
38
|
+
if Gem::Specification.respond_to?(:find_by_name)
|
39
|
+
Gem::Specification.find_by_name("rvm")
|
40
|
+
else
|
41
|
+
Gem.source_index.find_name("rvm").last
|
42
|
+
end
|
43
|
+
unless rvm_spec.version > Gem::Version.create('1.11.3.4')
|
44
|
+
say_wizard "rvm gem version: #{rvm_spec.version}"
|
45
|
+
raise "Please update rvm gem to 1.11.3.5 or newer"
|
46
|
+
end
|
47
|
+
begin
|
48
|
+
RVM.gemset_use! app_name
|
49
|
+
rescue => e
|
50
|
+
say_wizard "rvm failure: unable to use gemset #{app_name}, reason: #{e}"
|
51
|
+
raise
|
52
|
+
end
|
53
|
+
if File.exist?('.ruby-version')
|
54
|
+
say_wizard ".ruby-version file already exists"
|
55
|
+
else
|
56
|
+
create_file '.ruby-version', "#{RUBY_VERSION}\n"
|
57
|
+
end
|
58
|
+
if File.exist?('.ruby-gemset')
|
59
|
+
say_wizard ".ruby-gemset file already exists"
|
60
|
+
else
|
61
|
+
create_file '.ruby-gemset', "#{app_name}\n"
|
62
|
+
end
|
63
|
+
else
|
64
|
+
say_wizard "WARNING! RVM does not appear to be available."
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
## QUIET ASSETS
|
69
|
+
prefs[:quiet_assets] = true if config['quiet_assets']
|
70
|
+
if prefs[:quiet_assets]
|
71
|
+
say_wizard "recipe setting quiet_assets for reduced asset pipeline logging"
|
72
|
+
add_gem 'quiet_assets', :group => :development
|
73
|
+
end
|
74
|
+
|
75
|
+
## LOCAL_ENV.YML FILE
|
76
|
+
prefs[:local_env_file] = config['local_env_file'] unless config['local_env_file'] = 'none'
|
77
|
+
|
78
|
+
if prefer :local_env_file, 'figaro'
|
79
|
+
say_wizard "recipe creating application.yml file for environment variables with figaro"
|
80
|
+
add_gem 'figaro', '>= 1.0.0.rc1'
|
81
|
+
elsif prefer :local_env_file, 'foreman'
|
82
|
+
say_wizard "recipe creating .env file for development environment variables with foreman"
|
83
|
+
add_gem 'foreman', :group => :development
|
84
|
+
end
|
85
|
+
|
86
|
+
## BETTER ERRORS
|
87
|
+
prefs[:better_errors] = true if config['better_errors']
|
88
|
+
if prefs[:better_errors]
|
89
|
+
say_wizard "recipe adding better_errors gem"
|
90
|
+
add_gem 'better_errors', :group => :development
|
91
|
+
if RUBY_ENGINE == 'ruby'
|
92
|
+
case RUBY_VERSION.split('.')[0] + "." + RUBY_VERSION.split('.')[1]
|
93
|
+
when '2.1'
|
94
|
+
add_gem 'binding_of_caller', :group => :development, :platforms => [:mri_21]
|
95
|
+
when '2.0'
|
96
|
+
add_gem 'binding_of_caller', :group => :development, :platforms => [:mri_20]
|
97
|
+
when '1.9'
|
98
|
+
add_gem 'binding_of_caller', :group => :development, :platforms => [:mri_19]
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
# Pry
|
104
|
+
prefs[:pry] = true if config['pry']
|
105
|
+
if prefs[:pry]
|
106
|
+
say_wizard "recipe adding pry-rails gem"
|
107
|
+
add_gem 'pry-rails', :group => [:development, :test]
|
108
|
+
add_gem 'pry-rescue', :group => [:development, :test]
|
109
|
+
add_gem 'pry'
|
110
|
+
add_gem 'pry-byebug'
|
111
|
+
add_gem 'pry-remote'
|
112
|
+
add_gem 'pry-stack_explorer'
|
113
|
+
end
|
114
|
+
|
115
|
+
## Rubocop
|
116
|
+
prefs[:rubocop] = true if config['rubocop']
|
117
|
+
if prefs[:rubocop]
|
118
|
+
say_wizard "recipe adding rubocop gem and basic .rubocop.yml"
|
119
|
+
add_gem 'rubocop', :group => [:development, :test]
|
120
|
+
copy_from_repo '.rubocop.yml'
|
121
|
+
end
|
122
|
+
|
123
|
+
## Disable Turbolinks
|
124
|
+
if config['disable_turbolinks']
|
125
|
+
prefs[:disable_turbolinks] = true
|
126
|
+
end
|
127
|
+
if prefs[:disable_turbolinks]
|
128
|
+
say_wizard "recipe removing support for Rails Turbolinks"
|
129
|
+
stage_two do
|
130
|
+
say_wizard "recipe stage two"
|
131
|
+
gsub_file 'Gemfile', /gem 'turbolinks'\n/, ''
|
132
|
+
gsub_file 'app/assets/javascripts/application.js', "//= require turbolinks\n", ''
|
133
|
+
case prefs[:templates]
|
134
|
+
when 'erb'
|
135
|
+
gsub_file 'app/views/layouts/application.html.erb', /, 'data-turbolinks-track' => true/, ''
|
136
|
+
when 'haml'
|
137
|
+
gsub_file 'app/views/layouts/application.html.haml', /, 'data-turbolinks-track' => true/, ''
|
138
|
+
when 'slim'
|
139
|
+
gsub_file 'app/views/layouts/application.html.slim', /, 'data-turbolinks-track' => true/, ''
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
## BAN SPIDERS
|
145
|
+
prefs[:ban_spiders] = true if config['ban_spiders']
|
146
|
+
if prefs[:ban_spiders]
|
147
|
+
say_wizard "recipe banning spiders by modifying 'public/robots.txt'"
|
148
|
+
stage_two do
|
149
|
+
say_wizard "recipe stage two"
|
150
|
+
gsub_file 'public/robots.txt', /# User-Agent/, 'User-Agent'
|
151
|
+
gsub_file 'public/robots.txt', /# Disallow/, 'Disallow'
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
## JSRUNTIME
|
156
|
+
case RbConfig::CONFIG['host_os']
|
157
|
+
when /linux/i
|
158
|
+
prefs[:jsruntime] = yes_wizard? "Add 'therubyracer' JavaScript runtime (for Linux users without node.js)?" unless prefs.has_key? :jsruntime
|
159
|
+
if prefs[:jsruntime]
|
160
|
+
say_wizard "recipe adding 'therubyracer' JavaScript runtime gem"
|
161
|
+
add_gem 'therubyracer', :platform => :ruby
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
stage_four do
|
166
|
+
say_wizard "recipe stage four"
|
167
|
+
say_wizard "recipe removing unnecessary files and whitespace"
|
168
|
+
%w{
|
169
|
+
public/index.html
|
170
|
+
app/assets/images/rails.png
|
171
|
+
}.each { |file| remove_file file }
|
172
|
+
# remove temporary Haml gems from Gemfile when Slim is selected
|
173
|
+
if prefer :templates, 'slim'
|
174
|
+
gsub_file 'Gemfile', /.*gem 'haml2slim'\n/, "\n"
|
175
|
+
gsub_file 'Gemfile', /.*gem 'html2haml'\n/, "\n"
|
176
|
+
end
|
177
|
+
# remove gems and files used to assist redmint_composer
|
178
|
+
gsub_file 'Gemfile', /.*gem 'rails_apps_pages'\n/, ''
|
179
|
+
gsub_file 'Gemfile', /.*gem 'rails_apps_testing'\n/, ''
|
180
|
+
remove_file 'config/railscomposer.yml'
|
181
|
+
# remove commented lines and multiple blank lines from Gemfile
|
182
|
+
# thanks to https://github.com/perfectline/template-bucket/blob/master/cleanup.rb
|
183
|
+
gsub_file 'Gemfile', /#.*\n/, "\n"
|
184
|
+
gsub_file 'Gemfile', /\n^\s*\n/, "\n"
|
185
|
+
remove_file 'Gemfile.lock'
|
186
|
+
run 'bundle install --without production'
|
187
|
+
# remove commented lines and multiple blank lines from config/routes.rb
|
188
|
+
gsub_file 'config/routes.rb', / #.*\n/, "\n"
|
189
|
+
gsub_file 'config/routes.rb', /\n^\s*\n/, "\n"
|
190
|
+
# GIT
|
191
|
+
git :add => '-A' if prefer :git, true
|
192
|
+
git :commit => '-qm "redmint_composer: extras"' if prefer :git, true
|
193
|
+
end
|
194
|
+
|
195
|
+
## GITHUB
|
196
|
+
prefs[:github] = true if config['github']
|
197
|
+
if prefs[:github]
|
198
|
+
add_gem 'hub', :require => nil, :group => [:development]
|
199
|
+
stage_three do
|
200
|
+
say_wizard "recipe stage three"
|
201
|
+
say_wizard "recipe creating GitHub repository"
|
202
|
+
git_uri = `git config remote.origin.url`.strip
|
203
|
+
unless git_uri.size == 0
|
204
|
+
say_wizard "Repository already exists:"
|
205
|
+
say_wizard "#{git_uri}"
|
206
|
+
else
|
207
|
+
run "hub create #{app_name}"
|
208
|
+
run "hub push -u origin master"
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
## REDMINT DEFAULT GEMS
|
214
|
+
prefs[:redmint_gems] = true if config['redmint_gems']
|
215
|
+
if prefs[:redmint_gems]
|
216
|
+
say_wizard "recipe adding default redmint gems"
|
217
|
+
add_gem 'zeus'
|
218
|
+
add_gem 'awesome_print'
|
219
|
+
add_gem 'yaml_db'
|
220
|
+
add_gem 'kaminari'
|
221
|
+
add_gem 'ransack'
|
222
|
+
add_gem 'redis'
|
223
|
+
add_gem 'draper'
|
224
|
+
add_gem "i18n-js", ">= 3.0.0.rc8"
|
225
|
+
add_gem 'mini_magick'
|
226
|
+
add_gem 'carrierwave'
|
227
|
+
add_gem 'carrierwave_backgrounder'
|
228
|
+
add_gem 'cancancan', '~> 1.10'
|
229
|
+
add_gem "rolify"
|
230
|
+
add_gem 'sinatra', '>= 1.3.0', :require => nil
|
231
|
+
add_gem 'sidekiq'
|
232
|
+
add_gem 'sidetiq'
|
233
|
+
add_gem 'cocoon'
|
234
|
+
add_gem "font-awesome-rails"
|
235
|
+
add_gem 'wicked'
|
236
|
+
add_gem 'axlsx_rails'
|
237
|
+
add_gem 'letter_opener', :group => [:development]
|
238
|
+
add_gem 'foreman', "0.63.0", :group => [:development, :production]
|
239
|
+
add_gem 'stackmint', git: "git@gitlab.redmintlabs.com:redmint/stackmint.git", :group => [:development, :production]
|
240
|
+
add_gem 'puma', :group => [:development, :production]
|
241
|
+
add_gem 'rollbar', '~> 2.4.0', :group => [:development, :production]
|
242
|
+
add_gem 'bourbon'
|
243
|
+
end
|
244
|
+
|
245
|
+
__END__
|
246
|
+
|
247
|
+
name: extras
|
248
|
+
description: "Various extras."
|
249
|
+
author: RailsApps
|
250
|
+
|
251
|
+
requires: [gems]
|
252
|
+
run_after: [gems, init]
|
253
|
+
category: other
|
254
|
+
|
255
|
+
config:
|
256
|
+
- disable_turbolinks:
|
257
|
+
type: boolean
|
258
|
+
prompt: Disable Rails Turbolinks?
|
259
|
+
- ban_spiders:
|
260
|
+
type: boolean
|
261
|
+
prompt: Set a robots.txt file to ban spiders?
|
262
|
+
- github:
|
263
|
+
type: boolean
|
264
|
+
prompt: Create a GitHub repository?
|
265
|
+
- local_env_file:
|
266
|
+
type: multiple_choice
|
267
|
+
prompt: Add gem and file for environment variables?
|
268
|
+
choices: [ [None, none], [Add .env with Foreman, foreman], [Add application.yml with Figaro, figaro]]
|
269
|
+
- quiet_assets:
|
270
|
+
type: boolean
|
271
|
+
prompt: Reduce assets logger noise during development?
|
272
|
+
- better_errors:
|
273
|
+
type: boolean
|
274
|
+
prompt: Improve error reporting with 'better_errors' during development?
|
275
|
+
- pry:
|
276
|
+
type: boolean
|
277
|
+
prompt: Use 'pry' as console replacement?
|
278
|
+
- rubocop:
|
279
|
+
type: boolean
|
280
|
+
prompt: Use 'rubocop' to ensure that your code conforms to the Ruby style guide?
|
281
|
+
- redmint_gems:
|
282
|
+
type: boolean
|
283
|
+
prompt: Add default redmint gems?
|