lobot 0.10.1 → 0.10.2
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.md +37 -19
- data/features/ci.feature +19 -3
- data/features/step_definitions/ci_steps.rb +16 -4
- data/features/support/env.rb +1 -1
- data/lib/generators/lobot/config_generator.rb +6 -4
- data/lib/generators/lobot/install_generator.rb +9 -0
- data/lib/generators/lobot/templates/chef/cookbooks/pivotal_ci/recipes/default.rb +0 -1
- data/lib/generators/lobot/templates/chef/cookbooks/pivotal_ci/recipes/jenkins.rb +1 -1
- data/lib/generators/lobot/templates/chef/cookbooks/pivotal_ci/recipes/teamcity.rb +43 -0
- data/lib/generators/lobot/templates/chef/cookbooks/pivotal_ci/templates/default/teamcity-initd.erb +44 -0
- data/lib/generators/lobot/templates/ci_build.sh +1 -1
- data/lib/lobot/tasks/ci.rake +12 -5
- data/lib/lobot/version.rb +1 -1
- data/spec/install_spec.rb +77 -43
- metadata +4 -2
data/README.md
CHANGED
@@ -2,21 +2,21 @@ Lobot: Your Chief Administrative Aide on Cloud City
|
|
2
2
|
============================
|
3
3
|
|
4
4
|

