jamie 0.1.0.alpha14 → 0.1.0.alpha15
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +0 -1
- data/bin/jamie +4 -0
- data/jamie.gemspec +0 -1
- data/lib/jamie.rb +2 -1
- data/lib/jamie/cli.rb +1 -1
- data/lib/jamie/version.rb +1 -1
- metadata +3 -21
- data/lib/jamie/driver/vagrant.rb +0 -39
- data/lib/jamie/vagrant.rb +0 -57
data/Rakefile
CHANGED
data/bin/jamie
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# -*- encoding: utf-8 -*-
|
3
3
|
|
4
|
+
# Trap interrupts to quit cleanly. See
|
5
|
+
# https://twitter.com/mitchellh/status/283014103189053442
|
6
|
+
Signal.trap("INT") { exit 1 }
|
7
|
+
|
4
8
|
$:.unshift File.join(File.dirname(__FILE__), %w{.. lib})
|
5
9
|
require 'jamie/cli'
|
6
10
|
|
data/jamie.gemspec
CHANGED
@@ -21,7 +21,6 @@ Gem::Specification.new do |gem|
|
|
21
21
|
gem.add_dependency 'net-ssh'
|
22
22
|
gem.add_dependency 'net-scp'
|
23
23
|
gem.add_dependency 'mixlib-shellout'
|
24
|
-
gem.add_dependency 'vagrant', '~> 1.0.5'
|
25
24
|
|
26
25
|
gem.add_development_dependency 'yard'
|
27
26
|
gem.add_development_dependency 'maruku'
|
data/lib/jamie.rb
CHANGED
@@ -9,6 +9,7 @@ require 'mixlib/shellout'
|
|
9
9
|
require 'net/https'
|
10
10
|
require 'net/scp'
|
11
11
|
require 'net/ssh'
|
12
|
+
require 'pathname'
|
12
13
|
require 'socket'
|
13
14
|
require 'stringio'
|
14
15
|
require 'yaml'
|
@@ -834,7 +835,7 @@ module Jamie
|
|
834
835
|
end
|
835
836
|
|
836
837
|
def prepare_chef_home(ssh_args)
|
837
|
-
ssh(ssh_args, "sudo rm -rf #{chef_home} && mkdir -p #{chef_home}")
|
838
|
+
ssh(ssh_args, "sudo rm -rf #{chef_home} && mkdir -p #{chef_home}/cache")
|
838
839
|
end
|
839
840
|
|
840
841
|
def upload_chef_data(ssh_args, instance)
|
data/lib/jamie/cli.rb
CHANGED
@@ -190,7 +190,7 @@ module Jamie
|
|
190
190
|
run_list = cookbook_name ? "recipe[#{cookbook_name}]" : nil
|
191
191
|
attributes = cookbook_name ? { cookbook_name => nil } : nil
|
192
192
|
|
193
|
-
{ '
|
193
|
+
{ 'driver_plugin' => 'vagrant',
|
194
194
|
'platforms' => platforms,
|
195
195
|
'suites' => [
|
196
196
|
{ 'name' => 'standard',
|
data/lib/jamie/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jamie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.alpha15
|
5
5
|
prerelease: 6
|
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-12-
|
12
|
+
date: 2012-12-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -75,22 +75,6 @@ dependencies:
|
|
75
75
|
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: vagrant
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
|
-
requirements:
|
83
|
-
- - ~>
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: 1.0.5
|
86
|
-
type: :runtime
|
87
|
-
prerelease: false
|
88
|
-
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ~>
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: 1.0.5
|
94
78
|
- !ruby/object:Gem::Dependency
|
95
79
|
name: yard
|
96
80
|
requirement: !ruby/object:Gem::Requirement
|
@@ -174,10 +158,8 @@ files:
|
|
174
158
|
- jamie.gemspec
|
175
159
|
- lib/jamie.rb
|
176
160
|
- lib/jamie/cli.rb
|
177
|
-
- lib/jamie/driver/vagrant.rb
|
178
161
|
- lib/jamie/rake_tasks.rb
|
179
162
|
- lib/jamie/thor_tasks.rb
|
180
|
-
- lib/jamie/vagrant.rb
|
181
163
|
- lib/jamie/version.rb
|
182
164
|
- lib/vendor/hash_recursive_merge.rb
|
183
165
|
- templates/plugin/driver.rb.erb
|
@@ -201,7 +183,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
201
183
|
version: '0'
|
202
184
|
segments:
|
203
185
|
- 0
|
204
|
-
hash:
|
186
|
+
hash: 2338100729257258503
|
205
187
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
206
188
|
none: false
|
207
189
|
requirements:
|
data/lib/jamie/driver/vagrant.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
require 'jamie'
|
4
|
-
|
5
|
-
module Jamie
|
6
|
-
|
7
|
-
module Driver
|
8
|
-
|
9
|
-
# Vagrant driver for Jamie. It communicates to Vagrant via the CLI.
|
10
|
-
class Vagrant < Jamie::Driver::SSHBase
|
11
|
-
|
12
|
-
default_config 'memory', '256'
|
13
|
-
|
14
|
-
def perform_create(instance, state)
|
15
|
-
state['name'] = instance.name
|
16
|
-
run_command "vagrant up #{state['name']} --no-provision"
|
17
|
-
end
|
18
|
-
|
19
|
-
def perform_converge(instance, state)
|
20
|
-
run_command "vagrant provision #{state['name']}"
|
21
|
-
end
|
22
|
-
|
23
|
-
def perform_destroy(instance, state)
|
24
|
-
run_command "vagrant destroy #{state['name']} -f"
|
25
|
-
state.delete('name')
|
26
|
-
end
|
27
|
-
|
28
|
-
protected
|
29
|
-
|
30
|
-
def generate_ssh_args(state)
|
31
|
-
Array(state['name'])
|
32
|
-
end
|
33
|
-
|
34
|
-
def ssh(ssh_args, cmd)
|
35
|
-
run_command %{vagrant ssh #{ssh_args.first} --command '#{cmd}'}
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
data/lib/jamie/vagrant.rb
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
require 'forwardable'
|
4
|
-
require 'vagrant'
|
5
|
-
|
6
|
-
require 'jamie'
|
7
|
-
|
8
|
-
module Jamie
|
9
|
-
|
10
|
-
module Vagrant
|
11
|
-
|
12
|
-
# A Vagrant confiuration class which wraps a Jamie::Config instance.
|
13
|
-
class Config < ::Vagrant::Config::Base
|
14
|
-
extend Forwardable
|
15
|
-
|
16
|
-
def_delegators :@config, :suites, :suites=, :platforms, :platforms=,
|
17
|
-
:instances, :yaml_file, :yaml_file=, :log_level, :log_level=,
|
18
|
-
:test_base_path, :test_base_path=, :yaml_data
|
19
|
-
|
20
|
-
def initialize
|
21
|
-
@config = Jamie::Config.new
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
# Defines all Vagrant virtual machines, one for each instance.
|
26
|
-
#
|
27
|
-
# @param config [Vagrant::Config::Top] Vagrant top level config object
|
28
|
-
def self.define_vms(config)
|
29
|
-
config.jamie.instances.each do |instance|
|
30
|
-
define_vagrant_vm(config, instance)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
private
|
35
|
-
|
36
|
-
def self.define_vagrant_vm(config, instance)
|
37
|
-
driver = instance.platform.driver
|
38
|
-
|
39
|
-
config.vm.define instance.name do |c|
|
40
|
-
c.vm.box = driver['box']
|
41
|
-
c.vm.box_url = driver['box_url'] if driver['box_url']
|
42
|
-
c.vm.host_name = "#{instance.name}.vagrantup.com"
|
43
|
-
c.vm.customize ["modifyvm", :id, "--memory", driver['memory']]
|
44
|
-
|
45
|
-
c.vm.provision :chef_solo do |chef|
|
46
|
-
chef.log_level = config.jamie.log_level
|
47
|
-
chef.run_list = instance.run_list
|
48
|
-
chef.json = instance.attributes
|
49
|
-
chef.data_bags_path = instance.suite.data_bags_path
|
50
|
-
chef.roles_path = instance.suite.roles_path
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
Vagrant.config_keys.register(:jamie) { Jamie::Vagrant::Config }
|