rails_apps_composer 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -1,16 +1,18 @@
1
1
  h1. Rails Apps Composer Gem
2
2
 
3
- A gem with recipes to create Rails application templates you can use to generate Rails starter apps. Creates ready-to-run Rails web applications. Makes it easy to create and maintain a starter app using your own preferred options.
3
+ A gem with recipes to create Rails application templates you can use to generate Rails starter apps. Creates ready-to-run Rails web applications. Makes it easy to create and maintain a starter app.
4
+
5
+ I use the Rails Apps Composer gem to create the "Rails Example Apps":http://railsapps.github.com/ for the "RailsApps project":https://github.com/RailsApps.
4
6
 
5
7
  h4. Based on Michael Bleigh's RailsWizard Gem
6
8
 
7
- The rails_apps_composer gem is a fork of "Michael Bleigh's RailsWizard gem":https://github.com/intridea/rails_wizard (see credits below). The purpose of this fork is to provide recipes for ready-to-run Rails starter apps. Several recipes provided by the rails_apps_composer gem are different from those provided by the rails_wizard gem. Applications generated with the rails_apps_composer gem are more complete; for example, they may include a home page with sign-in, sign-out navigation links.
9
+ The Rails Apps Composer gem is a fork of "Michael Bleigh's RailsWizard gem":https://github.com/intridea/rails_wizard (see credits below). The purpose of the fork is to provide recipes for ready-to-run Rails starter apps. Several recipes provided by the Rails Apps Composer gem are different from those provided by the rails_wizard gem. Applications generated with the Rails Apps Composer gem are more complete; for example, they may include a home page with sign-in, sign-out navigation links.
8
10
 
9
11
  Any issues? Please create a "GitHub issue":http://github.com/RailsApps/rails_apps_composer/issues.
10
12
 
11
13
  h2. !http://twitter-badges.s3.amazonaws.com/t_logo-a.png(Follow on Twitter)!:http://www.twitter.com/rails_apps Follow on Twitter !http://railsapps.github.com/images/mailing-list-icon.jpg(Join the Mailing List)!:http://eepurl.com/dQx3o Join the Mailing List
12
14
 
13
- Follow the project on Twitter: "http://twitter.com/rails_apps":http://twitter.com/rails_apps. Tweet some praise if you like what you've found.
15
+ Follow the project on Twitter: "rails_apps":http://twitter.com/rails_apps. Tweet some praise if you like what you've found.
14
16
 
15
17
  <a href="http://eepurl.com/dQx3o">Join the email list</a> (low volume, announcements only) for project updates and my tips about Rails resources.
16
18
 
@@ -28,17 +30,12 @@ h2. Dependencies
28
30
 
29
31
  Before generating a new Rails app, you will need:
30
32
 
31
- * The Ruby language (version 1.8.7 or 1.9.2)
32
- * Rails (version 3.0.4 or newer)
33
-
34
- I recommend installing rvm, the "Ruby Version Manager":http://rvm.beginrescueend.com/, to manage multiple versions of Rails.
33
+ * The Ruby language (version 1.9.2)
34
+ * Rails
35
35
 
36
- If you are using rvm, you can see a list of the Ruby versions currently installed:
37
- @$ rvm list@
36
+ Recipes can be written to detect which version of Rails is in use. Some of the recipes behave differently depending on the version of Rails.
38
37
 
39
- Check that appropriate versions of Ruby and Rails are installed in your development environment:
40
- @$ ruby -v@
41
- @$ rails -v@
38
+ See "Managing Rails Versions and Gems":http://railsapps.github.com/managing-rails-versions-gems.html for detailed instructions and advice.
42
39
 
43
40
  h2. Installation
44
41
 
@@ -58,11 +55,11 @@ You'll find more details about the available recipes by browsing the repository
58
55
 
59
56
  h4. Generate a Starter App
60
57
 
61
- There are two ways to use the rails_apps_composer gem to generate a starter app.
58
+ There are two ways to use the Rails Apps Composer gem to generate a starter app.
62
59
 
