relevance_rails 0.1.0 → 0.1.1.alpha
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +10 -0
- data/README.md +19 -19
- data/lib/generators/deployment/deployment_generator.rb +2 -0
- data/lib/generators/fixtures/fixtures_generator.rb +3 -1
- data/lib/generators/provision_config/provision_config_generator.rb +59 -8
- data/lib/generators/{relevance_file → provision_config}/templates/Capfile +0 -0
- data/lib/generators/{relevance_file → provision_config}/templates/deploy.rb.erb +4 -3
- data/lib/generators/{relevance_file → provision_config}/templates/recipes_deploy.rb +0 -0
- data/lib/generators/{relevance_file → provision_config}/templates/vagrant.rb +1 -0
- data/lib/generators/relevance_file/relevance_file_generator.rb +3 -17
- data/lib/relevance_rails/chef_dna.rb +6 -4
- data/lib/relevance_rails/generator_overrides.rb +13 -0
- data/lib/relevance_rails/provision.rb +79 -20
- data/lib/relevance_rails/relevance_rails_template.rb +8 -9
- data/lib/relevance_rails/runner.rb +33 -2
- data/lib/relevance_rails/version.rb +1 -1
- data/lib/relevance_rails.rb +8 -22
- data/lib/tasks/provision.rake +21 -0
- data/relevance_rails.gemspec +2 -1
- data/script/ci +46 -15
- data/script/ci_nightly +79 -0
- data/spec/acceptance_spec.rb +9 -9
- data/spec/lib/provision_config_generator_spec.rb +3 -4
- data/spec/lib/provision_spec.rb +16 -0
- data/spec/lib/runner_spec.rb +5 -1
- data/spec/spec_helper.rb +1 -2
- data/techdebt.md +6 -1
- metadata +120 -117
- data/spec/lib/relevance_rails_spec.rb +0 -15
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
*v0.1.1.alpha*
|
2
|
+
|
3
|
+
* Ruby manager agnostic - can use rvm, system ruby or rbenv
|
4
|
+
* new APP --relevance-dev for simple QA development
|
5
|
+
* Fix sudo on deploy user
|
6
|
+
* provision rvmrc mirrors app's rvmrc
|
7
|
+
* existing app users have a deploy that just works
|
8
|
+
* fail fast in more places
|
9
|
+
* stop and destroy provisioned instances from commandline
|
10
|
+
|
1
11
|
*v0.1.0*
|
2
12
|
|
3
13
|
* Provisioning can be done on existing apps
|
data/README.md
CHANGED
@@ -34,11 +34,19 @@ After a `bundle install`, pull in our chef recipes into provision/:
|
|
34
34
|
|
35
35
|
```sh
|
36
36
|
# defaults to mysql
|
37
|
-
$ rails g provision_config
|
37
|
+
$ rails g provision_config
|
38
38
|
# if using postgresql
|
39
|
-
$ rails g provision_config
|
39
|
+
$ rails g provision_config postgresql
|
40
40
|
```
|
41
41
|
|
42
|
+
Configuring bundled ssh keys
|
43
|
+
----------------------------
|
44
|
+
|
45
|
+
By default, relevance_rails bundles all your keys from `ssh-add -L` with your instance. For bundling
|
46
|
+
additional keys, you can create a ~/.relevance_rails/keys_git_url file and point it to a git repo that
|
47
|
+
has additional keys. Keys in that git repo should exist as top level *.pub files. You *MUST* have at
|
48
|
+
least one key to provision.
|
49
|
+
|
42
50
|
Provisioning on EC2
|
43
51
|
-------------------
|
44
52
|
|
@@ -66,11 +74,7 @@ server:
|
|
66
74
|
Now just provision your instance:
|
67
75
|
|
68
76
|
```sh
|
69
|
-
$ rake provision:
|
70
|
-
...
|
71
|
-
Server IP: 1.1.1.1
|
72
|
-
# Pass IP from previous command as second argument
|
73
|
-
$ rails g deployment qa 1.1.1.1
|
77
|
+
$ rake provision:ec2_and_generate NAME=qa
|
74
78
|
$ cap qa deploy:setup deploy
|
75
79
|
```
|
76
80
|
|
@@ -91,9 +95,11 @@ Vagrant instance should be up at 172.25.5.5.
|
|
91
95
|
Supported Ruby Versions
|
92
96
|
-----------------------
|
93
97
|
|
94
|
-
Currently both Ruby 1.9.x and REE 1.8.7 are supported
|
98
|
+
Currently both Ruby 1.9.x and REE 1.8.7 are supported. relevance_rails
|
95
99
|
configures your Rails app (and Chef provisioning scripts) to require the version
|
96
|
-
of Ruby you used to invoke the relevance_rails executable.
|
100
|
+
of Ruby you used to invoke the relevance_rails executable. If relevance_rails is run
|
101
|
+
in a non-rvm environment, all installation occurs in the current gem environment. If in rvm,
|
102
|
+
the app is installed into its own rvm gemset.
|
97
103
|
|
98
104
|
Supported Databases
|
99
105
|
-------------------
|
@@ -105,17 +111,11 @@ standard `--database=postgresql` Rails option, relevance_rails will use PostgreS
|
|
105
111
|
Maintainer Notes
|
106
112
|
----------------
|
107
113
|
|
108
|
-
When QAing or doing local development of this gem, the gem must be built and
|
109
|
-
|
110
|
-
In order to test deployment, use the example below to package the relevance_rails gem:
|
114
|
+
When QAing or doing local development of this gem, the gem must be built locally and creating
|
115
|
+
an app needs an additional flag.
|
111
116
|
|
112
|
-
|
113
|
-
|
114
|
-
~/src/relevance_rails $ gem build relevance_rails.gemspec
|
115
|
-
~/src/relevance_rails $ cd ~/src/app
|
116
|
-
~/src/app $ gem install ../relevance_rails/relevance_rails-0.0.7.gem
|
117
|
-
~/src/app $ bundle package
|
118
|
-
~/src/app $ git commit -m "Package gems" vendor/cache
|
117
|
+
$ gem build relevance_rails.gemspec && gem install relevance_rails-VERSION.gem
|
118
|
+
$ relevance_rails new APP --relevance-dev
|
119
119
|
|
120
120
|
Caveats
|
121
121
|
-------
|
@@ -5,6 +5,7 @@ class DeploymentGenerator < Rails::Generators::NamedBase
|
|
5
5
|
def write_stage_file
|
6
6
|
create_file "config/deploy/#{name}.rb", <<-DEPLOY_STAGE
|
7
7
|
set :user, 'deploy'
|
8
|
+
set :use_sudo, false
|
8
9
|
|
9
10
|
role :web, "#{hostname}"
|
10
11
|
role :app, "#{hostname}"
|
@@ -20,6 +21,7 @@ role :db, "#{hostname}", :primary => true
|
|
20
21
|
else
|
21
22
|
stages = eval($1)
|
22
23
|
stages << name
|
24
|
+
stages.uniq!
|
23
25
|
stage_array_contents = stages.map{|stage| "\"#{stage}\""}.join(', ')
|
24
26
|
new_contents << "set :stages, [#{stage_array_contents}]\n"
|
25
27
|
end
|
@@ -11,7 +11,9 @@ STR
|
|
11
11
|
%h1 WELCOME HOME
|
12
12
|
STR
|
13
13
|
create_file "app/views/relevance_rails/db.html.haml", <<-STR
|
14
|
-
|
14
|
+
= conn = ActiveRecord::Base.connection
|
15
|
+
= results = conn.execute("select 4200+42 as advanced_math")
|
16
|
+
%h1.advanced_math= results.first["advanced_math"]
|
15
17
|
STR
|
16
18
|
end
|
17
19
|
|
@@ -1,7 +1,8 @@
|
|
1
1
|
require 'relevance_rails'
|
2
2
|
require 'rails/generators'
|
3
3
|
|
4
|
-
class ProvisionConfigGenerator < Rails::Generators::
|
4
|
+
class ProvisionConfigGenerator < Rails::Generators::Base
|
5
|
+
include RelevanceRails::GeneratorOverrides
|
5
6
|
|
6
7
|
desc "This generator configures the provision sub-directory with appropriate files."
|
7
8
|
|
@@ -11,6 +12,27 @@ class ProvisionConfigGenerator < Rails::Generators::NamedBase
|
|
11
12
|
|
12
13
|
attr_reader :authorized_keys
|
13
14
|
|
15
|
+
# This generator may not receive a working directory;
|
16
|
+
# and we pull data by shelling out to RVM about the ruby
|
17
|
+
# version. This sets the directory explicitly beforehand.
|
18
|
+
def change_directory
|
19
|
+
Dir.chdir(destination_root)
|
20
|
+
end
|
21
|
+
|
22
|
+
def check_authorized_keys
|
23
|
+
if (@authorized_keys = fetch_keys).empty?
|
24
|
+
abort "No ssh keys were found! Check ssh-add -L and your keys_git_url config."
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def create_capistrano_files
|
29
|
+
backup_copy_file 'Capfile', 'Capfile'
|
30
|
+
backup_template 'deploy.rb.erb', 'config/deploy.rb'
|
31
|
+
backup_copy_file 'recipes_deploy.rb', 'config/deploy/recipes/deploy.rb'
|
32
|
+
backup_copy_file 'vagrant.rb', 'config/deploy/vagrant.rb'
|
33
|
+
git :commit => '-m "Add Capistrano files"'
|
34
|
+
end
|
35
|
+
|
14
36
|
def fetch_elzar
|
15
37
|
git :remote => 'add -f elzar git://github.com/relevance/elzar.git'
|
16
38
|
git :merge => '-s ours --no-commit elzar/master'
|
@@ -20,9 +42,6 @@ class ProvisionConfigGenerator < Rails::Generators::NamedBase
|
|
20
42
|
end
|
21
43
|
|
22
44
|
def create_authorized_key_data_bag
|
23
|
-
if (@authorized_keys = fetch_keys).empty?
|
24
|
-
abort "No ssh keys were found! Check ssh-add -L and your keys_git_url config."
|
25
|
-
end
|
26
45
|
@authorized_keys.map! {|key| "\"#{key}\""}
|
27
46
|
template('authorized_keys.json.erb', 'provision/data_bags/deploy/authorized_keys.json', {:force => true})
|
28
47
|
end
|
@@ -31,14 +50,20 @@ class ProvisionConfigGenerator < Rails::Generators::NamedBase
|
|
31
50
|
path = File.expand_path('provision/dna.json', destination_root)
|
32
51
|
json = JSON.parse File.binread(path)
|
33
52
|
json['rails_app']['name'] = name
|
34
|
-
# This generator may not receive a working directory;
|
35
|
-
# and we pull data by shelling out to RVM about the ruby
|
36
|
-
# version. This sets the directory explicitly beforehand.
|
37
|
-
Dir.chdir(destination_root)
|
38
53
|
RelevanceRails::ChefDNA.gene_splice(json,database)
|
39
54
|
create_file('provision/dna.json', JSON.generate(json), {:force => true})
|
40
55
|
end
|
41
56
|
|
57
|
+
def create_rvmrc
|
58
|
+
if File.exists?(rvmrc = Rails.root.join('.rvmrc'))
|
59
|
+
create_file('provision/.rvmrc', File.read(rvmrc), :force => true)
|
60
|
+
git :add => 'provision/.rvmrc'
|
61
|
+
else
|
62
|
+
remove_file 'provision/.rvmrc'
|
63
|
+
git :rm => 'provision/.rvmrc'
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
42
67
|
def commit_changes
|
43
68
|
git :add => 'provision/data_bags/deploy/authorized_keys.json'
|
44
69
|
git :add => 'provision/Vagrantfile'
|
@@ -48,6 +73,32 @@ class ProvisionConfigGenerator < Rails::Generators::NamedBase
|
|
48
73
|
|
49
74
|
private
|
50
75
|
|
76
|
+
def name
|
77
|
+
Rails.application.class.name.split('::').first.underscore
|
78
|
+
end
|
79
|
+
|
80
|
+
def backup_copy_file(source, destination)
|
81
|
+
backup_manip_file(source, destination, :copy_file)
|
82
|
+
end
|
83
|
+
|
84
|
+
def backup_template(source, destination)
|
85
|
+
backup_manip_file(source, destination, :template)
|
86
|
+
end
|
87
|
+
|
88
|
+
def backup_manip_file(source, destination, operation)
|
89
|
+
if File.exists?(destination)
|
90
|
+
backup_file = "#{destination}.bak"
|
91
|
+
say_status :backup, "#{destination} to #{backup_file}"
|
92
|
+
git :mv => "#{destination} #{backup_file}"
|
93
|
+
end
|
94
|
+
|
95
|
+
send(operation, source, destination)
|
96
|
+
# git wasn't picking up current directory
|
97
|
+
change_directory
|
98
|
+
git :add => destination
|
99
|
+
end
|
100
|
+
|
101
|
+
|
51
102
|
def fetch_keys
|
52
103
|
local_keys = `ssh-add -L`.split("\n")
|
53
104
|
local_keys = [] unless $?.success?
|
File without changes
|
@@ -2,16 +2,17 @@ require 'bundler/capistrano'
|
|
2
2
|
require 'capistrano_colors'
|
3
3
|
|
4
4
|
set :application, "<%= name %>"
|
5
|
-
set :repository, "."
|
6
|
-
set :deploy_via, :copy
|
7
5
|
|
8
6
|
set :scm, :git
|
7
|
+
set :repository, "."
|
9
8
|
|
10
9
|
set :deploy_to, "/var/www/apps/#{ application }"
|
10
|
+
set :deploy_via, :copy
|
11
|
+
set :copy_exclude, '.git/*'
|
12
|
+
|
11
13
|
default_run_options[:pty] = true
|
12
14
|
set :ssh_options, { :paranoid => false, :forward_agent => true }
|
13
15
|
|
14
|
-
set :copy_exclude, '.git/*'
|
15
16
|
|
16
17
|
set :stages, %w(vagrant)
|
17
18
|
set :default_stage, 'vagrant'
|
File without changes
|
@@ -21,7 +21,9 @@ class RelevanceFileGenerator < Rails::Generators::NamedBase
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def create_rvmrc
|
24
|
-
|
24
|
+
if ENV['rvm_path']
|
25
|
+
create_file ".rvmrc", "rvm use #{RelevanceRails.ruby_version}@#{name}"
|
26
|
+
end
|
25
27
|
end
|
26
28
|
|
27
29
|
def create_rspec
|
@@ -32,14 +34,6 @@ class RelevanceFileGenerator < Rails::Generators::NamedBase
|
|
32
34
|
copy_file 'spec_helper.rb', 'spec/spec_helper.rb'
|
33
35
|
end
|
34
36
|
|
35
|
-
def copy_capfile
|
36
|
-
copy_file 'Capfile', 'Capfile'
|
37
|
-
end
|
38
|
-
|
39
|
-
def create_deploy
|
40
|
-
template 'deploy.rb.erb', 'config/deploy.rb'
|
41
|
-
end
|
42
|
-
|
43
37
|
def create_database_example_yml
|
44
38
|
if database == 'mysql'
|
45
39
|
template 'database.example.yml.mysql.erb', 'config/database.example.yml'
|
@@ -50,14 +44,6 @@ class RelevanceFileGenerator < Rails::Generators::NamedBase
|
|
50
44
|
end
|
51
45
|
end
|
52
46
|
|
53
|
-
def copy_deploy_recipes
|
54
|
-
copy_file 'recipes_deploy.rb', 'config/deploy/recipes/deploy.rb'
|
55
|
-
end
|
56
|
-
|
57
|
-
def copy_vagrant_stage
|
58
|
-
copy_file 'vagrant.rb', 'config/deploy/vagrant.rb'
|
59
|
-
end
|
60
|
-
|
61
47
|
def fix_session_store
|
62
48
|
gsub_file 'config/initializers/session_store.rb', 'key:', ':key =>'
|
63
49
|
end
|
@@ -15,14 +15,16 @@ module RelevanceRails::ChefDNA
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.set_ruby(json)
|
18
|
-
if RelevanceRails.
|
18
|
+
if RelevanceRails.ruby_version =~ /^ree-(.*)/i
|
19
19
|
json['ruby_enterprise']['version'] = $1
|
20
20
|
json['ruby_enterprise']['url'] = "http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-#{$1}"
|
21
21
|
appstack_index = json['run_list'].find_index {|e| e[/^role\[.*_appstack\]$/] }
|
22
22
|
json['run_list'][appstack_index] = 'role[enterprise_appstack]'
|
23
|
-
elsif RelevanceRails.
|
24
|
-
|
25
|
-
json['ruby']['
|
23
|
+
elsif RelevanceRails.ruby_version =~ /^ruby-(.*)/i
|
24
|
+
full_version = $1
|
25
|
+
json['ruby']['version'] = full_version
|
26
|
+
major_version = full_version[/(\d\.\d).*/, 1]
|
27
|
+
json['ruby']['url'] = "http://ftp.ruby-lang.org/pub/ruby/#{major_version}/ruby-#{full_version}.tar.gz"
|
26
28
|
appstack_index = json['run_list'].find_index {|e| e[/^role\[.*_appstack\]$/] }
|
27
29
|
json['run_list'][appstack_index] = 'role[ruby_appstack]'
|
28
30
|
else
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module RelevanceRails
|
2
|
+
module GeneratorOverrides
|
3
|
+
def git(commands={})
|
4
|
+
super
|
5
|
+
if !$?.success?
|
6
|
+
command_string = commands.is_a?(Symbol) ? "git #{commands}" :
|
7
|
+
commands.map {|cmd, options| "git #{cmd} #{options}" }.join("; ")
|
8
|
+
msg = "Generator failed with command(s): #{command_string}"
|
9
|
+
abort "\n#{'*' * msg.size}\n#{msg}\n#{'*' * msg.size}"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -1,40 +1,97 @@
|
|
1
1
|
require 'fog'
|
2
|
+
require 'thor'
|
3
|
+
require 'timeout'
|
2
4
|
|
3
5
|
module RelevanceRails
|
4
6
|
module Provision
|
5
7
|
def self.create_ec2(name = nil)
|
6
8
|
abort "Please provide a $NAME" unless name
|
7
|
-
provision_ec2_instances(name)
|
9
|
+
server = provision_ec2_instances(name)
|
10
|
+
wait_for_ssh server
|
11
|
+
run_commands server
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.stop_ec2
|
15
|
+
return unless ENV["FORCE"] == "true" || Thor::Shell::Basic.new.yes?("Are you sure you want to shut down EC2 instance #{instance_id}?")
|
16
|
+
puts "Shutting down EC2 instance #{instance_id}..."
|
17
|
+
server = fog_connection.servers.get(instance_id)
|
18
|
+
server.stop
|
19
|
+
server.wait_for { state == "stopped" }
|
20
|
+
puts "Done!"
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.destroy_ec2
|
24
|
+
return unless ENV["FORCE"] == "true" || Thor::Shell::Basic.new.yes?("Are you sure you want to destroy EC2 instance #{instance_id}?")
|
25
|
+
puts "Destroying EC2 instance #{instance_id}..."
|
26
|
+
server = fog_connection.servers.get(instance_id)
|
27
|
+
server.destroy
|
28
|
+
server.wait_for { state == "terminated" }
|
29
|
+
puts "Removing config/ec2_instance.txt..."
|
30
|
+
File.delete('config/ec2_instance.txt')
|
31
|
+
puts "Done!"
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.current_dns
|
35
|
+
server = fog_connection.servers.get(instance_id)
|
36
|
+
puts server.reload.dns_name
|
8
37
|
end
|
9
38
|
|
10
39
|
private
|
40
|
+
|
41
|
+
def self.instance_id
|
42
|
+
@instance_id ||= File.read('config/ec2_instance.txt').chomp
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.config
|
46
|
+
@config ||= YAML::load(File.read(File.expand_path("~/.relevance_rails/aws_config.yml")))
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.fog_connection
|
50
|
+
@fog_connection ||= Fog::Compute.new(config['aws_credentials'].merge(:provider => 'AWS'))
|
51
|
+
end
|
52
|
+
|
11
53
|
def self.provision_ec2_instances(name)
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
fog.tags.create(:key => 'Name',
|
54
|
+
puts "Provisioning an instance..."
|
55
|
+
server = fog_connection.servers.create(config['server']['creation_config'])
|
56
|
+
fog_connection.tags.create(:key => 'Name',
|
16
57
|
:value => "#{Rails.application.class.parent_name} #{name}",
|
17
58
|
:resource_id => server.id)
|
18
59
|
server.private_key = config['server']['private_key']
|
19
|
-
|
20
|
-
|
60
|
+
|
61
|
+
File.open("config/ec2_instance.txt", "w") do |f|
|
62
|
+
f.puts(server.id)
|
63
|
+
end
|
64
|
+
|
65
|
+
puts "Provisioned!"
|
66
|
+
server
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.run_commands(server)
|
21
70
|
puts "Updating apt cache..."
|
22
|
-
|
71
|
+
run_command(server, 'sudo apt-get update')
|
23
72
|
puts "Installing ruby..."
|
24
|
-
|
73
|
+
run_command(server, 'sudo apt-get -y install ruby')
|
25
74
|
puts "Installing rubygems..."
|
26
|
-
|
75
|
+
run_command(server, 'sudo apt-get -y install rubygems1.8')
|
27
76
|
puts "Installing chef..."
|
28
|
-
|
77
|
+
run_command(server, 'sudo gem install chef --no-ri --no-rdoc --version 0.10.8')
|
29
78
|
puts "Copying chef resources from provision directory.."
|
30
79
|
server.scp("#{Rails.root.join('provision')}/", '/tmp/chef-solo', :recursive => true)
|
31
80
|
puts "Converging server, this may take a while (10-20 minutes)"
|
32
|
-
|
33
|
-
|
81
|
+
run_command(server, 'cd /tmp/chef-solo && sudo /var/lib/gems/1.8/bin/chef-solo -c solo.rb -j dna.json')
|
82
|
+
|
83
|
+
puts "Server Instance: #{server.id}"
|
34
84
|
puts "Server IP: #{server.public_ip_address}"
|
85
|
+
server
|
86
|
+
end
|
87
|
+
|
88
|
+
def self.run_command(server, command)
|
89
|
+
jobs = server.ssh(command)
|
90
|
+
exit 1 unless jobs_succeeded?(jobs)
|
35
91
|
end
|
36
92
|
|
37
93
|
def self.wait_for_ssh(server)
|
94
|
+
puts "Waiting for ssh connectivity..."
|
38
95
|
server.wait_for { ready? }
|
39
96
|
succeeded = false
|
40
97
|
attempts = 0
|
@@ -42,27 +99,29 @@ module RelevanceRails
|
|
42
99
|
until succeeded || attempts > 4
|
43
100
|
sleep 10
|
44
101
|
begin
|
45
|
-
|
102
|
+
# Should be checked for compatability across rubies
|
103
|
+
Timeout.timeout(60) { server.ssh('ls') }
|
46
104
|
succeeded = true
|
47
|
-
rescue Errno::ECONNREFUSED => e
|
48
|
-
puts "
|
105
|
+
rescue Errno::ECONNREFUSED, Timeout::Error => e
|
106
|
+
puts "Connecting to Amazon refused. Attempt #{attempts+1}..."
|
49
107
|
attempts += 1
|
50
108
|
last_error = e
|
51
109
|
end
|
52
110
|
end
|
53
111
|
raise last_error unless succeeded
|
54
|
-
puts "Server up and listening for SSH
|
112
|
+
puts "Server up and listening for SSH!"
|
55
113
|
end
|
56
114
|
|
57
|
-
def self.
|
58
|
-
return if jobs.all? { |job| job.status == 0 }
|
115
|
+
def self.jobs_succeeded?(jobs)
|
116
|
+
return true if jobs.all? { |job| job.status == 0 }
|
59
117
|
jobs.each do |job|
|
60
118
|
puts "----------------------"
|
61
|
-
puts "
|
119
|
+
puts "Command '#{job.command}'"
|
62
120
|
puts "STDOUT: #{job.stdout}"
|
63
121
|
puts "STDERR: #{job.stderr}"
|
64
122
|
puts "----------------------"
|
65
123
|
end
|
124
|
+
false
|
66
125
|
end
|
67
126
|
|
68
127
|
end
|
@@ -1,11 +1,6 @@
|
|
1
1
|
require 'relevance_rails'
|
2
2
|
require 'json'
|
3
3
|
|
4
|
-
def rvm_run(command)
|
5
|
-
say_status :rvm_run, command
|
6
|
-
RelevanceRails.rvm_run(command)
|
7
|
-
end
|
8
|
-
|
9
4
|
db = ['postgresql','mysql'].include?(options[:database]) ? options[:database] : 'mysql'
|
10
5
|
|
11
6
|
remove_file 'README.rdoc'
|
@@ -19,13 +14,17 @@ remove_file 'app/views/layouts/application.html.erb'
|
|
19
14
|
|
20
15
|
generate(:relevance_file, app_name, db)
|
21
16
|
|
22
|
-
|
23
|
-
|
24
|
-
|
17
|
+
inside destination_root do
|
18
|
+
run "gem install bundler"
|
19
|
+
run "bundle install"
|
20
|
+
end
|
25
21
|
|
26
22
|
git :init
|
27
23
|
append_file ".gitignore", "config/database.yml\n"
|
28
24
|
run 'cp config/database.example.yml config/database.yml'
|
29
25
|
git :add => "."
|
30
26
|
git :commit => "-a -m 'Initial commit'"
|
31
|
-
|
27
|
+
|
28
|
+
inside destination_root do
|
29
|
+
generate(:provision_config, db)
|
30
|
+
end
|
@@ -5,14 +5,45 @@ module RelevanceRails
|
|
5
5
|
def self.start(argv=ARGV)
|
6
6
|
if argv.delete '--version'
|
7
7
|
puts "RelevanceRails #{RelevanceRails::VERSION}"
|
8
|
-
|
8
|
+
elsif argv[0] == 'new'
|
9
9
|
add_default_options! argv
|
10
|
-
|
10
|
+
if ENV['rvm_path'].nil?
|
11
|
+
exec 'rails', *argv
|
12
|
+
else
|
13
|
+
app_name = argv[1]
|
14
|
+
env = setup_rvm app_name
|
15
|
+
|
16
|
+
new_rvm_string = "#{env.environment_name.split('@')[0]}@#{app_name}"
|
17
|
+
install_relevance_rails argv, new_rvm_string, env.environment_name
|
18
|
+
exec new_rvm_string,'-S','rails', *argv
|
19
|
+
end
|
11
20
|
end
|
12
21
|
end
|
13
22
|
|
14
23
|
private
|
15
24
|
|
25
|
+
def self.setup_rvm(app_name)
|
26
|
+
$LOAD_PATH.unshift "#{ENV['rvm_path']}/lib"
|
27
|
+
require 'rvm'
|
28
|
+
|
29
|
+
env = RVM::Environment.current
|
30
|
+
env.gemset_create(app_name)
|
31
|
+
env
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.install_relevance_rails(argv, new_rvm_string, current_gemset)
|
35
|
+
child_env = RVM::Environment.new(new_rvm_string)
|
36
|
+
puts "Installing relevance_rails into the app's gemset..."
|
37
|
+
|
38
|
+
result = if argv.delete '--relevance-dev'
|
39
|
+
rubygem = "#{ENV['rvm_path']}/gems/#{current_gemset}/cache/relevance_rails-#{RelevanceRails::VERSION}.gem"
|
40
|
+
child_env.run('gem', 'install', rubygem)
|
41
|
+
else
|
42
|
+
child_env.run('gem', 'install', 'relevance_rails', '-v', RelevanceRails::VERSION)
|
43
|
+
end
|
44
|
+
abort "Unable to install relevance_rails into the new gemset" if result.exit_status != 0
|
45
|
+
end
|
46
|
+
|
16
47
|
def self.add_default_options!(argv)
|
17
48
|
unless argv.any? =~ /^-d$/
|
18
49
|
template = File.join(File.dirname(__FILE__), "relevance_rails_template.rb")
|
data/lib/relevance_rails.rb
CHANGED
@@ -2,30 +2,16 @@ require "relevance_rails/version"
|
|
2
2
|
require "relevance_rails/public_key_fetcher"
|
3
3
|
require "relevance_rails/chef_dna"
|
4
4
|
require 'relevance_rails/railtie' if defined? Rails
|
5
|
+
require 'relevance_rails/generator_overrides'
|
5
6
|
|
6
7
|
module RelevanceRails
|
7
|
-
def self.
|
8
|
-
@
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
def self.rvm_current
|
16
|
-
@rvm_current ||= rvm_exec('rvm current').chomp
|
17
|
-
end
|
18
|
-
|
19
|
-
# rvm_current SHOULD be in $PATH and execute ruby for the
|
20
|
-
# correct version and gemset
|
21
|
-
def self.rvm_run(command)
|
22
|
-
ret = `#{rvm_current} -S #{command}`
|
23
|
-
unless $?.success?
|
24
|
-
abort "\n Command '#{command}' failed with:\n#{ret}"
|
8
|
+
def self.ruby_version
|
9
|
+
@ruby_version ||= begin
|
10
|
+
if RUBY_DESCRIPTION[/Ruby Enterprise Edition (\d{4}\.\d\d)/, 1]
|
11
|
+
"ree-#{RUBY_VERSION}-#{$1}"
|
12
|
+
else
|
13
|
+
"ruby-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
|
14
|
+
end
|
25
15
|
end
|
26
16
|
end
|
27
|
-
|
28
|
-
def self.rvm_exec(command)
|
29
|
-
`bash -c 'source ~/.rvm/scripts/rvm > /dev/null && #{command}'`
|
30
|
-
end
|
31
17
|
end
|
data/lib/tasks/provision.rake
CHANGED
@@ -1,8 +1,29 @@
|
|
1
1
|
require 'relevance_rails/provision'
|
2
2
|
|
3
3
|
namespace :provision do
|
4
|
+
desc 'Provision a deployable EC2 instance and generate Capistrano config'
|
5
|
+
task :ec2_and_generate do
|
6
|
+
server = RelevanceRails::Provision.create_ec2(ENV['NAME'])
|
7
|
+
system('rails', 'generate', 'deployment', ENV['NAME'], server.public_ip_address)
|
8
|
+
end
|
9
|
+
|
4
10
|
desc 'Provision a deployable EC2 instance'
|
5
11
|
task :ec2 do
|
6
12
|
RelevanceRails::Provision.create_ec2(ENV['NAME'])
|
7
13
|
end
|
14
|
+
|
15
|
+
desc 'Stop your previously-provisioned EC2 instance'
|
16
|
+
task :stop do
|
17
|
+
RelevanceRails::Provision.stop_ec2
|
18
|
+
end
|
19
|
+
|
20
|
+
desc 'Destroy your previously-provisioned EC2 instance'
|
21
|
+
task :destroy do
|
22
|
+
RelevanceRails::Provision.destroy_ec2
|
23
|
+
end
|
24
|
+
|
25
|
+
desc 'Return the current public DNS name for your previously-provisioned EC2 instance'
|
26
|
+
task :current_dns do
|
27
|
+
RelevanceRails::Provision.current_dns
|
28
|
+
end
|
8
29
|
end
|
data/relevance_rails.gemspec
CHANGED
@@ -23,8 +23,9 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.executables = ['relevance_rails']
|
24
24
|
|
25
25
|
# specify any dependencies here; for example:
|
26
|
-
s.add_runtime_dependency
|
26
|
+
s.add_runtime_dependency 'rails', '~> 3.2'
|
27
27
|
s.add_runtime_dependency 'fog', '~> 1.3.0'
|
28
|
+
s.add_runtime_dependency 'thor', '~> 0.14.6'
|
28
29
|
s.add_development_dependency 'pry'
|
29
30
|
s.add_development_dependency 'capybara'
|
30
31
|
s.add_development_dependency 'rspec'
|
data/script/ci
CHANGED
@@ -1,40 +1,66 @@
|
|
1
|
-
#!/bin/bash
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# Function to sanity-check generators since Rails 3.x does not
|
4
|
+
# give a non-zero exist code if generators fail
|
5
|
+
function files_must_exist {
|
6
|
+
for checked_file in "$@"; do
|
7
|
+
if [ ! -e "$checked_file" ]; then
|
8
|
+
echo "'$checked_file' didn't exist!"
|
9
|
+
exit 1
|
10
|
+
fi
|
11
|
+
done
|
12
|
+
}
|
13
|
+
|
14
|
+
# Function to sanity-check generators since Rails 3.x does not
|
15
|
+
# give a non-zero exist code if generators fail
|
16
|
+
function files_must_NOT_exist {
|
17
|
+
for checked_file in "$@"; do
|
18
|
+
if [ -e "$checked_file" ]; then
|
19
|
+
echo "'$checked_file' still exists!"
|
20
|
+
exit 1
|
21
|
+
fi
|
22
|
+
done
|
23
|
+
}
|
2
24
|
|
3
25
|
RAILS_APP="app_for_ci"
|
4
26
|
TARGET_HOST="placeholder.example.com"
|
5
27
|
|
28
|
+
# Setup RVM
|
6
29
|
source "$HOME/.rvm/scripts/rvm"
|
7
30
|
rvm use "ruby-1.9.2@relevance_rails"
|
31
|
+
echo "RVM is now using:` rvm current`"
|
32
|
+
|
33
|
+
# exit if any statement fails;
|
34
|
+
# must be set AFTER loading RVM
|
35
|
+
set -e
|
8
36
|
|
9
37
|
gem install bundler
|
10
38
|
bundle install
|
11
39
|
bundle exec rake spec
|
12
40
|
|
13
|
-
# exit if any statement fails; must be set AFTER loading RVM
|
14
|
-
set -e
|
15
|
-
|
16
41
|
echo "Building new relevance_rails gem..."
|
17
42
|
rm -Rf relevance_rails-*.gem
|
18
|
-
gem build --verbose relevance_rails.gemspec
|
43
|
+
gem build --verbose relevance_rails.gemspec
|
19
44
|
echo "Done"
|
20
45
|
|
21
|
-
# NOTE: Manual install of just-built gem to workaround bundler wanting
|
22
|
-
# it to live on rubygems.org.
|
46
|
+
# NOTE: Manual install of just-built gem to workaround bundler wanting
|
47
|
+
# it to live on rubygems.org.
|
23
48
|
# NOTE: RVM 1.x doesn't work with "set -e", so you have to unset/set it.
|
24
49
|
set +e
|
25
50
|
rvm --force gemset delete $RAILS_APP
|
26
51
|
rvm gemset create $RAILS_APP
|
27
52
|
rvm gemset use $RAILS_APP
|
53
|
+
echo "RVM is now using:` rvm current`"
|
28
54
|
set -e
|
29
55
|
|
30
|
-
if
|
56
|
+
if $(gem list relevance_rails --installed); then
|
31
57
|
echo "Removing old relevance_rails gem..."
|
32
|
-
gem uninstall --verbose --all --executables relevance_rails
|
58
|
+
gem uninstall --verbose --all --executables relevance_rails
|
33
59
|
echo "Done"
|
34
60
|
fi
|
35
61
|
|
36
62
|
echo "Installing relevance_rails gem into $RAILS_APP gemset..."
|
37
|
-
gem install relevance_rails-*.gem
|
63
|
+
gem install relevance_rails-*.gem
|
38
64
|
echo "Done."
|
39
65
|
|
40
66
|
rm -Rf ./$RAILS_APP
|
@@ -42,16 +68,21 @@ relevance_rails new $RAILS_APP --database=postgresql
|
|
42
68
|
|
43
69
|
# NOTE: this does NOT change the RVM gemset; we set it manually above
|
44
70
|
builtin cd $RAILS_APP
|
71
|
+
echo "RVM is now using:` rvm current`"
|
45
72
|
|
46
|
-
|
47
|
-
|
48
|
-
git add .
|
49
|
-
git commit -m "Generated relevance_rails deployment scripts."
|
50
|
-
echo "Done."
|
73
|
+
files_must_NOT_exist public/index.html
|
74
|
+
files_must_exist config/database.yml provision/dna.json config/deploy.rb config/deploy/recipes/deploy.rb
|
51
75
|
|
52
76
|
echo "Generating relevance_rails fixtures..."
|
53
77
|
./script/rails generate fixtures
|
54
78
|
git add .
|
55
79
|
git commit -m "Generated relevance_rails fixtures."
|
80
|
+
files_must_exist app/assets/javascripts/relevance_rails.js.coffee app/assets/stylesheets/relevance_rails.css.scss
|
56
81
|
echo "Done."
|
57
82
|
|
83
|
+
echo "Generating relevance_rails deployment scripts..."
|
84
|
+
./script/rails generate deployment staging $TARGET_HOST
|
85
|
+
git add .
|
86
|
+
git commit -m "Generated relevance_rails deployment scripts for $TARGET_HOST."
|
87
|
+
files_must_exist config/deploy/staging.rb
|
88
|
+
echo "Done."
|
data/script/ci_nightly
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# Set the DISPLAY variable if not already set
|
4
|
+
: ${DISPLAY:=":1"}
|
5
|
+
# Allows firefox to use display
|
6
|
+
export DISPLAY
|
7
|
+
|
8
|
+
RAILS_APP="app_for_ci"
|
9
|
+
EC2_MEMENTO_FILE="config/ec2_instance.txt"
|
10
|
+
|
11
|
+
function stop_server_and_exit {
|
12
|
+
if [ -f $EC2_MEMENTO_FILE ]; then
|
13
|
+
echo "Stopping newly-created server..."
|
14
|
+
bundle exec rake provision:stop FORCE=true --trace
|
15
|
+
echo "Done."
|
16
|
+
fi
|
17
|
+
|
18
|
+
echo "BUILD FAILED"
|
19
|
+
exit 1
|
20
|
+
}
|
21
|
+
|
22
|
+
echo "RVM is now using:` rvm current`"
|
23
|
+
|
24
|
+
set -e
|
25
|
+
./script/ci
|
26
|
+
set +e
|
27
|
+
|
28
|
+
source "$HOME/.rvm/scripts/rvm"
|
29
|
+
rvm use "ruby-1.9.2@$RAILS_APP"
|
30
|
+
echo "RVM is now using:` rvm current`"
|
31
|
+
|
32
|
+
builtin cd $RAILS_APP
|
33
|
+
|
34
|
+
echo "Provisioning an EC2 instance..."
|
35
|
+
rm -f $EC2_MEMENTO_FILE
|
36
|
+
server_name="Nightly Build Testing - `date "+%Y-%m-%d %H:%M:%S"` "
|
37
|
+
bundle exec rake --trace provision:ec2 NAME="$server_name"
|
38
|
+
[ $? -ne 0 ] && stop_server_and_exit
|
39
|
+
echo "Done!"
|
40
|
+
|
41
|
+
echo "Determine the EC2 instance's DNS name..."
|
42
|
+
TARGET_HOST=`bundle exec rake provision:current_dns`
|
43
|
+
[ $? -ne 0 ] && stop_server_and_exit
|
44
|
+
echo "Done."
|
45
|
+
|
46
|
+
echo "Generating relevance_rails deployment scripts..."
|
47
|
+
./script/rails generate deployment staging $TARGET_HOST --force
|
48
|
+
[ $? -ne 0 ] && stop_server_and_exit
|
49
|
+
git add .
|
50
|
+
git commit -m "Generated relevance_rails deployment scripts for $TARGET_HOST."
|
51
|
+
[ $? -ne 0 ] && stop_server_and_exit
|
52
|
+
echo "Done."
|
53
|
+
|
54
|
+
echo "Capistrano: setup..."
|
55
|
+
bundle exec cap staging deploy:setup
|
56
|
+
[ $? -ne 0 ] && stop_server_and_exit
|
57
|
+
echo "Done."
|
58
|
+
|
59
|
+
echo "Capistrano: deploying..."
|
60
|
+
bundle exec cap staging deploy:cold
|
61
|
+
[ $? -ne 0 ] && stop_server_and_exit
|
62
|
+
echo "Done."
|
63
|
+
|
64
|
+
builtin cd -
|
65
|
+
rvm gemset use relevance_rails
|
66
|
+
echo "RVM is now using:` rvm current`"
|
67
|
+
|
68
|
+
echo "Running the acceptance tests against our newly-created server..."
|
69
|
+
ACCEPTANCE_HOST=$TARGET_HOST rake acceptance --trace
|
70
|
+
[ $? -ne 0 ] && stop_server_and_exit
|
71
|
+
echo "Done."
|
72
|
+
|
73
|
+
builtin cd $RAILS_APP
|
74
|
+
rvm gemset use $RAILS_APP
|
75
|
+
|
76
|
+
echo "Terminating our newly-created server..."
|
77
|
+
bundle exec rake provision:destroy FORCE=true --trace
|
78
|
+
echo "Done!"
|
79
|
+
|
data/spec/acceptance_spec.rb
CHANGED
@@ -1,25 +1,25 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe 'App is alive', :js => true, :acceptance => true do
|
4
|
-
it 'verifies coffeescript served up as js' do
|
5
|
-
visit '/assets/relevance_rails.js'
|
6
|
-
page.should have_content "console.log('Hello from Relevance, Inc!');"
|
7
|
-
end
|
8
|
-
|
9
4
|
it "verifies haml is served up" do
|
10
5
|
visit '/relevance_rails'
|
11
6
|
page.should have_content 'WELCOME HOME'
|
12
7
|
end
|
13
8
|
|
9
|
+
it 'verifies coffeescript served up as js' do
|
10
|
+
visit '/assets/application.js'
|
11
|
+
page.should have_content 'console.log("Hello from Relevance, Inc!")'
|
12
|
+
end
|
13
|
+
|
14
14
|
it "verifies scss is served up as css" do
|
15
|
-
visit '/assets/
|
16
|
-
page.should have_content "background-color:
|
15
|
+
visit '/assets/application.css'
|
16
|
+
page.should have_content "background-color:blue"
|
17
17
|
end
|
18
18
|
|
19
19
|
it "verifies a working database connection" do
|
20
20
|
visit '/relevance_rails/db'
|
21
|
-
within ('h1.
|
22
|
-
page.should have_content '
|
21
|
+
within ('h1.advanced_math') do
|
22
|
+
page.should have_content '4242'
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
require 'generators/provision_config/provision_config_generator'
|
3
3
|
|
4
4
|
describe ProvisionConfigGenerator do
|
5
|
-
context '#
|
5
|
+
context '#check_authorized_keys' do
|
6
6
|
subject { ProvisionConfigGenerator.new(['name']) }
|
7
7
|
|
8
8
|
it "aborts if no ssh-keys are found" do
|
@@ -14,14 +14,13 @@ describe ProvisionConfigGenerator do
|
|
14
14
|
RelevanceRails::PublicKeyFetcher.should_receive(:public_keys).and_return([])
|
15
15
|
|
16
16
|
should_abort_with(/^No ssh keys were found!/) do
|
17
|
-
subject.
|
17
|
+
subject.check_authorized_keys
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
21
|
it "doesn't abort if ssh-keys are found" do
|
22
22
|
subject.should_receive(:fetch_keys).and_return(['ssh-rsa ZZZZ'])
|
23
|
-
subject.
|
24
|
-
expect { subject.create_authorized_key_data_bag }.to_not raise_error
|
23
|
+
expect { subject.check_authorized_keys }.to_not raise_error
|
25
24
|
end
|
26
25
|
end
|
27
26
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'relevance_rails/provision'
|
3
|
+
|
4
|
+
describe RelevanceRails::Provision do
|
5
|
+
describe '.run_commands' do
|
6
|
+
it "fails fast if a command fails" do
|
7
|
+
job = mock(:status => 1, :stdout => '', :stderr => 'FAIL WHALE', :command => 'exit 1')
|
8
|
+
server = mock(:ssh => [job])
|
9
|
+
capture_stdout do
|
10
|
+
expect do
|
11
|
+
RelevanceRails::Provision.run_commands server
|
12
|
+
end.to raise_error SystemExit
|
13
|
+
end.should =~ /STDERR: FAIL WHALE/
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/spec/lib/runner_spec.rb
CHANGED
@@ -13,9 +13,13 @@ describe RelevanceRails::Runner do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
it "new calls exec" do
|
16
|
-
RelevanceRails::Runner.should_receive(:exec).with(
|
16
|
+
RelevanceRails::Runner.should_receive(:exec).with(anything,
|
17
|
+
'-S', 'rails', 'new', 'the_app', '-m',
|
17
18
|
File.expand_path(File.dirname(__FILE__) +
|
18
19
|
"/../../lib/relevance_rails/relevance_rails_template.rb"))
|
20
|
+
RelevanceRails::Runner.should_receive(:install_relevance_rails)
|
21
|
+
env = mock :environment_name => '1.9.3@default'
|
22
|
+
RelevanceRails::Runner.should_receive(:setup_rvm).and_return(env)
|
19
23
|
start('new', 'the_app')
|
20
24
|
end
|
21
25
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -55,5 +55,4 @@ end
|
|
55
55
|
|
56
56
|
Capybara.current_driver = :selenium
|
57
57
|
Capybara.run_server = false
|
58
|
-
|
59
|
-
Capybara.app_host = ENV["ACCEPTANCE_HOST"] || 'http://localhost:3000'
|
58
|
+
Capybara.app_host = 'http://' + (ENV["ACCEPTANCE_HOST"] || 'localhost:3000')
|
data/techdebt.md
CHANGED
@@ -6,8 +6,13 @@
|
|
6
6
|
** cleaner rvm version detection - intermittenly picks up no version
|
7
7
|
** intermittent mysql::server failures (mysql server not up yet) on `vagrant up`. Attempt fix in site_cookbooks
|
8
8
|
** intermittent setup failure - apt-get update fails with 404s or ruby not found
|
9
|
+
** when generating an app with --database=postgresql, provision_config
|
10
|
+
generator intermittently fails at the beginning with different gem not found
|
11
|
+
errors. Generating the app more than once or inspecting the problem solves it
|
12
|
+
** provision_config generator intermittently can't detect current working directory which breaks
|
13
|
+
git commands. Current solution of sprinkling Dir.chdir is a bandaid at best.
|
9
14
|
|
10
|
-
*
|
15
|
+
* Provisioning an instance
|
11
16
|
** Don't hardcode path to chef binstub, caused by ubuntu installing weirdness
|
12
17
|
** Make the deployment generator idempotent
|
13
18
|
** Better error handling when the aws.yml is not present
|
metadata
CHANGED
@@ -1,122 +1,137 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: relevance_rails
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 0
|
10
|
-
version: 0.1.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1.alpha
|
5
|
+
prerelease: 6
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Alex Redington
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-04-12 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: rails
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
18
|
+
requirements:
|
26
19
|
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 3
|
31
|
-
- 2
|
32
|
-
version: "3.2"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3.2'
|
33
22
|
type: :runtime
|
34
|
-
|
35
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.2'
|
30
|
+
- !ruby/object:Gem::Dependency
|
36
31
|
name: fog
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.3.0
|
38
|
+
type: :runtime
|
37
39
|
prerelease: false
|
38
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
41
|
none: false
|
40
|
-
requirements:
|
42
|
+
requirements:
|
41
43
|
- - ~>
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
hash: 27
|
44
|
-
segments:
|
45
|
-
- 1
|
46
|
-
- 3
|
47
|
-
- 0
|
44
|
+
- !ruby/object:Gem::Version
|
48
45
|
version: 1.3.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: thor
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.14.6
|
49
54
|
type: :runtime
|
50
|
-
version_requirements: *id002
|
51
|
-
- !ruby/object:Gem::Dependency
|
52
|
-
name: pry
|
53
55
|
prerelease: false
|
54
|
-
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.14.6
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: pry
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
55
65
|
none: false
|
56
|
-
requirements:
|
57
|
-
- -
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
|
60
|
-
segments:
|
61
|
-
- 0
|
62
|
-
version: "0"
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
63
70
|
type: :development
|
64
|
-
version_requirements: *id003
|
65
|
-
- !ruby/object:Gem::Dependency
|
66
|
-
name: capybara
|
67
71
|
prerelease: false
|
68
|
-
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
69
73
|
none: false
|
70
|
-
requirements:
|
71
|
-
- -
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: capybara
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
77
86
|
type: :development
|
78
|
-
version_requirements: *id004
|
79
|
-
- !ruby/object:Gem::Dependency
|
80
|
-
name: rspec
|
81
87
|
prerelease: false
|
82
|
-
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rspec
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
83
97
|
none: false
|
84
|
-
requirements:
|
85
|
-
- -
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
|
88
|
-
segments:
|
89
|
-
- 0
|
90
|
-
version: "0"
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
91
102
|
type: :development
|
92
|
-
version_requirements: *id005
|
93
|
-
- !ruby/object:Gem::Dependency
|
94
|
-
name: rake
|
95
103
|
prerelease: false
|
96
|
-
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rake
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
97
113
|
none: false
|
98
|
-
requirements:
|
114
|
+
requirements:
|
99
115
|
- - ~>
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
hash: 11
|
102
|
-
segments:
|
103
|
-
- 0
|
104
|
-
- 9
|
105
|
-
- 2
|
106
|
-
- 2
|
116
|
+
- !ruby/object:Gem::Version
|
107
117
|
version: 0.9.2.2
|
108
118
|
type: :development
|
109
|
-
|
110
|
-
|
111
|
-
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 0.9.2.2
|
126
|
+
description: A Rails 3 wrapper which forces template use and includes a plethora of
|
127
|
+
generators for standard Relevance bits.
|
128
|
+
email:
|
112
129
|
- alex.redington@thinkrelevance.com
|
113
|
-
executables:
|
130
|
+
executables:
|
114
131
|
- relevance_rails
|
115
132
|
extensions: []
|
116
|
-
|
117
133
|
extra_rdoc_files: []
|
118
|
-
|
119
|
-
files:
|
134
|
+
files:
|
120
135
|
- .gitignore
|
121
136
|
- .rvmrc
|
122
137
|
- .travis.yml
|
@@ -129,20 +144,21 @@ files:
|
|
129
144
|
- lib/generators/deployment/deployment_generator.rb
|
130
145
|
- lib/generators/fixtures/fixtures_generator.rb
|
131
146
|
- lib/generators/provision_config/provision_config_generator.rb
|
147
|
+
- lib/generators/provision_config/templates/Capfile
|
132
148
|
- lib/generators/provision_config/templates/authorized_keys.json.erb
|
149
|
+
- lib/generators/provision_config/templates/deploy.rb.erb
|
150
|
+
- lib/generators/provision_config/templates/recipes_deploy.rb
|
151
|
+
- lib/generators/provision_config/templates/vagrant.rb
|
133
152
|
- lib/generators/relevance_file/relevance_file_generator.rb
|
134
|
-
- lib/generators/relevance_file/templates/Capfile
|
135
153
|
- lib/generators/relevance_file/templates/Gemfile.erb
|
136
154
|
- lib/generators/relevance_file/templates/README.markdown.erb
|
137
155
|
- lib/generators/relevance_file/templates/application.html.haml.erb
|
138
156
|
- lib/generators/relevance_file/templates/database.example.yml.mysql.erb
|
139
157
|
- lib/generators/relevance_file/templates/database.example.yml.postgresql.erb
|
140
|
-
- lib/generators/relevance_file/templates/deploy.rb.erb
|
141
|
-
- lib/generators/relevance_file/templates/recipes_deploy.rb
|
142
158
|
- lib/generators/relevance_file/templates/spec_helper.rb
|
143
|
-
- lib/generators/relevance_file/templates/vagrant.rb
|
144
159
|
- lib/relevance_rails.rb
|
145
160
|
- lib/relevance_rails/chef_dna.rb
|
161
|
+
- lib/relevance_rails/generator_overrides.rb
|
146
162
|
- lib/relevance_rails/provision.rb
|
147
163
|
- lib/relevance_rails/public_key_fetcher.rb
|
148
164
|
- lib/relevance_rails/railtie.rb
|
@@ -152,48 +168,35 @@ files:
|
|
152
168
|
- lib/tasks/provision.rake
|
153
169
|
- relevance_rails.gemspec
|
154
170
|
- script/ci
|
171
|
+
- script/ci_nightly
|
155
172
|
- spec/acceptance_spec.rb
|
156
173
|
- spec/lib/provision_config_generator_spec.rb
|
157
|
-
- spec/lib/
|
174
|
+
- spec/lib/provision_spec.rb
|
158
175
|
- spec/lib/runner_spec.rb
|
159
176
|
- spec/spec_helper.rb
|
160
177
|
- techdebt.md
|
161
|
-
homepage:
|
178
|
+
homepage: ''
|
162
179
|
licenses: []
|
163
|
-
|
164
180
|
post_install_message:
|
165
181
|
rdoc_options: []
|
166
|
-
|
167
|
-
require_paths:
|
182
|
+
require_paths:
|
168
183
|
- lib
|
169
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
184
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
170
185
|
none: false
|
171
|
-
requirements:
|
172
|
-
- -
|
173
|
-
- !ruby/object:Gem::Version
|
174
|
-
|
175
|
-
|
176
|
-
- 0
|
177
|
-
version: "0"
|
178
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
|
+
requirements:
|
187
|
+
- - ! '>='
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '0'
|
190
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
179
191
|
none: false
|
180
|
-
requirements:
|
181
|
-
- -
|
182
|
-
- !ruby/object:Gem::Version
|
183
|
-
|
184
|
-
segments:
|
185
|
-
- 0
|
186
|
-
version: "0"
|
192
|
+
requirements:
|
193
|
+
- - ! '>'
|
194
|
+
- !ruby/object:Gem::Version
|
195
|
+
version: 1.3.1
|
187
196
|
requirements: []
|
188
|
-
|
189
197
|
rubyforge_project: relevance_rails
|
190
198
|
rubygems_version: 1.8.21
|
191
199
|
signing_key:
|
192
200
|
specification_version: 3
|
193
201
|
summary: Rails 3 Relevance style, with all infrastructure bits automated away.
|
194
|
-
test_files:
|
195
|
-
- spec/acceptance_spec.rb
|
196
|
-
- spec/lib/provision_config_generator_spec.rb
|
197
|
-
- spec/lib/relevance_rails_spec.rb
|
198
|
-
- spec/lib/runner_spec.rb
|
199
|
-
- spec/spec_helper.rb
|
202
|
+
test_files: []
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe RelevanceRails do
|
4
|
-
context '.rvm_run' do
|
5
|
-
it 'aborts when the command fails' do
|
6
|
-
should_abort_with(/Command '.+' failed with/) do
|
7
|
-
subject.rvm_run('-e "exit 1"')
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'succeeds when the command passes' do
|
12
|
-
expect { subject.rvm_run('-e "exit 0"') }.to_not raise_error
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|