redmint_composer 2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/README.textile +10 -0
  3. data/bin/redmint_composer +7 -0
  4. data/lib/rails_wizard.rb +7 -0
  5. data/lib/rails_wizard/command.rb +204 -0
  6. data/lib/rails_wizard/config.rb +88 -0
  7. data/lib/rails_wizard/diagnostics.rb +58 -0
  8. data/lib/rails_wizard/recipe.rb +114 -0
  9. data/lib/rails_wizard/recipes.rb +56 -0
  10. data/lib/rails_wizard/template.rb +111 -0
  11. data/recipes/admin.rb +42 -0
  12. data/recipes/analytics.rb +41 -0
  13. data/recipes/core.rb +32 -0
  14. data/recipes/deployment.rb +178 -0
  15. data/recipes/devise.rb +34 -0
  16. data/recipes/email.rb +65 -0
  17. data/recipes/email_dev.rb +92 -0
  18. data/recipes/example.rb +63 -0
  19. data/recipes/extras.rb +283 -0
  20. data/recipes/frontend.rb +33 -0
  21. data/recipes/gems.rb +274 -0
  22. data/recipes/git.rb +27 -0
  23. data/recipes/init.rb +179 -0
  24. data/recipes/learn_rails.rb +89 -0
  25. data/recipes/locale.rb +31 -0
  26. data/recipes/omniauth.rb +38 -0
  27. data/recipes/pages.rb +91 -0
  28. data/recipes/rails_bootstrap.rb +29 -0
  29. data/recipes/rails_devise.rb +26 -0
  30. data/recipes/rails_devise_pundit.rb +25 -0
  31. data/recipes/rails_devise_roles.rb +25 -0
  32. data/recipes/rails_foundation.rb +29 -0
  33. data/recipes/rails_mailinglist_activejob.rb +76 -0
  34. data/recipes/rails_omniauth.rb +27 -0
  35. data/recipes/rails_signup_download.rb +69 -0
  36. data/recipes/rails_stripe_checkout.rb +84 -0
  37. data/recipes/rails_stripe_coupons.rb +125 -0
  38. data/recipes/rails_stripe_membership_saas.rb +112 -0
  39. data/recipes/railsapps.rb +77 -0
  40. data/recipes/readme.rb +161 -0
  41. data/recipes/roles.rb +40 -0
  42. data/recipes/setup.rb +162 -0
  43. data/recipes/tests.rb +59 -0
  44. data/spec/rails_wizard/config_spec.rb +108 -0
  45. data/spec/rails_wizard/recipe_spec.rb +115 -0
  46. data/spec/rails_wizard/recipes/sanity_spec.rb +30 -0
  47. data/spec/rails_wizard/recipes_spec.rb +41 -0
  48. data/spec/rails_wizard/template_spec.rb +92 -0
  49. data/spec/spec_helper.rb +11 -0
  50. data/spec/support/rails_directory.rb +17 -0
  51. data/spec/support/template_runner.rb +28 -0
  52. data/spec/test_recipes/test_recipe_in_file.rb +9 -0
  53. data/templates/helpers.erb +138 -0
  54. data/templates/layout.erb +231 -0
  55. data/templates/recipe.erb +13 -0
  56. data/version.rb +3 -0
  57. metadata +201 -0
