ey_rails_wizard 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.md +5 -0
- data/ey_rails_wizard.gemspec +1 -0
- data/lib/rails/generators/.DS_Store +0 -0
- data/lib/rails/generators/run_template/USAGE +13 -0
- data/lib/rails/generators/run_template/run_template_generator.rb +13 -0
- data/lib/rails_wizard/template.rb +1 -1
- data/scrolls/eycloud.rb +55 -45
- data/scrolls/github.rb +16 -9
- data/scrolls/mysql.rb +7 -7
- data/scrolls/passenger.rb +10 -0
- data/scrolls/puma.rb +1 -0
- data/scrolls/twitter_bootstrap.rb +31 -0
- data/scrolls/{twitter_bootstrap_rails.rb → twitter_bootstrap_rails_v1.rb} +2 -0
- data/version.rb +1 -1
- metadata +35 -19
data/ChangeLog.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# ChangeLog
|
2
2
|
|
3
|
+
* `eycloud` - now using `ey_cli` to create/boot environments
|
4
|
+
* `twitter_bootstrap` - based on latest RailsCast
|
5
|
+
* `github` - asks for a new repo name if cannot create a repository
|
6
|
+
* Better resolution of ordering of nested dependencies... by doing more .sort.sort.sort.... oh noes.
|
7
|
+
|
3
8
|
## v0.4
|
4
9
|
|
5
10
|
* SCROLLS ARE IN, "recipes" are out. Wizards use scrolls. Alchemists use recipes.
|
data/ey_rails_wizard.gemspec
CHANGED
@@ -13,6 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.description = %q{Quickly and easily create Rails application templates featuring dozens of popular libraries tuned for Engine Yard Cloud}
|
14
14
|
|
15
15
|
s.add_dependency "i18n"
|
16
|
+
s.add_dependency "json", "1.6.5"
|
16
17
|
s.add_dependency "activesupport", "~> 3.0"
|
17
18
|
s.add_dependency "thor"
|
18
19
|
s.add_development_dependency "rspec", "~> 2.5.0"
|
Binary file
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Description:
|
2
|
+
Apply an application template to an existing application
|
3
|
+
|
4
|
+
Application templates are traditionally used for new applications. Such as:
|
5
|
+
|
6
|
+
rails new myapp -m /path/to/template.rb
|
7
|
+
|
8
|
+
This generator allows the templates to be reused/reapplied to this existing application.
|
9
|
+
|
10
|
+
Example:
|
11
|
+
rails g run_template /path/to/template.rb
|
12
|
+
rails g run_template https://mycompany.com/template.rb
|
13
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class RunTemplateGenerator < Rails::Generators::Base
|
2
|
+
source_root File.expand_path('../templates', __FILE__)
|
3
|
+
|
4
|
+
argument :template_path, :desc => "Path to an application template"
|
5
|
+
|
6
|
+
def apply_template
|
7
|
+
path = template_path
|
8
|
+
unless path =~ /^https?:\/\//
|
9
|
+
path = File.expand_path(path, Dir.pwd)
|
10
|
+
end
|
11
|
+
apply path
|
12
|
+
end
|
13
|
+
end
|
data/scrolls/eycloud.rb
CHANGED
@@ -1,53 +1,62 @@
|
|
1
1
|
@name = File.basename(File.expand_path("."))
|
2
|
-
say_custom "eycloud", "Deploying #{@name} to Engine Yard Cloud..."
|
3
2
|
|
4
|
-
|
5
|
-
gem '
|
3
|
+
gem_group :development do
|
4
|
+
gem 'ey_cli'
|
5
|
+
gem 'engineyard'
|
6
|
+
end
|
7
|
+
|
8
|
+
gem 'ey_config' # for partner services
|
9
|
+
|
10
|
+
required_dbs = %w[mysql postgresql]
|
11
|
+
required_app_servers = %w[unicorn trinidad passenger puma thin]
|
12
|
+
|
13
|
+
selected_db = required_dbs.find {|db| scroll? db }
|
14
|
+
unless selected_db
|
15
|
+
say_custom "eycloud", "Please include a DB choice from: #{required_dbs.join ", "}"
|
16
|
+
exit_now = true
|
17
|
+
end
|
6
18
|
|
7
|
-
|
8
|
-
|
9
|
-
|
19
|
+
selected_app_server = required_app_servers.find {|app| scroll? app }
|
20
|
+
unless selected_app_server
|
21
|
+
say_custom "eycloud", "Please include an App Server choice from: #{required_app_servers.join ", "}"
|
22
|
+
exit_now = true
|
10
23
|
end
|
11
24
|
|
25
|
+
exit 1 if exit_now
|
26
|
+
|
12
27
|
after_everything do
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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?
|
28
|
+
@git_url ||= `git config remote.origin.url`.strip
|
29
|
+
if @git_url.size == 0
|
30
|
+
say_custom "eycloud", "Skipping... no git URI discovered"
|
31
|
+
else
|
32
|
+
run "ey login"
|
33
|
+
|
34
|
+
if @mysql_stack
|
35
|
+
say_custom "eycloud", "Using mysql #{@mysql_stack}"
|
36
|
+
elsif @postgresql_stack
|
37
|
+
say_custom "eycloud", "Using postgresql #{@postgresql_stack}"
|
38
|
+
end
|
47
39
|
|
48
|
-
|
49
|
-
|
50
|
-
|
40
|
+
framework_env = multiple_choice "Which framework environment?", [%w[Production production], %w[Staging staging]]
|
41
|
+
|
42
|
+
# TODO check for app name first
|
43
|
+
app_name = (@repo_name && @repo_name.size > 0) ? @repo_name : @name
|
44
|
+
say_custom "eycloud", "Checking for availability of #{app_name}"
|
45
|
+
@app_names ||= `ey_cli apps | grep "-" | sed "s/.* //"`.split(/\n/)
|
46
|
+
while @app_names.include?(app_name)
|
47
|
+
app_name = ask_wizard "Application #{app_name} is already taken; what"
|
48
|
+
end
|
49
|
+
|
50
|
+
name = File.basename(".")
|
51
|
+
command = "ey_cli create_app --name #{app_name} --type rails3 "
|
52
|
+
command += "--git #{@git_url} "
|
53
|
+
command += "--framework_env #{framework_env} "
|
54
|
+
command += "--env_name #{@name}_#{framework_env} "
|
55
|
+
command += "--stack #{selected_app_server} "
|
56
|
+
command += "--solo"
|
57
|
+
run command
|
58
|
+
|
59
|
+
end
|
51
60
|
end
|
52
61
|
|
53
62
|
__END__
|
@@ -56,7 +65,8 @@ name: Engine Yard Cloud
|
|
56
65
|
description: The Most Powerful Ruby Cloud
|
57
66
|
author: drnic
|
58
67
|
|
59
|
-
requires: [github]
|
60
|
-
run_after: [github]
|
61
68
|
category: deployment
|
62
69
|
exclusive: deployment
|
70
|
+
|
71
|
+
requires: [github]
|
72
|
+
run_after: [github]
|
data/scrolls/github.rb
CHANGED
@@ -1,15 +1,21 @@
|
|
1
1
|
gem 'github', '>= 0.7.0', :group => [:development]
|
2
2
|
|
3
3
|
after_everything do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
tried_create_already = false
|
5
|
+
while (@git_uri = `git config remote.origin.url`.strip) && @git_uri.size == 0
|
6
|
+
if tried_create_already
|
7
|
+
@repo_name = ask_wizard "Repository already exists. What project name?"
|
8
|
+
else
|
9
|
+
@repo_name = ""
|
10
|
+
end
|
11
|
+
if config["github_private"]
|
12
|
+
run "bundle exec gh create-from-local #{@repo_name} --private"
|
13
|
+
else
|
14
|
+
run "bundle exec gh create-from-local #{@repo_name}"
|
15
|
+
end
|
16
|
+
tried_create_already = true
|
8
17
|
end
|
9
|
-
|
10
|
-
# TODO - what to do if repo already exists? prompt to override?
|
11
18
|
|
12
|
-
@git_uri = `git config remote.origin.url`.strip
|
13
19
|
say_custom "github", "Created repo #{@git_uri}"
|
14
20
|
end
|
15
21
|
|
@@ -27,5 +33,6 @@ run_after: [git]
|
|
27
33
|
|
28
34
|
config:
|
29
35
|
- github_private:
|
30
|
-
|
31
|
-
|
36
|
+
prompt: "Create a GitHub repository?"
|
37
|
+
type: multiple_choice
|
38
|
+
choices: [["Public", false], ["Private", true]]
|
data/scrolls/mysql.rb
CHANGED
@@ -8,13 +8,13 @@ end
|
|
8
8
|
|
9
9
|
# TODO generate config/database.yml for DBs
|
10
10
|
|
11
|
-
if scroll?("eycloud")
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
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
18
|
|
19
19
|
__END__
|
20
20
|
|
data/scrolls/puma.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
gem_group :assets do
|
2
|
+
gem 'twitter-bootstrap-rails'
|
3
|
+
end
|
4
|
+
|
5
|
+
after_bundler do
|
6
|
+
generate "bootstrap:install"
|
7
|
+
layout = config["twitter_bootstrap_layout"]
|
8
|
+
generate "bootstrap:layout #{layout}"
|
9
|
+
gsub_file "app/controllers/application_controller.rb", /class ApplicationController < ActionController::Base/, <<-RUBY
|
10
|
+
class ApplicationController < ActionController::Base
|
11
|
+
layout "#{layout}"
|
12
|
+
RUBY
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
__END__
|
17
|
+
|
18
|
+
name: Twitter Bootstrap Rails
|
19
|
+
description: Add Twitter Bootstrap CSS
|
20
|
+
|
21
|
+
category: stylesheet
|
22
|
+
exclusive: stylesheet
|
23
|
+
tags: [css, stylesheet]
|
24
|
+
|
25
|
+
config:
|
26
|
+
- twitter_bootstrap_layout:
|
27
|
+
prompt: "Which Twitter Bootstrap layout?"
|
28
|
+
type: multiple_choice
|
29
|
+
choices: [["Fluid", "fluid"], ["Fixed", "fixed"]]
|
30
|
+
|
31
|
+
|
data/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ey_rails_wizard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-03-
|
13
|
+
date: 2012-03-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: i18n
|
17
|
-
requirement: &
|
17
|
+
requirement: &70162210574060 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,21 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70162210574060
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: json
|
28
|
+
requirement: &70162210573480 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - =
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.6.5
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *70162210573480
|
26
37
|
- !ruby/object:Gem::Dependency
|
27
38
|
name: activesupport
|
28
|
-
requirement: &
|
39
|
+
requirement: &70162210572960 !ruby/object:Gem::Requirement
|
29
40
|
none: false
|
30
41
|
requirements:
|
31
42
|
- - ~>
|
@@ -33,10 +44,10 @@ dependencies:
|
|
33
44
|
version: '3.0'
|
34
45
|
type: :runtime
|
35
46
|
prerelease: false
|
36
|
-
version_requirements: *
|
47
|
+
version_requirements: *70162210572960
|
37
48
|
- !ruby/object:Gem::Dependency
|
38
49
|
name: thor
|
39
|
-
requirement: &
|
50
|
+
requirement: &70162210572580 !ruby/object:Gem::Requirement
|
40
51
|
none: false
|
41
52
|
requirements:
|
42
53
|
- - ! '>='
|
@@ -44,10 +55,10 @@ dependencies:
|
|
44
55
|
version: '0'
|
45
56
|
type: :runtime
|
46
57
|
prerelease: false
|
47
|
-
version_requirements: *
|
58
|
+
version_requirements: *70162210572580
|
48
59
|
- !ruby/object:Gem::Dependency
|
49
60
|
name: rspec
|
50
|
-
requirement: &
|
61
|
+
requirement: &70162210572040 !ruby/object:Gem::Requirement
|
51
62
|
none: false
|
52
63
|
requirements:
|
53
64
|
- - ~>
|
@@ -55,10 +66,10 @@ dependencies:
|
|
55
66
|
version: 2.5.0
|
56
67
|
type: :development
|
57
68
|
prerelease: false
|
58
|
-
version_requirements: *
|
69
|
+
version_requirements: *70162210572040
|
59
70
|
- !ruby/object:Gem::Dependency
|
60
71
|
name: bundler
|
61
|
-
requirement: &
|
72
|
+
requirement: &70162210571540 !ruby/object:Gem::Requirement
|
62
73
|
none: false
|
63
74
|
requirements:
|
64
75
|
- - ~>
|
@@ -66,10 +77,10 @@ dependencies:
|
|
66
77
|
version: 1.1.0
|
67
78
|
type: :development
|
68
79
|
prerelease: false
|
69
|
-
version_requirements: *
|
80
|
+
version_requirements: *70162210571540
|
70
81
|
- !ruby/object:Gem::Dependency
|
71
82
|
name: rails
|
72
|
-
requirement: &
|
83
|
+
requirement: &70162210571080 !ruby/object:Gem::Requirement
|
73
84
|
none: false
|
74
85
|
requirements:
|
75
86
|
- - ! '>='
|
@@ -77,10 +88,10 @@ dependencies:
|
|
77
88
|
version: 3.0.0
|
78
89
|
type: :development
|
79
90
|
prerelease: false
|
80
|
-
version_requirements: *
|
91
|
+
version_requirements: *70162210571080
|
81
92
|
- !ruby/object:Gem::Dependency
|
82
93
|
name: ZenTest
|
83
|
-
requirement: &
|
94
|
+
requirement: &70162210570700 !ruby/object:Gem::Requirement
|
84
95
|
none: false
|
85
96
|
requirements:
|
86
97
|
- - ! '>='
|
@@ -88,7 +99,7 @@ dependencies:
|
|
88
99
|
version: '0'
|
89
100
|
type: :development
|
90
101
|
prerelease: false
|
91
|
-
version_requirements: *
|
102
|
+
version_requirements: *70162210570700
|
92
103
|
description: Quickly and easily create Rails application templates featuring dozens
|
93
104
|
of popular libraries tuned for Engine Yard Cloud
|
94
105
|
email:
|
@@ -110,6 +121,9 @@ files:
|
|
110
121
|
- autotest/discover.rb
|
111
122
|
- bin/ey_rails_wizard
|
112
123
|
- ey_rails_wizard.gemspec
|
124
|
+
- lib/rails/generators/.DS_Store
|
125
|
+
- lib/rails/generators/run_template/USAGE
|
126
|
+
- lib/rails/generators/run_template/run_template_generator.rb
|
113
127
|
- lib/rails_wizard.rb
|
114
128
|
- lib/rails_wizard/command.rb
|
115
129
|
- lib/rails_wizard/config.rb
|
@@ -157,6 +171,7 @@ files:
|
|
157
171
|
- scrolls/oa_oauth.rb
|
158
172
|
- scrolls/omniauth.rb
|
159
173
|
- scrolls/paper_trail.rb
|
174
|
+
- scrolls/passenger.rb
|
160
175
|
- scrolls/pow.rb
|
161
176
|
- scrolls/prototype.rb
|
162
177
|
- scrolls/puma.rb
|
@@ -181,7 +196,8 @@ files:
|
|
181
196
|
- scrolls/test_unit.rb
|
182
197
|
- scrolls/thin.rb
|
183
198
|
- scrolls/thinking_sphinx.rb
|
184
|
-
- scrolls/
|
199
|
+
- scrolls/twitter_bootstrap.rb
|
200
|
+
- scrolls/twitter_bootstrap_rails_v1.rb
|
185
201
|
- scrolls/unicorn.rb
|
186
202
|
- spec/rails_wizard/config_spec.rb
|
187
203
|
- spec/rails_wizard/recipe_spec.rb
|
@@ -210,7 +226,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
210
226
|
version: '0'
|
211
227
|
segments:
|
212
228
|
- 0
|
213
|
-
hash:
|
229
|
+
hash: 2342862746662081785
|
214
230
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
215
231
|
none: false
|
216
232
|
requirements:
|
@@ -219,7 +235,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
219
235
|
version: '0'
|
220
236
|
segments:
|
221
237
|
- 0
|
222
|
-
hash:
|
238
|
+
hash: 2342862746662081785
|
223
239
|
requirements: []
|
224
240
|
rubyforge_project:
|
225
241
|
rubygems_version: 1.8.17
|