|
5
|
-
###
|
5
|
+
###Easily create your CI server on EC2
|
6
6
|
|
7
|
-
Lando Calrissian relies on Lobot to keep Cloud City afloat, and now you can rely on Lobot to
|
7
|
+
Lando Calrissian relies on Lobot to keep Cloud City afloat, and now you can rely on Lobot to get your continuous integration server running in the cloud. Lobot is a gem that will help you spin-up, bootstrap, and install Jenkins or TeamCity for CI for your Rails app on Amazon EC2.
|
8
8
|
|
9
9
|
# What do I get?
|
10
10
|
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
11
|
+
* Rake tasks for creating, starting, stopping, or destroying your CI srever on EC2
|
12
|
+
* Capistrano tasks for bootstrapping the Centos EC2 instance
|
13
|
+
* Chef recipes for configuring the instance to run Jenkins and build Rails projects
|
14
14
|
|
15
|
-
all you'll need to do is run the following commands:
|
15
|
+
After you add lobot to your Gemfile, all you'll need to do is run the following commands:
|
16
16
|
|
17
|
-
rails g lobot:install
|
17
|
+
rails g lobot:install [jenkins|teamcity]
|
18
18
|
rails g lobot:config
|
19
|
-
rake ci:
|
19
|
+
rake ci:create_server
|
20
20
|
cap ci bootstrap
|
21
21
|
cap ci chef
|
22
22
|
|
@@ -31,10 +31,17 @@ Add lobot to your Gemfile, in the development group:
|
|
31
31
|
## Generate
|
32
32
|
Lobot is a Rails 3 generator. Rails 2 can be made to work, but you will need to copy the template files into your project.
|
33
33
|
|
34
|
-
|
34
|
+
### For Jenkins:
|
35
|
+
|
36
|
+
rails g lobot:install jenkins
|
37
|
+
|
38
|
+
### For TeamCity:
|
39
|
+
Lobot only creates your EC2 instance and installs the build server. Configuration for TeamCity still needs to be done manually.
|
40
|
+
|
41
|
+
rails g lobot:install teamcity
|
35
42
|
|
36
43
|
## Setup
|
37
|
-
You can use a generator to interactively generate the config/ci.yml that includes some reasonable defaults and explanations
|
44
|
+
You can use a generator to interactively generate the config/ci.yml that includes some reasonable defaults and explanations.
|
38
45
|
|
39
46
|
rails g lobot:config
|
40
47
|
|
@@ -52,18 +59,25 @@ Alternatively, manually edit config/ci.yml
|
|
52
59
|
aws_secret_access_key: The Secret Access Key for your Amazon AWS account
|
53
60
|
provider: AWS # leave this one alone
|
54
61
|
server:
|
55
|
-
name: run 'rake ci:
|
56
|
-
instance_id: run 'rake ci:
|
62
|
+
name: run 'rake ci:create_server to populate'
|
63
|
+
instance_id: run 'rake ci:create_server to populate'
|
57
64
|
build_command: ./script/ci_build.sh
|
58
65
|
ec2_server_access:
|
59
66
|
key_pair_name: myapp_ci
|
60
67
|
id_rsa_path: ~/.ssh/id_rsa
|
61
68
|
github_private_ssh_key_path: ~/.ssh/id_rsa
|
62
69
|
|
70
|
+
## Adjust Defaults (Optional)
|
71
|
+
In your ci.yml, there are defaults set for values that have the recommened value. For example, the instance size used for EC2 is set to "m1.large", which costs $230/month.
|
72
|
+
If you don't need to increase your memory size for Jenkins or TeamCity, you could elect to use "c1.medium" instead which costs about half that.
|
73
|
+
You can also save on EC2 costs by using a tool like cimonitor or ylastic to schedule when your instances are online.
|
74
|
+
|
63
75
|
For security, the lobot:install task added config/ci.yml to the .gitignore file since it includes sensitive AWS credentials and your CI users password.
|
64
76
|
Keep in mind that the default build script ci_build.sh uses the headless gem and jasmine. You'll want to add those to your Gemfile or change your build command.
|
65
77
|
|
66
|
-
|
78
|
+
## Commit and push your changes
|
79
|
+
|
80
|
+
At this point you will need to create a commit of the files generated or modified and push those changes to your remote git repository so Jenkins can execute your build command.
|
67
81
|
|
68
82
|
## Modify the soloistrc if necessary
|
69
83
|
|
@@ -73,17 +87,17 @@ Switch postgres to mysql, or add your own recipes for your own dependencies.
|
|
73
87
|
|
74
88
|
1. Launch an instance, allocate and associates an elastic IP and updates ci.yml:
|
75
89
|
|
76
|
-
|
90
|
+
rake ci:create_server
|
77
91
|
|
78
92
|
2. Bootstrap the instance using the boostrap_server.sh script generated by Lobot. The script instals ruby prerequisites, creates the app_user account, and installs RVM for that user:
|
79
93
|
|
80
|
-
|
94
|
+
cap ci bootstrap
|
81
95
|
|
82
96
|
3. Upload the contents of your chef/cookbooks/ directory, upload the soloistrc, and run chef:
|
83
97
|
|
84
|
-
|
98
|
+
cap ci chef
|
85
99
|
|
86
|
-
Your lobot instance should now be up and running. You will be able to access your CI server at: http
|
100
|
+
Your lobot instance should now be up and running. You will be able to access your CI server at: http://<your instance address>/ with the username and password you chose during configuration.
|
87
101
|
For more information about Jenkins CI, see http://jenkins-ci.org/
|
88
102
|
|
89
103
|
## Troubleshooting
|
@@ -94,11 +108,15 @@ Shell access for your instance
|
|
94
108
|
|
95
109
|
Terminating your instance and deallocating the elastic IP
|
96
110
|
|
97
|
-
rake ci:
|
111
|
+
rake ci:destroy_server
|
98
112
|
|
99
113
|
Suspending your instance
|
100
114
|
|
101
|
-
rake ci:
|
115
|
+
rake ci:stop_server
|
116
|
+
|
117
|
+
Rstarting a server
|
118
|
+
|
119
|
+
rake ci:start_server
|
102
120
|
|
103
121
|
## Add your new CI instance to [cimonitor](http://github.com/pivotal/cimonitor) and CCMenu
|
104
122
|
|
data/features/ci.feature
CHANGED
@@ -9,17 +9,17 @@ Feature: CI
|
|
9
9
|
And I vendor Lobot
|
10
10
|
And I put Lobot in the Gemfile
|
11
11
|
And I run bundle install
|
12
|
-
And I run the Lobot generator
|
12
|
+
And I run the Lobot generator for "Jenkins"
|
13
13
|
Then rake reports ci tasks as being available
|
14
14
|
|
15
15
|
@aws
|
16
|
-
Scenario: Install CI on Amazon AWS using new Rails template
|
16
|
+
Scenario: Install Jenkins CI on Amazon AWS using new Rails template
|
17
17
|
When I create a new Rails project
|
18
18
|
And I vendor Lobot
|
19
19
|
And I put Lobot in the Gemfile
|
20
20
|
And I add a gem with an https://github.com source
|
21
21
|
And I run bundle install
|
22
|
-
And I run the Lobot generator
|
22
|
+
And I run the Lobot generator for "Jenkins"
|
23
23
|
And I enter my info into the ci.yml file
|
24
24
|
And I make changes to be committed
|
25
25
|
And I push to git
|
@@ -27,3 +27,19 @@ Feature: CI
|
|
27
27
|
And I bootstrap
|
28
28
|
And I deploy
|
29
29
|
Then CI is green
|
30
|
+
|
31
|
+
@aws
|
32
|
+
Scenario: Install TeamCity CI on Amazon AWS using new Rails template
|
33
|
+
When I create a new Rails project
|
34
|
+
And I vendor Lobot
|
35
|
+
And I put Lobot in the Gemfile
|
36
|
+
And I add a gem with an https://github.com source
|
37
|
+
And I run bundle install
|
38
|
+
And I run the Lobot generator for "TeamCity"
|
39
|
+
And I enter my info into the ci.yml file
|
40
|
+
And I make changes to be committed
|
41
|
+
And I push to git
|
42
|
+
And I start the server
|
43
|
+
And I bootstrap
|
44
|
+
And I deploy
|
45
|
+
Then TeamCity is installed
|
@@ -37,8 +37,8 @@ When /^I run bundle install$/ do
|
|
37
37
|
system!('cd testapp && bundle exec gem list | grep lobot')
|
38
38
|
end
|
39
39
|
|
40
|
-
When /^I run the Lobot generator$/ do
|
41
|
-
system!(
|
40
|
+
When /^I run the Lobot generator for "([^"]*)"$/ do |build_server_name|
|
41
|
+
system!("cd testapp && rails generate lobot:install #{build_server_name}")
|
42
42
|
system!('ls testapp | grep -s soloistrc')
|
43
43
|
end
|
44
44
|
|
@@ -92,7 +92,7 @@ When /^I push to git$/ do
|
|
92
92
|
end
|
93
93
|
|
94
94
|
When /^I start the server$/ do
|
95
|
-
system! "cd testapp && bundle exec rake ci:
|
95
|
+
system! "cd testapp && bundle exec rake ci:create_server"
|
96
96
|
end
|
97
97
|
|
98
98
|
When /^I bootstrap$/ do
|
@@ -113,5 +113,17 @@ Then /^CI is green$/ do
|
|
113
113
|
end
|
114
114
|
|
115
115
|
Then /^rake reports ci tasks as being available$/ do
|
116
|
-
`cd testapp && bundle exec rake -T`.should include("ci:
|
116
|
+
`cd testapp && bundle exec rake -T`.should include("ci:start_server")
|
117
117
|
end
|
118
|
+
|
119
|
+
Then /^TeamCity is installed$/ do
|
120
|
+
ci_conf_location = 'testapp/config/ci.yml'
|
121
|
+
ci_yml = YAML.load_file(ci_conf_location)
|
122
|
+
|
123
|
+
Timeout::timeout(400) do
|
124
|
+
until system("wget http://#{ci_yml['server']['elastic_ip']}:8111")
|
125
|
+
sleep 5
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
data/features/support/env.rb
CHANGED
@@ -23,6 +23,8 @@ module Lobot
|
|
23
23
|
'provider' => "AWS"
|
24
24
|
},
|
25
25
|
'server' => {
|
26
|
+
'name' => nil,
|
27
|
+
'instance_id' => nil,
|
26
28
|
'flavor_id' => "m1.large",
|
27
29
|
'security_group' => "ci_servers",
|
28
30
|
'ssh_port' => "22"
|
@@ -93,7 +95,7 @@ module Lobot
|
|
93
95
|
* For a tutorial on this see: http://open.bsdcow.org/histerical/tutorials/ssh_pubkey_auth#1.2
|
94
96
|
EOS
|
95
97
|
while true do
|
96
|
-
id_rsa_path = ask("
|
98
|
+
id_rsa_path = ask("SSH Private Key for EC2 Access [#{config['ec2_server_access']['id_rsa_path'].split('/').last}]:", :bold)
|
97
99
|
config['ec2_server_access']['id_rsa_path'] = id_rsa_path if id_rsa_path != ""
|
98
100
|
if config['ec2_server_access']['id_rsa_path'] != File.expand_path(config['ec2_server_access']['id_rsa_path'])
|
99
101
|
config['ec2_server_access']['id_rsa_path'] = File.expand_path(File.join(ENV['HOME'], '.ssh', config['ec2_server_access']['id_rsa_path']))
|
@@ -111,7 +113,7 @@ module Lobot
|
|
111
113
|
* repository you entered above. On github this will be listed here: https://github.com/settings/ssh
|
112
114
|
EOS
|
113
115
|
while true do
|
114
|
-
github_private_ssh_key_path = ask("
|
116
|
+
github_private_ssh_key_path = ask("SSH Private Key for Github [#{config['github_private_ssh_key_path'].split('/').last}]:", :bold)
|
115
117
|
config['github_private_ssh_key_path'] = github_private_ssh_key_path if github_private_ssh_key_path != ""
|
116
118
|
if config['github_private_ssh_key_path'] != File.expand_path(config['github_private_ssh_key_path'])
|
117
119
|
config['github_private_ssh_key_path'] = File.expand_path(File.join(ENV['HOME'], '.ssh', config['github_private_ssh_key_path']))
|
@@ -132,8 +134,8 @@ module Lobot
|
|
132
134
|
|
133
135
|
say "\n\nconfig/ci.yml configured:\n#{File.read(Rails.root.join('config/ci.yml'))}\n"
|
134
136
|
say "You can edit this file to change any additional defaults."
|
135
|
-
say "Before continuing, be sure to push uncommitted changes to your git repository.", :
|
136
|
-
say "For next steps, see README.md"
|
137
|
+
say "Before continuing, be sure to push uncommitted changes to your git repository.", :green
|
138
|
+
say "For next steps, see the lobot README.md"
|
137
139
|
end
|
138
140
|
end
|
139
141
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Lobot
|
2
2
|
class InstallGenerator < Rails::Generators::Base
|
3
3
|
source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
|
4
|
+
argument :build_server, :type => :string, :default => "Jenkins"
|
4
5
|
|
5
6
|
def create_ci_files
|
6
7
|
template 'ci.yml', 'config/ci.yml'
|
@@ -30,5 +31,13 @@ module Lobot
|
|
30
31
|
directory 'chef', 'chef'
|
31
32
|
end
|
32
33
|
|
34
|
+
def add_ci_recipe_to_default
|
35
|
+
server_name = build_server.downcase
|
36
|
+
server_name = "jenkins" if build_server.blank?
|
37
|
+
|
38
|
+
# append jenkins or teamcity recipe based on the user's choice
|
39
|
+
append_to_file "chef/cookbooks/pivotal_ci/recipes/default.rb", %Q{include_recipe "pivotal_ci::#{server_name}"}
|
40
|
+
end
|
41
|
+
|
33
42
|
end
|
34
43
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
include_recipe "pivotal_server::daemontools"
|
2
|
+
include_recipe "pivotal_ci::xvfb"
|
3
|
+
include_recipe "pivotal_ci::git_config"
|
4
|
+
|
5
|
+
username = ENV['SUDO_USER'].strip
|
6
|
+
user_home = ENV['HOME']
|
7
|
+
|
8
|
+
install_dir = "#{user_home}"
|
9
|
+
tar_location = "#{install_dir}/teamcity.tar.gz"
|
10
|
+
|
11
|
+
execute "download teamcity" do
|
12
|
+
command "mkdir -p #{install_dir} && curl -Lsf http://download.jetbrains.com/teamcity/TeamCity-7.0.2a.tar.gz -o #{tar_location}"
|
13
|
+
user username
|
14
|
+
not_if { File.exists?(tar_location) }
|
15
|
+
end
|
16
|
+
|
17
|
+
execute "unpack teamcity" do
|
18
|
+
command "cd #{install_dir} && tar xfz #{tar_location} && mkdir -p #{install_dir}/TeamCity/logs"
|
19
|
+
user username
|
20
|
+
group username
|
21
|
+
not_if { File.exists?("#{install_dir}/TeamCity") }
|
22
|
+
end
|
23
|
+
|
24
|
+
template "/etc/init.d/teamcity" do
|
25
|
+
source "teamcity-initd.erb"
|
26
|
+
variables(
|
27
|
+
:username => username
|
28
|
+
)
|
29
|
+
mode 0755
|
30
|
+
end
|
31
|
+
|
32
|
+
execute "Start TeamCity" do
|
33
|
+
# while this runs successfully, it doesn't successfully start TeamCity. Rebooting instead.
|
34
|
+
command "/etc/init.d/teamcity start"
|
35
|
+
end
|
36
|
+
|
37
|
+
execute "Adding TeamCity to init.d" do
|
38
|
+
command "chkconfig --add teamcity"
|
39
|
+
end
|
40
|
+
|
41
|
+
execute "Reboot the instance to bring up TeamCity" do
|
42
|
+
command "sudo reboot"
|
43
|
+
end
|
data/lib/generators/lobot/templates/chef/cookbooks/pivotal_ci/templates/default/teamcity-initd.erb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# chkconfig: 345 86 16
|
4
|
+
|
5
|
+
# description: TeamCity service #
|
6
|
+
#
|
7
|
+
|
8
|
+
export JAVA_HOME=/usr/lib/jvm/jre-1.6.0-openjdk.x86_64
|
9
|
+
|
10
|
+
start(){
|
11
|
+
echo "Starting TeamCity"
|
12
|
+
/command/setuidgid <%= @username %> /home/<%= @username %>/TeamCity/bin/startup.sh
|
13
|
+
/command/setuidgid <%= @username %> /home/<%= @username %>/TeamCity/buildAgent/bin/agent.sh start
|
14
|
+
}
|
15
|
+
|
16
|
+
stop(){
|
17
|
+
echo "Stopping TeamCity"
|
18
|
+
/command/setuidgid <%= @username %> /home/<%= @username %>/TeamCity/bin/shutdown.sh
|
19
|
+
/command/setuidgid <%= @username %> /home/<%= @username %>/TeamCity/buildAgent/bin/agent.sh stop kill
|
20
|
+
}
|
21
|
+
|
22
|
+
restart(){
|
23
|
+
echo "Restarting TeamCity"
|
24
|
+
stop
|
25
|
+
start
|
26
|
+
}
|
27
|
+
|
28
|
+
case "$1" in
|
29
|
+
start)
|
30
|
+
start;;
|
31
|
+
|
32
|
+
stop)
|
33
|
+
stop;;
|
34
|
+
|
35
|
+
restart)
|
36
|
+
restart;;
|
37
|
+
*)
|
38
|
+
|
39
|
+
echo $"Usage: $0 {start|stop|restart}"
|
40
|
+
exit 1
|
41
|
+
esac
|
42
|
+
|
43
|
+
exit 0
|
44
|
+
|
data/lib/lobot/tasks/ci.rake
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
namespace :ci do
|
2
2
|
desc "Spin up CI server on amazon"
|
3
|
-
task :
|
3
|
+
task :create_server do
|
4
4
|
require 'fog'
|
5
5
|
require 'yaml'
|
6
6
|
require 'socket'
|
@@ -29,7 +29,7 @@ namespace :ci do
|
|
29
29
|
p security_group
|
30
30
|
end
|
31
31
|
|
32
|
-
PORTS_TO_OPEN = [22, 443, 80]
|
32
|
+
PORTS_TO_OPEN = [22, 443, 80, 8111]
|
33
33
|
PORTS_TO_OPEN.each do |port|
|
34
34
|
is_in_security_group = !!security_group.ip_permissions.detect{|group| (group['fromPort']..group['toPort']).include?(port) && group['ipRanges'].detect{|range| range["cidrIp"]== "0.0.0.0/0" } }
|
35
35
|
|
@@ -104,7 +104,7 @@ namespace :ci do
|
|
104
104
|
end
|
105
105
|
|
106
106
|
desc "terminate the CI Server and release IP"
|
107
|
-
task :
|
107
|
+
task :destroy_server do
|
108
108
|
puts "Terminating the CI Server and releasing IP..."
|
109
109
|
require 'fog'
|
110
110
|
require 'yaml'
|
@@ -126,7 +126,7 @@ namespace :ci do
|
|
126
126
|
end
|
127
127
|
|
128
128
|
desc "stop(suspend) the CI Server"
|
129
|
-
task :
|
129
|
+
task :stop_server do
|
130
130
|
puts "Stopping (suspending) the CI Server..."
|
131
131
|
require 'fog'
|
132
132
|
require 'yaml'
|
@@ -147,7 +147,7 @@ namespace :ci do
|
|
147
147
|
end
|
148
148
|
|
149
149
|
desc "start(resume) the CI Server"
|
150
|
-
task :
|
150
|
+
task :start_server do
|
151
151
|
require 'fog'
|
152
152
|
require 'yaml'
|
153
153
|
require 'socket'
|
@@ -258,4 +258,11 @@ namespace :ci do
|
|
258
258
|
end
|
259
259
|
exit exit_code
|
260
260
|
end
|
261
|
+
|
262
|
+
#aliases
|
263
|
+
desc "maybe"
|
264
|
+
task "server:create" => "ci:create_server"
|
265
|
+
task "server:start" => "ci:start_server"
|
266
|
+
task "server:destroy" => "ci:destroy_server"
|
267
|
+
task "server:stop" => "ci:stop_server"
|
261
268
|
end
|
data/lib/lobot/version.rb
CHANGED
data/spec/install_spec.rb
CHANGED
@@ -8,72 +8,106 @@ describe Lobot::InstallGenerator do
|
|
8
8
|
|
9
9
|
before do
|
10
10
|
prepare_destination
|
11
|
-
run_generator
|
12
11
|
end
|
13
12
|
|
14
13
|
after :all do
|
15
14
|
FileUtils.rm_rf ::File.expand_path("../tmp", __FILE__)
|
16
15
|
end
|
17
16
|
|
18
|
-
|
19
|
-
|
20
|
-
end
|
17
|
+
context "without requiring input" do
|
18
|
+
before { run_generator }
|
21
19
|
|
22
|
-
it "creates ci.yml" do
|
23
|
-
assert_file "config/ci.yml", /app_name/
|
24
|
-
end
|
25
20
|
|
26
|
-
|
27
|
-
|
28
|
-
|
21
|
+
it "creates .gitignore" do
|
22
|
+
assert_file ".gitignore", /config\/ci.yml/
|
23
|
+
end
|
29
24
|
|
30
|
-
|
31
|
-
|
32
|
-
|
25
|
+
it "creates ci.yml" do
|
26
|
+
assert_file "config/ci.yml", /app_name/
|
27
|
+
end
|
33
28
|
|
34
|
-
|
35
|
-
|
36
|
-
|
29
|
+
it "create bootstrap_server.sh" do
|
30
|
+
assert_file "script/bootstrap_server.sh", /bin\/bash/
|
31
|
+
end
|
37
32
|
|
38
|
-
|
39
|
-
|
40
|
-
prepare_destination
|
41
|
-
system("echo 'line 2' > #{destination_root}/Capfile")
|
42
|
-
run_generator
|
43
|
-
assert_file "Capfile", "load 'config/capistrano/ci'\nline 2\n"
|
33
|
+
it "creates a ci_build.sh file" do
|
34
|
+
assert_file "script/ci_build.sh"
|
44
35
|
end
|
45
|
-
end
|
46
36
|
|
47
|
-
|
48
|
-
|
49
|
-
assert_file "Capfile", /load 'config\/capistrano\/ci'/
|
37
|
+
it "makes ci_build.sh executable" do
|
38
|
+
system("test -x #{destination_root}/script/ci_build.sh").should == true
|
50
39
|
end
|
51
40
|
|
52
|
-
|
53
|
-
|
41
|
+
context "Capfile exists" do
|
42
|
+
it "appends a load path to the Capfile" do
|
43
|
+
prepare_destination
|
44
|
+
system("echo 'line 2' > #{destination_root}/Capfile")
|
45
|
+
run_generator
|
46
|
+
assert_file "Capfile", "load 'config/capistrano/ci'\nline 2\n"
|
47
|
+
end
|
54
48
|
end
|
55
|
-
end
|
56
49
|
|
57
|
-
|
58
|
-
|
59
|
-
|
50
|
+
context "Capfile doesn't exist" do
|
51
|
+
it "create a Capfile" do
|
52
|
+
assert_file "Capfile", /load 'config\/capistrano\/ci'/
|
53
|
+
end
|
60
54
|
|
61
|
-
|
62
|
-
|
63
|
-
|
55
|
+
it "give you the capify (default) capfile, but commented out" do
|
56
|
+
assert_file "Capfile", /# load 'deploy'/
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
it "creates config/deploy/ci.rb" do
|
61
|
+
assert_file "config/deploy/ci.rb", /role :ci, "#\{ci_server\}:#\{ssh_port\}"/
|
62
|
+
end
|
63
|
+
|
64
|
+
it "creates config/capistrano/ci.rb" do
|
65
|
+
assert_file "config/capistrano/ci.rb", /task :ci_setup do/
|
66
|
+
end
|
67
|
+
|
68
|
+
it "creates soloistrc" do
|
69
|
+
assert_file "soloistrc", /cookbook_paths/
|
70
|
+
end
|
64
71
|
|
65
|
-
|
66
|
-
|
72
|
+
it "creates the chef directory" do
|
73
|
+
destination_root.should have_structure do
|
74
|
+
directory "chef" do
|
75
|
+
directory "cookbooks" do
|
76
|
+
directory "pivotal_ci"
|
77
|
+
directory "pivotal_server"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
67
82
|
end
|
68
83
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
84
|
+
context "when asking for which app" do
|
85
|
+
context "with valid input" do
|
86
|
+
before do
|
87
|
+
run_generator [input]
|
88
|
+
end
|
89
|
+
|
90
|
+
context "when selecting Jenkins" do
|
91
|
+
let(:input) { "Jenkins" }
|
92
|
+
it "adds jenkins recipe to default recipe" do
|
93
|
+
assert_file "chef/cookbooks/pivotal_ci/recipes/default.rb", /include_recipe "pivotal_ci::jenkins"/
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
context "when selecting TeamCity" do
|
98
|
+
let(:input) { "TeamCity" }
|
99
|
+
it "adds teamcity recipe to default recipe" do
|
100
|
+
assert_file "chef/cookbooks/pivotal_ci/recipes/default.rb", /include_recipe "pivotal_ci::teamcity"/
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
context "when selecting the default" do
|
105
|
+
let(:input) { "" }
|
106
|
+
it "adds jenkins recipe to default recipe" do
|
107
|
+
assert_file "chef/cookbooks/pivotal_ci/recipes/default.rb", /include_recipe "pivotal_ci::jenkins"/
|
75
108
|
end
|
76
109
|
end
|
77
110
|
end
|
111
|
+
|
78
112
|
end
|
79
113
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lobot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fog
|
@@ -235,8 +235,10 @@ files:
|
|
235
235
|
- lib/generators/lobot/templates/chef/cookbooks/pivotal_ci/recipes/git_config.rb
|
236
236
|
- lib/generators/lobot/templates/chef/cookbooks/pivotal_ci/recipes/id_rsa.rb
|
237
237
|
- lib/generators/lobot/templates/chef/cookbooks/pivotal_ci/recipes/jenkins.rb
|
238
|
+
- lib/generators/lobot/templates/chef/cookbooks/pivotal_ci/recipes/teamcity.rb
|
238
239
|
- lib/generators/lobot/templates/chef/cookbooks/pivotal_ci/recipes/xvfb.rb
|
239
240
|
- lib/generators/lobot/templates/chef/cookbooks/pivotal_ci/templates/default/jenkins-job-config.xml.erb
|
241
|
+
- lib/generators/lobot/templates/chef/cookbooks/pivotal_ci/templates/default/teamcity-initd.erb
|
240
242
|
- lib/generators/lobot/templates/chef/cookbooks/pivotal_server/files/default/cacert.pem
|
241
243
|
- lib/generators/lobot/templates/chef/cookbooks/pivotal_server/libraries/marker.rb
|
242
244
|
- lib/generators/lobot/templates/chef/cookbooks/pivotal_server/recipes/ca_cert.rb
|