rails_apps_composer 1.5.5 → 2.0.1
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 +185 -254
- data/lib/rails_wizard/command.rb +54 -13
- data/lib/rails_wizard/config.rb +1 -1
- data/lib/rails_wizard/diagnostics.rb +22 -0
- data/lib/rails_wizard/template.rb +36 -2
- data/lib/rails_wizard.rb +1 -0
- data/recipes/auth.rb +84 -0
- data/recipes/controllers.rb +58 -0
- data/recipes/{seed_database.rb → database.rb} +35 -22
- data/recipes/{action_mailer.rb → email.rb} +29 -50
- data/recipes/example.rb +70 -0
- data/recipes/extras.rb +91 -30
- data/recipes/frontend.rb +59 -0
- data/recipes/gems.rb +128 -0
- data/recipes/models.rb +61 -0
- data/recipes/prelaunch.rb +45 -0
- data/recipes/readme.rb +83 -0
- data/recipes/routes.rb +36 -0
- data/recipes/setup.rb +148 -0
- data/recipes/testing.rb +187 -0
- data/recipes/views.rb +39 -0
- data/spec/rails_wizard/template_spec.rb +4 -2
- data/templates/helpers.erb +53 -2
- data/templates/layout.erb +81 -20
- data/version.rb +1 -1
- metadata +19 -49
- data/recipes/active_admin.rb +0 -36
- data/recipes/activerecord.rb +0 -37
- data/recipes/add_user.rb +0 -140
- data/recipes/airbrake.rb +0 -34
- data/recipes/backbone.rb +0 -23
- data/recipes/capybara.rb +0 -34
- data/recipes/cleanup.rb +0 -40
- data/recipes/cloudfiles.rb +0 -36
- data/recipes/compass.rb +0 -46
- data/recipes/compass_960.rb +0 -48
- data/recipes/cucumber.rb +0 -75
- data/recipes/datamapper.rb +0 -111
- data/recipes/devise.rb +0 -114
- data/recipes/git.rb +0 -40
- data/recipes/guard.rb +0 -89
- data/recipes/haml.rb +0 -23
- data/recipes/heroku.rb +0 -61
- data/recipes/home_page.rb +0 -58
- data/recipes/home_page_users.rb +0 -47
- data/recipes/html5.rb +0 -152
- data/recipes/inherited_resources.rb +0 -23
- data/recipes/less.rb +0 -12
- data/recipes/mongohq.rb +0 -59
- data/recipes/mongoid.rb +0 -38
- data/recipes/mongolab.rb +0 -59
- data/recipes/omniauth.rb +0 -194
- data/recipes/omniauth_email.rb +0 -82
- data/recipes/paperclip.rb +0 -79
- data/recipes/prelaunch_signup.rb +0 -586
- data/recipes/rails_admin.rb +0 -29
- data/recipes/redis.rb +0 -23
- data/recipes/responders.rb +0 -10
- data/recipes/resque.rb +0 -25
- data/recipes/rspec.rb +0 -131
- data/recipes/sass.rb +0 -25
- data/recipes/settingslogic.rb +0 -43
- data/recipes/simple_form.rb +0 -54
- data/recipes/slim.rb +0 -46
- data/recipes/static_page.rb +0 -43
- data/recipes/subdomains.rb +0 -121
- data/recipes/turnip.rb +0 -18
- data/recipes/unicorn.rb +0 -29
- data/recipes/users_page.rb +0 -165
data/recipes/rails_admin.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git'
|
2
|
-
|
3
|
-
after_bundler do
|
4
|
-
generate 'rails_admin:install_admin'
|
5
|
-
rake 'admin:copy_assets'
|
6
|
-
rake 'admin:ckeditor_download' if config['ckeditor']
|
7
|
-
end
|
8
|
-
|
9
|
-
inject_into_file 'config/routes.rb', :after => "routes.draw do" do
|
10
|
-
<<-RUBY
|
11
|
-
\n
|
12
|
-
mount RailsAdmin::Engine => '/admin', :as => 'rails_admin'
|
13
|
-
\n
|
14
|
-
RUBY
|
15
|
-
end
|
16
|
-
|
17
|
-
__END__
|
18
|
-
|
19
|
-
name: RailsAdmin
|
20
|
-
description: "Install RailsAdmin to manage data in your application"
|
21
|
-
author: alno
|
22
|
-
|
23
|
-
category: other
|
24
|
-
|
25
|
-
config:
|
26
|
-
- ckeditor:
|
27
|
-
type: boolean
|
28
|
-
prompt: Install CKEditor?
|
29
|
-
|
data/recipes/redis.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
if config['redis']
|
2
|
-
gem 'redis'
|
3
|
-
|
4
|
-
after_bundler do
|
5
|
-
say_wizard "Generating Redis initializer..."
|
6
|
-
|
7
|
-
create_file "config/initializers/redis.rb" do <<-RUBY
|
8
|
-
REDIS = Redis.new
|
9
|
-
RUBY
|
10
|
-
end
|
11
|
-
end
|
12
|
-
else
|
13
|
-
recipes.delete('redis')
|
14
|
-
end
|
15
|
-
__END__
|
16
|
-
|
17
|
-
name: Redis
|
18
|
-
description: "Add Redis as a persistence engine to your application."
|
19
|
-
author: mbleigh
|
20
|
-
|
21
|
-
exclusive: key_value
|
22
|
-
category: persistence
|
23
|
-
tags: [key_value, cache, session_store]
|
data/recipes/responders.rb
DELETED
data/recipes/resque.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
if config['resque']
|
2
|
-
gem 'resque'
|
3
|
-
|
4
|
-
after_bundler do
|
5
|
-
say_wizard 'Adding resque.rake task to lib/tasks'
|
6
|
-
create_file "lib/tasks/resque.rake" do <<-RUBY
|
7
|
-
require 'resque/tasks'
|
8
|
-
RUBY
|
9
|
-
end
|
10
|
-
end
|
11
|
-
else
|
12
|
-
recipes.delete('resque')
|
13
|
-
end
|
14
|
-
|
15
|
-
__END__
|
16
|
-
|
17
|
-
name: Resque
|
18
|
-
description: "Add Resque to your application."
|
19
|
-
author: porta
|
20
|
-
|
21
|
-
category: worker
|
22
|
-
tags: [background, worker]
|
23
|
-
|
24
|
-
requires: [redis]
|
25
|
-
run_after: [redis]
|
data/recipes/rspec.rb
DELETED
@@ -1,131 +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/rspec.rb
|
3
|
-
|
4
|
-
if config['rspec']
|
5
|
-
gem 'rspec-rails', '>= 2.11.0', :group => [:development, :test]
|
6
|
-
if recipes.include? 'mongoid'
|
7
|
-
# use the database_cleaner gem to reset the test database
|
8
|
-
gem 'database_cleaner', '>= 0.8.0', :group => :test
|
9
|
-
# include RSpec matchers from the mongoid-rspec gem
|
10
|
-
gem 'mongoid-rspec', '1.4.6', :group => :test
|
11
|
-
end
|
12
|
-
case config['fixtures']
|
13
|
-
when 'machinist'
|
14
|
-
gem 'machinist', :group => :test
|
15
|
-
when 'factory_girl'
|
16
|
-
gem 'factory_girl_rails', '>= 3.5.0', :group => [:development, :test]
|
17
|
-
end
|
18
|
-
# add a collection of RSpec matchers and Cucumber steps to make testing email easy
|
19
|
-
gem 'email_spec', '>= 1.2.1', :group => :test
|
20
|
-
create_file 'features/support/email_spec.rb' do <<-RUBY
|
21
|
-
require 'email_spec/cucumber'
|
22
|
-
RUBY
|
23
|
-
end
|
24
|
-
else
|
25
|
-
recipes.delete('rspec')
|
26
|
-
end
|
27
|
-
|
28
|
-
# note: there is no need to specify the RSpec generator in the config/application.rb file
|
29
|
-
|
30
|
-
if config['rspec']
|
31
|
-
after_bundler do
|
32
|
-
say_wizard "RSpec recipe running 'after bundler'"
|
33
|
-
generate 'rspec:install'
|
34
|
-
generate 'email_spec:steps'
|
35
|
-
inject_into_file 'spec/spec_helper.rb', "require 'email_spec'\n", :after => "require 'rspec/rails'\n"
|
36
|
-
inject_into_file 'spec/spec_helper.rb', :after => "RSpec.configure do |config|\n" do <<-RUBY
|
37
|
-
config.include(EmailSpec::Helpers)
|
38
|
-
config.include(EmailSpec::Matchers)
|
39
|
-
RUBY
|
40
|
-
end
|
41
|
-
if config['fixtures'] === 'machinist'
|
42
|
-
say_wizard "Generating blueprints file for Machinist"
|
43
|
-
generate 'machinist:install'
|
44
|
-
end
|
45
|
-
|
46
|
-
say_wizard "Removing test folder (not needed for RSpec)"
|
47
|
-
run 'rm -rf test/'
|
48
|
-
|
49
|
-
inject_into_file 'config/application.rb', :after => "Rails::Application\n" do <<-RUBY
|
50
|
-
|
51
|
-
# don't generate RSpec tests for views and helpers
|
52
|
-
config.generators do |g|
|
53
|
-
g.view_specs false
|
54
|
-
g.helper_specs false
|
55
|
-
#{"g.fixture_replacement :machinist" if config['fixtures'] === 'machinist'}
|
56
|
-
end
|
57
|
-
|
58
|
-
RUBY
|
59
|
-
end
|
60
|
-
|
61
|
-
|
62
|
-
if recipes.include? 'mongoid'
|
63
|
-
|
64
|
-
# remove ActiveRecord artifacts
|
65
|
-
gsub_file 'spec/spec_helper.rb', /config.fixture_path/, '# config.fixture_path'
|
66
|
-
gsub_file 'spec/spec_helper.rb', /config.use_transactional_fixtures/, '# config.use_transactional_fixtures'
|
67
|
-
|
68
|
-
# reset your application database to a pristine state during testing
|
69
|
-
inject_into_file 'spec/spec_helper.rb', :before => "\nend" do
|
70
|
-
<<-RUBY
|
71
|
-
\n
|
72
|
-
# Clean up the database
|
73
|
-
require 'database_cleaner'
|
74
|
-
config.before(:suite) do
|
75
|
-
DatabaseCleaner.strategy = :truncation
|
76
|
-
DatabaseCleaner.orm = "mongoid"
|
77
|
-
end
|
78
|
-
|
79
|
-
config.before(:each) do
|
80
|
-
DatabaseCleaner.clean
|
81
|
-
end
|
82
|
-
RUBY
|
83
|
-
end
|
84
|
-
|
85
|
-
# remove either possible occurrence of "require rails/test_unit/railtie"
|
86
|
-
gsub_file 'config/application.rb', /require 'rails\/test_unit\/railtie'/, '# require "rails/test_unit/railtie"'
|
87
|
-
gsub_file 'config/application.rb', /require "rails\/test_unit\/railtie"/, '# require "rails/test_unit/railtie"'
|
88
|
-
|
89
|
-
# configure RSpec to use matchers from the mongoid-rspec gem
|
90
|
-
create_file 'spec/support/mongoid.rb' do
|
91
|
-
<<-RUBY
|
92
|
-
RSpec.configure do |config|
|
93
|
-
config.include Mongoid::Matchers
|
94
|
-
end
|
95
|
-
RUBY
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
if recipes.include? 'devise'
|
100
|
-
# add Devise test helpers
|
101
|
-
create_file 'spec/support/devise.rb' do
|
102
|
-
<<-RUBY
|
103
|
-
RSpec.configure do |config|
|
104
|
-
config.include Devise::TestHelpers, :type => :controller
|
105
|
-
end
|
106
|
-
RUBY
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
__END__
|
114
|
-
|
115
|
-
name: RSpec
|
116
|
-
description: "Use RSpec instead of TestUnit."
|
117
|
-
author: RailsApps
|
118
|
-
|
119
|
-
exclusive: unit_testing
|
120
|
-
category: testing
|
121
|
-
|
122
|
-
args: ["-T"]
|
123
|
-
|
124
|
-
config:
|
125
|
-
- rspec:
|
126
|
-
type: boolean
|
127
|
-
prompt: Would you like to use RSpec instead of TestUnit?
|
128
|
-
- fixtures:
|
129
|
-
type: multiple_choice
|
130
|
-
prompt: Which library would you like to use for test fixtures with RSpec?
|
131
|
-
choices: [["None", none], ["factory_girl", factory_girl], ["machinist", machinist]]
|
data/recipes/sass.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
|
2
|
-
if config['sass']
|
3
|
-
gem 'sass', '>= 3.1.12'
|
4
|
-
after_bundler do
|
5
|
-
create_file 'config/initializers/sass.rb' do <<-RUBY
|
6
|
-
Rails.application.config.generators.stylesheet_engine = :sass
|
7
|
-
RUBY
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
__END__
|
13
|
-
|
14
|
-
name: SASS
|
15
|
-
description: "Utilize SASS for really awesome stylesheets!"
|
16
|
-
author: mbleigh, mrc2407, & ashley_woodard
|
17
|
-
|
18
|
-
exclusive: css_replacement
|
19
|
-
category: assets
|
20
|
-
tags: [css]
|
21
|
-
|
22
|
-
config:
|
23
|
-
- sass:
|
24
|
-
type: boolean
|
25
|
-
prompt: Would you like to use SASS syntax instead of SCSS?
|
data/recipes/settingslogic.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
gem 'settingslogic'
|
2
|
-
|
3
|
-
say_wizard "Generating config/application.yml..."
|
4
|
-
|
5
|
-
append_file "config/application.rb", <<-RUBY
|
6
|
-
|
7
|
-
require 'settings'
|
8
|
-
RUBY
|
9
|
-
|
10
|
-
create_file "lib/settings.rb", <<-RUBY
|
11
|
-
class Settings < Settingslogic
|
12
|
-
source "#\{Rails.root\}/config/application.yml"
|
13
|
-
namespace Rails.env
|
14
|
-
end
|
15
|
-
|
16
|
-
RUBY
|
17
|
-
|
18
|
-
create_file "config/application.yml", <<-YAML
|
19
|
-
defaults: &defaults
|
20
|
-
cool:
|
21
|
-
saweet: nested settings
|
22
|
-
neat_setting: 24
|
23
|
-
awesome_setting: <%= "Did you know 5 + 5 = #{5 + 5}?" %>
|
24
|
-
|
25
|
-
development:
|
26
|
-
<<: *defaults
|
27
|
-
neat_setting: 800
|
28
|
-
|
29
|
-
test:
|
30
|
-
<<: *defaults
|
31
|
-
|
32
|
-
production:
|
33
|
-
<<: *defaults
|
34
|
-
YAML
|
35
|
-
|
36
|
-
__END__
|
37
|
-
|
38
|
-
name: Settingslogic
|
39
|
-
description: "A simple and straightforward settings solution that uses an ERB enabled YAML file and a singleton design pattern."
|
40
|
-
author: elandesign
|
41
|
-
|
42
|
-
category: other
|
43
|
-
tags: [utilities, configuration]
|
data/recipes/simple_form.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
# Application template recipe for the rails_apps_composer. Check for a newer version here:
|
2
|
-
# https://github.com/gmgp/rails_apps_composer/blob/master/recipes/simple_form.rb
|
3
|
-
|
4
|
-
case config['form_option']
|
5
|
-
when 'no'
|
6
|
-
say_wizard "Form help recipe skipped."
|
7
|
-
when 'simple_form'
|
8
|
-
gem 'simple_form'
|
9
|
-
# for external test
|
10
|
-
recipes << 'simple_form'
|
11
|
-
when 'simple_form_bootstrap'
|
12
|
-
gem 'simple_form'
|
13
|
-
# for external test
|
14
|
-
recipes << 'simple_form'
|
15
|
-
recipes << 'simple_form_bootstrap'
|
16
|
-
else
|
17
|
-
say_wizard "Form help recipe skipped."
|
18
|
-
end
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
after_bundler do
|
23
|
-
|
24
|
-
say_wizard "Simple form recipe running 'after bundler'"
|
25
|
-
|
26
|
-
case config['form_option']
|
27
|
-
when 'simple_form'
|
28
|
-
generate 'simple_form:install'
|
29
|
-
when 'simple_form_bootstrap'
|
30
|
-
if recipes.include? 'bootstrap'
|
31
|
-
generate 'simple_form:install --bootstrap'
|
32
|
-
else
|
33
|
-
say_wizard "Bootstrap not found."
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
|
39
|
-
__END__
|
40
|
-
|
41
|
-
name: SimpleForm
|
42
|
-
description: "Check for 'simple_form'."
|
43
|
-
author: Gmgp
|
44
|
-
|
45
|
-
category: other
|
46
|
-
tags: [utilities, configuration]
|
47
|
-
|
48
|
-
run_after: [html5]
|
49
|
-
|
50
|
-
config:
|
51
|
-
- form_option:
|
52
|
-
type: multiple_choice
|
53
|
-
prompt: "Which form gem would you like?"
|
54
|
-
choices: [["None", no], ["simple form", simple_form], ["simple form (bootstrap)", simple_form_bootstrap]]
|
data/recipes/slim.rb
DELETED
@@ -1,46 +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/slim.rb
|
3
|
-
|
4
|
-
if config['slim']
|
5
|
-
gem 'slim', '~> 1.0'
|
6
|
-
gem 'slim-rails', '~> 1.0.3', :group => :development
|
7
|
-
else
|
8
|
-
recipes.delete('slim')
|
9
|
-
end
|
10
|
-
|
11
|
-
after_bundler do
|
12
|
-
|
13
|
-
say_wizard "Slim recipe running 'after bundler'"
|
14
|
-
|
15
|
-
remove_file 'app/views/layouts/application.html.erb'
|
16
|
-
# There is Slim code in this script. Changing the indentation is perilous between SLIMs.
|
17
|
-
# We have to use single-quote-style-heredoc to avoid interpolation.
|
18
|
-
create_file 'app/views/layouts/application.html.slim' do
|
19
|
-
<<-'SLIM'
|
20
|
-
doctype html
|
21
|
-
html
|
22
|
-
head
|
23
|
-
title App_Name
|
24
|
-
= stylesheet_link_tag "application", :media => "all"
|
25
|
-
= javascript_include_tag "application"
|
26
|
-
= csrf_meta_tags
|
27
|
-
body
|
28
|
-
= yield
|
29
|
-
SLIM
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
__END__
|
35
|
-
|
36
|
-
name: SLIM
|
37
|
-
description: "Utilize Slim instead of ERB."
|
38
|
-
author: claudiob
|
39
|
-
|
40
|
-
category: templating
|
41
|
-
exclusive: templating
|
42
|
-
|
43
|
-
config:
|
44
|
-
- slim:
|
45
|
-
type: boolean
|
46
|
-
prompt: Would you like to use Slim instead of ERB?
|
data/recipes/static_page.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
|
2
|
-
after_bundler do
|
3
|
-
|
4
|
-
say_wizard "HomePage recipe running 'after bundler'"
|
5
|
-
|
6
|
-
# remove the default home page
|
7
|
-
remove_file 'public/index.html'
|
8
|
-
|
9
|
-
# create a home controller and view
|
10
|
-
generate(:controller, "static home")
|
11
|
-
|
12
|
-
# set up a simple home page (with placeholder content)
|
13
|
-
if recipes.include? 'haml'
|
14
|
-
remove_file 'app/views/static/home.html.haml'
|
15
|
-
# There is Haml code in this script. Changing the indentation is perilous between HAMLs.
|
16
|
-
# We have to use single-quote-style-heredoc to avoid interpolation.
|
17
|
-
create_file 'app/views/static/home.html.haml' do
|
18
|
-
<<-'HAML'
|
19
|
-
%h3 Home
|
20
|
-
HAML
|
21
|
-
end
|
22
|
-
else
|
23
|
-
remove_file 'app/views/static/home.html.erb'
|
24
|
-
create_file 'app/views/static/home.html.erb' do
|
25
|
-
<<-ERB
|
26
|
-
<h3>Home</h3>
|
27
|
-
ERB
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
# set routes
|
32
|
-
gsub_file 'config/routes.rb', /get \"static\/home\"/, 'root to: "static#home"'
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
__END__
|
37
|
-
|
38
|
-
name: StaticPage
|
39
|
-
description: "Create a simple home page (creates a static controller and view)."
|
40
|
-
author: RailsApps
|
41
|
-
|
42
|
-
category: other
|
43
|
-
tags: [utilities, configuration]
|
data/recipes/subdomains.rb
DELETED
@@ -1,121 +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/subdomains.rb
|
3
|
-
# this recipe requires Mongoid and Haml (ActiveRecord and ERB verions are not implemented)
|
4
|
-
|
5
|
-
if recipes.include? 'haml'
|
6
|
-
if recipes.include? 'mongoid'
|
7
|
-
after_bundler do
|
8
|
-
say_wizard "Subdomains recipe running 'after bundler'"
|
9
|
-
case config['subdomain_option']
|
10
|
-
when 'no'
|
11
|
-
say_wizard "Subdomains recipe skipped."
|
12
|
-
when 'one-per-user'
|
13
|
-
# user name as a subdomain
|
14
|
-
inject_into_file 'app/models/user.rb', :before => 'attr_accessible' do <<-RUBY
|
15
|
-
validates_format_of :name, with: /^[a-z0-9_]+$/, message: 'must be lowercase alphanumerics only'
|
16
|
-
validates_length_of :name, maximum: 32, message: 'exceeds maximum of 32 characters'
|
17
|
-
validates_exclusion_of :name, in: ['www', 'mail', 'ftp'], message: 'is not available'
|
18
|
-
|
19
|
-
RUBY
|
20
|
-
end
|
21
|
-
# modify db/seeds.rb
|
22
|
-
gsub_file 'db/seeds.rb', /First User/, 'user1'
|
23
|
-
gsub_file 'db/seeds.rb', /Second User/, 'user2'
|
24
|
-
# controller and views for the profile page
|
25
|
-
create_file 'app/controllers/profiles_controller.rb' do
|
26
|
-
<<-RUBY
|
27
|
-
class ProfilesController < ApplicationController
|
28
|
-
def show
|
29
|
-
@user = User.first(conditions: { name: request.subdomain }) || not_found
|
30
|
-
end
|
31
|
-
|
32
|
-
def not_found
|
33
|
-
raise ActionController::RoutingError.new('User Not Found')
|
34
|
-
end
|
35
|
-
end
|
36
|
-
RUBY
|
37
|
-
end
|
38
|
-
# There is Haml code in this script. Changing the indentation is perilous between HAMLs.
|
39
|
-
# We have to use single-quote-style-heredoc to avoid interpolation.
|
40
|
-
create_file 'app/views/profiles/show.html.haml' do
|
41
|
-
<<-'HAML'
|
42
|
-
%h1 Profile
|
43
|
-
%h3= @user.name
|
44
|
-
%h3= @user.email
|
45
|
-
HAML
|
46
|
-
end
|
47
|
-
# implement routing constraint for subdomains
|
48
|
-
# be sure to autoload (set config.autoload_paths in config/application.rb)
|
49
|
-
# or require this class in the config/routes.rb file
|
50
|
-
create_file 'lib/subdomain.rb' do
|
51
|
-
<<-RUBY
|
52
|
-
class Subdomain
|
53
|
-
def self.matches?(request)
|
54
|
-
case request.subdomain
|
55
|
-
when 'www', '', nil
|
56
|
-
false
|
57
|
-
else
|
58
|
-
true
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
RUBY
|
63
|
-
end
|
64
|
-
# create routes for subdomains
|
65
|
-
gsub_file 'config/routes.rb', /root :to => "home#index"/, ''
|
66
|
-
inject_into_file 'config/routes.rb', :after => 'resources :users, :only => [:show, :index]' do <<-RUBY
|
67
|
-
|
68
|
-
constraints(Subdomain) do
|
69
|
-
match '/' => 'profiles#show'
|
70
|
-
end
|
71
|
-
root :to => "home#index"
|
72
|
-
RUBY
|
73
|
-
end
|
74
|
-
remove_file 'app/views/users/show.html.haml'
|
75
|
-
# There is Haml code in this script. Changing the indentation is perilous between HAMLs.
|
76
|
-
# We have to use single-quote-style-heredoc to avoid interpolation.
|
77
|
-
create_file 'app/views/users/show.html.haml' do
|
78
|
-
<<-'HAML'
|
79
|
-
%p
|
80
|
-
User: #{@user.name}
|
81
|
-
%p
|
82
|
-
Email: #{@user.email if @user.email}
|
83
|
-
%p
|
84
|
-
Profile: #{link_to root_url(:subdomain => @user.name), root_url(:subdomain => @user.name)}
|
85
|
-
HAML
|
86
|
-
end
|
87
|
-
remove_file 'app/views/home/index.html.haml'
|
88
|
-
# There is Haml code in this script. Changing the indentation is perilous between HAMLs.
|
89
|
-
# We have to use single-quote-style-heredoc to avoid interpolation.
|
90
|
-
create_file 'app/views/home/index.html.haml' do
|
91
|
-
<<-'HAML'
|
92
|
-
%h3 Home
|
93
|
-
- @users.each do |user|
|
94
|
-
%br/
|
95
|
-
#{user.name} profile: #{link_to root_url(:subdomain => user.name), root_url(:subdomain => user.name)}
|
96
|
-
HAML
|
97
|
-
end
|
98
|
-
gsub_file 'app/controllers/users_controller.rb', /before_filter :authenticate_user!/, ''
|
99
|
-
end
|
100
|
-
end
|
101
|
-
else
|
102
|
-
say_wizard "The subdomains recipe is only implememted for Mongoid (no support for ActiveRecord)."
|
103
|
-
end
|
104
|
-
else
|
105
|
-
say_wizard "The subdomains recipe is only implememted for Haml (no support for ERB)."
|
106
|
-
end
|
107
|
-
|
108
|
-
__END__
|
109
|
-
|
110
|
-
name: subdomains
|
111
|
-
description: "Allow use of subdomains."
|
112
|
-
author: RailsApps
|
113
|
-
|
114
|
-
category: other
|
115
|
-
tags: [utilities, configuration]
|
116
|
-
|
117
|
-
config:
|
118
|
-
- subdomain_option:
|
119
|
-
type: multiple_choice
|
120
|
-
prompt: "Would you like to add support for subdomains?"
|
121
|
-
choices: [["No", no], ["One subdomain per user (like Basecamp)", one-per-user]]
|
data/recipes/turnip.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
gem 'turnip', :group => [:test]
|
2
|
-
|
3
|
-
after_bundler do
|
4
|
-
append_to_file '.rspec', '-r turnip/rspec'
|
5
|
-
create_file 'spec/acceptance/steps/.gitkeep'
|
6
|
-
end
|
7
|
-
|
8
|
-
__END__
|
9
|
-
|
10
|
-
name: Turnip
|
11
|
-
description: "Gherkin extension for RSpec"
|
12
|
-
author: listrophy,mathias
|
13
|
-
|
14
|
-
requires: [rspec]
|
15
|
-
run_after: [rspec]
|
16
|
-
exclusive: acceptance_testing
|
17
|
-
category: testing
|
18
|
-
tags: [acceptance]
|
data/recipes/unicorn.rb
DELETED
@@ -1,29 +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/unicorn.rb
|
3
|
-
|
4
|
-
case config['unicorn']
|
5
|
-
when 'development'
|
6
|
-
say_wizard "Adding 'unicorn'"
|
7
|
-
gem "unicorn-rails", :platform => :ruby, :group => [:development, :test]
|
8
|
-
when 'production'
|
9
|
-
say_wizard "Adding 'unicorn'"
|
10
|
-
gem "unicorn-rails", :platform => :ruby, :group => :production
|
11
|
-
when 'both'
|
12
|
-
say_wizard "Adding 'unicorn'"
|
13
|
-
gem "unicorn-rails", :platform => :ruby
|
14
|
-
end
|
15
|
-
|
16
|
-
__END__
|
17
|
-
|
18
|
-
name: Unicorn
|
19
|
-
description: "Use Unicorn as your default server (works on Heroku with the Celadon Cedar stack)."
|
20
|
-
author: mmacedo
|
21
|
-
|
22
|
-
category: server
|
23
|
-
tags: [server]
|
24
|
-
|
25
|
-
config:
|
26
|
-
- unicorn:
|
27
|
-
type: multiple_choice
|
28
|
-
prompt: Would you like to use unicorn as your server?
|
29
|
-
choices: [["No", no], ["In development only", development], ["In production only", production], ["Both development and production", both]]
|