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.
Files changed (69) hide show
  1. data/README.textile +185 -254
  2. data/lib/rails_wizard/command.rb +54 -13
  3. data/lib/rails_wizard/config.rb +1 -1
  4. data/lib/rails_wizard/diagnostics.rb +22 -0
  5. data/lib/rails_wizard/template.rb +36 -2
  6. data/lib/rails_wizard.rb +1 -0
  7. data/recipes/auth.rb +84 -0
  8. data/recipes/controllers.rb +58 -0
  9. data/recipes/{seed_database.rb → database.rb} +35 -22
  10. data/recipes/{action_mailer.rb → email.rb} +29 -50
  11. data/recipes/example.rb +70 -0
  12. data/recipes/extras.rb +91 -30
  13. data/recipes/frontend.rb +59 -0
  14. data/recipes/gems.rb +128 -0
  15. data/recipes/models.rb +61 -0
  16. data/recipes/prelaunch.rb +45 -0
  17. data/recipes/readme.rb +83 -0
  18. data/recipes/routes.rb +36 -0
  19. data/recipes/setup.rb +148 -0
  20. data/recipes/testing.rb +187 -0
  21. data/recipes/views.rb +39 -0
  22. data/spec/rails_wizard/template_spec.rb +4 -2
  23. data/templates/helpers.erb +53 -2
  24. data/templates/layout.erb +81 -20
  25. data/version.rb +1 -1
  26. metadata +19 -49
  27. data/recipes/active_admin.rb +0 -36
  28. data/recipes/activerecord.rb +0 -37
  29. data/recipes/add_user.rb +0 -140
  30. data/recipes/airbrake.rb +0 -34
  31. data/recipes/backbone.rb +0 -23
  32. data/recipes/capybara.rb +0 -34
  33. data/recipes/cleanup.rb +0 -40
  34. data/recipes/cloudfiles.rb +0 -36
  35. data/recipes/compass.rb +0 -46
  36. data/recipes/compass_960.rb +0 -48
  37. data/recipes/cucumber.rb +0 -75
  38. data/recipes/datamapper.rb +0 -111
  39. data/recipes/devise.rb +0 -114
  40. data/recipes/git.rb +0 -40
  41. data/recipes/guard.rb +0 -89
  42. data/recipes/haml.rb +0 -23
  43. data/recipes/heroku.rb +0 -61
  44. data/recipes/home_page.rb +0 -58
  45. data/recipes/home_page_users.rb +0 -47
  46. data/recipes/html5.rb +0 -152
  47. data/recipes/inherited_resources.rb +0 -23
  48. data/recipes/less.rb +0 -12
  49. data/recipes/mongohq.rb +0 -59
  50. data/recipes/mongoid.rb +0 -38
  51. data/recipes/mongolab.rb +0 -59
  52. data/recipes/omniauth.rb +0 -194
  53. data/recipes/omniauth_email.rb +0 -82
  54. data/recipes/paperclip.rb +0 -79
  55. data/recipes/prelaunch_signup.rb +0 -586
  56. data/recipes/rails_admin.rb +0 -29
  57. data/recipes/redis.rb +0 -23
  58. data/recipes/responders.rb +0 -10
  59. data/recipes/resque.rb +0 -25
  60. data/recipes/rspec.rb +0 -131
  61. data/recipes/sass.rb +0 -25
  62. data/recipes/settingslogic.rb +0 -43
  63. data/recipes/simple_form.rb +0 -54
  64. data/recipes/slim.rb +0 -46
  65. data/recipes/static_page.rb +0 -43
  66. data/recipes/subdomains.rb +0 -121
  67. data/recipes/turnip.rb +0 -18
  68. data/recipes/unicorn.rb +0 -29
  69. data/recipes/users_page.rb +0 -165
data/recipes/extras.rb CHANGED
@@ -1,60 +1,121 @@
1
- # Application template recipe for the rails_apps_composer. Check for a newer version here:
1
+ # Application template recipe for the rails_apps_composer. Change the recipe here:
2
2
  # https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/extras.rb
3
3
 