63
60
  If you want to build a starter app for one-time use, you can build an application by providing a list of recipes with the @-r@ option. This will automatically generate an application using the specified recipes.
64
61
 
65
- If you want to create and save an application template that you can reuse as needed to "clone" identical starter apps, you can download the rails_apps_composer project, customize recipes as needed, and use a @rake@ task to save a reusable application template file.
62
+ If you want to create and save an application template that you can reuse as needed to "clone" identical starter apps, you can download the Rails Apps Composer project, customize recipes as needed, and use a @rake@ task to save a reusable application template file.
66
63
 
67
64
  Each of these approaches is described below.
68
65
 
@@ -70,13 +67,13 @@ h2. Make Your Own Starter App for One-Time Use
70
67
 
71
68
  h4. Select Recipes
72
69
 
73
- You can mix and match recipes to create your own customized starter app. Browse the repository "recipes directory":https://github.com/RailsApps/rails_apps_composer/tree/master/recipes to see what is available. Then provide your list of recipes to the rails_apps_composer gem using the @-r@ option and generate an app as needed. Here's an example that creates a simple app using jquery and haml:
70
+ You can mix and match recipes to create your own customized starter app. Browse the repository "recipes directory":https://github.com/RailsApps/rails_apps_composer/tree/master/recipes to see what is available. Then provide your list of recipes to the Rails Apps Composer gem using the @-r@ option and generate an app as needed. Here's an example that creates a simple app using jquery and haml:
74
71
 
75
72
  <pre>
76
73
  $ rails_apps_composer new APP_NAME -r jquery haml
77
74
  </pre>
78
75
 
79
- To build the "rails3-mongoid-devise":http://github.com/RailsApps/rails3-mongoid-devise/ example application, run the command:
76
+ For example, to build the "rails3-mongoid-devise":http://github.com/RailsApps/rails3-mongoid-devise/ example application, run the command:
80
77
 
81
78
  <pre>
82
79
  $ rails_apps_composer new APP_NAME -r jquery haml rspec cucumber mongoid action_mailer devise add_user home_page home_page_users seed_database users_page css_setup application_layout devise_navigation cleanup ban_spiders git
@@ -86,13 +83,13 @@ h2. Make Your Own Starter App with a Reusable Application Template
86
83
 
87
84
  You can modify the recipes and save an application template that creates your own customized starter app.
88
85
 
89
- First, you'll need to make your own copy of the rails_apps_composer gem.
86
+ First, you'll need to make your own copy of the Rails Apps Composer gem.
90
87
 
91
88
  @$ git clone git://github.com/RailsApps/rails_apps_composer.git@
92
89
 
93
90
  @$ cd rails_apps_composer@
94
91
 
95
- The "mg":https://github.com/sr/mg "minimal gem" is required for development of the rails_apps_composer gem. Several other gems are needed as well:
92
+ The "mg":https://github.com/sr/mg "minimal gem" is required for development of the Rails Apps Composer gem. Several other gems are needed as well:
96
93
 
97
94
  @$ gem install i18n activesupport thor rspec mg@
98
95
 
