rails_apps_composer 2.0.1 → 2.1.0

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
@@ -1,4 +1,4 @@
1
- h1. !http://railsapps.github.com/images/rails-36x36.jpg(Rails Apps Composer Gem)! Rails Apps Composer 2.0
1
+ h1. !http://railsapps.github.com/images/rails-36x36.jpg(Rails Apps Composer Gem)! Rails Apps Composer 2.1
2
2
 
3
3
  The Rails Apps Composer gem installs a command line tool to assemble a Rails application from a collection of "recipes."
4
4
 
@@ -7,6 +7,8 @@ What you can do with the rails_apps_composer gem:
7
7
  * create a starter app from the command line
8
8
  * make a reusable application template
9
9
 
10
+ You can use local recipes as well as recipes supplied with the gem.
11
+
10
12
  The "Rails Composer":http://railsapps.github.com/rails-composer/ tool is built with the rails_apps_composer gem. The Rails Composer tool creates the "example applications":http://railsapps.github.com/ for the "RailsApps":http://railsapps.github.com/ project.
11
13
 
12
14
  The "Guide to the Rails Apps Composer Gem":http://railsapps.github.com/tutorial-rails-apps-composer.html provides complete documentation:
@@ -26,9 +28,15 @@ h2. !http://twitter-badges.s3.amazonaws.com/t_logo-a.png(Follow on Twitter)!:htt
26
28
 
27
29
  Follow the project on Twitter: "@rails_apps":http://twitter.com/rails_apps. Tweet some praise if you like what you've found.
28
30
 
29
- h2. What's New in Version 2.0
31
+ h2. What's New
32
+
33
+ See the "CHANGELOG":https://github.com/RailsApps/rails_apps_composer/blob/master/CHANGELOG.textile for details.
34
+
35
+ h3. Version 2.1
36
+
37
+ * use local recipes
30
38
 
31
- Rails_apps_composer 2.0 is significantly different from earlier versions:
39
+ h3. Version 2.0
32
40
 
33
41
  * the "Guide":http://railsapps.github.com/tutorial-rails-apps-composer.html provides complete documentation
34
42
  * diagnostics compare your selected recipes and preferences to known working combinations
@@ -7,7 +7,9 @@ module RailsWizard
7
7
  desc "new APP_NAME", "create a new Rails app"
8
8
  method_option :recipes, :type => :array, :aliases => "-r"
9
9
  method_option :defaults, :type => :string, :aliases => "-d"
10
+ method_option :recipe_dirs, :type => :array, :aliases => "-l"
10
11
  def new(name)
12
+ add_recipes
11
13
  args = ask_for_args
12
14
  recipes, defaults = load_defaults
13
15
  recipes = ask_for_recipes(recipes)
@@ -18,7 +20,9 @@ module RailsWizard
18
20
  desc "template TEMPLATE_FILE", "create a new Rails template"
19
21
  method_option :recipes, :type => :array, :aliases => "-r"
20
22
  method_option :defaults, :type => :string, :aliases => "-d"
23
+ method_option :recipe_dirs, :type => :array, :aliases => "-l"
21
24
  def template(template_name)
25
+ add_recipes
22
26
  recipes, defaults = load_defaults
23
27
  recipes = ask_for_recipes(recipes)
24
28
  gems = ask_for_gems
@@ -46,6 +50,12 @@ module RailsWizard
46
50
  def green; "\033[32m" end
47
51
  def yellow; "\033[33m" end
48
52
 
53
+ def add_recipes
54
+ if dirs = options[:recipe_dirs]
55
+ dirs.each { |d| Recipes.add_from_directory(d) }
56
+ end
57
+ end
58
+
49
59
  def load_defaults
50
60
  # Load defaults from a file; if a file specifies recipes, they'll be run *before*
51
61
  # any on the command line (or prompted for)..
@@ -34,5 +34,15 @@ module RailsWizard
34
34
  def self.remove_from_category(category, recipe)
35
35
  (@@categories[category.to_s] ||= []).delete(recipe.key)
36
36
  end
