rails_apps_composer 2.2.16 → 2.2.17

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.
data/README.textile CHANGED
@@ -140,6 +140,8 @@ $ rails_apps_composer new myapp -l ~/recipes/
140
140
 
141
141
  If you create local recipes, please consider contributing them to the project.
142
142
 
143
+ If you want to only use your local recipes, and not include the default recipes, use the @-L@ flag.
144
+
143
145
  h3. Generate an Application Interactively
144
146
 
145
147
  You'll be prompted for recipes and gems:
@@ -261,6 +263,14 @@ $ rails_apps_composer template ~/Desktop/template.rb -d my_defaults.yaml
261
263
 
262
264
  Use the @my_defaults.yaml@ file to specify a list of recipes, preferences, and extra gems. You can use any name (and file extension) for the file. See the "Defaults File":http://railsapps.github.com/tutorial-rails-apps-composer.html#Defaults section in the Guide concerning the format of the defaults file. Use the "quiet flag" @-q@ if you want to skip all prompts.
263
265
 
266
+ h3. Generate an Application Template With Your Own Layout
267
+
268
+ If you want to generate an application template, but use your own layout to do so, you can use the @-t@ flag to set the directory where your templates are. Look at the @templates/@ directory in this gem to see how your templates should look.
269
+
270
+ <pre>
271
+ $ rails_apps_composer template ~/Desktop/template.rb -t ~/Desktop/my_templates
272
+ </pre>
273
+
264
274
  h3. Generate an Application from a Template
265
275
 
266
276
  After you've created a template file, you can generate an application from a template at any time using the @rails new@ command with the @-m@ option:
@@ -8,6 +8,8 @@ module RailsWizard
8
8
  method_option :recipes, :type => :array, :aliases => "-r"
9
9
  method_option :defaults, :type => :string, :aliases => "-d"
10
10
  method_option :recipe_dirs, :type => :array, :aliases => "-l"
11
+ method_option :no_default_recipes, :type => :boolean, :aliases => "-L"
12
+ method_option :template_root, :type => :string, :aliases => '-t'
11
13
  method_option :quiet, :type => :boolean, :aliases => "-q", :default => false
12
14
  def new(name)
13
15
  add_recipes
@@ -22,6 +24,8 @@ module RailsWizard
22
24
  method_option :recipes, :type => :array, :aliases => "-r"
23
25
  method_option :defaults, :type => :string, :aliases => "-d"
24
26
  method_option :recipe_dirs, :type => :array, :aliases => "-l"
27
+ method_option :no_default_recipes, :type => :boolean, :aliases => "-L"
28
+ method_option :template_root, :type => :string, :aliases => '-t'
25
29
  method_option :quiet, :type => :boolean, :aliases => "-q", :default => false
26
30
  def template(template_name)
27
31
  add_recipes
@@ -54,6 +58,7 @@ module RailsWizard
54
58
  def yellow; "\033[33m" end
55
59
 
56
60
  def add_recipes
61
+ Recipes.clear if options[:no_default_recipes]
57
62
  if dirs = options[:recipe_dirs]
58
63
  dirs.each { |d| Recipes.add_from_directory(d) }
59
64
  end
@@ -135,23 +140,27 @@ module RailsWizard
135
140
  default
136
141
  end
137
142
  end
138
-
143
+
139
144
  def ask_for_args(defaults)
140
145
  args = []
141
146
  default_args = defaults["args"] || {}
142
-
147
+
143
148
  question = "#{bold}Would you like to skip Test::Unit? (yes for RSpec) \033[33m(y/n)\033[0m#{clear}"
144
149
  args << "-T" if ask_for_arg(question, default_args[:skip_test_unit])
145
150
 
146
151
  question = "#{bold}Would you like to skip Active Record? (yes for MongoDB) \033[33m(y/n)\033[0m#{clear}"
147
152
  args << "-O" if ask_for_arg(question, default_args[:skip_active_record])
148
-
153
+
149
154
  args
150
155
  end
151
-
156
+
152
157
  #pass in name if you want to create a rails app
