buckknife 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/Gemfile +4 -0
- data/HISTORY.md +8 -0
- data/README.md +65 -0
- data/Rakefile +27 -0
- data/buckknife.gemspec +31 -0
- data/lib/buckknife.rb +44 -0
- data/lib/buckknife/command.rb +33 -0
- data/lib/buckknife/commands/add_role.rb +13 -0
- data/lib/buckknife/commands/base.rb +24 -0
- data/lib/buckknife/commands/bootstrap.rb +28 -0
- data/lib/buckknife/commands/capistrano.rb +46 -0
- data/lib/buckknife/commands/create.rb +42 -0
- data/lib/buckknife/commands/euca_create.rb +60 -0
- data/lib/buckknife/commands/rackspace_create.rb +58 -0
- data/lib/buckknife/commands/run_client.rb +49 -0
- data/lib/buckknife/data_accessor.rb +29 -0
- data/lib/buckknife/environment.rb +16 -0
- data/lib/buckknife/helper.rb +39 -0
- data/lib/buckknife/knife_helper.rb +22 -0
- data/lib/buckknife/node.rb +30 -0
- data/lib/buckknife/project.rb +80 -0
- data/lib/buckknife/templates/deploy_environments.rb.erb +85 -0
- data/lib/buckknife/templates/project.json.erb +75 -0
- data/lib/buckknife/version.rb +3 -0
- data/lib/chef/knife/project_add_role.rb +24 -0
- data/lib/chef/knife/project_bootstrap.rb +24 -0
- data/lib/chef/knife/project_capistrano.rb +19 -0
- data/lib/chef/knife/project_create.rb +53 -0
- data/lib/chef/knife/project_info.rb +13 -0
- data/lib/chef/knife/project_list.rb +17 -0
- data/lib/chef/knife/project_new.rb +28 -0
- data/lib/chef/knife/project_run_client.rb +30 -0
- data/lib/chef/knife/project_show.rb +34 -0
- data/spec/buckknife/commands/add_role_spec.rb +14 -0
- data/spec/buckknife/commands/bootstrap_spec.rb +22 -0
- data/spec/buckknife/commands/capistrano_spec.rb +13 -0
- data/spec/buckknife/commands/create_spec.rb +48 -0
- data/spec/buckknife/commands/run_client_spec.rb +15 -0
- data/spec/buckknife/environment_spec.rb +14 -0
- data/spec/buckknife/helper_spec.rb +11 -0
- data/spec/buckknife/node_spec.rb +18 -0
- data/spec/buckknife/project_spec.rb +49 -0
- data/spec/data_bags/projects/myapp.json +139 -0
- data/spec/knife.rb +4 -0
- data/spec/knife/project_bootstrap_spec.rb +0 -0
- data/spec/knife/project_info_spec.rb +17 -0
- data/spec/knife/project_list_spec.rb +18 -0
- data/spec/spec_helper.rb +27 -0
- metadata +251 -0
@@ -0,0 +1,139 @@
|
|
1
|
+
{
|
2
|
+
"id": "myapp",
|
3
|
+
"domain": "myapp.com",
|
4
|
+
"repository": "http://svn.domain.com/myapp/trunk",
|
5
|
+
"provider": "rackspace",
|
6
|
+
"rs_api_key": "",
|
7
|
+
"rs_api_username": "",
|
8
|
+
"public_interface": "eth0",
|
9
|
+
"internal_interface": "eth1",
|
10
|
+
"distro": "ubuntu10.04.deb",
|
11
|
+
"base_run_list": "role[base],recipe[base_projects::myapp],role[base_server]",
|
12
|
+
|
13
|
+
"environments": {
|
14
|
+
"production": {
|
15
|
+
"domain_name": "origin.myapp.com",
|
16
|
+
"www_virtual_ip": "127.0.0.1",
|
17
|
+
"database_user": "",
|
18
|
+
"database_password": ""
|
19
|
+
},
|
20
|
+
"staging": {
|
21
|
+
"domain_name": "staging.myapp.com",
|
22
|
+
"www_virtual_ip": "127.0.0.1",
|
23
|
+
"database_user": "",
|
24
|
+
"database_password": ""
|
25
|
+
},
|
26
|
+
"dev": {
|
27
|
+
"domain_name": "dev.myapp.com",
|
28
|
+
"www_virtual_ip": "127.0.0.1",
|
29
|
+
"database_user": "",
|
30
|
+
"database_password": ""
|
31
|
+
}
|
32
|
+
},
|
33
|
+
|
34
|
+
"nodes": {
|
35
|
+
"myapp-monitor1": {
|
36
|
+
"group": "monitor",
|
37
|
+
"size": "2G",
|
38
|
+
"environment": "production",
|
39
|
+
"roles": "monitor_client rails_app",
|
40
|
+
"recipes": "",
|
41
|
+
"address": "127.0.0.1",
|
42
|
+
"ssh_username": "username",
|
43
|
+
"ssh_password": "password"
|
44
|
+
},
|
45
|
+
|
46
|
+
"myapp-prod-app1": {
|
47
|
+
"group": "app",
|
48
|
+
"size": "8G",
|
49
|
+
"environment": "production",
|
50
|
+
"roles": "app_heartbeat_pair rails_app rails_nginx_app rails_local_mysql_app mysql_db rails_mysql_master monitor_client",
|
51
|
+
"recipes": "",
|
52
|
+
"address": "127.0.0.1",
|
53
|
+
"ssh_username": "username",
|
54
|
+
"ssh_password": "password"
|
55
|
+
},
|
56
|
+
"myapp-prod-app2": {
|
57
|
+
"group": "app",
|
58
|
+
"size": "8G",
|
59
|
+
"environment": "production",
|
60
|
+
"roles": "app_heartbeat_pair rails_app rails_nginx_app rails_local_mysql_app mysql_db monitor_client",
|
61
|
+
"recipes": "",
|
62
|
+
"address": "127.0.0.1",
|
63
|
+
"ssh_username": "username",
|
64
|
+
"ssh_password": "password"
|
65
|
+
},
|
66
|
+
"myapp-prod-job1": {
|
67
|
+
"group": "job",
|
68
|
+
"size": "4G",
|
69
|
+
"environment": "production",
|
70
|
+
"roles": "rails_app rails_job rails_local_mysql_app monitor_client",
|
71
|
+
"recipes": "",
|
72
|
+
"address": "127.0.0.1",
|
73
|
+
"ssh_username": "username",
|
74
|
+
"ssh_password": "password"
|
75
|
+
},
|
76
|
+
|
77
|
+
"myapp-staging-app1": {
|
78
|
+
"group": "app",
|
79
|
+
"size": "2G",
|
80
|
+
"environment": "staging",
|
81
|
+
"roles": "app_heartbeat_pair rails_app rails_nginx_app rails_local_mysql_app mysql_db rails_mysql_master monitor_client",
|
82
|
+
"recipes": "",
|
83
|
+
"address": "127.0.0.1",
|
84
|
+
"ssh_username": "username",
|
85
|
+
"ssh_password": "password"
|
86
|
+
},
|
87
|
+
"myapp-staging-app2": {
|
88
|
+
"group": "app",
|
89
|
+
"size": "2G",
|
90
|
+
"environment": "staging",
|
91
|
+
"roles": "app_heartbeat_pair rails_app rails_nginx_app rails_local_mysql_app mysql_db monitor_client",
|
92
|
+
"recipes": "",
|
93
|
+
"address": "127.0.0.1",
|
94
|
+
"ssh_username": "username",
|
95
|
+
"ssh_password": "password"
|
96
|
+
},
|
97
|
+
"myapp-staging-job1": {
|
98
|
+
"group": "job",
|
99
|
+
"size": "2G",
|
100
|
+
"environment": "staging",
|
101
|
+
"roles": "rails_app rails_job rails_local_mysql_app monitor_client",
|
102
|
+
"recipes": "",
|
103
|
+
"address": "127.0.0.1",
|
104
|
+
"ssh_username": "username",
|
105
|
+
"ssh_password": "password"
|
106
|
+
},
|
107
|
+
|
108
|
+
"myapp-dev-app1": {
|
109
|
+
"group": "app",
|
110
|
+
"size": "2G",
|
111
|
+
"environment": "dev",
|
112
|
+
"roles": "app_heartbeat_pair rails_app rails_nginx_app rails_local_mysql_app mysql_db rails_mysql_master monitor_client",
|
113
|
+
"recipes": "",
|
114
|
+
"address": "127.0.0.1",
|
115
|
+
"ssh_username": "username",
|
116
|
+
"ssh_password": "password"
|
117
|
+
},
|
118
|
+
"myapp-dev-app2": {
|
119
|
+
"group": "app",
|
120
|
+
"size": "2G",
|
121
|
+
"environment": "dev",
|
122
|
+
"roles": "app_heartbeat_pair rails_app rails_nginx_app rails_local_mysql_app mysql_db monitor_client",
|
123
|
+
"recipes": "",
|
124
|
+
"address": "127.0.0.1",
|
125
|
+
"ssh_username": "username",
|
126
|
+
"ssh_password": "password"
|
127
|
+
},
|
128
|
+
"myapp-dev-job1": {
|
129
|
+
"group": "job",
|
130
|
+
"size": "2G",
|
131
|
+
"environment": "dev",
|
132
|
+
"roles": "rails_app rails_job rails_local_mysql_app monitor_client",
|
133
|
+
"recipes": "",
|
134
|
+
"address": "127.0.0.1",
|
135
|
+
"ssh_username": "username",
|
136
|
+
"ssh_password": "password"
|
137
|
+
}
|
138
|
+
}
|
139
|
+
}
|
data/spec/knife.rb
ADDED
File without changes
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe BuckKnife::ProjectInfo do
|
4
|
+
subject do
|
5
|
+
cmd = BuckKnife::ProjectInfo.new
|
6
|
+
cmd.config[:config_file] = Chef::Config[:config_file]
|
7
|
+
cmd.configure_chef
|
8
|
+
@ui = Chef::Knife::UI.new(StringIO.new, StringIO.new, StringIO.new, {})
|
9
|
+
cmd.ui = @ui
|
10
|
+
cmd
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should provide info on configuration" do
|
14
|
+
subject.run
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe BuckKnife::ProjectList do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@cmd = BuckKnife::ProjectList.new
|
7
|
+
@cmd.config[:config_file] = Chef::Config[:config_file]
|
8
|
+
@cmd.configure_chef
|
9
|
+
@ui = Chef::Knife::UI.new(StringIO.new, StringIO.new, StringIO.new, {})
|
10
|
+
@cmd.ui = @ui
|
11
|
+
@cmd
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should list projects" do
|
15
|
+
BuckKnife::Project.should_receive(:all) { [] }
|
16
|
+
@cmd.run
|
17
|
+
end
|
18
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'rspec/core'
|
2
|
+
require 'buckknife'
|
3
|
+
|
4
|
+
ENV['KITCHEN_PROJECT_ROOT'] = File.expand_path("../data_bags/projects", __FILE__)
|
5
|
+
# puts ENV['KITCHEN_PROJECT_ROOT']
|
6
|
+
|
7
|
+
require 'chef'
|
8
|
+
require 'chef/knife'
|
9
|
+
Chef::Config[:config_file] = File.expand_path("../knife.rb", __FILE__)
|
10
|
+
BuckKnife::Project.root = File.expand_path("../data_bags/projects", __FILE__)
|
11
|
+
|
12
|
+
RSpec.configure do |config|
|
13
|
+
def capture(stream)
|
14
|
+
begin
|
15
|
+
stream = stream.to_s
|
16
|
+
eval "$#{stream} = StringIO.new"
|
17
|
+
yield
|
18
|
+
result = eval("$#{stream}").string
|
19
|
+
ensure
|
20
|
+
eval("$#{stream} = #{stream.upcase}")
|
21
|
+
end
|
22
|
+
|
23
|
+
result
|
24
|
+
end
|
25
|
+
|
26
|
+
alias :silence :capture
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,251 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: buckknife
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Ben Marini
|
14
|
+
- Kirt Fitzpatrick
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2011-07-22 00:00:00 -07:00
|
20
|
+
default_executable:
|
21
|
+
dependencies:
|
22
|
+
- !ruby/object:Gem::Dependency
|
23
|
+
name: chef
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ~>
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 51
|
31
|
+
segments:
|
32
|
+
- 0
|
33
|
+
- 10
|
34
|
+
- 2
|
35
|
+
version: 0.10.2
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id001
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: highline
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
hash: 3
|
47
|
+
segments:
|
48
|
+
- 0
|
49
|
+
version: "0"
|
50
|
+
type: :runtime
|
51
|
+
version_requirements: *id002
|
52
|
+
- !ruby/object:Gem::Dependency
|
53
|
+
name: json
|
54
|
+
prerelease: false
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
hash: 3
|
61
|
+
segments:
|
62
|
+
- 0
|
63
|
+
version: "0"
|
64
|
+
type: :runtime
|
65
|
+
version_requirements: *id003
|
66
|
+
- !ruby/object:Gem::Dependency
|
67
|
+
name: escape
|
68
|
+
prerelease: false
|
69
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
hash: 3
|
75
|
+
segments:
|
76
|
+
- 0
|
77
|
+
version: "0"
|
78
|
+
type: :runtime
|
79
|
+
version_requirements: *id004
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: activemodel
|
82
|
+
prerelease: false
|
83
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ~>
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
hash: 21
|
89
|
+
segments:
|
90
|
+
- 3
|
91
|
+
- 0
|
92
|
+
- 9
|
93
|
+
version: 3.0.9
|
94
|
+
type: :runtime
|
95
|
+
version_requirements: *id005
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: rspec
|
98
|
+
prerelease: false
|
99
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
101
|
+
requirements:
|
102
|
+
- - ~>
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
hash: 23
|
105
|
+
segments:
|
106
|
+
- 2
|
107
|
+
- 6
|
108
|
+
- 0
|
109
|
+
version: 2.6.0
|
110
|
+
type: :development
|
111
|
+
version_requirements: *id006
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: rcov
|
114
|
+
prerelease: false
|
115
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ~>
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
hash: 41
|
121
|
+
segments:
|
122
|
+
- 0
|
123
|
+
- 9
|
124
|
+
- 9
|
125
|
+
version: 0.9.9
|
126
|
+
type: :development
|
127
|
+
version_requirements: *id007
|
128
|
+
- !ruby/object:Gem::Dependency
|
129
|
+
name: knife-rackspace
|
130
|
+
prerelease: false
|
131
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
132
|
+
none: false
|
133
|
+
requirements:
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
hash: 3
|
137
|
+
segments:
|
138
|
+
- 0
|
139
|
+
version: "0"
|
140
|
+
type: :development
|
141
|
+
version_requirements: *id008
|
142
|
+
description: Extras for Chef's knife command
|
143
|
+
email:
|
144
|
+
- ben.marini@akqa.com
|
145
|
+
- kirt.fitzpatrick@akqa.com
|
146
|
+
executables: []
|
147
|
+
|
148
|
+
extensions: []
|
149
|
+
|
150
|
+
extra_rdoc_files: []
|
151
|
+
|
152
|
+
files:
|
153
|
+
- .gitignore
|
154
|
+
- Gemfile
|
155
|
+
- HISTORY.md
|
156
|
+
- README.md
|
157
|
+
- Rakefile
|
158
|
+
- buckknife.gemspec
|
159
|
+
- lib/buckknife.rb
|
160
|
+
- lib/buckknife/command.rb
|
161
|
+
- lib/buckknife/commands/add_role.rb
|
162
|
+
- lib/buckknife/commands/base.rb
|
163
|
+
- lib/buckknife/commands/bootstrap.rb
|
164
|
+
- lib/buckknife/commands/capistrano.rb
|
165
|
+
- lib/buckknife/commands/create.rb
|
166
|
+
- lib/buckknife/commands/euca_create.rb
|
167
|
+
- lib/buckknife/commands/rackspace_create.rb
|
168
|
+
- lib/buckknife/commands/run_client.rb
|
169
|
+
- lib/buckknife/data_accessor.rb
|
170
|
+
- lib/buckknife/environment.rb
|
171
|
+
- lib/buckknife/helper.rb
|
172
|
+
- lib/buckknife/knife_helper.rb
|
173
|
+
- lib/buckknife/node.rb
|
174
|
+
- lib/buckknife/project.rb
|
175
|
+
- lib/buckknife/templates/deploy_environments.rb.erb
|
176
|
+
- lib/buckknife/templates/project.json.erb
|
177
|
+
- lib/buckknife/version.rb
|
178
|
+
- lib/chef/knife/project_add_role.rb
|
179
|
+
- lib/chef/knife/project_bootstrap.rb
|
180
|
+
- lib/chef/knife/project_capistrano.rb
|
181
|
+
- lib/chef/knife/project_create.rb
|
182
|
+
- lib/chef/knife/project_info.rb
|
183
|
+
- lib/chef/knife/project_list.rb
|
184
|
+
- lib/chef/knife/project_new.rb
|
185
|
+
- lib/chef/knife/project_run_client.rb
|
186
|
+
- lib/chef/knife/project_show.rb
|
187
|
+
- spec/buckknife/commands/add_role_spec.rb
|
188
|
+
- spec/buckknife/commands/bootstrap_spec.rb
|
189
|
+
- spec/buckknife/commands/capistrano_spec.rb
|
190
|
+
- spec/buckknife/commands/create_spec.rb
|
191
|
+
- spec/buckknife/commands/run_client_spec.rb
|
192
|
+
- spec/buckknife/environment_spec.rb
|
193
|
+
- spec/buckknife/helper_spec.rb
|
194
|
+
- spec/buckknife/node_spec.rb
|
195
|
+
- spec/buckknife/project_spec.rb
|
196
|
+
- spec/data_bags/projects/myapp.json
|
197
|
+
- spec/knife.rb
|
198
|
+
- spec/knife/project_bootstrap_spec.rb
|
199
|
+
- spec/knife/project_info_spec.rb
|
200
|
+
- spec/knife/project_list_spec.rb
|
201
|
+
- spec/spec_helper.rb
|
202
|
+
has_rdoc: true
|
203
|
+
homepage: ""
|
204
|
+
licenses: []
|
205
|
+
|
206
|
+
post_install_message:
|
207
|
+
rdoc_options: []
|
208
|
+
|
209
|
+
require_paths:
|
210
|
+
- lib
|
211
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
212
|
+
none: false
|
213
|
+
requirements:
|
214
|
+
- - ">="
|
215
|
+
- !ruby/object:Gem::Version
|
216
|
+
hash: 3
|
217
|
+
segments:
|
218
|
+
- 0
|
219
|
+
version: "0"
|
220
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
221
|
+
none: false
|
222
|
+
requirements:
|
223
|
+
- - ">="
|
224
|
+
- !ruby/object:Gem::Version
|
225
|
+
hash: 3
|
226
|
+
segments:
|
227
|
+
- 0
|
228
|
+
version: "0"
|
229
|
+
requirements: []
|
230
|
+
|
231
|
+
rubyforge_project: buckknife
|
232
|
+
rubygems_version: 1.6.1
|
233
|
+
signing_key:
|
234
|
+
specification_version: 3
|
235
|
+
summary: You call that a knife? THIS is a knife
|
236
|
+
test_files:
|
237
|
+
- spec/buckknife/commands/add_role_spec.rb
|
238
|
+
- spec/buckknife/commands/bootstrap_spec.rb
|
239
|
+
- spec/buckknife/commands/capistrano_spec.rb
|
240
|
+
- spec/buckknife/commands/create_spec.rb
|
241
|
+
- spec/buckknife/commands/run_client_spec.rb
|
242
|
+
- spec/buckknife/environment_spec.rb
|
243
|
+
- spec/buckknife/helper_spec.rb
|
244
|
+
- spec/buckknife/node_spec.rb
|
245
|
+
- spec/buckknife/project_spec.rb
|
246
|
+
- spec/data_bags/projects/myapp.json
|
247
|
+
- spec/knife.rb
|
248
|
+
- spec/knife/project_bootstrap_spec.rb
|
249
|
+
- spec/knife/project_info_spec.rb
|
250
|
+
- spec/knife/project_list_spec.rb
|
251
|
+
- spec/spec_helper.rb
|