ey_rails_wizard 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.md +8 -0
- data/README.md +21 -17
- data/Rakefile +21 -6
- data/lib/rails_wizard.rb +5 -5
- data/lib/rails_wizard/command.rb +29 -23
- data/lib/rails_wizard/config.rb +6 -6
- data/lib/rails_wizard/{recipe.rb → scroll.rb} +10 -10
- data/lib/rails_wizard/{recipes.rb → scrolls.rb} +9 -9
- data/lib/rails_wizard/template.rb +23 -23
- data/sample.rb +2 -2
- data/{recipes → scrolls}/active_admin.rb +1 -1
- data/{recipes → scrolls}/activerecord.rb +0 -0
- data/{recipes → scrolls}/cancan.rb +0 -0
- data/{recipes → scrolls}/capybara.rb +0 -0
- data/{recipes → scrolls}/carrierwave.rb +0 -0
- data/{recipes → scrolls}/carrierwave_direct.rb +0 -0
- data/{recipes → scrolls}/cartographer.rb +0 -0
- data/{recipes → scrolls}/cucumber.rb +1 -1
- data/scrolls/delayed_job.rb +94 -0
- data/{recipes → scrolls}/devise.rb +2 -2
- data/{recipes → scrolls}/devise_invitable.rb +0 -0
- data/{recipes → scrolls}/env_yaml.rb +0 -0
- data/{recipes → scrolls}/event_calendar.rb +0 -0
- data/scrolls/eycloud.rb +62 -0
- data/{recipes → scrolls}/eycloud_recipes_on_deploy.rb +1 -1
- data/{recipes → scrolls}/factory_girl.rb +1 -1
- data/{recipes → scrolls}/ffaker.rb +0 -0
- data/{recipes → scrolls}/fixture_builder.rb +0 -0
- data/{recipes → scrolls}/forgery.rb +0 -0
- data/{recipes → scrolls}/git.rb +0 -0
- data/scrolls/github.rb +31 -0
- data/{recipes → scrolls}/haml.rb +0 -0
- data/{recipes → scrolls}/heroku.rb +0 -0
- data/{recipes → scrolls}/hoptoad.rb +1 -1
- data/{recipes → scrolls}/inherited_resources.rb +0 -0
- data/scrolls/intercom.rb +35 -0
- data/{recipes → scrolls}/jammit.rb +0 -0
- data/{recipes → scrolls}/jasmine.rb +0 -0
- data/{recipes → scrolls}/jquery.rb +0 -0
- data/{recipes → scrolls}/mini_magick.rb +0 -0
- data/{recipes → scrolls}/mongo_mapper.rb +0 -0
- data/{recipes → scrolls}/mongohq.rb +2 -2
- data/{recipes → scrolls}/mongoid.rb +0 -0
- data/{recipes → scrolls}/mootools.rb +0 -0
- data/{recipes → scrolls}/mysql.rb +12 -2
- data/scrolls/newrelic.rb +11 -0
- data/{recipes → scrolls}/nifty_generators.rb +1 -1
- data/{recipes → scrolls}/oa_oauth.rb +0 -0
- data/{recipes → scrolls}/omniauth.rb +0 -0
- data/{recipes → scrolls}/paper_trail.rb +0 -0
- data/{recipes → scrolls}/pow.rb +0 -0
- data/{recipes → scrolls}/prototype.rb +0 -0
- data/{recipes → scrolls}/puma.rb +0 -0
- data/{recipes → scrolls}/rails_admin.rb +0 -0
- data/{recipes → scrolls}/rails_basics.rb +9 -4
- data/{recipes → scrolls}/rails_dev_tweaks.rb +0 -0
- data/{recipes → scrolls}/rails_erd.rb +0 -0
- data/{recipes → scrolls}/rails_footnotes.rb +0 -0
- data/{recipes → scrolls}/ransack.rb +0 -0
- data/{recipes → scrolls}/redis.rb +4 -0
- data/scrolls/resque.rb +70 -0
- data/{recipes → scrolls}/rmagick.rb +0 -0
- data/{recipes → scrolls}/rspec.rb +0 -0
- data/{recipes → scrolls}/sass.rb +1 -1
- data/{recipes → scrolls}/sequel.rb +0 -0
- data/{recipes → scrolls}/settingslogic.rb +0 -0
- data/{recipes → scrolls}/shoulda_matchers.rb +0 -0
- data/scrolls/sidekiq.rb +23 -0
- data/{recipes → scrolls}/simple_form.rb +1 -1
- data/{recipes → scrolls}/slim.rb +0 -0
- data/{recipes → scrolls}/sqlite3.rb +0 -0
- data/{recipes → scrolls}/test_unit.rb +0 -0
- data/{recipes → scrolls}/thin.rb +0 -0
- data/{recipes → scrolls}/thinking_sphinx.rb +0 -0
- data/{recipes → scrolls}/twitter_bootstrap_rails.rb +1 -1
- data/{recipes → scrolls}/unicorn.rb +0 -0
- data/spec/rails_wizard/config_spec.rb +6 -6
- data/spec/rails_wizard/recipe_spec.rb +16 -16
- data/spec/rails_wizard/recipes/sanity_spec.rb +13 -13
- data/spec/rails_wizard/recipes_spec.rb +9 -9
- data/spec/rails_wizard/template_spec.rb +15 -15
- data/templates/helpers.erb +9 -9
- data/templates/layout.erb +7 -7
- data/templates/new_scroll.erb +20 -0
- data/templates/{recipe.erb → scroll.erb} +3 -3
- data/version.rb +1 -1
- metadata +88 -83
- data/recipes/delayed_job.rb +0 -16
- data/recipes/eycloud.rb +0 -30
- data/recipes/resque.rb +0 -37
data/sample.rb
CHANGED
@@ -29,10 +29,10 @@ Rails.application.config.generators do |g|
|
|
29
29
|
end
|
30
30
|
RUBY
|
31
31
|
|
32
|
-
|
32
|
+
scrolls = ["activerecord", "devise", "prototype"]
|
33
33
|
|
34
34
|
def say_custom(tag, text); say "\033[1m\033[36m" + tag.to_s.rjust(10) + "\033[0m" + " #{text}" end
|
35
|
-
def
|
35
|
+
def say_scroll(name); say "\033[1m\033[36m" + "scroll".rjust(10) + "\033[0m" + " Running #{name} scroll..." end
|
36
36
|
def say_wizard(text); say_custom('wizard', text) end
|
37
37
|
def ask_wizard(question)
|
38
38
|
ask "\033[1m\033[30m\033[46m" + "prompt".rjust(10) + "\033[0m\033[36m" + " #{question}\033[0m"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -3,7 +3,7 @@ gem 'capybara', :group => [:development, :test]
|
|
3
3
|
gem 'database_cleaner', :group => [:development, :test]
|
4
4
|
|
5
5
|
after_bundler do
|
6
|
-
generate "cucumber:install --capybara#{' --rspec' if
|
6
|
+
generate "cucumber:install --capybara#{' --rspec' if scrolls.include?('rspec')}#{' -D' unless scrolls.include?('activerecord')}"
|
7
7
|
end
|
8
8
|
|
9
9
|
__END__
|
@@ -0,0 +1,94 @@
|
|
1
|
+
gem 'delayed_job_active_record'
|
2
|
+
gem 'delayed_job_admin'
|
3
|
+
|
4
|
+
if config["admin"]
|
5
|
+
inject_into_class "app/controllers/application_controller.rb", "ApplicationController" do
|
6
|
+
<<-RUBY
|
7
|
+
|
8
|
+
def delayed_job_admin_authentication
|
9
|
+
# authentication_logic_goes_here
|
10
|
+
true
|
11
|
+
end
|
12
|
+
|
13
|
+
RUBY
|
14
|
+
end
|
15
|
+
|
16
|
+
create_file "readmes/delayed_job_admin.md", <<-MD
|
17
|
+
# Delayed Job Admin README
|
18
|
+
|
19
|
+
Delayed Job Admin console is available at [/delayed_job_admin](http://localhost:3000/delayed_job_admin).
|
20
|
+
|
21
|
+
```
|
22
|
+
open http://localhost:3000/delayed_job_admin
|
23
|
+
```
|
24
|
+
|
25
|
+
## Steps to complete
|
26
|
+
|
27
|
+
### Authentication
|
28
|
+
|
29
|
+
By default, there is no authentication or authorization protecting access to `/delayed_job_admin`.
|
30
|
+
|
31
|
+
Please go to `app/controllers/application_controller.rb` and edit the following method:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
def delayed_job_admin_authentication
|
35
|
+
# authentication_logic_goes_here
|
36
|
+
true
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
40
|
+
For example, if you are using the Devise gem and have an Admin model:
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
def delayed_job_admin_authentication
|
44
|
+
authenticate_admin!
|
45
|
+
end
|
46
|
+
```
|
47
|
+
|
48
|
+
MD
|
49
|
+
end
|
50
|
+
|
51
|
+
if scroll? "eycloud_recipes_on_deploy"
|
52
|
+
gem 'eycloud-scroll-delayed_job', :group => :eycloud
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
after_bundler do
|
57
|
+
generate 'delayed_job'
|
58
|
+
|
59
|
+
if scroll? "eycloud_recipes_on_deploy"
|
60
|
+
say_wizard 'Installing deploy hooks to restart delayed_job after deploys'
|
61
|
+
run "touch deploy/before_restart.rb"
|
62
|
+
append_file "deploy/before_restart.rb", <<-RUBY
|
63
|
+
on_app_servers_and_utilities do
|
64
|
+
node[:applications].each do |app_name, data|
|
65
|
+
sudo 'echo "sleep 20 && monit -g dj_\#{app_name} restart all" | at now'
|
66
|
+
end
|
67
|
+
end
|
68
|
+
RUBY
|
69
|
+
|
70
|
+
append_file "deploy/cookbooks/main/scrolls/default.rb", "\nrequire_scroll 'delayed_job'\n"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
after_everything do
|
75
|
+
say_custom "readme", "Delayed Job Admin"
|
76
|
+
run %q{cat "readmes/delayed_job_admin.md"}
|
77
|
+
end
|
78
|
+
|
79
|
+
__END__
|
80
|
+
|
81
|
+
name: Delayed Job
|
82
|
+
description: Use Delayed Job to handle background jobs
|
83
|
+
author: drnic
|
84
|
+
|
85
|
+
exclusive: worker
|
86
|
+
category: worker
|
87
|
+
tags: [worker,background-tasks]
|
88
|
+
|
89
|
+
run_after: [eycloud_recipes_on_deploy]
|
90
|
+
|
91
|
+
config:
|
92
|
+
- admin:
|
93
|
+
type: boolean
|
94
|
+
prompt: "Install simple admin interface to Delayed Job?"
|
@@ -9,11 +9,11 @@ inject_into_file 'config/routes.rb', "\nroot :to => 'home#index'\n", :after => "
|
|
9
9
|
after_bundler do
|
10
10
|
generate 'devise:install'
|
11
11
|
|
12
|
-
if
|
12
|
+
if scrolls.include? 'mongo_mapper'
|
13
13
|
gem 'mm-devise'
|
14
14
|
gsub_file 'config/initializers/devise.rb', 'devise/orm/', 'devise/orm/mongo_mapper_active_model'
|
15
15
|
generate 'mongo_mapper:devise User'
|
16
|
-
elsif
|
16
|
+
elsif scrolls.include? 'mongoid'
|
17
17
|
gsub_file 'config/initializers/devise.rb', 'devise/orm/active_record', 'devise/orm/mongoid'
|
18
18
|
end
|
19
19
|
|
File without changes
|
File without changes
|
File without changes
|
data/scrolls/eycloud.rb
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
@name = File.basename(File.expand_path("."))
|
2
|
+
say_custom "eycloud", "Deploying #{@name} to Engine Yard Cloud..."
|
3
|
+
|
4
|
+
# gem 'engineyard-v2', :groups => [:development]
|
5
|
+
gem 'ey_config'
|
6
|
+
|
7
|
+
unless scroll?("mysql") || scroll?("postgresql")
|
8
|
+
say_custom "eycloud", "ERROR: To deploy to Engine Yard Cloud, please include 'mysql' or 'postgresql' scroll."
|
9
|
+
exit 1
|
10
|
+
end
|
11
|
+
|
12
|
+
after_everything do
|
13
|
+
if @mysql_stack
|
14
|
+
say_custom "eycloud", "Using mysql #{@mysql_stack}"
|
15
|
+
elsif @postgresql_stack
|
16
|
+
say_custom "eycloud", "Using postgresql #{@postgresql_stack}"
|
17
|
+
end
|
18
|
+
|
19
|
+
# run "ey login"
|
20
|
+
#
|
21
|
+
# require "yaml"
|
22
|
+
# require "engineyard" # for EY.ui
|
23
|
+
# require "engineyard/eyrc" # to load api token
|
24
|
+
# require "engineyard-cloud-client"
|
25
|
+
# ey_api = EY::CloudClient.new(EY::EYRC.load.api_token)
|
26
|
+
#
|
27
|
+
#
|
28
|
+
# say_custom "eycloud", "Fetching list of accounts..."
|
29
|
+
# current_apps = EY::CloudClient::App.all(ey_api)
|
30
|
+
#
|
31
|
+
# # TODO check if @git_uri is in current_apps, if not then create app
|
32
|
+
#
|
33
|
+
# accounts = current_apps.map(&:account).uniq
|
34
|
+
# account = multiple_choice("Create app to which Engine Yard Cloud account?", accounts.map {|a| [a.name, a]})
|
35
|
+
#
|
36
|
+
# say_custom "eycloud", "Creating application #{@name} on account #{account.name}..."
|
37
|
+
# app = EY::CloudClient::App.create(ey_api, {
|
38
|
+
# "account" => account,
|
39
|
+
# "name" => @name,
|
40
|
+
# "repository_uri" => @git_uri,
|
41
|
+
# "app_type_id" => "rails3"
|
42
|
+
# })
|
43
|
+
#
|
44
|
+
|
45
|
+
# TODO how to get deploy key?
|
46
|
+
# How to upload deploy key to github?
|
47
|
+
|
48
|
+
# multiple_choice("Let's boot some instances!", [
|
49
|
+
# [""]
|
50
|
+
# ])
|
51
|
+
end
|
52
|
+
|
53
|
+
__END__
|
54
|
+
|
55
|
+
name: Engine Yard Cloud
|
56
|
+
description: The Most Powerful Ruby Cloud
|
57
|
+
author: drnic
|
58
|
+
|
59
|
+
requires: [github]
|
60
|
+
run_after: [github]
|
61
|
+
category: deployment
|
62
|
+
exclusive: deployment
|
File without changes
|
File without changes
|
File without changes
|
data/{recipes → scrolls}/git.rb
RENAMED
File without changes
|
data/scrolls/github.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
gem 'github', '>= 0.7.0', :group => [:development]
|
2
|
+
|
3
|
+
after_everything do
|
4
|
+
if config["github_private"]
|
5
|
+
run "bundle exec gh create-from-local --private"
|
6
|
+
else
|
7
|
+
run "bundle exec gh create-from-local"
|
8
|
+
end
|
9
|
+
|
10
|
+
# TODO - what to do if repo already exists? prompt to override?
|
11
|
+
|
12
|
+
@git_uri = `git config remote.origin.url`.strip
|
13
|
+
say_custom "github", "Created repo #{@git_uri}"
|
14
|
+
end
|
15
|
+
|
16
|
+
__END__
|
17
|
+
|
18
|
+
name: GitHub
|
19
|
+
description: Create/push project to new GitHub repository
|
20
|
+
author: drnic
|
21
|
+
|
22
|
+
category: deployment
|
23
|
+
exclusive: scm-hosting
|
24
|
+
|
25
|
+
requires: [git]
|
26
|
+
run_after: [git]
|
27
|
+
|
28
|
+
config:
|
29
|
+
- github_private:
|
30
|
+
type: boolean
|
31
|
+
prompt: "Creating GitHub repository; want it to be private?"
|
data/{recipes → scrolls}/haml.rb
RENAMED
File without changes
|
File without changes
|
File without changes
|
data/scrolls/intercom.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# gem 'intercom-ruby', :group => [:development] # for API communication
|
2
|
+
gem 'intercom-rails' # to generate the javascript in the layout
|
3
|
+
|
4
|
+
|
5
|
+
# during initial generation (after "rails new")
|
6
|
+
# signin to intercom.io, fetch token, or enter tokens
|
7
|
+
# create new intercom app and get metadata
|
8
|
+
|
9
|
+
|
10
|
+
after_bundler do
|
11
|
+
generate %Q|intercom:install #{config["intercom_app_id"]}|
|
12
|
+
end
|
13
|
+
|
14
|
+
after_everything do
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
__END__
|
19
|
+
|
20
|
+
name: Intercom
|
21
|
+
description: Install intercom.io
|
22
|
+
author: drnic
|
23
|
+
website: http://intercom.io
|
24
|
+
|
25
|
+
requires: []
|
26
|
+
run_after: []
|
27
|
+
run_before: []
|
28
|
+
|
29
|
+
category: other # authentication, testing, persistence, javascript, css, services, deployment, and templating
|
30
|
+
# exclusive:
|
31
|
+
|
32
|
+
config:
|
33
|
+
- intercom_app_id:
|
34
|
+
type: string
|
35
|
+
prompt: "What is your Intercom app id for this new, fantastic app?"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -30,7 +30,7 @@ YAML
|
|
30
30
|
end
|
31
31
|
|
32
32
|
after_bundler do
|
33
|
-
mongo_yml = "config/mongo#{'id' if
|
33
|
+
mongo_yml = "config/mongo#{'id' if scroll?('mongoid')}.yml"
|
34
34
|
|
35
35
|
prepend_file mongo_yml, header
|
36
36
|
inject_into_file mongo_yml, " <<: *mongohq\n", :after => "production:\n <<: *defaults\n"
|
@@ -52,7 +52,7 @@ config:
|
|
52
52
|
- use_heroku:
|
53
53
|
type: boolean
|
54
54
|
prompt: "Use the MongoHQ Heroku addon?"
|
55
|
-
|
55
|
+
if_scroll: heroku
|
56
56
|
- uri:
|
57
57
|
type: string
|
58
58
|
prompt: "Enter your MongoHQ URI:"
|
File without changes
|
File without changes
|
@@ -1,13 +1,21 @@
|
|
1
|
-
if
|
1
|
+
if scroll?("sqlite3")
|
2
2
|
gem "mysql2", :group => :production
|
3
3
|
else
|
4
|
-
gem "mysql2"
|
4
|
+
gem "mysql2"
|
5
5
|
end
|
6
6
|
# TODO what about Windows?
|
7
7
|
# TODO what if you only want MySQL in production?
|
8
8
|
|
9
9
|
# TODO generate config/database.yml for DBs
|
10
10
|
|
11
|
+
if scroll?("eycloud")
|
12
|
+
mysql_versions = [
|
13
|
+
["MySQL 5.0", "mysql_50"],
|
14
|
+
["MySQL 5.5 (beta)", "mysql_55"]
|
15
|
+
]
|
16
|
+
@mysql_stack = multiple_choice("Create app to which Engine Yard Cloud account?", mysql_versions)
|
17
|
+
end
|
18
|
+
|
11
19
|
__END__
|
12
20
|
|
13
21
|
name: MySQL
|
@@ -17,3 +25,5 @@ author: drnic
|
|
17
25
|
exclusive: orm
|
18
26
|
category: persistence
|
19
27
|
tags: [sql, orm, mysql]
|
28
|
+
|
29
|
+
run_before: [eycloud]
|
data/scrolls/newrelic.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
gem 'newrelic_rpm'
|
2
|
+
|
3
|
+
__END__
|
4
|
+
|
5
|
+
name: New Relic RPM
|
6
|
+
description: Monitor applications with New Relic
|
7
|
+
author: drnic
|
8
|
+
website: https://support.cloud.engineyard.com/entries/21016493-monitor-applications-with-new-relic-on-engine-yard-cloud
|
9
|
+
|
10
|
+
category: deployment
|
11
|
+
exclusive: app-monitoring
|
File without changes
|
File without changes
|
File without changes
|
data/{recipes → scrolls}/pow.rb
RENAMED
File without changes
|
File without changes
|
data/{recipes → scrolls}/puma.rb
RENAMED
File without changes
|