37
+
38
+ def self.add_from_directory(directory)
39
+ Dir.foreach(directory) do |file|
40
+ path = File.join(directory, file)
41
+ next unless path.match /\.rb$/
42
+ key = File.basename(path, '.rb')
43
+ recipe = Recipe.generate(key, File.open(path))
44
+ add(recipe)
45
+ end
46
+ end
37
47
  end
38
48
  end
data/lib/rails_wizard.rb CHANGED
@@ -4,8 +4,4 @@ require 'rails_wizard/config'
4
4
  require 'rails_wizard/diagnostics'
5
5
  require 'rails_wizard/template'
6
6
 
7
- Dir[File.dirname(__FILE__) + '/../recipes/*.rb'].each do |path|
8
- key = File.basename(path, '.rb')
9
- recipe = RailsWizard::Recipe.generate(key, File.open(path))
10
- RailsWizard::Recipes.add(recipe)
11
- end
7
+ RailsWizard::Recipes.add_from_directory(File.dirname(__FILE__) + '/../recipes')
data/recipes/gems.rb CHANGED
@@ -15,7 +15,7 @@ gem 'unicorn', '>= 4.3.1', :group => :production if prefer :prod_webserver, 'uni
15
15
  gem 'puma', '>= 1.5.0', :group => :production if prefer :prod_webserver, 'puma'
16
16
 
17
17
  ## Database Adapter
18
- gem 'mongoid', '>= 3.0.1' if prefer :orm, 'mongoid'
18
+ gem 'mongoid', '>= 3.0.3' if prefer :orm, 'mongoid'
19
19
  gem 'pg', '>= 0.14.0' if prefer :database, 'postgresql'
20
20
  gem 'mysql2', '>= 0.3.11' if prefer :database, 'mysql'
21
21
  copy_from_repo 'config/database-postgresql.yml', :prefs => 'postgresql'
@@ -54,24 +54,24 @@ end
54
54
  if prefer :integration, 'cucumber'
55
55
  gem 'cucumber-rails', '>= 1.3.0', :group => :test, :require => false
56
56
  gem 'database_cleaner', '>= 0.8.0', :group => :test unless prefer :orm, 'mongoid'
57
- gem 'launchy', '>= 2.1.0', :group => :test
57
+ gem 'launchy', '>= 2.1.2', :group => :test
58
58
  end
59
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'
60
+ gem 'factory_girl_rails', '>= 4.0.0', :group => [:development, :test] if prefer :fixtures, 'factory_girl'
61
+ gem 'machinist', '>= 2.0', :group => :test if prefer :fixtures, 'machinist'
62
62
 
63
63
  ## Front-end Framework
64
64
  gem 'bootstrap-sass', '>= 2.0.4.0' if prefer :bootstrap, 'sass'
65
- gem 'zurb-foundation', '>= 3.0.5' if prefer :frontend, 'foundation'
65
+ gem 'zurb-foundation', '>= 3.0.8' if prefer :frontend, 'foundation'
66
66
  if prefer :bootstrap, 'less'
67
- gem 'twitter-bootstrap-rails', '>= 2.0.3', :group => :assets
67
+ gem 'twitter-bootstrap-rails', '>= 2.1.1', :group => :assets
68
68
  # install gem 'therubyracer' to use Less
69
- gem 'therubyracer', :group => :assets, :platform => :ruby
69
+ gem 'therubyracer', '>= 0.10.2', :group => :assets, :platform => :ruby
70
70
  end
71
71
 
72
72
  ## Email
73
- gem 'sendgrid' if prefer :email, 'sendgrid'
74
- gem 'hominid' if prefer :email, 'mandrill'
73
+ gem 'sendgrid', '>= 1.0.1' if prefer :email, 'sendgrid'
74
+ gem 'hominid', '>= 3.0.5' if prefer :email, 'mandrill'
75
75
 
76
76
  ## Authentication (Devise)
77
77
  gem 'devise', '>= 2.1.2' if prefer :authentication, 'devise'
@@ -89,7 +89,7 @@ gem 'omniauth-tumblr' if prefer :omniauth_provider, 'tumblr'
89
89
  ## Authorization
90
90
  if prefer :authorization, 'cancan'
91
91
  gem 'cancan', '>= 1.6.8'
