rails3_devise_wizard 0.2
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 +135 -0
- data/bin/rails3_devise_wizard +7 -0
- data/lib/rails_wizard/command.rb +79 -0
- data/lib/rails_wizard/config.rb +86 -0
- data/lib/rails_wizard/recipe.rb +106 -0
- data/lib/rails_wizard/recipes.rb +38 -0
- data/lib/rails_wizard/template.rb +58 -0
- data/lib/rails_wizard.rb +10 -0
- data/recipes/action_mailer.rb +41 -0
- data/recipes/activerecord.rb +37 -0
- data/recipes/add_user_name.rb +75 -0
- data/recipes/application_layout.rb +43 -0
- data/recipes/ban_spiders.rb +19 -0
- data/recipes/capybara.rb +34 -0
- data/recipes/cleanup.rb +34 -0
- data/recipes/css_setup.rb +40 -0
- data/recipes/cucumber.rb +69 -0
- data/recipes/devise.rb +35 -0
- data/recipes/devise_navigation.rb +95 -0
- data/recipes/env_yaml.rb +54 -0
- data/recipes/git.rb +26 -0
- data/recipes/haml.rb +14 -0
- data/recipes/heroku.rb +58 -0
- data/recipes/home_page.rb +43 -0
- data/recipes/home_page_users.rb +50 -0
- data/recipes/hoptoad.rb +34 -0
- data/recipes/jammit.rb +43 -0
- data/recipes/jquery.rb +44 -0
- data/recipes/less.rb +12 -0
- data/recipes/mongo_mapper.rb +18 -0
- data/recipes/mongohq.rb +59 -0
- data/recipes/mongoid.rb +30 -0
- data/recipes/mootools.rb +23 -0
- data/recipes/omniauth.rb +15 -0
- data/recipes/pow.rb +12 -0
- data/recipes/prototype.rb +11 -0
- data/recipes/rails_admin.rb +21 -0
- data/recipes/redis.rb +17 -0
- data/recipes/redistogo.rb +40 -0
- data/recipes/rightjs.rb +17 -0
- data/recipes/rspec.rb +89 -0
- data/recipes/sass.rb +13 -0
- data/recipes/seed_database.rb +35 -0
- data/recipes/sequel.rb +13 -0
- data/recipes/settingslogic.rb +43 -0
- data/recipes/slim.rb +11 -0
- data/recipes/test_unit.rb +11 -0
- data/recipes/users_page.rb +103 -0
- data/spec/rails_wizard/config_spec.rb +99 -0
- data/spec/rails_wizard/recipe_spec.rb +103 -0
- data/spec/rails_wizard/recipes/sanity_spec.rb +30 -0
- data/spec/rails_wizard/recipes_spec.rb +24 -0
- data/spec/rails_wizard/template_spec.rb +48 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/support/rails_directory.rb +17 -0
- data/spec/support/template_runner.rb +28 -0
- data/templates/helpers.erb +45 -0
- data/templates/layout.erb +46 -0
- data/templates/recipe.erb +10 -0
- data/version.rb +3 -0
- metadata +205 -0
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe RailsWizard::Recipes do
|
4
|
+
subject{ RailsWizard::Recipes }
|
5
|
+
let(:recipe){ RailsWizard::Recipe.generate("recipe_test", "# Testing", :name => "Test Recipe", :category => "test", :description => "Just a test.")}
|
6
|
+
|
7
|
+
before(:all) do
|
8
|
+
RailsWizard::Recipes.add(recipe)
|
9
|
+
end
|
10
|
+
|
11
|
+
it '.list_classes should include recipe classes' do
|
12
|
+
subject.list_classes.should be_include(recipe)
|
13
|
+
end
|
14
|
+
|
15
|
+
it '.list should include recipe keys' do
|
16
|
+
subject.list.should be_include('recipe_test')
|
17
|
+
end
|
18
|
+
|
19
|
+
describe '.for' do
|
20
|
+
it 'should find for a given category' do
|
21
|
+
RailsWizard::Recipes.for('test').should be_include('recipe_test')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe RailsWizard::Template do
|
4
|
+
subject{ RailsWizard::Template }
|
5
|
+
let(:recipe){ RailsWizard::Recipe.generate('name','# test') }
|
6
|
+
|
7
|
+
describe '#initialize' do
|
8
|
+
it 'should work with classes' do
|
9
|
+
subject.new([recipe]).recipes.should == [recipe]
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '#recipes_with_dependencies' do
|
14
|
+
def r(*deps)
|
15
|
+
mock(:Class, :requires => deps, :superclass => RailsWizard::Recipe)
|
16
|
+
end
|
17
|
+
|
18
|
+
subject do
|
19
|
+
@template = RailsWizard::Template.new([])
|
20
|
+
@template.stub!(:recipes).and_return(@recipes)
|
21
|
+
@template.stub!(:recipe_classes).and_return(@recipes)
|
22
|
+
@template
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should return the same number recipes if none have dependencies' do
|
26
|
+
@recipes = [r, r]
|
27
|
+
subject.recipes_with_dependencies.size.should == 2
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should handle simple dependencies' do
|
31
|
+
@recipes = [r(r, r), r(r)]
|
32
|
+
subject.recipes_with_dependencies.size.should == 5
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should handle multi-level dependencies' do
|
36
|
+
@recipes = [r(r(r))]
|
37
|
+
subject.recipes_with_dependencies.size.should == 3
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should uniqify' do
|
41
|
+
a = r
|
42
|
+
b = r(a)
|
43
|
+
c = r(r, a, b)
|
44
|
+
@recipes = [a,b,c]
|
45
|
+
subject.recipes_with_dependencies.size.should == 4
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
class RailsDirectory
|
2
|
+
def initialize(path)
|
3
|
+
@path = path
|
4
|
+
end
|
5
|
+
|
6
|
+
def file_path(path)
|
7
|
+
File.join(@path, path)
|
8
|
+
end
|
9
|
+
|
10
|
+
def has_file?(path)
|
11
|
+
File.exist?(file_path(path))
|
12
|
+
end
|
13
|
+
|
14
|
+
def [](path)
|
15
|
+
File.open(file_path(path)).read
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class TemplateRunner
|
2
|
+
attr_reader :template, :config, :app_name, :dir, :rails_dir, :output
|
3
|
+
def initialize(template, config)
|
4
|
+
@template = template
|
5
|
+
@config = config
|
6
|
+
end
|
7
|
+
|
8
|
+
def run(app_name = 'rails_app')
|
9
|
+
@app_name = app_name
|
10
|
+
@dir = Dir.mktmpdir
|
11
|
+
@rails_dir = File.join(@dir, @app_name)
|
12
|
+
Dir.chrdir(@dir) do
|
13
|
+
template_file = File.open 'template.rb', 'w'
|
14
|
+
template_file.write
|
15
|
+
template_file.close
|
16
|
+
@output = `rails new #{@app_name} -m template.rb`
|
17
|
+
end
|
18
|
+
@output
|
19
|
+
end
|
20
|
+
|
21
|
+
def rails
|
22
|
+
RailsDirectory.new(@rails_dir)
|
23
|
+
end
|
24
|
+
|
25
|
+
def clean
|
26
|
+
FileUtils.remove_entry_secure @dir
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
def recipes; @recipes end
|
2
|
+
def recipe?(name); @recipes.include?(name) end
|
3
|
+
|
4
|
+
def say_custom(tag, text); say "\033[1m\033[36m" + tag.to_s.rjust(10) + "\033[0m" + " #{text}" end
|
5
|
+
def say_recipe(name); say "\033[1m\033[36m" + "recipe".rjust(10) + "\033[0m" + " Running #{name} recipe..." end
|
6
|
+
def say_wizard(text); say_custom(@current_recipe || 'wizard', text) end
|
7
|
+
|
8
|
+
def ask_wizard(question)
|
9
|
+
ask "\033[1m\033[30m\033[46m" + (@current_recipe || "prompt").rjust(10) + "\033[0m\033[36m" + " #{question}\033[0m"
|
10
|
+
end
|
11
|
+
|
12
|
+
def yes_wizard?(question)
|
13
|
+
answer = ask_wizard(question + " \033[33m(y/n)\033[0m")
|
14
|
+
case answer.downcase
|
15
|
+
when "yes", "y"
|
16
|
+
true
|
17
|
+
when "no", "n"
|
18
|
+
false
|
19
|
+
else
|
20
|
+
yes_wizard?(question)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def no_wizard?(question); !yes_wizard?(question) end
|
25
|
+
|
26
|
+
def multiple_choice(question, choices)
|
27
|
+
say_custom('question', question)
|
28
|
+
values = {}
|
29
|
+
choices.each_with_index do |choice,i|
|
30
|
+
values[(i + 1).to_s] = choice[1]
|
31
|
+
say_custom (i + 1).to_s + ')', choice[0]
|
32
|
+
end
|
33
|
+
answer = ask_wizard("Enter your selection:") while !values.keys.include?(answer)
|
34
|
+
values[answer]
|
35
|
+
end
|
36
|
+
|
37
|
+
@current_recipe = nil
|
38
|
+
@configs = {}
|
39
|
+
|
40
|
+
@after_blocks = []
|
41
|
+
def after_bundler(&block); @after_blocks << [@current_recipe, block]; end
|
42
|
+
@after_everything_blocks = []
|
43
|
+
def after_everything(&block); @after_everything_blocks << [@current_recipe, block]; end
|
44
|
+
@before_configs = {}
|
45
|
+
def before_config(&block); @before_configs[@current_recipe] = block; end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# >---------------------------------------------------------------------------<
|
2
|
+
#
|
3
|
+
# _____ _ _ __ ___ _
|
4
|
+
# | __ \ (_) | \ \ / (_) | |
|
5
|
+
# | |__) |__ _ _| |___\ \ /\ / / _ ______ _ _ __ __| |
|
6
|
+
# | _ // _` | | / __|\ \/ \/ / | |_ / _` | '__/ _` |
|
7
|
+
# | | \ \ (_| | | \__ \ \ /\ / | |/ / (_| | | | (_| |
|
8
|
+
# |_| \_\__,_|_|_|___/ \/ \/ |_/___\__,_|_| \__,_|
|
9
|
+
#
|
10
|
+
# This template was generated by rails3_devise_wizard, a custom version of
|
11
|
+
# RailsWizard, the application template builder. For more information, see:
|
12
|
+
# https://github.com/fortuity/rails3_devise_wizard/
|
13
|
+
#
|
14
|
+
# >---------------------------------------------------------------------------<
|
15
|
+
|
16
|
+
# >----------------------------[ Initial Setup ]------------------------------<
|
17
|
+
|
18
|
+
initializer 'generators.rb', <<-RUBY
|
19
|
+
Rails.application.config.generators do |g|
|
20
|
+
end
|
21
|
+
RUBY
|
22
|
+
|
23
|
+
@recipes = <%= resolve_recipes.map(&:key).inspect %>
|
24
|
+
|
25
|
+
<%= render "helpers" %>
|
26
|
+
|
27
|
+
<% resolve_recipes.each do |recipe| %>
|
28
|
+
<%= render 'recipe', recipe.get_binding %>
|
29
|
+
<% end %>
|
30
|
+
|
31
|
+
<% if custom_code? %># >-----------------------------[ Custom Code ]-------------------------------<
|
32
|
+
|
33
|
+
<%= custom_code %><% end %>
|
34
|
+
|
35
|
+
@current_recipe = nil
|
36
|
+
|
37
|
+
# >-----------------------------[ Run Bundler ]-------------------------------<
|
38
|
+
|
39
|
+
say_wizard "Running Bundler install. This will take a while."
|
40
|
+
run 'bundle install'
|
41
|
+
say_wizard "Running after Bundler callbacks."
|
42
|
+
@after_blocks.each{|b| config = @configs[b[0]] || {}; @current_recipe = b[0]; b[1].call}
|
43
|
+
|
44
|
+
@current_recipe = nil
|
45
|
+
say_wizard "Running after everything callbacks."
|
46
|
+
@after_everything_blocks.each{|b| config = @configs[b[0]] || {}; @current_recipe = b[0]; b[1].call}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# ><%= "[ #{name} ]".center(75,'-') %><
|
2
|
+
|
3
|
+
@current_recipe = "<%= key %>"
|
4
|
+
@before_configs["<%= key %>"].call if @before_configs["<%= key %>"]
|
5
|
+
say_recipe '<%= name %>'
|
6
|
+
|
7
|
+
<%= config.compile if config %>
|
8
|
+
@configs[@current_recipe] = config
|
9
|
+
|
10
|
+
<%= template %>
|
data/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,205 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails3_devise_wizard
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: "0.2"
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Daniel Kehoe
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-04-15 00:00:00 -07:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: i18n
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
type: :runtime
|
25
|
+
prerelease: false
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ~>
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 3.0.0
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: thor
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: "0"
|
46
|
+
type: :runtime
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: rspec
|
51
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ~>
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 2.5.0
|
57
|
+
type: :development
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: *id004
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: mg
|
62
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: "0"
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: *id005
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: activesupport
|
73
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ~>
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 3.0.0
|
79
|
+
type: :development
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: *id006
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: i18n
|
84
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: "0"
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: *id007
|
93
|
+
description: A gem to generate Rails application templates you can use to create Rails starter apps that use Devise for authentication.
|
94
|
+
email:
|
95
|
+
- daniel@danielkehoe.com
|
96
|
+
executables:
|
97
|
+
- rails3_devise_wizard
|
98
|
+
extensions: []
|
99
|
+
|
100
|
+
extra_rdoc_files: []
|
101
|
+
|
102
|
+
files:
|
103
|
+
- lib/rails_wizard/command.rb
|
104
|
+
- lib/rails_wizard/config.rb
|
105
|
+
- lib/rails_wizard/recipe.rb
|
106
|
+
- lib/rails_wizard/recipes.rb
|
107
|
+
- lib/rails_wizard/template.rb
|
108
|
+
- lib/rails_wizard.rb
|
109
|
+
- recipes/action_mailer.rb
|
110
|
+
- recipes/activerecord.rb
|
111
|
+
- recipes/add_user_name.rb
|
112
|
+
- recipes/application_layout.rb
|
113
|
+
- recipes/ban_spiders.rb
|
114
|
+
- recipes/capybara.rb
|
115
|
+
- recipes/cleanup.rb
|
116
|
+
- recipes/css_setup.rb
|
117
|
+
- recipes/cucumber.rb
|
118
|
+
- recipes/devise.rb
|
119
|
+
- recipes/devise_navigation.rb
|
120
|
+
- recipes/env_yaml.rb
|
121
|
+
- recipes/git.rb
|
122
|
+
- recipes/haml.rb
|
123
|
+
- recipes/heroku.rb
|
124
|
+
- recipes/home_page.rb
|
125
|
+
- recipes/home_page_users.rb
|
126
|
+
- recipes/hoptoad.rb
|
127
|
+
- recipes/jammit.rb
|
128
|
+
- recipes/jquery.rb
|
129
|
+
- recipes/less.rb
|
130
|
+
- recipes/mongo_mapper.rb
|
131
|
+
- recipes/mongohq.rb
|
132
|
+
- recipes/mongoid.rb
|
133
|
+
- recipes/mootools.rb
|
134
|
+
- recipes/omniauth.rb
|
135
|
+
- recipes/pow.rb
|
136
|
+
- recipes/prototype.rb
|
137
|
+
- recipes/rails_admin.rb
|
138
|
+
- recipes/redis.rb
|
139
|
+
- recipes/redistogo.rb
|
140
|
+
- recipes/rightjs.rb
|
141
|
+
- recipes/rspec.rb
|
142
|
+
- recipes/sass.rb
|
143
|
+
- recipes/seed_database.rb
|
144
|
+
- recipes/sequel.rb
|
145
|
+
- recipes/settingslogic.rb
|
146
|
+
- recipes/slim.rb
|
147
|
+
- recipes/test_unit.rb
|
148
|
+
- recipes/users_page.rb
|
149
|
+
- README.textile
|
150
|
+
- version.rb
|
151
|
+
- templates/helpers.erb
|
152
|
+
- templates/layout.erb
|
153
|
+
- templates/recipe.erb
|
154
|
+
- spec/rails_wizard/config_spec.rb
|
155
|
+
- spec/rails_wizard/recipe_spec.rb
|
156
|
+
- spec/rails_wizard/recipes/sanity_spec.rb
|
157
|
+
- spec/rails_wizard/recipes_spec.rb
|
158
|
+
- spec/rails_wizard/template_spec.rb
|
159
|
+
- spec/spec_helper.rb
|
160
|
+
- spec/support/rails_directory.rb
|
161
|
+
- spec/support/template_runner.rb
|
162
|
+
- bin/rails3_devise_wizard
|
163
|
+
has_rdoc: true
|
164
|
+
homepage: http://github.com/fortuity/rails3_devise_wizard
|
165
|
+
licenses: []
|
166
|
+
|
167
|
+
post_install_message:
|
168
|
+
rdoc_options: []
|
169
|
+
|
170
|
+
require_paths:
|
171
|
+
- lib
|
172
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
173
|
+
none: false
|
174
|
+
requirements:
|
175
|
+
- - ">="
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
hash: -2754679886023976313
|
178
|
+
segments:
|
179
|
+
- 0
|
180
|
+
version: "0"
|
181
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
|
+
none: false
|
183
|
+
requirements:
|
184
|
+
- - ">="
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
hash: -2754679886023976313
|
187
|
+
segments:
|
188
|
+
- 0
|
189
|
+
version: "0"
|
190
|
+
requirements: []
|
191
|
+
|
192
|
+
rubyforge_project: rails3_devise_wizard
|
193
|
+
rubygems_version: 1.6.2
|
194
|
+
signing_key:
|
195
|
+
specification_version: 3
|
196
|
+
summary: Create ready-to-run Rails web applications using Devise for authentication.
|
197
|
+
test_files:
|
198
|
+
- spec/rails_wizard/config_spec.rb
|
199
|
+
- spec/rails_wizard/recipe_spec.rb
|
200
|
+
- spec/rails_wizard/recipes/sanity_spec.rb
|
201
|
+
- spec/rails_wizard/recipes_spec.rb
|
202
|
+
- spec/rails_wizard/template_spec.rb
|
203
|
+
- spec/spec_helper.rb
|
204
|
+
- spec/support/rails_directory.rb
|
205
|
+
- spec/support/template_runner.rb
|