153
158
  #pass in file_name if you want to create a template
154
159
  def run_template(name, recipes, gems, args, defaults, file_name=nil)
160
+ if options[:template_root]
161
+ RailsWizard::Template.template_root = options[:template_root]
162
+ end
163
+
155
164
  if file_name
156
165
  file = File.new(file_name,'w')
157
166
  else
@@ -2,7 +2,7 @@ module RailsWizard
2
2
  module Recipes
3
3
  @@categories = {}
4
4
  @@list = {}
5
-
5
+
6
6
  def self.add(recipe)
7
7
  RailsWizard::Recipes.const_set ActiveSupport::Inflector.camelize(recipe.key), recipe
8
8
  @@list[recipe.key] = recipe
@@ -11,6 +11,14 @@ module RailsWizard
11
11
  recipe
12
12
  end
13
13
 
14
+ def self.clear
15
+ self.list.each do |recipe_key|
16
+ send(:remove_const, ActiveSupport::Inflector.camelize(recipe_key))
17
+ end
18
+ @@categories = {}
19
+ @@list = {}
20
+ end
21
+
14
22
  def self.[](key)
15
23
  @@list[key.to_s]
16
24
  end
@@ -19,7 +19,11 @@ module RailsWizard
19
19
  end
20
20
 
21
21
  def self.template_root
22
- File.dirname(__FILE__) + '/../../templates'
22
+ @template_root ||= File.dirname(__FILE__) + '/../../templates'
23
+ end
24
+
25
+ def self.template_root=(root)
26
+ @template_root = root
23
27
  end
24
28
 
25
29
  def self.render(template_name, binding = nil)
data/recipes/gems.rb CHANGED
@@ -75,7 +75,7 @@ gem 'machinist', '>= 2.0', :group => :test if prefer :fixtures, 'machinist'
75
75
  ## Front-end Framework
76
76
  gem 'bootstrap-sass', '>= 2.1.0.1' if prefer :bootstrap, 'sass'
77
77
  gem 'compass-rails', '>= 1.0.3', :group => :assets if prefer :frontend, 'foundation'
78
- gem 'zurb-foundation', '>= 3.1.1', :group => :assets if prefer :frontend, 'foundation'
78
+ gem 'zurb-foundation', '>= 3.2.0', :group => :assets if prefer :frontend, 'foundation'
79
79
  if prefer :bootstrap, 'less'
80
80
  gem 'twitter-bootstrap-rails', '>= 2.1.4', :group => :assets
81
81
  # install gem 'therubyracer' to use Less
data/recipes/saas.rb CHANGED
@@ -31,7 +31,7 @@ if prefer :railsapps, 'rails-stripe-membership-saas'
31
31
  copy_from_repo 'features/users/sign_up.feature', :repo => repo
32
32
  copy_from_repo 'features/step_definitions/user_steps.rb', :repo => repo
33
33
  copy_from_repo 'config/locales/devise.en.yml', :repo => repo
34
-
34
+
35
35
  # >-------------------------------[ Models ]--------------------------------<
36
36
  copy_from_repo 'app/models/ability.rb', :repo => repo
37
37
  copy_from_repo 'app/models/user.rb', :repo => repo
@@ -53,10 +53,10 @@ if prefer :railsapps, 'rails-stripe-membership-saas'
53
53
  copy_from_repo 'app/controllers/content_controller.rb', :repo => repo
54
54
  copy_from_repo 'app/controllers/registrations_controller.rb', :repo => repo
55
55
  copy_from_repo 'app/controllers/application_controller.rb', :repo => repo
56
+ copy_from_repo 'app/controllers/users_controller.rb', :repo => repo
56
57
 
57
58
  # >-------------------------------[ Mailers ]--------------------------------<
58
59
  generate 'mailer UserMailer'
59
- copy_from_repo 'spec/mailers/user_mailer_spec.rb', :repo => repo
60
60
  copy_from_repo 'app/mailers/user_mailer.rb', :repo => repo
61
61
 
62
62
  # >-------------------------------[ Views ]--------------------------------<