@@ -0,0 +1,89 @@
1
+ # Application template recipe for the rails_apps_composer. Change the recipe here:
2
+ # https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/learn_rails.rb
3
+
4
+ if prefer :apps4, 'learn-rails'
5
+
6
+ # preferences
7
+ prefs[:authentication] = false
8
+ prefs[:authorization] = false
9
+ prefs[:dashboard] = 'none'
10
+ prefs[:ban_spiders] = false
11
+ prefs[:better_errors] = true
12
+ prefs[:database] = 'sqlite'
13
+ prefs[:deployment] = 'heroku'
14
+ prefs[:devise_modules] = false
15
+ prefs[:dev_webserver] = 'webrick'
16
+ prefs[:email] = 'gmail'
17
+ prefs[:form_builder] = 'simple_form'
18
+ prefs[:frontend] = 'foundation5'
19
+ prefs[:github] = false
20
+ prefs[:git] = true
21
+ prefs[:local_env_file] = 'none'
22
+ prefs[:prod_webserver] = 'same'
23
+ prefs[:pry] = false
24
+ prefs[:quiet_assets] = true
25
+ prefs[:secrets] = ['owner_email', 'mailchimp_list_id', 'mailchimp_api_key']
26
+ prefs[:templates] = 'erb'
27
+ prefs[:tests] = false
28
+ prefs[:pages] = 'none'
29
+ prefs[:locale] = 'none'
30
+ prefs[:analytics] = 'none'
31
+ prefs[:rubocop] = false
32
+ prefs[:disable_turbolinks] = false
33
+
34
+ # gems
35
+ add_gem 'high_voltage'
36
+ add_gem 'gibbon'
37
+ gsub_file 'Gemfile', /gem 'sqlite3'\n/, ''
38
+ add_gem 'sqlite3', :group => :development
39
+ add_gem 'rails_12factor', :group => :production
40
+
41
+ stage_three do
42
+ say_wizard "recipe stage three"
43
+ repo = 'https://raw.github.com/RailsApps/learn-rails/master/'
44
+
45
+ # >-------------------------------[ Models ]--------------------------------<
46
+
47
+ copy_from_repo 'app/models/contact.rb', :repo => repo
48
+ copy_from_repo 'app/models/visitor.rb', :repo => repo
49
+
50
+ # >-------------------------------[ Controllers ]--------------------------------<
51
+
52
+ copy_from_repo 'app/controllers/contacts_controller.rb', :repo => repo
53
+ copy_from_repo 'app/controllers/visitors_controller.rb', :repo => repo
54
+
55
+ # >-------------------------------[ Mailers ]--------------------------------<
56
+
57
+ generate 'mailer UserMailer'
58
+ copy_from_repo 'app/mailers/user_mailer.rb', :repo => repo
59
+
60
+ # >-------------------------------[ Views ]--------------------------------<
61
+
62
+ copy_from_repo 'app/views/contacts/new.html.erb', :repo => repo
63
+ copy_from_repo 'app/views/pages/about.html.erb', :repo => repo
64
+ copy_from_repo 'app/views/user_mailer/contact_email.html.erb', :repo => repo
65
+ copy_from_repo 'app/views/user_mailer/contact_email.text.erb', :repo => repo
66
+ copy_from_repo 'app/views/visitors/new.html.erb', :repo => repo
67
+ # create navigation links using the rails_layout gem
68
+ generate 'layout:navigation -f'
69
+
70
+ # >-------------------------------[ Routes ]--------------------------------<
71
+
72
+ copy_from_repo 'config/routes.rb', :repo => repo
73
+
74
+ # >-------------------------------[ Assets ]--------------------------------<
75
+
76
+ copy_from_repo 'app/assets/javascripts/segmentio.js', :repo => repo
77
+
78
+ end
79
+ end
80
+
81
+ __END__
82
+
83
+ name: learn_rails
84
+ description: "learn-rails starter application"
85
+ author: RailsApps
86
+
87
+ requires: [core]
88
+ run_after: [git]
89
+ category: apps
@@ -0,0 +1,31 @@
1
+ # Application template recipe for the rails_apps_composer. Change the recipe here:
2
+ # https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/locale.rb
3
+
4
+ unless prefs[:locale]
5
+ prefs[:locale] = ask_wizard('Set a locale? Enter nothing for English, or es, de, etc:')
6
+ prefs[:locale] = 'none' unless prefs[:locale].present?
7
+ end
8
+
9
+ unless prefer :locale, 'none'
10
+ add_gem 'devise-i18n' if prefer :authentication, 'devise'
11
+ end
12
+
13
+ stage_two do
14
+ unless prefer :locale, 'none'
15
+ locale_for_app = prefs[:locale].include?('-') ? "'#{prefs[:locale]}'" : prefs[:locale]
16
+ gsub_file 'config/application.rb', /# config.i18n.default_locale.*$/, "config.i18n.default_locale = :#{locale_for_app}"
17
+ locale_filename = "config/locales/#{prefs[:locale]}.yml"
18
+ create_file locale_filename
19
+ append_to_file locale_filename, "#{prefs[:locale]}:"
20
+ end
21
+ end
22
+
23
+ __END__
24
+
25
+ name: locale
26
+ description: "Set default locale"
27
+ author: hedgesky
28
+
29
+ category: other
30
+ requires: [setup]
31
+ run_after: [setup]
@@ -0,0 +1,38 @@
1
+ # Application template recipe for the rails_apps_composer. Change the recipe here:
2
+ # https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/omniauth.rb
3
+
4
+ stage_two do
5
+ say_wizard "recipe stage two"
6
+ if prefer :authentication, 'omniauth'
7
+ repo = 'https://raw.github.com/RailsApps/rails-omniauth/master/'
8
+ copy_from_repo 'config/initializers/omniauth.rb', :repo => repo
9
+ gsub_file 'config/initializers/omniauth.rb', /twitter/, prefs[:omniauth_provider] unless prefer :omniauth_provider, 'twitter'
10
+ generate 'model User name:string provider:string uid:string'
11
+ run 'bundle exec rake db:migrate'
12
+ copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails-omniauth/master/'
13
+ copy_from_repo 'app/controllers/application_controller.rb', :repo => repo
14
+ filename = 'app/controllers/sessions_controller.rb'
15
+ copy_from_repo filename, :repo => repo
16
+ gsub_file filename, /twitter/, prefs[:omniauth_provider] unless prefer :omniauth_provider, 'twitter'
17
+ routes = <<-TEXT
18
+ get '/auth/:provider/callback' => 'sessions#create'
19
+ get '/signin' => 'sessions#new', :as => :signin
20
+ get '/signout' => 'sessions#destroy', :as => :signout
21
+ get '/auth/failure' => 'sessions#failure'
22
+ TEXT
23
+ inject_into_file 'config/routes.rb', routes + "\n", :after => "routes.draw do\n"
24
+ end
25
+ ### GIT ###
26
+ git :add => '-A' if prefer :git, true
27
+ git :commit => '-qm "redmint_composer: omniauth"' if prefer :git, true
28
+ end
29
+
30
+ __END__
31
+
32
+ name: omniauth
33
+ description: "Add OmniAuth for authentication"
34
+ author: RailsApps
35
+
36
+ requires: [setup, gems]
37
+ run_after: [setup, gems]
38
+ category: mvc
@@ -0,0 +1,91 @@
1
+ # Application template recipe for the rails_apps_composer. Change the recipe here:
2
+ # https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/pages.rb
3
+
4
+ stage_two do
5
+ say_wizard "recipe stage two"
6
+ case prefs[:pages]
7
+ when 'home'
8
+ generate 'pages:home -f'
9
+ when 'about'
10
+ generate 'pages:about -f'
11
+ when 'users'
12
+ generate 'pages:users -f'
13
+ generate 'pages:roles -f' if prefer :authorization, 'roles'
14
+ generate 'pages:authorized -f' if prefer :authorization, 'pundit'
15
+ when 'about+users'
16
+ generate 'pages:about -f'
17
+ generate 'pages:users -f'
18
+ generate 'pages:roles -f' if prefer :authorization, 'roles'
19
+ generate 'pages:authorized -f' if prefer :authorization, 'pundit'
20
+ end
21
+ generate 'pages:upmin -f' if prefer :dashboard, 'upmin'
22
+ generate 'layout:navigation -f'
23
+ ### GIT ###
24
+ git :add => '-A' if prefer :git, true
25
+ git :commit => '-qm "redmint_composer: add pages"' if prefer :git, true
26
+ end
27
+
28
+ stage_four do
29
+ say_wizard "recipe stage four"
30
+ case prefs[:layouts]
31
+ when 'bare'
32
+ generate 'theme:bare -f'
33
+ when 'blog_home'
34
+ generate 'theme:blog_home -f'
35
+ when 'business_casual'
36
+ generate 'theme:business_casual -f'
37
+ when 'business_frontpage'
38
+ generate 'theme:business_frontpage -f'
39
+ when 'clean_blog'
40
+ generate 'theme:clean_blog -f'
41
+ when 'four_col_portfolio'
42
+ generate 'theme:four_col_portfolio -f'
43
+ when 'full_width_pics'
44
+ generate 'theme:full_width_pics -f'
45
+ when 'heroic_features'
46
+ generate 'theme:heroic_features -f'
47
+ when 'landing_page'
48
+ generate 'theme:landing_page -f'
49
+ when 'modern_business'
50
+ generate 'theme:modern_business -f'
51
+ when 'one_col_portfolio'
52
+ generate 'theme:one_col_portfolio -f'
53
+ when 'one_page_wonder'
54
+ generate 'theme:one_page_wonder -f'
55
+ when 'portfolio_item'
56
+ generate 'theme:portfolio_item -f'
57
+ when 'round_about'
58
+ generate 'theme:round_about -f'
59
+ when 'shop_homepage'
60
+ generate 'theme:shop_homepage -f'
61
+ when 'shop_item'
62
+ generate 'theme:shop_item -f'
63
+ when 'simple_sidebar'
64
+ generate 'theme:simple_sidebar -f'
65
+ when 'small_business'
66
+ generate 'theme:small_business -f'
67
+ when 'stylish_portfolio'
68
+ generate 'theme:stylish_portfolio -f'
69
+ when 'the_big_picture'
70
+ generate 'theme:the_big_picture -f'
71
+ when 'three_col_portfolio'
72
+ generate 'theme:three_col_portfolio -f'
73
+ when 'thumbnail_gallery'
74
+ generate 'theme:thumbnail_gallery -f'
75
+ when 'two_col_portfolio'
76
+ generate 'theme:two_col_portfolio -f'
77
+ end
78
+ ### GIT ###
79
+ git :add => '-A' if prefer :git, true
80
+ git :commit => '-qm "redmint_composer: add Bootstrap page layouts"' if prefer :git, true
81
+ end
82
+
83
+ __END__
84
+
85
+ name: pages
86
+ description: "Add pages"
87
+ author: RailsApps
88
+
89
+ requires: [setup, gems, frontend]
90
+ run_after: [setup, gems, frontend]
91
+ category: mvc
@@ -0,0 +1,29 @@
1
+ # Application template recipe for the rails_apps_composer. Change the recipe here:
2
+ # https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/rails_bootstrap.rb
3
+
4
+ if prefer :apps4, 'rails-bootstrap'
5
+ prefs[:authentication] = false
6
+ prefs[:authorization] = false
7
+ prefs[:dashboard] = 'none'
8
+ prefs[:better_errors] = true
9
+ prefs[:devise_modules] = false
10
+ prefs[:email] = 'none'
11
+ prefs[:frontend] = 'bootstrap3'
12
+ prefs[:git] = true
13
+ prefs[:local_env_file] = false
14
+ prefs[:pry] = false
15
+ prefs[:quiet_assets] = true
16
+ prefs[:pages] = 'about'
17
+ prefs[:locale] = 'none'
18
+ prefs[:rubocop] = false
19
+ end
20
+
21
+ __END__
22
+
23
+ name: rails_bootstrap
24
+ description: "rails-bootstrap starter application"
25
+ author: RailsApps
26
+
27
+ requires: [core]
28
+ run_after: [git]
29
+ category: apps
@@ -0,0 +1,26 @@
1
+ # Application template recipe for the rails_apps_composer. Change the recipe here:
2
+ # https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/rails_devise.rb
3
+
4
+ if prefer :apps4, 'rails-devise'
5
+ prefs[:authentication] = 'devise'
6
+ prefs[:authorization] = false
7
+ prefs[:dashboard] = 'none'
8
+ prefs[:better_errors] = true
9
+ prefs[:git] = true
10
+ prefs[:local_env_file] = false
11
+ prefs[:pry] = false
12
+ prefs[:quiet_assets] = true
13
+ prefs[:pages] = 'users'
14
+ prefs[:locale] = 'none'
15
+ prefs[:rubocop] = false
16
+ end
17
+
18
+ __END__
19
+
20
+ name: rails_devise
21
+ description: "rails-devise starter application"
22
+ author: RailsApps
23
+
24
+ requires: [core]
25
+ run_after: [git]
26
+ category: apps
@@ -0,0 +1,25 @@
1
+ # Application template recipe for the rails_apps_composer. Change the recipe here:
2
+ # https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/rails_devise_pundit.rb
3
+
4
+ if prefer :apps4, 'rails-devise-pundit'
5
+ prefs[:authentication] = 'devise'
6
+ prefs[:authorization] = 'pundit'
7
+ prefs[:better_errors] = true
8
+ prefs[:git] = true
9
+ prefs[:local_env_file] = false
10
+ prefs[:pry] = false
11
+ prefs[:quiet_assets] = true
12
+ prefs[:pages] = 'users'
13
+ prefs[:locale] = 'none'
14
+ prefs[:rubocop] = false
15
+ end
16
+
17
+ __END__
18
+
19
+ name: rails_devise_pundit
20
+ description: "rails-devise-pundit starter application"
21
+ author: RailsApps
22
+
23
+ requires: [core]
24
+ run_after: [git]
25
+ category: apps
@@ -0,0 +1,25 @@
1
+ # Application template recipe for the rails_apps_composer. Change the recipe here:
2
+ # https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/rails_devise_roles.rb
3
+
4
+ if prefer :apps4, 'rails-devise-roles'
5
+ prefs[:authentication] = 'devise'
6
+ prefs[:authorization] = 'roles'
7
+ prefs[:better_errors] = true
8
+ prefs[:git] = true
9
+ prefs[:local_env_file] = false
10
+ prefs[:pry] = false
11
+ prefs[:quiet_assets] = true
12
+ prefs[:pages] = 'users'
13
+ prefs[:locale] = 'none'
14
+ prefs[:rubocop] = false
15
+ end
16
+
17
+ __END__
18
+
19
+ name: rails_devise_roles
20
+ description: "rails-devise-roles starter application"
21
+ author: RailsApps
22
+
23
+ requires: [core]
24
+ run_after: [git]
25
+ category: apps
@@ -0,0 +1,29 @@
1
+ # Application template recipe for the rails_apps_composer. Change the recipe here:
2
+ # https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/rails_foundation.rb
3
+
4
+ if prefer :apps4, 'rails-foundation'
5
+ prefs[:authentication] = false
6
+ prefs[:authorization] = false
7
+ prefs[:dashboard] = 'none'
8
+ prefs[:better_errors] = true
9
+ prefs[:devise_modules] = false
10
+ prefs[:email] = 'none'
11
+ prefs[:frontend] = 'foundation5'
12
+ prefs[:git] = true
13
+ prefs[:local_env_file] = false
14
+ prefs[:pry] = false
15
+ prefs[:quiet_assets] = true
16
+ prefs[:pages] = 'about'
17
+ prefs[:locale] = 'none'
18
+ prefs[:rubocop] = false
19
+ end
20
+
21
+ __END__
22
+
23
+ name: rails_foundation
24
+ description: "rails-foundation starter application"
25
+ author: RailsApps
26
+
27
+ requires: [core]
28
+ run_after: [git]
29
+ category: apps
@@ -0,0 +1,76 @@
1
+ # Application template recipe for the rails_apps_composer. Change the recipe here:
2
+ # https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/rails_mailinglist_activejob.rb
3
+
4
+ if prefer :apps4, 'rails-mailinglist-activejob'
5
+ prefs[:authentication] = false
6
+ prefs[:authorization] = false
7
+ prefs[:dashboard] = 'none'
8
+ prefs[:better_errors] = true
9
+ prefs[:form_builder] = 'simple_form'
10
+ prefs[:git] = true
11
+ prefs[:local_env_file] = false
12
+ prefs[:pry] = false
13
+ prefs[:quiet_assets] = true
14
+ prefs[:secrets] = ['mailchimp_list_id', 'mailchimp_api_key']
15
+ prefs[:pages] = 'about'
16
+ prefs[:locale] = 'none'
17
+ prefs[:rubocop] = false
18
+
19
+ # gems
20
+ add_gem 'gibbon'
21
+ add_gem 'high_voltage'
22
+ add_gem 'sucker_punch'
23
+
24
+ stage_two do
25
+ say_wizard "recipe stage two"
26
+ generate 'model Visitor email:string'
27
+ end
28
+
29
+ stage_three do
30
+ say_wizard "recipe stage three"
31
+ repo = 'https://raw.github.com/RailsApps/rails-mailinglist-activejob/master/'
32
+
33
+ # >-------------------------------[ Config ]---------------------------------<
34
+
35
+ copy_from_repo 'config/initializers/active_job.rb', :repo => repo
36
+
37
+ # >-------------------------------[ Models ]--------------------------------<
38
+
39
+ copy_from_repo 'app/models/visitor.rb', :repo => repo
40
+
41
+ # >-------------------------------[ Controllers ]--------------------------<
42
+
43
+ copy_from_repo 'app/controllers/visitors_controller.rb', :repo => repo
44
+
45
+ # >-------------------------------[ Jobs ]---------------------------------<
46
+
47
+ copy_from_repo 'app/jobs/mailing_list_signup_job.rb', :repo => repo
48
+
49
+ # >-------------------------------[ Views ]--------------------------------<
50
+
51
+ remove_file 'app/views/visitors/index.html.erb'
52
+ copy_from_repo 'app/views/visitors/new.html.erb', :repo => repo
53
+
54
+ # >-------------------------------[ Routes ]-------------------------------<
55
+
56
+ gsub_file 'config/routes.rb', / root to: 'visitors#index'\n/, ''
57
+ inject_into_file 'config/routes.rb', " root to: 'visitors#new'\n", :after => "routes.draw do\n"
58
+ route = ' resources :visitors, only: [:new, :create]'
59
+ inject_into_file 'config/routes.rb', route + "\n", :after => "routes.draw do\n"
60
+
61
+ # >-------------------------------[ Tests ]--------------------------------<
62
+
63
+ ### tests not implemented
64
+
65
+ end
66
+ end
67
+
68
+ __END__
69
+
70
+ name: rails_mailinglist_activejob
71
+ description: "rails_mailinglist_activejob starter application"
72
+ author: RailsApps
73
+
74
+ requires: [core]
75
+ run_after: [git]
76
+ category: apps