4
- if config['footnotes']
5
- say_wizard "Adding 'rails-footnotes'"
6
- gem 'rails-footnotes', '>= 3.7', :group => :development
7
- after_bundler do
8
- generate 'rails_footnotes:install'
9
- end
4
+ ## FORM BUILDER
5
+ case config['form_builder']
6
+ when 'simple_form'
7
+ prefs[:form_builder] = 'simple_form'
8
+ end
9
+ case prefs[:form_builder]
10
+ when 'simple_form'
11
+ gem 'simple_form'
12
+ after_bundler do
13
+ if prefer :frontend, 'bootstrap'
14
+ say_wizard "recipe installing simple_form for use with Twitter Bootstrap"
15
+ generate 'simple_form:install --bootstrap'
16
+ else
17
+ say_wizard "recipe installing simple_form"
18
+ generate 'simple_form:install'
19
+ end
20
+ end
10
21
  end
11
22
 
23
+ ## BAN SPIDERS
12
24
  if config['ban_spiders']
25
+ prefs[:ban_spiders] = true
26
+ end
27
+ if prefs[:ban_spiders]
13
28
  say_wizard "Banning spiders by modifying 'public/robots.txt'"
14
29
  after_bundler do
15
- # ban spiders from your site by changing robots.txt
16
30
  gsub_file 'public/robots.txt', /# User-Agent/, 'User-Agent'
17
31
  gsub_file 'public/robots.txt', /# Disallow/, 'Disallow'
18
32
  end
19
33
  end
20
34
 
21
- if config['paginate']
22
- say_wizard "Adding 'will_paginate'"
23
- if recipes.include? 'mongoid'
24
- gem 'will_paginate_mongoid'
25
- else
26
- gem 'will_paginate', '>= 3.0.3'
27
- end
28
- recipes << 'paginate'
29
- end
30
-
35
+ ## JSRUNTIME
31
36
  if config['jsruntime']
37
+ prefs[:jsruntime] = true
38
+ end
39
+ if prefs[:jsruntime]
32
40
  say_wizard "Adding 'therubyracer' JavaScript runtime gem"
33
- # maybe it was already added by the html5 recipe for bootstrap_less?
34
- unless recipes.include? 'jsruntime'
41
+ # maybe it was already added for bootstrap-less?
42
+ unless prefer :bootstrap, 'less'
35
43
  gem 'therubyracer', :group => :assets, :platform => :ruby
36
44
  end
37
45
  end
38
46
 
47
+ ## RVMRC
48
+ if config['rvmrc']
49
+ prefs[:rvmrc] = true
50
+ end
51
+ if prefs[:rvmrc]
52
+ # using the rvm Ruby API, see:
53
+ # http://blog.thefrontiergroup.com.au/2010/12/a-brief-introduction-to-the-rvm-ruby-api/
54
+ if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
55
+ begin
56
+ rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME']))
57
+ rvm_lib_path = File.join(rvm_path, 'lib')
58
+ require 'rvm'
59
+ rescue LoadError
60
+ raise "RVM ruby lib is currently unavailable."
61
+ end
62
+ else
63
+ raise "RVM ruby lib is currently unavailable."
64
+ end
65
+ say_wizard "creating RVM gemset '#{app_name}'"
66
+ RVM.gemset_create app_name
67
+ run "rvm rvmrc trust"
68
+ say_wizard "switching to gemset '#{app_name}'"
69
+ begin
70
+ RVM.gemset_use! app_name
71
+ rescue StandardError
72
+ raise "Use rvm gem 1.11.3.5 or newer."
73
+ end
74
+ run "rvm gemset list"
75
+ copy_from_repo '.rvmrc'
76
+ gsub_file '.rvmrc', /App_Name/, "#{app_name}"
77
+ end
78
+
79
+ ## AFTER_EVERYTHING
80
+ after_everything do
81
+ say_wizard "recipe removing unnecessary files and whitespace"
82
+ %w{
83
+ public/index.html
84
+ app/assets/images/rails.png
85
+ }.each { |file| remove_file file }
86
+ # remove commented lines and multiple blank lines from Gemfile
87
+ # thanks to https://github.com/perfectline/template-bucket/blob/master/cleanup.rb
88
+ gsub_file 'Gemfile', /#.*\n/, "\n"
89
+ gsub_file 'Gemfile', /\n^\s*\n/, "\n"
90
+ # remove commented lines and multiple blank lines from config/routes.rb
91
+ gsub_file 'config/routes.rb', / #.*\n/, "\n"
92
+ gsub_file 'config/routes.rb', /\n^\s*\n/, "\n"
93
+ # GIT
94
+ git :add => '.' if prefer :git, true
95
+ git :commit => "-aqm 'rails_apps_composer: starter app complete'" if prefer :git, true
96
+ end
97
+
39
98
  __END__