92
- gem 'rolify', '>= 3.1.0'
92
+ gem 'rolify', '>= 3.2.0'
93
93
  end
94
94
 
95
95
  ## Signup App
data/recipes/models.rb CHANGED
@@ -33,17 +33,19 @@ after_bundler do
33
33
  ### SUBDOMAINS ###
34
34
  copy_from_repo 'app/models/user.rb', :repo => 'https://raw.github.com/RailsApps/rails3-subdomains/master/' if prefer :starter_app, 'subdomains'
35
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"
36
+ if prefer :authorization, 'cancan'
37
+ unless prefer :orm, 'mongoid'
38
+ generate 'rolify:role Role User'
39
+ else
40
+ generate 'rolify:role Role User mongoid'
41
+ # correct the generation of rolify 3.1 with mongoid
42
+ # the call to `rolify` should be *after* the inclusion of mongoid
43
+ # (see https://github.com/EppO/rolify/issues/61)
44
+ # This isn't needed for rolify>=3.2.0.beta4, but should cause no harm
45
+ gsub_file 'app/models/user.rb',
46
+ /^\s*(rolify.*?)$\s*(include Mongoid::Document.*?)$/,
47
+ " \\2\n extend Rolify\n \\1\n"
48
+ end
47
49
  end
48
50
  ### GIT ###
49
51
  git :add => '.' if prefer :git, true
@@ -21,4 +21,9 @@ describe RailsWizard::Recipes do
21
21
  RailsWizard::Recipes.for('test').should be_include('recipe_test')
22
22
  end
23
23
  end
24
+
25
+ it 'should add recipes in a directory with add_from_directory' do
26
+ subject.add_from_directory(File.join(File.dirname(__FILE__), '..', 'test_recipes'))
27
+ subject.list.should include 'test_recipe_in_file'
28
+ end
24
29
  end
@@ -0,0 +1,9 @@
1
+ say_wizard "Hi! I am a test."
2
+
3
+ __END__
4
+
5
+ name: test_recipe_in_file
6
+ description: "this is test file"
7
+ author: githubname
8
+
9
+ category: test
data/templates/layout.erb CHANGED
@@ -98,7 +98,11 @@ end
98
98
  # >-----------------------------[ Run 'Bundle Install' ]-------------------------------<
99
99
 
100
100
  say_wizard "Installing gems. This will take a while."
101
- run 'bundle install --without production'
101
+ if prefs.has_key? :bundle_path
102
+ run "bundle install --without production #{prefs[:bundle_path]}"
103
+ else
104
+ run 'bundle install --without production'
105
+ end
102
106
 
103
107
  # >-----------------------------[ Run 'After Bundler' Callbacks ]-------------------------------<
104
108
 
data/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RailsWizard
2
- VERSION = "2.0.1"
2
+ VERSION = "2.1.0"
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.0.1
4
+ version: 2.1.0
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-09 00:00:00.000000000 Z
12
+ date: 2012-08-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: i18n
@@ -183,6 +183,7 @@ files:
183
183
  - spec/spec_helper.rb
184
184
  - spec/support/rails_directory.rb
185
185
  - spec/support/template_runner.rb
186
+ - spec/test_recipes/test_recipe_in_file.rb
186
187
  - bin/rails_apps_composer
187
188
  homepage: http://github.com/RailsApps/rails_apps_composer
188
189
  licenses: []
@@ -198,7 +199,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
198
199
  version: '0'
199
200
  segments:
200
201
  - 0
201
- hash: -2921388160186911464
202
+ hash: 282801510994621394
202
203
  required_rubygems_version: !ruby/object:Gem::Requirement
203
204
  none: false
204
205
  requirements:
@@ -207,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
208
  version: '0'
208
209
  segments:
209
210
  - 0
210
- hash: -2921388160186911464
211
+ hash: 282801510994621394
211
212
  requirements: []
212
213
  rubyforge_project: rails_apps_composer
213
214
  rubygems_version: 1.8.24
@@ -223,3 +224,4 @@ test_files:
223
224
  - spec/spec_helper.rb
224
225
  - spec/support/rails_directory.rb
225
226
  - spec/support/template_runner.rb
227
+ - spec/test_recipes/test_recipe_in_file.rb