@@ -102,7 +99,7 @@ Modify or write new recipes as you wish (see below for details about writing rec
102
99
 
103
100
  h4. Save the Application Template
104
101
 
105
- The rails_apps_composer gem creates an application template as an intermediate step before generating an application. You can generate and save the application template. Here's an example of generating an application template and saving the template to a file:
102
+ The Rails Apps Composer gem creates an application template as an intermediate step before generating an application. You can generate and save the application template. Here's an example of generating an application template and saving the template to a file:
106
103
 
107
104
  <pre>
108
105
  $ rake print --silent RECIPES=recipe1,recipe2 > ~/Desktop/template.txt
@@ -110,13 +107,13 @@ $ rake print --silent RECIPES=recipe1,recipe2 > ~/Desktop/template.txt
110
107
 
111
108
  If you don't include the @--silent@ option, the rake task will generate the application template with an extraneous first line. Open the template file and remove the first line if you encounter this problem.
112
109
 
113
- The rails_apps_composer gem creates an application template that can be used by the @rails new@ command with the @-m@ option. For example:
110
+ The Rails Apps Composer gem creates an application template that can be used by the @rails new@ command with the @-m@ option. For example:
114
111
 
115
112
  <pre>
116
113
  $ rails new testapp -m ~/Desktop/template.txt
117
114
  </pre>
118
115
 
119
- You can specify the @-T -O -J@ flags as needed to skip Test::Unit files and Active Record files. For Rails 3.0, you can also specify the @-J@ flag to skip Prototype files.
116
+ You can specify the @-T -O@ flags as needed to skip Test::Unit files and Active Record files. For Rails 3.0, you can also specify the @-J@ flag to skip Prototype files (not needed for Rails 3.1).
120
117
 
121
118
  That's all it takes. You'll have a ready-to-customize Rails web application in minutes.
122
119
 
@@ -168,11 +165,11 @@ For your reference, here’s an annotated list of available "recipes for the Rai
168
165
 
169
166
  h2. Writing New Recipes
170
167
 
171
- You can find the rails_apps_composer recipe collection in the GitHub repository's "recipes directory":https://github.com/RailsApps/rails_apps_composer/tree/master/recipes. If you find errors or improve a recipe you can contribute to the project by submitting a pull request or creating a "Github issue":http://github.com/RailsApps/rails_apps_composer/issues.
168
+ You can find the Rails Apps Composer recipe collection in the GitHub repository's "recipes directory":https://github.com/RailsApps/rails_apps_composer/tree/master/recipes. If you find errors or improve a recipe you can contribute to the project by submitting a pull request or creating a "Github issue":http://github.com/RailsApps/rails_apps_composer/issues.
172
169
 
173
170
  h4. Rails Wizard Basics
174
171
 
175
- For more information on all available options for authoring recipes that can be read by the rails_wizard or rails_apps_composer gems, please see the "wiki for Michael Bleigh's RailsWizard gem":https://github.com/intridea/rails_wizard/wiki.
172
+ For more information on all available options for authoring recipes that can be read by the rails_wizard or Rails Apps Composer gems, please see the "wiki for Michael Bleigh's RailsWizard gem":https://github.com/intridea/rails_wizard/wiki.
176
173
 
177
174
  Recipes are made of up *template code* and *YAML back-matter* stored in a ruby file. The @__END__@ parsing convention is used so that each recipe is actually a valid, parseable Ruby file. The structure of a recipe looks something like this:
178
175
 
@@ -193,7 +190,7 @@ author: mbleigh
193
190
 
194
191
  h4. Rails Apps Composer Differences
195
192
 
196
- The rails_apps_composer gem is very similar to the rails_wizard gem, with one significant difference. The rails_wizard gem allows specification of execution order for recipes with @run_after@ and @run_after@ configuration flags. The rails_apps_composer gem does not support @run_after@ or @run_after@; instead, the order which you provide the recipes sets the execution order. This makes it easier to chain a series of recipes in the order you prefer. For example,
193
+ The Rails Apps Composer gem is very similar to the rails_wizard gem, with one significant difference. The rails_wizard gem allows specification of execution order for recipes with @run_after@ and @run_after@ configuration flags. The Rails Apps Composer gem does not support @run_after@ or @run_after@; instead, the order which you provide the recipes sets the execution order. This makes it easier to chain a series of recipes in the order you prefer. For example,
197
194
 
198
195
  <pre>
199
196
  $ rails_apps_composer new APP_NAME -r git jquery haml
@@ -203,7 +200,7 @@ installs jquery before haml.
203
200
 
204
201
  h4. Recipe Differences
205
202
 
206
- Several recipes provided by the rails_apps_composer gem are different from those provided by the rails_wizard gem.
203
+ Several recipes provided by the Rails Apps Composer gem are different from those provided by the rails_wizard gem.
207
204
 
208
205
  h4. Rails Wizard RSpec Tests
209
206
 
@@ -244,11 +241,11 @@ RSpec, Cucumber, and Yard recipes were contributed by "Ramon Brooker":http://cog
244
241
  Additional recipes by Daniel Kehoe, "http://danielkehoe.com/":http://danielkehoe.com/.
245
242
 
246
243
  Is the gem useful to you? Follow the project on Twitter:
247
- "http://twitter.com/rails_apps":http://twitter.com/rails_apps
244
+ "rails_apps":http://twitter.com/rails_apps
248
245
  and tweet some praise. I'd love to know you were helped out by the gem.
249
246
 
250
247
  h2. License
251
248
 
252
249
  h4. MIT License
253
250
 
254
- The rails_apps_composer gem and its recipes are distributed under the MIT License.
251
+ The Rails Apps Composer gem and its recipes are distributed under the MIT License.
@@ -10,7 +10,7 @@ after_bundler do
10
10
  remove_file 'app/views/layouts/application.html.erb'
11
11
  # There is Haml code in this script. Changing the indentation is perilous between HAMLs.
12
12
  create_file 'app/views/layouts/application.html.haml' do <<-HAML
13
- !!!
13
+ !!! 5
14
14
  %html
15
15
  %head
16
16
  %title #{app_name}
@@ -23,6 +23,10 @@ after_bundler do
23
23
  = yield
24
24
  HAML
25
25
  end
26
+ if recipes.include? 'rails 3.1'
27
+ gsub_file 'app/views/layouts/application.html.haml', /stylesheet_link_tag :all/, 'stylesheet_link_tag :application'
28
+ gsub_file 'app/views/layouts/application.html.haml', /javascript_include_tag :defaults/, 'javascript_include_tag :application'
29
+ end
26
30
  else
27
31
  inject_into_file 'app/views/layouts/application.html.erb', :after => "<body>\n" do
28
32
  <<-ERB
data/recipes/capybara.rb CHANGED
@@ -1,4 +1,4 @@
1
- gem 'capybara', :group => [:development, :test]
1
+ gem 'capybara', :group => [:development, :test] unless config['cucumber']
2
2
 
3
3
  after_bundler do
4
4
  create_file "spec/support/capybara.rb", <<-RUBY
data/recipes/css_setup.rb CHANGED
@@ -6,14 +6,15 @@ after_bundler do
6
6
  say_wizard "CssSetup recipe running 'after bundler'"
7
7
 
8
8
  # Add a stylesheet with styles for a horizontal menu and flash messages
9
- create_file 'public/stylesheets/application.css' do <<-CSS
9
+ css = <<-CSS
10
+
10
11
  ul.hmenu {
11
- list-style: none;
12
+ list-style: none;
12
13
  margin: 0 0 2em;
13
14
  padding: 0;
14
15
  }
15
16
  ul.hmenu li {
16
- display: inline;
17
+ display: inline;
17
18
  }
18
19
  #flash_notice, #flash_alert {
19
20
  padding: 5px 8px;
@@ -27,7 +28,12 @@ ul.hmenu li {
27
28
  background-color: #FCC;
28
29
  border: solid 1px #C66;
29
30
  }
31
+
30
32
  CSS
33
+ if recipes.include? 'rails 3.0'
34
+ create_file 'public/stylesheets/application.css', css
35
+ else
36
+ append_file 'app/assets/stylesheets/application.css', css
31
37
  end
32
38
 
33
39
  end
data/recipes/cucumber.rb CHANGED
@@ -4,13 +4,13 @@
4
4
  if config['cucumber']
5
5
  if recipes.include? 'rails 3.0'
6
6
  # for Rails 3.0, use only gem versions we know that work
7
- gem 'cucumber-rails', '0.4.1', :group => :test
8
- gem 'capybara', '0.4.1.2', :group => :test
7
+ gem 'cucumber-rails', '0.5.1', :group => :test
8
+ gem 'capybara', '1.0.0.beta1', :group => :test
9
9
  gem 'database_cleaner', '0.6.7', :group => :test
10
10
  gem 'launchy', '0.4.0', :group => :test
11
11
  else
12
12
  # for Rails 3.1+, use optimistic versioning for gems
13
- gem 'cucumber-rails', '>= 0.5.0', :group => :test
13
+ gem 'cucumber-rails', '>= 0.5.1', :group => :test
14
14
  gem 'capybara', '>= 1.0.0.beta1', :group => :test
15
15
  gem 'database_cleaner', '>= 0.6.7', :group => :test
16
16
  gem 'launchy', '>= 0.4.0', :group => :test
@@ -35,17 +35,17 @@ end
35
35
  if config['cucumber']
36
36
  if recipes.include? 'devise'
37
37
  after_bundler do
38
- say_wizard "Copying Cucumber scenarios from the rails3-mongoid-devise examples"
38
+ say_wizard "Copying Cucumber scenarios from the rails3-devise-rspec-cucumber examples"
39
39
  begin
40
- # copy all the Cucumber scenario files from the rails3-mongoid-devise example app
41
- get 'https://github.com/RailsApps/rails3-mongoid-devise/raw/master/features/users/sign_in.feature', 'features/users/sign_in.feature'
42
- get 'https://github.com/RailsApps/rails3-mongoid-devise/raw/master/features/users/sign_out.feature', 'features/users/sign_out.feature'
43
- get 'https://github.com/RailsApps/rails3-mongoid-devise/raw/master/features/users/sign_up.feature', 'features/users/sign_up.feature'
44
- get 'https://github.com/RailsApps/rails3-mongoid-devise/raw/master/features/users/user_edit.feature', 'features/users/user_edit.feature'
45
- get 'https://github.com/RailsApps/rails3-mongoid-devise/raw/master/features/users/user_show.feature', 'features/users/user_show.feature'
46
- get 'https://github.com/RailsApps/rails3-mongoid-devise/raw/master/features/step_definitions/user_steps.rb', 'features/step_definitions/user_steps.rb'
40
+ # copy all the Cucumber scenario files from the rails3-devise-rspec-cucumber example app
41
+ get 'https://github.com/RailsApps/rails3-devise-rspec-cucumber/raw/master/features/users/sign_in.feature', 'features/users/sign_in.feature'
42
+ get 'https://github.com/RailsApps/rails3-devise-rspec-cucumber/raw/master/features/users/sign_out.feature', 'features/users/sign_out.feature'
43
+ get 'https://github.com/RailsApps/rails3-devise-rspec-cucumber/raw/master/features/users/sign_up.feature', 'features/users/sign_up.feature'
44
+ get 'https://github.com/RailsApps/rails3-devise-rspec-cucumber/raw/master/features/users/user_edit.feature', 'features/users/user_edit.feature'
45
+ get 'https://github.com/RailsApps/rails3-devise-rspec-cucumber/raw/master/features/users/user_show.feature', 'features/users/user_show.feature'
46
+ get 'https://github.com/RailsApps/rails3-devise-rspec-cucumber/raw/master/features/step_definitions/user_steps.rb', 'features/step_definitions/user_steps.rb'
47
47
  remove_file 'features/support/paths.rb'
48
- get 'https://github.com/RailsApps/rails3-mongoid-devise/raw/master/features/support/paths.rb', 'features/support/paths.rb'
48
+ get 'https://github.com/RailsApps/rails3-devise-rspec-cucumber/raw/master/features/support/paths.rb', 'features/support/paths.rb'
49
49
  rescue OpenURI::HTTPError
50
50
  say_wizard "Unable to obtain Cucumber example files from the repo"
51
51
  end
@@ -64,9 +64,9 @@ ERB
64
64
  if recipes.include? 'haml'
65
65
  # There is Haml code in this script. Changing the indentation is perilous between HAMLs.
66
66
  inject_into_file 'app/views/layouts/application.html.haml', :after => "%body\n" do <<-HAML
67
- %ul.hmenu
68
- = render 'devise/menu/registration_items'
69
- = render 'devise/menu/login_items'
67
+ %ul.hmenu
68
+ = render 'devise/menu/registration_items'
69
+ = render 'devise/menu/login_items'
70
70
  HAML
71
71
  end
72
72
  else
data/recipes/rspec.rb CHANGED
@@ -6,7 +6,7 @@ if config['rspec']
6
6
  # for Rails 3.0, use only gem versions we know that work
7
7
  say_wizard "REMINDER: When creating a Rails app using RSpec..."
8
8
  say_wizard "you should add the '-T' flag to 'rails new'"
9
- gem 'rspec-rails', '2.5.0', :group => [:development, :test]
9
+ gem 'rspec-rails', '2.6.1', :group => [:development, :test]
10
10
  if recipes.include? 'mongoid'
11
11
  # use the database_cleaner gem to reset the test database
12
12
  gem 'database_cleaner', '0.6.7', :group => :test
@@ -19,7 +19,7 @@ if config['rspec']
19
19
  end
20
20
  else
21
21
  # for Rails 3.1+, use optimistic versioning for gems
22
- gem 'rspec-rails', '>= 2.6.0', :group => [:development, :test]
22
+ gem 'rspec-rails', '>= 2.6.1', :group => [:development, :test]
23
23
  if recipes.include? 'mongoid'
24
24
  # use the database_cleaner gem to reset the test database
25
25
  gem 'database_cleaner', '>= 0.6.7', :group => :test
data/templates/layout.erb CHANGED
@@ -57,6 +57,7 @@ say_wizard "Checking configuration. Please confirm your preferences."
57
57
  say_wizard "Running 'bundle install'. This will take a while."
58
58
  run 'bundle install'
59
59
  say_wizard "Running 'after bundler' callbacks."
60
+ require 'bundler/setup'
60
61
  @after_blocks.each{|b| config = @configs[b[0]] || {}; @current_recipe = b[0]; b[1].call}
61
62
 
62
63
  @current_recipe = nil
data/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RailsWizard
2
- VERSION = "1.0.4"
2
+ VERSION = "1.0.5"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rails_apps_composer
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.4
5
+ version: 1.0.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Daniel Kehoe
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-24 00:00:00 Z
13
+ date: 2011-05-27 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: i18n
@@ -137,7 +137,6 @@ files:
137
137
  - recipes/pow.rb
138
138
  - recipes/prototype.rb
139
139
  - recipes/rails_admin.rb
140
- - recipes/rake_fix.rb
141
140
  - recipes/redis.rb
142
141
  - recipes/redistogo.rb
143
142
  - recipes/rightjs.rb
@@ -176,7 +175,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
176
175
  requirements:
177
176
  - - ">="
178
177
  - !ruby/object:Gem::Version
179
- hash: 822178014315943346
178
+ hash: -1974234557299836899
180
179
  segments:
181
180
  - 0
182
181
  version: "0"
@@ -185,14 +184,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
184
  requirements:
186
185
  - - ">="
187
186
  - !ruby/object:Gem::Version
188
- hash: 822178014315943346
187
+ hash: -1974234557299836899
189
188
  segments:
190
189
  - 0
191
190
  version: "0"
192
191
  requirements: []
193
192
 
194
193
  rubyforge_project: rails_apps_composer
195
- rubygems_version: 1.7.2
194
+ rubygems_version: 1.8.4
196
195
  signing_key:
197
196
  specification_version: 3
198
197
  summary: A version of the RailsWizard gem with custom recipes for Rails starter apps.
data/recipes/rake_fix.rb DELETED
@@ -1,25 +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/rake_fix.rb
3
-
4
- if config['rakefix']
5
- if recipes.include? 'rails 3.0'
6
- # for Rails 3.0, bind rake gem at version 0.8.7
7
- gem 'rake', '0.8.7'
8
- end
9
- else
10
- recipes.delete('rakefix')
11
- end
12
-
13
- __END__
14
-
15
- name: RakeFix
16
- description: "For Rails 3.0, bind rake gem at version 0.8.7."
17
- author: RailsApps
18
-
19
- category: other
20
- tags: [utilities, configuration]
21
-
22
- config:
23
- - rakefix:
24
- type: boolean
25
- prompt: Would you like to use Rake gem version 0.8.7 (recommended)?