rails_apps_composer 2.1.2 → 2.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +16 -7
- data/lib/rails_wizard/diagnostics.rb +5 -2
- data/recipes/all.rb +14 -0
- data/recipes/example.rb +1 -1
- data/recipes/extras.rb +3 -3
- data/recipes/frontend.rb +5 -5
- data/recipes/gems.rb +1 -0
- data/recipes/git.rb +1 -6
- data/recipes/{database.rb → init.rb} +2 -2
- data/recipes/prelaunch.rb +3 -3
- data/recipes/railsapps.rb +6 -1
- data/recipes/readme.rb +3 -1
- data/recipes/testing.rb +40 -0
- data/templates/helpers.erb +9 -0
- data/version.rb +1 -1
- metadata +6 -5
data/README.textile
CHANGED
@@ -72,8 +72,14 @@ Before using the rails_apps_composer gem, you will need:
|
|
72
72
|
* The Ruby language (version 1.9.3)
|
73
73
|
* Rails 3.1 or newer
|
74
74
|
|
75
|
+
The rails_apps_composer program uses the version of Rails that is currently installed when you launch the program. If you want to use the newest Rails version, upgrade before running rails_apps_composer.
|
76
|
+
|
75
77
|
See the article "Installing Rails":http://railsapps.github.com/installing-rails.html for advice about updating Rails and your development environment.
|
76
78
|
|
79
|
+
h4. Database
|
80
|
+
|
81
|
+
Except for SQLite, which runs by default on Mac OS X, you'll need to have a database server running before you run rails_apps_composer. This is true if you use PostgreSQL, MySQL, or MongoDB; use SQLite if you don't want to set up a database server.
|
82
|
+
|
77
83
|
h2. Installation
|
78
84
|
|
79
85
|
I recommend installing and using rvm, the "Ruby Version Manager":https://rvm.io/, to create a new gemset for rails_apps_composer. Using an rvm gemset will make it easier to identify and isolate incompatibilities among gems.
|
@@ -93,15 +99,16 @@ You can list recipes with short descriptions:
|
|
93
99
|
<pre>
|
94
100
|
$ rails_apps_composer list
|
95
101
|
|
102
|
+
all # Select all available recipes.
|
96
103
|
auth # Add authentication and authorization.
|
97
104
|
controllers # Add controllers needed for starter apps.
|
98
|
-
database # Set up and initialize database.
|
99
105
|
email # Configure email accounts.
|
100
|
-
example # Example of a recipe
|
106
|
+
example # Example of a recipe.
|
101
107
|
extras # Various extras.
|
102
108
|
frontend # Install a front-end framework for HTML5 and CSS.
|
103
109
|
gems # Add the gems your application needs.
|
104
110
|
git # Initialize git for your application.
|
111
|
+
init # Set up and initialize database.
|
105
112
|
models # Add models needed for starter apps.
|
106
113
|
railsapps # Install RailsApps example applications.
|
107
114
|
readme # Build a README file for your application.
|
@@ -160,11 +167,12 @@ Would you like to skip Test::Unit? (yes for RSpec) (y/n)
|
|
160
167
|
Would you like to skip Active Record? (yes for MongoDB) (y/n)
|
161
168
|
|
162
169
|
Available Recipes:
|
170
|
+
all: all
|
163
171
|
auth: auth
|
164
172
|
configuration: email, gems, git, railsapps, readme, setup
|
165
173
|
example: example
|
166
174
|
frontend: frontend
|
167
|
-
initialize:
|
175
|
+
initialize: init
|
168
176
|
mvc: controllers, models, routes, views
|
169
177
|
other: extras
|
170
178
|
testing: testing
|
@@ -182,10 +190,10 @@ You can specify any gem. Any string you enter will be added as a gem in the star
|
|
182
190
|
|
183
191
|
h3. Generate an Application from a List of Recipes
|
184
192
|
|
185
|
-
Provide a list of recipes using the @-r@ flag:
|
193
|
+
Provide a list of recipes using the @-r@ flag. The "all" recipe selects all available recipes:
|
186
194
|
|
187
195
|
<pre>
|
188
|
-
$ rails_apps_composer new myapp -r
|
196
|
+
$ rails_apps_composer new myapp -r all
|
189
197
|
|
190
198
|
Would you like to skip Test::Unit? (yes for RSpec) (y/n)
|
191
199
|
Would you like to skip Active Record? (yes for MongoDB) (y/n)
|
@@ -217,11 +225,12 @@ Specify a filename for the template:
|
|
217
225
|
$ rails_apps_composer template ~/Desktop/template.rb
|
218
226
|
|
219
227
|
Available Recipes:
|
228
|
+
all: all
|
220
229
|
auth: auth
|
221
230
|
configuration: email, gems, git, railsapps, readme, setup
|
222
231
|
example: example
|
223
232
|
frontend: frontend
|
224
|
-
initialize:
|
233
|
+
initialize: init
|
225
234
|
mvc: controllers, models, routes, views
|
226
235
|
other: extras
|
227
236
|
testing: testing
|
@@ -239,7 +248,7 @@ h3. Generate an Application Template from a List of Recipes
|
|
239
248
|
Specify a filename for the template and provide a list of recipes:
|
240
249
|
|
241
250
|
<pre>
|
242
|
-
$ rails_apps_composer template ~/Desktop/template.rb -r
|
251
|
+
$ rails_apps_composer template ~/Desktop/template.rb -r all
|
243
252
|
|
244
253
|
What gem would you like to add? (blank to finish)
|
245
254
|
Generating and saving application template...
|
@@ -15,8 +15,11 @@ module RailsWizard
|
|
15
15
|
@@recipes << %w(gems git setup)
|
16
16
|
@@recipes << %w(gems git readme setup)
|
17
17
|
@@recipes << %w(extras gems git readme setup)
|
18
|
-
@@recipes << %w(auth controllers
|
19
|
-
@@recipes << %w(auth controllers
|
18
|
+
@@recipes << %w(auth controllers email extras frontend gems git init models railsapps readme routes setup testing views)
|
19
|
+
@@recipes << %w(all auth controllers email extras frontend gems git init models railsapps readme routes setup testing views)
|
20
|
+
@@recipes << %w(auth controllers email example extras frontend gems git init models railsapps readme routes setup testing views)
|
21
|
+
@@recipes << %w(auth controllers email example extras frontend gems git init models prelaunch railsapps readme routes setup testing views)
|
22
|
+
@@recipes << %w(all auth controllers email example extras frontend gems git init models prelaunch railsapps readme routes setup testing views)
|
20
23
|
|
21
24
|
### collections of preferences that are known to work together
|
22
25
|
@@prefs = []
|
data/recipes/all.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# Application template recipe for the rails_apps_composer. Change the recipe here:
|
2
|
+
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/all.rb
|
3
|
+
|
4
|
+
## Git
|
5
|
+
say_wizard "selected all recipes"
|
6
|
+
|
7
|
+
__END__
|
8
|
+
|
9
|
+
name: all
|
10
|
+
description: "Select all available recipes."
|
11
|
+
author: RailsApps
|
12
|
+
|
13
|
+
requires: [git, railsapps, setup, readme, gems, testing, auth, email, models, controllers, views, routes, frontend, init, extras]
|
14
|
+
category: all
|
data/recipes/example.rb
CHANGED
data/recipes/extras.rb
CHANGED
@@ -69,7 +69,7 @@ if prefs[:rvmrc]
|
|
69
69
|
begin
|
70
70
|
RVM.gemset_use! app_name
|
71
71
|
rescue StandardError
|
72
|
-
raise "
|
72
|
+
raise "rvm failure: unable to use gemset #{app_name}"
|
73
73
|
end
|
74
74
|
run "rvm gemset list"
|
75
75
|
copy_from_repo '.rvmrc'
|
@@ -92,7 +92,7 @@ after_everything do
|
|
92
92
|
gsub_file 'config/routes.rb', /\n^\s*\n/, "\n"
|
93
93
|
# GIT
|
94
94
|
git :add => '.' if prefer :git, true
|
95
|
-
git :commit => "-aqm 'rails_apps_composer:
|
95
|
+
git :commit => "-aqm 'rails_apps_composer: extras'" if prefer :git, true
|
96
96
|
end
|
97
97
|
|
98
98
|
__END__
|
@@ -102,7 +102,7 @@ description: "Various extras."
|
|
102
102
|
author: RailsApps
|
103
103
|
|
104
104
|
requires: [gems]
|
105
|
-
run_after: [gems]
|
105
|
+
run_after: [init, gems]
|
106
106
|
category: other
|
107
107
|
|
108
108
|
config:
|
data/recipes/frontend.rb
CHANGED
@@ -36,12 +36,12 @@ RUBY
|
|
36
36
|
insert_into_file 'app/assets/javascripts/application.js', "//= require foundation\n", :after => "jquery_ujs\n"
|
37
37
|
insert_into_file 'app/assets/stylesheets/application.css.scss', " *= require foundation\n", :after => "require_self\n"
|
38
38
|
elsif prefer :frontend, 'skeleton'
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
39
|
+
copy_from 'https://raw.github.com/necolas/normalize.css/master/normalize.css', 'app/assets/stylesheets/normalize.css'
|
40
|
+
copy_from 'https://raw.github.com/dhgamache/Skeleton/master/stylesheets/base.css', 'app/assets/stylesheets/base.css'
|
41
|
+
copy_from 'https://raw.github.com/dhgamache/Skeleton/master/stylesheets/layout.css', 'app/assets/stylesheets/layout.css'
|
42
|
+
copy_from 'https://raw.github.com/dhgamache/Skeleton/master/stylesheets/skeleton.css', 'app/assets/stylesheets/skeleton.css'
|
43
43
|
elsif prefer :frontend, 'normalize'
|
44
|
-
|
44
|
+
copy_from 'https://raw.github.com/necolas/normalize.css/master/normalize.css', 'app/assets/stylesheets/normalize.css'
|
45
45
|
end
|
46
46
|
### GIT ###
|
47
47
|
git :add => '.' if prefer :git, true
|
data/recipes/gems.rb
CHANGED
@@ -15,6 +15,7 @@ gem 'unicorn', '>= 4.3.1', :group => :production if prefer :prod_webserver, 'uni
|
|
15
15
|
gem 'puma', '>= 1.6.1', :group => :production if prefer :prod_webserver, 'puma'
|
16
16
|
|
17
17
|
## Database Adapter
|
18
|
+
gsub_file 'Gemfile', /gem 'sqlite3'\n/, '' unless prefer :database, 'sqlite'
|
18
19
|
gem 'mongoid', '>= 3.0.3' if prefer :orm, 'mongoid'
|
19
20
|
gem 'pg', '>= 0.14.0' if prefer :database, 'postgresql'
|
20
21
|
gem 'mysql2', '>= 0.3.11' if prefer :database, 'mysql'
|
data/recipes/git.rb
CHANGED
@@ -5,12 +5,7 @@
|
|
5
5
|
say_wizard "initialize git"
|
6
6
|
prefs[:git] = true unless prefs.has_key? :git
|
7
7
|
if prefer :git, true
|
8
|
-
|
9
|
-
remove_file '.gitignore'
|
10
|
-
get 'https://raw.github.com/RailsApps/rails-composer/master/files/gitignore.txt', '.gitignore'
|
11
|
-
rescue OpenURI::HTTPError
|
12
|
-
say_wizard "Unable to obtain gitignore file from the repo"
|
13
|
-
end
|
8
|
+
copy_from 'https://raw.github.com/RailsApps/rails-composer/master/files/gitignore.txt', '.gitignore'
|
14
9
|
git :init
|
15
10
|
git :add => '.'
|
16
11
|
git :commit => "-aqm 'rails_apps_composer: initial commit'"
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Application template recipe for the rails_apps_composer. Change the recipe here:
|
2
|
-
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/
|
2
|
+
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/init.rb
|
3
3
|
|
4
4
|
after_everything do
|
5
5
|
say_wizard "recipe running after everything"
|
@@ -62,7 +62,7 @@ end # after_everything
|
|
62
62
|
|
63
63
|
__END__
|
64
64
|
|
65
|
-
name:
|
65
|
+
name: init
|
66
66
|
description: "Set up and initialize database."
|
67
67
|
author: RailsApps
|
68
68
|
|
data/recipes/prelaunch.rb
CHANGED
@@ -37,9 +37,9 @@ end # signup_app
|
|
37
37
|
__END__
|
38
38
|
|
39
39
|
name: prelaunch
|
40
|
-
description: "
|
40
|
+
description: "Not implemented."
|
41
41
|
author: RailsApps
|
42
42
|
|
43
|
-
requires: [setup, gems, auth, models, controllers, views, frontend,
|
44
|
-
run_after: [setup, gems, auth, models, controllers, views, frontend,
|
43
|
+
requires: [setup, gems, auth, models, controllers, views, frontend, init]
|
44
|
+
run_after: [setup, gems, auth, models, controllers, views, frontend, init]
|
45
45
|
category: apps
|
data/recipes/railsapps.rb
CHANGED
@@ -11,6 +11,7 @@ prefs[:railsapps] = multiple_choice "Install an example application?",
|
|
11
11
|
|
12
12
|
case prefs[:railsapps]
|
13
13
|
when 'rails3-bootstrap-devise-cancan'
|
14
|
+
prefs[:git] = true
|
14
15
|
prefs[:database] = 'sqlite'
|
15
16
|
prefs[:templates] = 'erb'
|
16
17
|
prefs[:unit_test] = 'rspec'
|
@@ -25,6 +26,7 @@ case prefs[:railsapps]
|
|
25
26
|
prefs[:starter_app] = 'admin_app'
|
26
27
|
prefs[:form_builder] = 'none'
|
27
28
|
when 'rails3-devise-rspec-cucumber'
|
29
|
+
prefs[:git] = true
|
28
30
|
prefs[:database] = 'sqlite'
|
29
31
|
prefs[:templates] = 'erb'
|
30
32
|
prefs[:unit_test] = 'rspec'
|
@@ -38,6 +40,7 @@ case prefs[:railsapps]
|
|
38
40
|
prefs[:starter_app] = 'users_app'
|
39
41
|
prefs[:form_builder] = 'none'
|
40
42
|
when 'rails3-mongoid-devise'
|
43
|
+
prefs[:git] = true
|
41
44
|
prefs[:database] = 'mongodb'
|
42
45
|
prefs[:orm] = 'mongoid'
|
43
46
|
prefs[:templates] = 'erb'
|
@@ -52,6 +55,7 @@ case prefs[:railsapps]
|
|
52
55
|
prefs[:starter_app] = 'users_app'
|
53
56
|
prefs[:form_builder] = 'none'
|
54
57
|
when 'rails3-mongoid-omniauth'
|
58
|
+
prefs[:git] = true
|
55
59
|
prefs[:database] = 'mongodb'
|
56
60
|
prefs[:orm] = 'mongoid'
|
57
61
|
prefs[:templates] = 'erb'
|
@@ -66,6 +70,7 @@ case prefs[:railsapps]
|
|
66
70
|
prefs[:starter_app] = 'users_app'
|
67
71
|
prefs[:form_builder] = 'none'
|
68
72
|
when 'rails3-subdomains'
|
73
|
+
prefs[:git] = true
|
69
74
|
prefs[:database] = 'mongodb'
|
70
75
|
prefs[:orm] = 'mongoid'
|
71
76
|
prefs[:templates] = 'haml'
|
@@ -87,6 +92,6 @@ name: railsapps
|
|
87
92
|
description: "Install RailsApps example applications."
|
88
93
|
author: RailsApps
|
89
94
|
|
90
|
-
requires: [auth, controllers,
|
95
|
+
requires: [auth, controllers, email, extras, frontend, gems, git, init, models, readme, routes, setup, testing, views]
|
91
96
|
run_after: [git]
|
92
97
|
category: configuration
|
data/recipes/readme.rb
CHANGED
@@ -29,8 +29,10 @@ after_everything do
|
|
29
29
|
# Ruby on Rails
|
30
30
|
gsub_file "README.textile", /\* Ruby/, "* Ruby version #{RUBY_VERSION}"
|
31
31
|
gsub_file "README.textile", /\* Rails/, "* Rails version #{Rails::VERSION::STRING}"
|
32
|
-
|
32
|
+
|
33
33
|
# Database
|
34
|
+
gsub_file "README.textile", /SQLite/, "PostgreSQL" if prefer :database, 'postgresql'
|
35
|
+
gsub_file "README.textile", /SQLite/, "MySQL" if prefer :database, 'mysql'
|
34
36
|
gsub_file "README.textile", /SQLite/, "MongoDB" if prefer :database, 'mongodb'
|
35
37
|
gsub_file "README.textile", /ActiveRecord/, "the Mongoid ORM" if prefer :orm, 'mongoid'
|
36
38
|
|
data/recipes/testing.rb
CHANGED
@@ -127,6 +127,21 @@ after_everything do
|
|
127
127
|
remove_file 'spec/helpers/home_helper_spec.rb'
|
128
128
|
remove_file 'spec/helpers/users_helper_spec.rb'
|
129
129
|
end
|
130
|
+
if (prefer :authentication, 'devise') && (prefer :starter_app, 'admin_app')
|
131
|
+
say_wizard "copying RSpec files from the rails3-bootstrap-devise-cancan examples"
|
132
|
+
repo = 'https://raw.github.com/RailsApps/rails3-bootstrap-devise-cancan/master/'
|
133
|
+
copy_from_repo 'spec/factories/users.rb', :repo => repo
|
134
|
+
gsub_file 'spec/factories/users.rb', /# confirmed_at/, "confirmed_at" if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')
|
135
|
+
copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo
|
136
|
+
copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo
|
137
|
+
copy_from_repo 'spec/models/user_spec.rb', :repo => repo
|
138
|
+
remove_file 'spec/views/home/index.html.erb_spec.rb'
|
139
|
+
remove_file 'spec/views/home/index.html.haml_spec.rb'
|
140
|
+
remove_file 'spec/views/users/show.html.erb_spec.rb'
|
141
|
+
remove_file 'spec/views/users/show.html.haml_spec.rb'
|
142
|
+
remove_file 'spec/helpers/home_helper_spec.rb'
|
143
|
+
remove_file 'spec/helpers/users_helper_spec.rb'
|
144
|
+
end
|
130
145
|
## RSPEC AND OMNIAUTH
|
131
146
|
if (prefer :authentication, 'omniauth') && (prefer :starter_app, 'users_app')
|
132
147
|
say_wizard "copying RSpec files from the rails3-mongoid-omniauth examples"
|
@@ -166,6 +181,31 @@ after_everything do
|
|
166
181
|
When I sign in with valid credentials
|
167
182
|
Then I see an unconfirmed account message
|
168
183
|
And I should be signed out
|
184
|
+
RUBY
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
if (prefer :authentication, 'devise') && (prefer :starter_app, 'admin_app')
|
189
|
+
say_wizard "copying Cucumber scenarios from the rails3-bootstrap-devise-cancan examples"
|
190
|
+
repo = 'https://raw.github.com/RailsApps/rails3-bootstrap-devise-cancan/master/'
|
191
|
+
copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo
|
192
|
+
copy_from_repo 'features/users/sign_in.feature', :repo => repo
|
193
|
+
copy_from_repo 'features/users/sign_out.feature', :repo => repo
|
194
|
+
copy_from_repo 'features/users/sign_up.feature', :repo => repo
|
195
|
+
copy_from_repo 'features/users/user_edit.feature', :repo => repo
|
196
|
+
copy_from_repo 'features/users/user_show.feature', :repo => repo
|
197
|
+
copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo
|
198
|
+
copy_from_repo 'features/support/paths.rb', :repo => repo
|
199
|
+
if (prefer :devise_modules, 'confirmable') || (prefer :devise_modules, 'invitable')
|
200
|
+
gsub_file 'features/step_definitions/user_steps.rb', /Welcome! You have signed up successfully./, "A message with a confirmation link has been sent to your email address."
|
201
|
+
inject_into_file 'features/users/sign_in.feature', :before => ' Scenario: User signs in successfully' do
|
202
|
+
<<-RUBY
|
203
|
+
Scenario: User has not confirmed account
|
204
|
+
Given I exist as an unconfirmed user
|
205
|
+
And I am not logged in
|
206
|
+
When I sign in with valid credentials
|
207
|
+
Then I see an unconfirmed account message
|
208
|
+
And I should be signed out
|
169
209
|
RUBY
|
170
210
|
end
|
171
211
|
end
|
data/templates/helpers.erb
CHANGED
@@ -49,6 +49,15 @@ def after_everything(&block); @after_everything_blocks << [@current_recipe, bloc
|
|
49
49
|
@before_configs = {}
|
50
50
|
def before_config(&block); @before_configs[@current_recipe] = block; end
|
51
51
|
|
52
|
+
def copy_from(source, destination)
|
53
|
+
begin
|
54
|
+
remove_file destination
|
55
|
+
get source, destination
|
56
|
+
rescue OpenURI::HTTPError
|
57
|
+
say_wizard "Unable to obtain #{source}"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
52
61
|
def copy_from_repo(filename, opts = {})
|
53
62
|
repo = 'https://raw.github.com/RailsApps/rails-composer/master/files/'
|
54
63
|
repo = opts[:repo] unless opts[:repo].nil?
|
data/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_apps_composer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: i18n
|
@@ -155,15 +155,16 @@ files:
|
|
155
155
|
- lib/rails_wizard/recipes.rb
|
156
156
|
- lib/rails_wizard/template.rb
|
157
157
|
- lib/rails_wizard.rb
|
158
|
+
- recipes/all.rb
|
158
159
|
- recipes/auth.rb
|
159
160
|
- recipes/controllers.rb
|
160
|
-
- recipes/database.rb
|
161
161
|
- recipes/email.rb
|
162
162
|
- recipes/example.rb
|
163
163
|
- recipes/extras.rb
|
164
164
|
- recipes/frontend.rb
|
165
165
|
- recipes/gems.rb
|
166
166
|
- recipes/git.rb
|
167
|
+
- recipes/init.rb
|
167
168
|
- recipes/models.rb
|
168
169
|
- recipes/prelaunch.rb
|
169
170
|
- recipes/railsapps.rb
|
@@ -201,7 +202,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
201
202
|
version: '0'
|
202
203
|
segments:
|
203
204
|
- 0
|
204
|
-
hash: -
|
205
|
+
hash: -1918959604150442453
|
205
206
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
206
207
|
none: false
|
207
208
|
requirements:
|
@@ -210,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
210
211
|
version: '0'
|
211
212
|
segments:
|
212
213
|
- 0
|
213
|
-
hash: -
|
214
|
+
hash: -1918959604150442453
|
214
215
|
requirements: []
|
215
216
|
rubyforge_project: rails_apps_composer
|
216
217
|
rubygems_version: 1.8.24
|