@@ -79,7 +79,13 @@ if prefer :railsapps, 'rails-stripe-membership-saas'
79
79
  copy_from_repo 'app/assets/javascripts/registrations.js.erb', :repo => repo
80
80
  copy_from_repo 'app/assets/stylesheets/application.css.scss', :repo => repo
81
81
  copy_from_repo 'app/assets/stylesheets/pricing.css.scss', :repo => repo
82
-
82
+
83
+ # >-------------------------------[ RSpec ]--------------------------------<
84
+ say_wizard "copying RSpec tests from the rails-stripe-membership-saas examples"
85
+ copy_from_repo 'spec/models/user_spec.rb', :repo => repo
86
+ copy_from_repo 'spec/controllers/content_controller_spec.rb', :repo => repo
87
+ copy_from_repo 'spec/mailers/user_mailer_spec.rb', :repo => repo
88
+
83
89
  ### GIT ###
84
90
  git :add => '-A' if prefer :git, true
85
91
  git :commit => '-qm "rails_apps_composer: membership app"' if prefer :git, true
data/recipes/testing.rb CHANGED
@@ -251,7 +251,9 @@ Fabricator(:user) do
251
251
  end
252
252
  RUBY
253
253
  end
254
- gsub_file 'features/step_definitions/user_steps.rb', /@user = FactoryGirl.create\(:user, email: @visitor\[:email\]\)/, '@user = Fabricate(:user, email: @visitor[:email])'
254
+ if prefer :integration, 'cucumber'
255
+ gsub_file 'features/step_definitions/user_steps.rb', /@user = FactoryGirl.create\(:user, email: @visitor\[:email\]\)/, '@user = Fabricate(:user, email: @visitor[:email])'
256
+ end
255
257
  gsub_file 'spec/controllers/users_controller_spec.rb', /@user = FactoryGirl.create\(:user\)/, '@user = Fabricate(:user)'
256
258
  end
257
259
  end # after_everything
@@ -26,4 +26,12 @@ describe RailsWizard::Recipes do
26
26
  subject.add_from_directory(File.join(File.dirname(__FILE__), '..', 'test_recipes'))
27
27
  subject.list.should include 'test_recipe_in_file'
28
28
  end
29
+
30
+ describe '.clear' do
31
+ it 'should remove all current recipes' do
32
+ RailsWizard::Recipes.clear
33
+ subject.list.should == []
34
+ subject.categories.should == []
35
+ end
36
+ end
29
37
  end
@@ -7,6 +7,18 @@ describe RailsWizard::Template do
7
7
  let(:gems){ ['foogem'] }
8
8
  let(:args){ [] }
9
9
 
10
+ describe '.template_root' do
11
+ it 'returns the gem ./templates directory by default' do
12
+ template_root = File.expand_path(subject.template_root)
13
+ template_root.should == File.expand_path('../../../templates', __FILE__)
14
+ end
15
+
16
+ it 'can be set to another directory' do
17
+ subject.template_root = '/tmp/templates'
18
+ subject.template_root.should == '/tmp/templates'
19
+ end
20
+ end
21
+
10
22
  describe '#initialize' do
11
23
  it 'should work with classes' do
12
24
  subject.new([recipe], gems).recipes.should == [recipe]
data/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RailsWizard
2
- VERSION = "2.2.16"
2
+ VERSION = "2.2.17"
3
3
  end
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.2.16
4
+ version: 2.2.17
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-10-24 00:00:00.000000000 Z
12
+ date: 2012-10-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: i18n
@@ -202,7 +202,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
202
202
  version: '0'
203
203
  segments:
204
204
  - 0
205
- hash: 2773202915050764008
205
+ hash: -4210114770382273959
206
206
  required_rubygems_version: !ruby/object:Gem::Requirement
207
207
  none: false
208
208
  requirements:
@@ -211,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
211
  version: '0'
212
212
  segments:
213
213
  - 0
214
- hash: 2773202915050764008
214
+ hash: -4210114770382273959
215
215
  requirements: []
216
216
  rubyforge_project: rails_apps_composer
217
217
  rubygems_version: 1.8.24