rails_apps_composer 1.2.1 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rails_wizard/template.rb +15 -2
- data/recipes/active_admin.rb +31 -0
- data/recipes/add_user.rb +1 -0
- data/recipes/compass.rb +2 -1
- data/recipes/devise.rb +6 -5
- data/recipes/mongoid.rb +1 -1
- data/recipes/omniauth.rb +4 -2
- data/recipes/rspec.rb +2 -2
- data/spec/rails_wizard/recipe_spec.rb +0 -22
- data/spec/rails_wizard/template_spec.rb +25 -0
- data/version.rb +1 -1
- metadata +64 -22
@@ -17,9 +17,22 @@ module RailsWizard
|
|
17
17
|
def render(template_name, binding = nil); self.class.render(template_name, binding) end
|
18
18
|
|
19
19
|
|
20
|
+
# Sort the recipes list taking 'run_after' directives into account.
|
20
21
|
def resolve_recipes
|
21
|
-
|
22
|
-
|
22
|
+
@resolve_recipes ||= begin
|
23
|
+
list = recipes_with_dependencies
|
24
|
+
|
25
|
+
for i in 0...list.size
|
26
|
+
after_keys = list[i+1..-1].map { |r| r.key }
|
27
|
+
|
28
|
+
if (list[i].run_after & after_keys).any?
|
29
|
+
list.push list.slice!(i)
|
30
|
+
redo
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
list
|
35
|
+
end
|
23
36
|
end
|
24
37
|
|
25
38
|
def recipe_classes
|
@@ -0,0 +1,31 @@
|
|
1
|
+
gem 'activeadmin'
|
2
|
+
gem "meta_search", '>= 1.1.0.pre'
|
3
|
+
# sass-rails is also required but is by default in rails
|
4
|
+
|
5
|
+
|
6
|
+
after_bundler do
|
7
|
+
case config['user_model']
|
8
|
+
when 'default'
|
9
|
+
generate 'active_admin:install'
|
10
|
+
when ''
|
11
|
+
generate 'active_admin:install'
|
12
|
+
when 'skip'
|
13
|
+
generate 'active_admin:install --skip-users'
|
14
|
+
else
|
15
|
+
generate "active_admin:install #{config['user_model']}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
__END__
|
20
|
+
|
21
|
+
name: RailsAdmin
|
22
|
+
description: "Install Active Admin to build an administration zone data in your application"
|
23
|
+
author: systho
|
24
|
+
|
25
|
+
category: other
|
26
|
+
|
27
|
+
config:
|
28
|
+
- user_model:
|
29
|
+
type: string
|
30
|
+
prompt: "What model will you use for admin users ? type 'skip' to skip this step (default is AdminUser)"
|
31
|
+
|
data/recipes/add_user.rb
CHANGED
data/recipes/compass.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
if config['compass']
|
2
|
-
gem 'compass', :version => '~> 0.12.
|
2
|
+
gem 'compass', :version => '~> 0.12.1', :group => [:assets]
|
3
|
+
gem 'compass-rails', :version => '~> 1.0.0', :group => [:assets]
|
3
4
|
after_bundler do
|
4
5
|
remove_file 'app/assets/stylesheets/application.css'
|
5
6
|
create_file 'app/assets/stylesheets/application.css.sass' do <<-SASS
|
data/recipes/devise.rb
CHANGED
@@ -6,12 +6,12 @@ case config['devise']
|
|
6
6
|
recipes.delete('devise')
|
7
7
|
say_wizard "Devise recipe skipped."
|
8
8
|
when 'standard'
|
9
|
-
gem 'devise', '>= 2.0.
|
9
|
+
gem 'devise', '>= 2.1.0.rc'
|
10
10
|
when 'confirmable'
|
11
|
-
gem 'devise', '>= 2.0.
|
11
|
+
gem 'devise', '>= 2.1.0.rc'
|
12
12
|
recipes << 'devise-confirmable'
|
13
13
|
when 'invitable'
|
14
|
-
gem 'devise', '>= 2.0.
|
14
|
+
gem 'devise', '>= 2.1.0.rc'
|
15
15
|
gem 'devise_invitable', '>= 1.0.0'
|
16
16
|
recipes << 'devise-confirmable'
|
17
17
|
recipes << 'devise-invitable'
|
@@ -57,8 +57,9 @@ if recipes.include? 'devise'
|
|
57
57
|
say_wizard "Copying RSpec files from the rails3-devise-rspec-cucumber examples"
|
58
58
|
begin
|
59
59
|
# copy all the RSpec specs files from the rails3-devise-rspec-cucumber example app
|
60
|
-
|
61
|
-
|
60
|
+
remove_file 'spec/factories/users.rb'
|
61
|
+
get 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/spec/factories/users.rb', 'spec/factories/users.rb'
|
62
|
+
gsub_file 'spec/factories/users.rb', /# confirmed_at/, "confirmed_at" if recipes.include? 'devise-confirmable'
|
62
63
|
remove_file 'spec/controllers/home_controller_spec.rb'
|
63
64
|
remove_file 'spec/controllers/users_controller_spec.rb'
|
64
65
|
get 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/spec/controllers/home_controller_spec.rb', 'spec/controllers/home_controller_spec.rb'
|
data/recipes/mongoid.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
if config['mongoid']
|
5
5
|
say_wizard "REMINDER: When creating a Rails app using Mongoid..."
|
6
6
|
say_wizard "you should add the '-O' flag to 'rails new'"
|
7
|
-
gem 'bson_ext', '>= 1.
|
7
|
+
gem 'bson_ext', '>= 1.6.1'
|
8
8
|
gem 'mongoid', '>= 2.4.6'
|
9
9
|
else
|
10
10
|
recipes.delete('mongoid')
|
data/recipes/omniauth.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/omniauth.rb
|
3
3
|
|
4
4
|
if config['omniauth']
|
5
|
-
gem 'omniauth', '>= 1.0.
|
5
|
+
gem 'omniauth', '>= 1.0.3'
|
6
6
|
# for available gems, see https://github.com/intridea/omniauth/wiki/List-of-Strategies
|
7
7
|
case config['provider']
|
8
8
|
when 'twitter'
|
@@ -13,6 +13,8 @@ if config['omniauth']
|
|
13
13
|
gem 'omniauth-github'
|
14
14
|
when 'linkedin'
|
15
15
|
gem 'omniauth-linkedin'
|
16
|
+
when 'google'
|
17
|
+
gem 'omniauth-google'
|
16
18
|
end
|
17
19
|
else
|
18
20
|
recipes.delete('omniauth')
|
@@ -152,4 +154,4 @@ config:
|
|
152
154
|
- provider:
|
153
155
|
type: multiple_choice
|
154
156
|
prompt: "Which service provider will you use?"
|
155
|
-
choices: [["Twitter", twitter], ["Facebook", facebook], ["GitHub", github], ["LinkedIn", linkedin]]
|
157
|
+
choices: [["Twitter", twitter], ["Facebook", facebook], ["GitHub", github], ["LinkedIn", linkedin], ["Google", google]]
|
data/recipes/rspec.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/rspec.rb
|
3
3
|
|
4
4
|
if config['rspec']
|
5
|
-
gem 'rspec-rails', '>= 2.
|
5
|
+
gem 'rspec-rails', '>= 2.9.0.rc2', :group => [:development, :test]
|
6
6
|
if recipes.include? 'mongoid'
|
7
7
|
# use the database_cleaner gem to reset the test database
|
8
8
|
gem 'database_cleaner', '>= 0.7.1', :group => :test
|
@@ -13,7 +13,7 @@ if config['rspec']
|
|
13
13
|
gem 'machinist', :group => :test
|
14
14
|
end
|
15
15
|
if config['factory_girl']
|
16
|
-
gem 'factory_girl_rails', '>=
|
16
|
+
gem 'factory_girl_rails', '>= 2.0.0.rc', :group => [:development, :test]
|
17
17
|
end
|
18
18
|
# add a collection of RSpec matchers and Cucumber steps to make testing email easy
|
19
19
|
gem 'email_spec', '>= 1.2.1', :group => :test
|
@@ -74,28 +74,6 @@ RUBY
|
|
74
74
|
recipe.send(k).should == v
|
75
75
|
end
|
76
76
|
end
|
77
|
-
|
78
|
-
context 'Comparable' do
|
79
|
-
subject{ RailsWizard::Recipe }
|
80
|
-
it 'a < b.run_after(a)' do
|
81
|
-
A = subject.generate('a', '#')
|
82
|
-
B = subject.generate('b', '#', :run_after => ['a'])
|
83
|
-
|
84
|
-
(A < B).should be_true
|
85
|
-
end
|
86
|
-
|
87
|
-
it 'a > b.run_before(a)' do
|
88
|
-
A = subject.generate('a', '#')
|
89
|
-
B = subject.generate('b', '#', :run_before => ['a'])
|
90
|
-
|
91
|
-
(A > B).should be_true
|
92
|
-
end
|
93
|
-
|
94
|
-
after do
|
95
|
-
Object.send :remove_const, :A if defined?(A)
|
96
|
-
Object.send :remove_const, :B if defined?(B)
|
97
|
-
end
|
98
|
-
end
|
99
77
|
end
|
100
78
|
|
101
79
|
__END__
|
@@ -10,6 +10,31 @@ describe RailsWizard::Template do
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
+
describe '#resolve_dependencies' do
|
14
|
+
def recipe(name, opts={})
|
15
|
+
RailsWizard::Recipe.generate(name, '', opts)
|
16
|
+
end
|
17
|
+
|
18
|
+
subject do
|
19
|
+
@template = RailsWizard::Template.new([])
|
20
|
+
@template.stub!(:recipes_with_dependencies).and_return(@recipes)
|
21
|
+
@template.resolve_recipes.map { |r| r.key }
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should sort properly' do
|
25
|
+
@recipes = [
|
26
|
+
recipe('add_user', :run_after => ['devise']),
|
27
|
+
recipe('devise', :run_after => ['omniauth']),
|
28
|
+
recipe('omniauth'),
|
29
|
+
recipe('haml'),
|
30
|
+
recipe('compass')
|
31
|
+
]
|
32
|
+
|
33
|
+
subject.index('devise').should > subject.index('omniauth')
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
13
38
|
describe '#recipes_with_dependencies' do
|
14
39
|
def r(*deps)
|
15
40
|
mock(:Class, :requires => deps, :superclass => RailsWizard::Recipe)
|
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: 1.
|
4
|
+
version: 1.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: i18n
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: activesupport
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: 3.0.0
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 3.0.0
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: thor
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,10 +53,15 @@ dependencies:
|
|
43
53
|
version: '0'
|
44
54
|
type: :runtime
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: rake
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ! '>='
|
@@ -54,10 +69,15 @@ dependencies:
|
|
54
69
|
version: '0'
|
55
70
|
type: :runtime
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: rspec
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ! '>='
|
@@ -65,10 +85,15 @@ dependencies:
|
|
65
85
|
version: 2.5.0
|
66
86
|
type: :development
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 2.5.0
|
69
94
|
- !ruby/object:Gem::Dependency
|
70
95
|
name: mg
|
71
|
-
requirement:
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
72
97
|
none: false
|
73
98
|
requirements:
|
74
99
|
- - ! '>='
|
@@ -76,10 +101,15 @@ dependencies:
|
|
76
101
|
version: '0'
|
77
102
|
type: :development
|
78
103
|
prerelease: false
|
79
|
-
version_requirements:
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
80
110
|
- !ruby/object:Gem::Dependency
|
81
111
|
name: activesupport
|
82
|
-
requirement:
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
83
113
|
none: false
|
84
114
|
requirements:
|
85
115
|
- - ! '>='
|
@@ -87,10 +117,15 @@ dependencies:
|
|
87
117
|
version: 3.0.0
|
88
118
|
type: :development
|
89
119
|
prerelease: false
|
90
|
-
version_requirements:
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 3.0.0
|
91
126
|
- !ruby/object:Gem::Dependency
|
92
127
|
name: i18n
|
93
|
-
requirement:
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
94
129
|
none: false
|
95
130
|
requirements:
|
96
131
|
- - ! '>='
|
@@ -98,7 +133,12 @@ dependencies:
|
|
98
133
|
version: '0'
|
99
134
|
type: :development
|
100
135
|
prerelease: false
|
101
|
-
version_requirements:
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
102
142
|
description: A gem with recipes to create Rails application templates you can use
|
103
143
|
to generate Rails starter apps.
|
104
144
|
email:
|
@@ -115,6 +155,7 @@ files:
|
|
115
155
|
- lib/rails_wizard/template.rb
|
116
156
|
- lib/rails_wizard.rb
|
117
157
|
- recipes/action_mailer.rb
|
158
|
+
- recipes/active_admin.rb
|
118
159
|
- recipes/activerecord.rb
|
119
160
|
- recipes/add_user.rb
|
120
161
|
- recipes/backbone.rb
|
@@ -162,7 +203,8 @@ files:
|
|
162
203
|
- spec/spec_helper.rb
|
163
204
|
- spec/support/rails_directory.rb
|
164
205
|
- spec/support/template_runner.rb
|
165
|
-
-
|
206
|
+
- !binary |-
|
207
|
+
YmluL3JhaWxzX2FwcHNfY29tcG9zZXI=
|
166
208
|
homepage: http://github.com/RailsApps/rails_apps_composer
|
167
209
|
licenses: []
|
168
210
|
post_install_message:
|
@@ -177,7 +219,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
177
219
|
version: '0'
|
178
220
|
segments:
|
179
221
|
- 0
|
180
|
-
hash:
|
222
|
+
hash: 3232364997351596987
|
181
223
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
224
|
none: false
|
183
225
|
requirements:
|
@@ -186,10 +228,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
228
|
version: '0'
|
187
229
|
segments:
|
188
230
|
- 0
|
189
|
-
hash:
|
231
|
+
hash: 3232364997351596987
|
190
232
|
requirements: []
|
191
233
|
rubyforge_project: rails_apps_composer
|
192
|
-
rubygems_version: 1.8.
|
234
|
+
rubygems_version: 1.8.19
|
193
235
|
signing_key:
|
194
236
|
specification_version: 3
|
195
237
|
summary: A version of the RailsWizard gem with custom recipes for Rails starter apps.
|