appscrolls 0.10.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/ChangeLog.md +6 -0
- data/appscrolls.gemspec +2 -2
- data/scrolls/cf.rb +88 -0
- data/scrolls/postgresql.rb +1 -3
- data/version.rb +1 -1
- metadata +22 -17
- data/scrolls/cfoundry.rb +0 -68
data/.gitignore
CHANGED
data/ChangeLog.md
CHANGED
@@ -4,6 +4,12 @@
|
|
4
4
|
|
5
5
|
* `puma` - added basic support for Puma; also Cloud Foundry will use Puma automatically
|
6
6
|
|
7
|
+
### v0.10.1
|
8
|
+
|
9
|
+
* `cfoundry` renamed to `cf`
|
10
|
+
* `cf` - automatically creates & binds postgresql/mysql if selected; deletes existing app of same name
|
11
|
+
* installation forces installation of latest bundler 1.3.4+ & rails 3.2.13+
|
12
|
+
|
7
13
|
## v0.9
|
8
14
|
|
9
15
|
* `Cloud Foundry` - added support for uploading to Cloud Foundry
|
data/appscrolls.gemspec
CHANGED
@@ -12,9 +12,9 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.summary = %q{The App Scrolls is a magical tool to generate new Rails and modify existing Rails applications (coming) to include your favourite, powerful magic.}
|
13
13
|
s.description = s.summary
|
14
14
|
|
15
|
-
s.add_dependency "
|
15
|
+
s.add_dependency "bundler", "~> 1.3.4"
|
16
|
+
s.add_dependency "rails", "~> 3.2.13"
|
16
17
|
s.add_dependency "i18n"
|
17
|
-
s.add_dependency "rails", "~> 3.2.2"
|
18
18
|
s.add_dependency "json", "~> 1.7.0"
|
19
19
|
s.add_dependency "thor"
|
20
20
|
s.add_development_dependency "cucumber"
|
data/scrolls/cf.rb
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
# Scroll is based on the following documentation
|
2
|
+
# * http://blog.cloudfoundry.com/2012/03/15/using-cloud-foundry-services-with-ruby-part-2-run-time-support-for-ruby-applications/
|
3
|
+
# * http://blog.cloudfoundry.com/2012/04/19/deploying-jruby-on-rails-applications-on-cloud-foundry/
|
4
|
+
|
5
|
+
vmc_version = '0.3.23'
|
6
|
+
|
7
|
+
@name = File.basename(File.expand_path("."))
|
8
|
+
|
9
|
+
gem 'vmc', "~> #{vmc_version}"
|
10
|
+
gem 'cf-runtime'
|
11
|
+
|
12
|
+
required_dbs = %w[mysql postgresql]
|
13
|
+
|
14
|
+
selected_db = required_dbs.find { |db| scroll? db }
|
15
|
+
unless selected_db
|
16
|
+
say_custom "cf", "Please include a DB choice from: #{required_dbs.join ", "}"
|
17
|
+
exit_now = true
|
18
|
+
end
|
19
|
+
|
20
|
+
manifest = {"applications"=>
|
21
|
+
{"."=>
|
22
|
+
{"name"=>@name,
|
23
|
+
"framework"=>
|
24
|
+
{"name"=>"rails3",
|
25
|
+
"info"=>
|
26
|
+
{"mem"=>"256M", "description"=>"Rails Application", "exec"=>nil}},
|
27
|
+
"url"=>"${name}.${target-base}",
|
28
|
+
"mem"=>"256M",
|
29
|
+
"instances"=>1,
|
30
|
+
"services"=>{}}}}
|
31
|
+
|
32
|
+
case selected_db.to_sym
|
33
|
+
when :postgresql
|
34
|
+
manifest["applications"]["."]["services"]["#{@name}-postgresql"] = {"type"=>"postgresql"}
|
35
|
+
db_username = config['pg_username'] || 'root'
|
36
|
+
db_password = config['pg_password'] || ''
|
37
|
+
when :mysql
|
38
|
+
manifest["applications"]["."]["services"]["#{@name}-mysql"] = {"type"=>"mysql"}
|
39
|
+
end
|
40
|
+
|
41
|
+
require "yaml"
|
42
|
+
create_file "manifest.yml", manifest.to_yaml
|
43
|
+
|
44
|
+
exit 1 if exit_now
|
45
|
+
|
46
|
+
after_bundler do
|
47
|
+
run %Q{vmc _#{vmc_version}_ apps | grep "\\b#{@name}\\b" && vmc _#{vmc_version}_ delete #{@name}}
|
48
|
+
|
49
|
+
# Desirable to vendor everything
|
50
|
+
run "bundle package"
|
51
|
+
|
52
|
+
production = <<-YAML.gsub(/^\s{2}/, '')
|
53
|
+
production:
|
54
|
+
adapter: #{selected_db}
|
55
|
+
<% db_svc = CFRuntime::CloudApp.service_props('#{selected_db}') %>
|
56
|
+
database: <%= db_svc[:database] rescue '#{project_name}_production' %>
|
57
|
+
username: <%= db_svc[:username] rescue '#{db_username}' %>
|
58
|
+
password: <%= db_svc[:password] rescue '#{db_password}' %>
|
59
|
+
<%= db_svc && db_svc[:host] ? "host: \#{db_svc[:host]}" : "" %>
|
60
|
+
<%= db_svc && db_svc[:port] ? "port: \#{db_svc[:port]}" : "" %>
|
61
|
+
YAML
|
62
|
+
append_file "config/database.yml", production
|
63
|
+
end
|
64
|
+
|
65
|
+
after_everything do
|
66
|
+
run "rake assets:precompile"
|
67
|
+
if jruby?
|
68
|
+
run "warble"
|
69
|
+
run "mkdir -p deploy"
|
70
|
+
run "cp #{project_name}.war deploy/"
|
71
|
+
end
|
72
|
+
run "vmc _#{vmc_version}_ push #{project_name} --runtime ruby19 --path . --no-start"
|
73
|
+
run "vmc _#{vmc_version}_ env-add #{project_name} BUNDLE_WITHOUT=assets:test:development"
|
74
|
+
run "vmc _#{vmc_version}_ start #{project_name}"
|
75
|
+
end
|
76
|
+
|
77
|
+
__END__
|
78
|
+
|
79
|
+
name: Cloud Foundry
|
80
|
+
description: Prepare codebase and perform initial deploy to a Cloud Foundry target
|
81
|
+
website: http://cloudfoundry.org
|
82
|
+
author: drnic
|
83
|
+
|
84
|
+
requires: []
|
85
|
+
run_after: [postgresql, mysql]
|
86
|
+
run_before: []
|
87
|
+
|
88
|
+
category: deployment
|
data/scrolls/postgresql.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
gem "pg"
|
2
|
-
|
3
1
|
gsub_file "config/database.yml", /username: .*/, "username: #{config['pg_username']}"
|
4
2
|
gsub_file "config/database.yml", /password: .*/, "password: #{config['pg_password']}"
|
5
3
|
%w[development test production].each do |env|
|
@@ -31,7 +29,7 @@ author: drnic
|
|
31
29
|
exclusive: orm
|
32
30
|
category: persistence
|
33
31
|
|
34
|
-
run_before: [eycloud]
|
32
|
+
run_before: [eycloud, cf]
|
35
33
|
|
36
34
|
args: -d postgresql
|
37
35
|
|
data/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appscrolls
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,16 +10,16 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-03-
|
13
|
+
date: 2013-03-30 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
16
|
+
name: bundler
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: 1.3.4
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -27,39 +27,39 @@ dependencies:
|
|
27
27
|
requirements:
|
28
28
|
- - ~>
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
version:
|
30
|
+
version: 1.3.4
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
|
-
name:
|
32
|
+
name: rails
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
34
34
|
none: false
|
35
35
|
requirements:
|
36
|
-
- -
|
36
|
+
- - ~>
|
37
37
|
- !ruby/object:Gem::Version
|
38
|
-
version:
|
38
|
+
version: 3.2.13
|
39
39
|
type: :runtime
|
40
40
|
prerelease: false
|
41
41
|
version_requirements: !ruby/object:Gem::Requirement
|
42
42
|
none: false
|
43
43
|
requirements:
|
44
|
-
- -
|
44
|
+
- - ~>
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
46
|
+
version: 3.2.13
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
48
|
+
name: i18n
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
57
|
version_requirements: !ruby/object:Gem::Requirement
|
58
58
|
none: false
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - ! '>='
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
62
|
+
version: '0'
|
63
63
|
- !ruby/object:Gem::Dependency
|
64
64
|
name: json
|
65
65
|
requirement: !ruby/object:Gem::Requirement
|
@@ -210,7 +210,7 @@ files:
|
|
210
210
|
- sample.rb
|
211
211
|
- scrolls/active_admin.rb
|
212
212
|
- scrolls/capybara.rb
|
213
|
-
- scrolls/
|
213
|
+
- scrolls/cf.rb
|
214
214
|
- scrolls/cucumber.rb
|
215
215
|
- scrolls/delayed_job.rb
|
216
216
|
- scrolls/env_yaml.rb
|
@@ -306,12 +306,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
306
306
|
- - ! '>='
|
307
307
|
- !ruby/object:Gem::Version
|
308
308
|
version: '0'
|
309
|
+
segments:
|
310
|
+
- 0
|
311
|
+
hash: -3286780568142603210
|
309
312
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
310
313
|
none: false
|
311
314
|
requirements:
|
312
315
|
- - ! '>='
|
313
316
|
- !ruby/object:Gem::Version
|
314
317
|
version: '0'
|
318
|
+
segments:
|
319
|
+
- 0
|
320
|
+
hash: -3286780568142603210
|
315
321
|
requirements: []
|
316
322
|
rubyforge_project:
|
317
323
|
rubygems_version: 1.8.25
|
@@ -331,4 +337,3 @@ test_files:
|
|
331
337
|
- spec/spec_helper.rb
|
332
338
|
- spec/support/rails_directory.rb
|
333
339
|
- spec/support/template_runner.rb
|
334
|
-
has_rdoc:
|
data/scrolls/cfoundry.rb
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
# Scroll is based on the following documentation
|
2
|
-
# * http://blog.cloudfoundry.com/2012/03/15/using-cloud-foundry-services-with-ruby-part-2-run-time-support-for-ruby-applications/
|
3
|
-
# * http://blog.cloudfoundry.com/2012/04/19/deploying-jruby-on-rails-applications-on-cloud-foundry/
|
4
|
-
|
5
|
-
gem 'vmc'
|
6
|
-
gem 'cf-runtime'
|
7
|
-
|
8
|
-
required_dbs = %w[mysql postgresql]
|
9
|
-
|
10
|
-
selected_db = required_dbs.find { |db| scroll? db }
|
11
|
-
unless selected_db
|
12
|
-
say_custom "cfoundry", "Please include a DB choice from: #{required_dbs.join ", "}"
|
13
|
-
exit_now = true
|
14
|
-
end
|
15
|
-
|
16
|
-
# TODO similar config for mysql
|
17
|
-
db_username = config['pg_username'] || 'root'
|
18
|
-
db_password = config['pg_password'] || ''
|
19
|
-
|
20
|
-
after_bundler do
|
21
|
-
# Must vendor everything
|
22
|
-
run "bundle package"
|
23
|
-
|
24
|
-
append_file "config/database.yml" do
|
25
|
-
<<-YAML.gsub(/^\s{2}/, '')
|
26
|
-
production:
|
27
|
-
adapter: #{selected_db}
|
28
|
-
<% require 'cfruntime/properties' %>
|
29
|
-
<% db_svc = CFRuntime::CloudApp.service_props('#{selected_db}') %>
|
30
|
-
database: <%= db_svc[:database] rescue '#{project_name}_production' %>
|
31
|
-
username: <%= db_svc[:username] rescue '#{db_username}' %>
|
32
|
-
password: <%= db_svc[:password] rescue '#{db_password}' %>
|
33
|
-
<%= db_svc && db_svc[:host] ? "host: #{db_svc[:host]}" : "" %>
|
34
|
-
<%= db_svc && db_svc[:port] ? "post: #{db_svc[:port]}" : "" %>
|
35
|
-
YAML
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
after_everything do
|
40
|
-
run "rake assets:precompile"
|
41
|
-
if jruby?
|
42
|
-
run "warble"
|
43
|
-
run "mkdir -p deploy"
|
44
|
-
run "cp #{project_name}.war deploy/"
|
45
|
-
end
|
46
|
-
run "vmc push #{project_name} --runtime ruby19 --path . --no-start"
|
47
|
-
run "vmc env-add #{project_name} BUNDLE_WITHOUT=assets:test:development"
|
48
|
-
run "vmc start #{project_name}"
|
49
|
-
end
|
50
|
-
|
51
|
-
__END__
|
52
|
-
|
53
|
-
name: CloudFoundry
|
54
|
-
description: Prepare codebase and perform initial deploy to a CloudFoundry target
|
55
|
-
website: http://cloudfoundry.org
|
56
|
-
author: drnic
|
57
|
-
|
58
|
-
requires: []
|
59
|
-
run_after: [postgresql, mysql]
|
60
|
-
run_before: []
|
61
|
-
|
62
|
-
category: deployment
|
63
|
-
# exclusive:
|
64
|
-
|
65
|
-
# config:
|
66
|
-
# - foo:
|
67
|
-
# type: boolean
|
68
|
-
# prompt: "Is foo true?"
|