40
99
 
41
- name: Extras
42
- description: "Various extras including 'ban_spiders' and 'rails-footnotes'."
100
+ name: extras
101
+ description: "Various extras."
43
102
  author: RailsApps
44
103
 
104
+ requires: [gems]
105
+ run_after: [gems]
45
106
  category: other
46
- tags: [utilities, configuration]
47
107
 
48
108
  config:
49
- - footnotes:
50
- type: boolean
51
- prompt: Would you like to use 'rails-footnotes' (it's SLOW!)?
109
+ - form_builder:
110
+ type: multiple_choice
111
+ prompt: Use a form builder gem?
112
+ choices: [["None", "none"], ["SimpleForm", "simple_form"]]
52
113
  - ban_spiders:
53
114
  type: boolean
54
- prompt: Would you like to set a robots.txt file to ban spiders?
55
- - paginate:
56
- type: boolean
57
- prompt: Would you like to add 'will_paginate' for pagination?
115
+ prompt: Set a robots.txt file to ban spiders?
58
116
  - jsruntime:
59
117
  type: boolean
60
118
  prompt: Add 'therubyracer' JavaScript runtime (for Linux users without node.js)?
119
+ - rvmrc:
120
+ type: boolean
121
+ prompt: Create a project-specific rvm gemset and .rvmrc?
@@ -0,0 +1,59 @@
1
+ # Application template recipe for the rails_apps_composer. Change the recipe here:
2
+ # https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/frontend.rb
3
+
4
+ after_bundler do
5
+ say_wizard "recipe running after 'bundle install'"
6
+ ### LAYOUTS ###
7
+ copy_from_repo 'app/views/layouts/application.html.erb'
8
+ copy_from_repo 'app/views/layouts/application-bootstrap.html.erb', :prefs => 'bootstrap'
9
+ copy_from_repo 'app/views/layouts/_messages.html.erb'
10
+ copy_from_repo 'app/views/layouts/_messages-bootstrap.html.erb', :prefs => 'bootstrap'
11
+ copy_from_repo 'app/views/layouts/_navigation.html.erb'
12
+ copy_from_repo 'app/views/layouts/_navigation-devise.html.erb', :prefs => 'devise'
13
+ copy_from_repo 'app/views/layouts/_navigation-cancan.html.erb', :prefs => 'cancan'
14
+ copy_from_repo 'app/views/layouts/_navigation-omniauth.html.erb', :prefs => 'omniauth'
15
+ copy_from_repo 'app/views/layouts/_navigation-subdomains_app.html.erb', :prefs => 'subdomains_app'
16
+ ## APPLICATION NAME
17
+ application_layout_file = 'app/views/layouts/application.html.erb'
18
+ navigation_partial_file = 'app/views/layouts/_navigation.html.erb'
19
+ gsub_file application_layout_file, /App_Name/, "#{app_name.humanize.titleize}"
20
+ gsub_file navigation_partial_file, /App_Name/, "#{app_name.humanize.titleize}"
21
+ ### CSS ###
22
+ remove_file 'app/assets/stylesheets/application.css'
23
+ copy_from_repo 'app/assets/stylesheets/application.css.scss'
24
+ copy_from_repo 'app/assets/stylesheets/application-bootstrap.css.scss', :prefs => 'bootstrap'
25
+ if prefer :bootstrap, 'less'
26
+ generate 'bootstrap:install'
27
+ insert_into_file 'app/assets/stylesheets/bootstrap_and_overrides.css.less', "body { padding-top: 60px; }\n", :after => "@import \"twitter/bootstrap/bootstrap\";\n"
28
+ elsif prefer :bootstrap, 'sass'
29
+ insert_into_file 'app/assets/javascripts/application.js', "//= require bootstrap\n", :after => "jquery_ujs\n"
30
+ create_file 'app/assets/stylesheets/bootstrap_and_overrides.css.scss', <<-RUBY
31
+ @import "bootstrap";
32
+ body { padding-top: 60px; }
33
+ @import "bootstrap-responsive";
34
+ RUBY
35
+ elsif prefer :frontend, 'foundation'
36
+ insert_into_file 'app/assets/javascripts/application.js', "//= require foundation\n", :after => "jquery_ujs\n"
37
+ insert_into_file 'app/assets/stylesheets/application.css.scss', " *= require foundation\n", :after => "require_self\n"
38
+ elsif prefer :frontend, 'skeleton'
39
+ copy_from_repo 'app/assets/stylesheets/normalize.css.scss', :repo => 'https://raw.github.com/necolas/normalize.css/master/normalize.css'
40
+ copy_from_repo 'app/assets/stylesheets/base.css.scss', :repo => 'https://raw.github.com/dhgamache/Skeleton/master/stylesheets/base.css'
41
+ copy_from_repo 'app/assets/stylesheets/layout.css.scss', :repo => 'https://raw.github.com/dhgamache/Skeleton/master/stylesheets/layout.css'
42
+ copy_from_repo 'app/assets/stylesheets/skeleton.css.scss', :repo => 'https://raw.github.com/dhgamache/Skeleton/master/stylesheets/skeleton.css'
43
+ elsif prefer :frontend, 'normalize'
44
+ copy_from_repo 'app/assets/stylesheets/normalize.css.scss', :repo => 'https://raw.github.com/necolas/normalize.css/master/normalize.css'
45
+ end
46
+ ### GIT ###
47
+ git :add => '.' if prefer :git, true
48
+ git :commit => "-aqm 'rails_apps_composer: front-end framework'" if prefer :git, true
49
+ end # after_bundler
50
+
51
+ __END__
52
+
53
+ name: frontend
54
+ description: "Install a front-end framework for HTML5 and CSS."
55
+ author: RailsApps
56
+
57
+ requires: [setup, gems]
58
+ run_after: [setup, gems]
59
+ category: frontend
data/recipes/gems.rb ADDED
@@ -0,0 +1,128 @@
1
+ # Application template recipe for the rails_apps_composer. Change the recipe here:
2
+ # https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/gems.rb
3
+
4
+ ### GEMFILE ###
5
+
6
+ ## Ruby on Rails
7
+ insert_into_file 'Gemfile', "ruby '1.9.3'\n", :before => "gem 'rails', '3.2.6'" if prefer :deploy, 'heroku'
8
+
9
+ ## Web Server
10
+ gem 'thin', '>= 1.4.1', :group => [:development, :test] if prefer :dev_webserver, 'thin'
11
+ gem 'unicorn', '>= 4.3.1', :group => [:development, :test] if prefer :dev_webserver, 'unicorn'
12
+ gem 'puma', '>= 1.5.0', :group => [:development, :test] if prefer :dev_webserver, 'puma'
13
+ gem 'thin', '>= 1.4.1', :group => :production if prefer :prod_webserver, 'thin'
14
+ gem 'unicorn', '>= 4.3.1', :group => :production if prefer :prod_webserver, 'unicorn'
15
+ gem 'puma', '>= 1.5.0', :group => :production if prefer :prod_webserver, 'puma'
16
+
17
+ ## Database Adapter
18
+ gem 'mongoid', '>= 3.0.1' if prefer :orm, 'mongoid'
19
+ gem 'pg', '>= 0.14.0' if prefer :database, 'postgresql'
20
+ gem 'mysql2', '>= 0.3.11' if prefer :database, 'mysql'
21
+ copy_from_repo 'config/database-postgresql.yml', :prefs => 'postgresql'
22
+ copy_from_repo 'config/database-mysql.yml', :prefs => 'mysql'
23
+
24
+ ## Template Engine
25
+ if prefer :templates, 'haml'
26
+ gem 'haml', '>= 3.1.6'
27
+ gem 'haml-rails', '>= 0.3.4', :group => :development
28
+ # hpricot and ruby_parser are needed for conversion of HTML to Haml
29
+ gem 'hpricot', '>= 0.8.6', :group => :development
30
+ gem 'ruby_parser', '>= 2.3.1', :group => :development
31
+ end
32
+ if prefer :templates, 'slim'
33
+ gem 'slim', '>= 1.2.2'
34
+ gem 'haml2slim', '>= 0.4.6', :group => :development
35
+ # Haml is needed for conversion of HTML to Slim
36
+ gem 'haml', '>= 3.1.6', :group => :development
37
+ gem 'haml-rails', '>= 0.3.4', :group => :development
38
+ gem 'hpricot', '>= 0.8.6', :group => :development
39
+ gem 'ruby_parser', '>= 2.3.1', :group => :development
40
+ end
41
+
42
+ ## Testing Framework
43
+ if prefer :unit_test, 'rspec'
44
+ gem 'rspec-rails', '>= 2.11.0', :group => [:development, :test]
45
+ gem 'capybara', '>= 1.1.2', :group => :test
46
+ if prefer :orm, 'mongoid'
47
+ # use the database_cleaner gem to reset the test database
48
+ gem 'database_cleaner', '>= 0.8.0', :group => :test
49
+ # include RSpec matchers from the mongoid-rspec gem
50
+ gem 'mongoid-rspec', '>= 1.4.6', :group => :test
51
+ end
52
+ gem 'email_spec', '>= 1.2.1', :group => :test unless prefer :email, 'none'
53
+ end
54
+ if prefer :integration, 'cucumber'
55
+ gem 'cucumber-rails', '>= 1.3.0', :group => :test, :require => false
56
+ gem 'database_cleaner', '>= 0.8.0', :group => :test unless prefer :orm, 'mongoid'
57
+ gem 'launchy', '>= 2.1.0', :group => :test
58
+ end
59
+ gem 'turnip', '>= 1.0.0', :group => :test if prefer :integration, 'turnip'
60
+ gem 'factory_girl_rails', '>= 3.5.0', :group => [:development, :test] if prefer :fixtures, 'factory_girl'
61
+ gem 'machinist', :group => :test if prefer :fixtures, 'machinist'
62
+
63
+ ## Front-end Framework
64
+ gem 'bootstrap-sass', '>= 2.0.4.0' if prefer :bootstrap, 'sass'
65
+ gem 'zurb-foundation', '>= 3.0.5' if prefer :frontend, 'foundation'
66
+ if prefer :bootstrap, 'less'
67
+ gem 'twitter-bootstrap-rails', '>= 2.0.3', :group => :assets
68
+ # install gem 'therubyracer' to use Less
69
+ gem 'therubyracer', :group => :assets, :platform => :ruby
70
+ end
71
+
72
+ ## Email
73
+ gem 'sendgrid' if prefer :email, 'sendgrid'
74
+ gem 'hominid' if prefer :email, 'mandrill'
75
+
76
+ ## Authentication (Devise)
77
+ gem 'devise', '>= 2.1.2' if prefer :authentication, 'devise'
78
+ gem 'devise_invitable', '>= 1.0.3' if prefer :devise_modules, 'invitable'
79
+
80
+ ## Authentication (OmniAuth)
81
+ gem 'omniauth', '>= 1.1.0' if prefer :authentication, 'omniauth'
82
+ gem 'omniauth-twitter' if prefer :omniauth_provider, 'twitter'
83
+ gem 'omniauth-facebook' if prefer :omniauth_provider, 'facebook'
84
+ gem 'omniauth-github' if prefer :omniauth_provider, 'github'
85
+ gem 'omniauth-linkedin' if prefer :omniauth_provider, 'linkedin'
86
+ gem 'omniauth-google-oauth2' if prefer :omniauth_provider, 'google-oauth2'
87
+ gem 'omniauth-tumblr' if prefer :omniauth_provider, 'tumblr'
88
+
89
+ ## Authorization
90
+ if prefer :authorization, 'cancan'
91
+ gem 'cancan', '>= 1.6.8'
92
+ gem 'rolify', '>= 3.1.0'
93
+ end
94
+
95
+ ## Signup App
96
+ if prefer :prelaunch_app, 'signup_app'
97
+ gem 'google_visualr', '>= 2.1.2'
98
+ gem 'jquery-datatables-rails', '>= 1.10.0'
99
+ end
100
+
101
+ ## Gems from a defaults file or added interactively
102
+ gems.each do |g|
103
+ gem g
104
+ end
105
+
106
+ ## Git
107
+ git :add => '.' if prefer :git, true
108
+ git :commit => "-aqm 'rails_apps_composer: Gemfile'" if prefer :git, true
109
+
110
+ ### GENERATORS ###
111
+ after_bundler do
112
+ ## Database
113
+ generate 'mongoid:config' if prefer :orm, 'mongoid'
114
+ remove_file 'config/database.yml' if prefer :orm, 'mongoid'
115
+ ## Git
116
+ git :add => '.' if prefer :git, true
117
+ git :commit => "-aqm 'rails_apps_composer: generators'" if prefer :git, true
118
+ end # after_bundler
119
+
120
+ __END__
121
+
122
+ name: gems
123
+ description: "Add the gems your application needs."
124
+ author: RailsApps
125
+
126
+ requires: [setup]
127
+ run_after: [setup]
128
+ category: configuration
data/recipes/models.rb ADDED
@@ -0,0 +1,61 @@
1
+ # Application template recipe for the rails_apps_composer. Change the recipe here:
2
+ # https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/models.rb
3
+
4
+ after_bundler do
5
+ say_wizard "recipe running after 'bundle install'"
6
+ ### DEVISE ###
7
+ if prefer :authentication, 'devise'
8
+ if prefer :orm, 'mongoid'
9
+ copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-devise/master/' if prefer :orm, 'mongoid'
10
+ else
11
+ generate 'migration AddNameToUsers name:string'
12
+ if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')
13
+ generate 'migration AddConfirmableToUsers confirmation_token:string confirmed_at:datetime confirmation_sent_at:datetime unconfirmed_email:string'
14
+ end
15
+ copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/'
16
+ end
17
+ end
18
+ ### OMNIAUTH ###
19
+ if prefer :authentication, 'omniauth'
20
+ if prefer :orm, 'mongoid'
21
+ copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'
22
+ else
23
+ generate 'model User name:string email:string provider:string uid:string'
24
+ run 'bundle exec rake db:migrate'
25
+ copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'
26
+ gsub_file 'app/models/user.rb', /class User/, 'class User < ActiveRecord::Base'
27
+ gsub_file 'app/models/user.rb', /^\s*include Mongoid::Document\n/, ''
28
+ gsub_file 'app/models/user.rb', /^\s*field.*\n/, ''
29
+ gsub_file 'app/models/user.rb', /^\s*# run 'rake db:mongoid:create_indexes' to create indexes\n/, ''
30
+ gsub_file 'app/models/user.rb', /^\s*index\(\{ email: 1 \}, \{ unique: true, background: true \}\)\n/, ''
31
+ end
32
+ end
33
+ ### SUBDOMAINS ###
34
+ copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains'
35
+ ### AUTHORIZATION (insert 'rolify' after User model is created) ###
36
+ unless prefer :orm, 'mongoid'
37
+ generate 'rolify:role Role User'
38
+ else
39
+ generate 'rolify:role Role User mongoid'
40
+ # correct the generation of rolify 3.1 with mongoid
41
+ # the call to `rolify` should be *after* the inclusion of mongoid
42
+ # (see https://github.com/EppO/rolify/issues/61)
43
+ # This isn't needed for rolify>=3.2.0.beta4, but should cause no harm
44
+ gsub_file 'app/models/user.rb',
45
+ /^\s*(rolify.*?)$\s*(include Mongoid::Document.*?)$/,
46
+ " \\2\n extend Rolify\n \\1\n"
47
+ end
48
+ ### GIT ###
49
+ git :add => '.' if prefer :git, true
50
+ git :commit => "-aqm 'rails_apps_composer: models'" if prefer :git, true
51
+ end # after_bundler
52
+
53
+ __END__
54
+
55
+ name: models
56
+ description: "Add models needed for starter apps."
57
+ author: RailsApps
58
+
59
+ requires: [setup, gems, auth]
60
+ run_after: [setup, gems, auth]
61
+ category: mvc
@@ -0,0 +1,45 @@
1
+ # Application template recipe for the rails_apps_composer. Change the recipe here:
2
+ # https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/prelaunch.rb
3
+
4
+ if prefer :prelaunch_app, 'signup_app'
5
+ raise StandardError.new "Sorry. The prelaunch recipe is not implemented."
6
+
7
+ after_bundler do
8
+ say_wizard "recipe running after 'bundle install'"
9
+ repo = 'https://raw.github.com/RailsApps/rails-prelaunch-signup/master/'
10
+
11
+ # >-------------------------------[ Create a git branch ]--------------------------------<
12
+ if prefer :git, true
13
+ if prefer :prelaunch_branch, 'master'
14
+ unless prefer :main_branch, 'none'
15
+ say_wizard "renaming git branch 'master' to '#{prefs[:main_branch]}' for starter app"
16
+ git :branch => "-m master #{prefs[:main_branch]}"
17
+ git :checkout => "-b master"
18
+ else
19
+ say_wizard "creating prelaunch app on git branch 'master'"
20
+ end
21
+ else
22
+ say_wizard "creating new git branch '#{prefs[:prelaunch_branch]}' for prelaunch app"
23
+ git :checkout => "-b #{prefs[:prelaunch_branch]}"
24
+ end
25
+ end
26
+
27
+ # >-------------------------------[ Create an initializer file ]--------------------------------<
28
+ copy_from_repo 'config/initializers/prelaunch-signup.rb', :repo => repo
29
+ say_wizard "PRELAUNCH_SIGNUP NOT IMPLEMENTED"
30
+
31
+ ### GIT ###
32
+ git :add => '.' if prefer :git, true
33
+ git :commit => "-aqm 'rails_apps_composer: prelaunch app'" if prefer :git, true
34
+ end # after_bundler
35
+ end # signup_app
36
+
37
+ __END__
38
+
39
+ name: prelaunch
40
+ description: "Generates a Prelaunch Signup App"
41
+ author: RailsApps
42
+
43
+ requires: [setup, gems, auth, models, controllers, views, frontend, database]
44
+ run_after: [setup, gems, auth, models, controllers, views, frontend, database]
45
+ category: apps
data/recipes/readme.rb ADDED
@@ -0,0 +1,83 @@
1
+ # Application template recipe for the rails_apps_composer. Change the recipe here:
2
+ # https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/readme.rb
3
+
4
+ after_everything do
5
+ say_wizard "recipe running after everything"
6
+
7
+ # remove default READMEs
8
+ %w{
9
+ README
10
+ README.rdoc
11
+ doc/README_FOR_APP
12
+ }.each { |file| remove_file file }
13
+
14
+ # add placeholder READMEs and humans.txt file
15
+ copy_from_repo 'public/humans.txt'
16
+ copy_from_repo 'README'
17
+ copy_from_repo 'README.textile'
18
+ gsub_file "README", /App_Name/, "#{app_name.humanize.titleize}"
19
+ gsub_file "README.textile", /App_Name/, "#{app_name.humanize.titleize}"
20
+
21
+ # Diagnostics
22
+ gsub_file "README.textile", /recipes that are known/, "recipes that are NOT known" if diagnostics[:recipes] == 'fail'
23
+ gsub_file "README.textile", /preferences that are known/, "preferences that are NOT known" if diagnostics[:prefs] == 'fail'
24
+ gsub_file "README.textile", /RECIPES/, recipes.sort.inspect
25
+ gsub_file "README.textile", /PREFERENCES/, prefs.inspect
26
+
27
+ # Ruby on Rails
28
+ gsub_file "README.textile", /\* Ruby/, "* Ruby version #{RUBY_VERSION}"
29
+ gsub_file "README.textile", /\* Rails/, "* Rails version #{Rails::VERSION::STRING}"
30
+
31
+ # Database
32
+ gsub_file "README.textile", /SQLite/, "MongoDB" if prefer :database, 'mongodb'
33
+ gsub_file "README.textile", /ActiveRecord/, "the Mongoid ORM" if prefer :orm, 'mongoid'
34
+
35
+ # Template Engine
36
+ gsub_file "README.textile", /ERB/, "Haml" if prefer :templates, 'haml'
37
+ gsub_file "README.textile", /ERB/, "Slim" if prefer :templates, 'slim'
38
+
39
+ # Testing Framework
40
+ gsub_file "README.textile", /Test::Unit/, "RSpec" if prefer :unit_test, 'rspec'
41
+ gsub_file "README.textile", /RSpec/, "RSpec and Cucumber" if prefer :integration, 'cucumber'
42
+ gsub_file "README.textile", /RSpec/, "RSpec and Factory Girl" if prefer :fixtures, 'factory_girl'
43
+ gsub_file "README.textile", /RSpec/, "RSpec and Machinist" if prefer :fixtures, 'machinist'
44
+
45
+ # Front-end Framework
46
+ gsub_file "README.textile", /Front-end Framework: None/, "Front-end Framework: Twitter Bootstrap (Sass)" if prefer :bootstrap, 'sass'
47
+ gsub_file "README.textile", /Front-end Framework: None/, "Front-end Framework: Twitter Bootstrap (Less)" if prefer :bootstrap, 'less'
48
+ gsub_file "README.textile", /Front-end Framework: None/, "Front-end Framework: Zurb Foundation" if prefer :frontend, 'foundation'
49
+ gsub_file "README.textile", /Front-end Framework: None/, "Front-end Framework: Skeleton" if prefer :frontend, 'skeleton'
50
+ gsub_file "README.textile", /Front-end Framework: None/, "Front-end Framework: Normalized CSS" if prefer :frontend, 'normalize'
51
+
52
+ # Form Builder
53
+ gsub_file "README.textile", /Form Builder: None/, "Form Builder: SimpleForm" if prefer :form_builder, 'simple_form'
54
+
55
+ # Email
56
+ unless prefer :email, 'none'
57
+ gsub_file "README.textile", /Gmail/, "SMTP" if prefer :email, 'smtp'
58
+ gsub_file "README.textile", /Gmail/, "SendGrid" if prefer :email, 'sendgrid'
59
+ gsub_file "README.textile", /Gmail/, "Mandrill" if prefer :email, 'mandrill'
60
+ else
61
+ gsub_file "README.textile", /h2. Email/, ""
62
+ gsub_file "README.textile", /The application is configured to send email using a Gmail account./, ""
63
+ end
64
+
65
+ # Authentication and Authorization
66
+ gsub_file "README.textile", /Authentication: None/, "Authentication: Devise" if prefer :authentication, 'devise'
67
+ gsub_file "README.textile", /Authentication: None/, "Authentication: OmniAuth" if prefer :authentication, 'omniauth'
68
+ gsub_file "README.textile", /Authorization: None/, "Authorization: CanCan" if prefer :authorization, 'cancan'
69
+
70
+ git :add => '.' if prefer :git, true
71
+ git :commit => "-aqm 'rails_apps_composer: add README files'" if prefer :git, true
72
+
73
+ end # after_everything
74
+
75
+ __END__
76
+
77
+ name: readme
78
+ description: "Build a README file for your application."
79
+ author: RailsApps
80
+
81
+ requires: [setup]
82
+ run_after: [setup]
83
+ category: configuration
data/recipes/routes.rb ADDED
@@ -0,0 +1,36 @@
1
+ # Application template recipe for the rails_apps_composer. Change the recipe here:
2
+ # https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/routes.rb
3
+
4
+ after_bundler do
5
+ say_wizard "recipe running after 'bundle install'"
6
+ ### HOME ###
7
+ if prefer :starter_app, 'home_app'
8
+ remove_file 'public/index.html'
9
+ gsub_file 'config/routes.rb', /get \"home\/index\"/, 'root :to => "home#index"'
10
+ end
11
+ ### USER_ACCOUNTS ###
12
+ if ['users_app','admin_app'].include? prefs[:starter_app]
13
+ ## DEVISE
14
+ copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/' if prefer :authentication, 'devise'
15
+ ## OMNIAUTH
16
+ copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/' if prefer :authentication, 'omniauth'
17
+ end
18
+ ### SUBDOMAINS ###
19
+ copy_from_repo 'lib/subdomain.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains'
20
+ copy_from_repo 'config/routes.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains'
21
+ ### CORRECT APPLICATION NAME ###
22
+ gsub_file 'config/routes.rb', /^.*.routes.draw do/, "#{app_const}.routes.draw do"
23
+ ### GIT ###
24
+ git :add => '.' if prefer :git, true
25
+ git :commit => "-aqm 'rails_apps_composer: routes'" if prefer :git, true
26
+ end # after_bundler
27
+
28
+ __END__
29
+
30
+ name: routes
31
+ description: "Add routes needed for starter apps."
32
+ author: RailsApps
33
+
34
+ requires: [setup, gems, auth, models, controllers, views]
35
+ run_after: [setup, gems, auth, models, controllers, views]
36
+ category: mvc