remy 0.0.3 → 0.0.4
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/.rdebugrc +3 -0
- data/.rvmrc +1 -1
- data/README.md +3 -3
- data/lib/remy/bootstrap.rb +2 -2
- data/lib/remy/chef.rb +13 -17
- data/lib/remy/config/chef.rb +56 -0
- data/lib/remy/config/node.rb +9 -0
- data/lib/remy/{remy.rb → config.rb} +17 -47
- data/lib/remy/server.rb +1 -1
- data/lib/remy/utility.rb +7 -0
- data/lib/remy/version.rb +1 -1
- data/lib/remy.rb +2 -1
- data/lib/tasks/remy.rake +5 -11
- data/remy.gemspec +1 -2
- data/spec/fixtures/chef.yml +5 -5
- data/spec/fixtures/hello_world_chef.yml +1 -1
- data/spec/fixtures/node.json +1 -0
- data/spec/remy/bootstrap_spec.rb +9 -9
- data/spec/remy/config/chef_spec.rb +360 -0
- data/spec/remy/config/node_spec.rb +20 -0
- data/spec/remy/integration/chef_spec.rb +4 -4
- data/spec/remy/utility_spec.rb +22 -0
- data/spec/remy_spec.rb +23 -251
- data/spec/spec_helper.rb +7 -4
- data/spec/tasks/remy_spec.rb +14 -0
- metadata +100 -146
- data/spec/remy/chef_spec.rb +0 -82
data/.rdebugrc
ADDED
data/.rvmrc
CHANGED
@@ -1 +1 @@
|
|
1
|
-
rvm 1.
|
1
|
+
rvm 1.9.2-p320@remy --create
|
data/README.md
CHANGED
@@ -164,7 +164,7 @@ This assumes that 'demo.sharespost.com' is specified in the :servers section of
|
|
164
164
|
|
165
165
|
### Run chef-solo on a single box:
|
166
166
|
|
167
|
-
The simplest usage of Remy (Note: this only works if the Remy.configuration has already been specified, such as within
|
167
|
+
The simplest usage of Remy (Note: this only works if the Remy::Configuration::Chef.configuration has already been specified, such as within
|
168
168
|
a Rails application):
|
169
169
|
|
170
170
|
`Remy::Chef.new(:ip_address => '123.123.123.123').run`
|
@@ -174,7 +174,7 @@ as an argument.
|
|
174
174
|
|
175
175
|
Example: update your production database box:
|
176
176
|
|
177
|
-
server_config = Remy.find_server_config(:rails_env => :production, :role => :db)
|
177
|
+
server_config = Remy::Configuration::Chef.find_server_config(:rails_env => :production, :role => :db)
|
178
178
|
Remy::Chef.new(server_config).run
|
179
179
|
|
180
180
|
Other arguments can be passed into chef and will get applied against this node:
|
@@ -193,7 +193,7 @@ which will make chef-solo run in debug mode.
|
|
193
193
|
|
194
194
|
From within your Capistrano file, you do a variety of things, such as the following:
|
195
195
|
|
196
|
-
Remy.servers.find_servers(:rails_env => :staging, :role => :app) do |server|
|
196
|
+
Remy::Configuration::Chef.servers.find_servers(:rails_env => :staging, :role => :app) do |server|
|
197
197
|
Remy::Chef.new(server).run
|
198
198
|
end
|
199
199
|
|
data/lib/remy/bootstrap.rb
CHANGED
@@ -7,7 +7,7 @@ module Remy
|
|
7
7
|
def initialize(options = { })
|
8
8
|
@ip_address = options[:ip_address]
|
9
9
|
@password = options[:password]
|
10
|
-
options = (Remy.bootstrap || {}).merge(options).symbolize_keys
|
10
|
+
options = (Remy::Config::Chef.bootstrap || {}).merge(options).symbolize_keys
|
11
11
|
@ruby_version = options[:ruby_version] || '1.8.7'
|
12
12
|
@gems = options[:gems] || {}
|
13
13
|
@quiet = options[:quiet] || false
|
@@ -24,7 +24,7 @@ module Remy
|
|
24
24
|
|
25
25
|
def apt_get_rvm_packages
|
26
26
|
# This list of required packages came from doing "rvm requirements"
|
27
|
-
remote_apt_get 'build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison'
|
27
|
+
remote_apt_get 'build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion'
|
28
28
|
end
|
29
29
|
|
30
30
|
def install_gems_to_bootstrap_chef
|
data/lib/remy/chef.rb
CHANGED
@@ -3,17 +3,18 @@ module Remy
|
|
3
3
|
# For chef-solo info, see: http://wiki.opscode.com/display/chef/Chef+Solo
|
4
4
|
include ::Remy::Shell
|
5
5
|
include FileUtils
|
6
|
+
include ::Remy::Utility
|
6
7
|
attr_reader :ip_address
|
7
8
|
|
8
9
|
def initialize(options = {})
|
9
10
|
options = JSON.parse(options).symbolize_keys! if options.is_a?(String)
|
10
11
|
@chef_args = options.delete(:chef_args)
|
11
12
|
@quiet = options.delete(:quiet)
|
12
|
-
@
|
13
|
-
@ip_address = options[:ip_address] ? options[:ip_address] : @
|
14
|
-
server_config = Remy.find_server_config(:ip_address => ip_address) || Hashie::Mash.new
|
15
|
-
@
|
16
|
-
@
|
13
|
+
@node_config = Remy::Config::Chef.config.dup
|
14
|
+
@ip_address = options[:ip_address] ? options[:ip_address] : @node_config.ip_address
|
15
|
+
server_config = Remy::Config::Chef.find_server_config(:ip_address => ip_address) || Hashie::Mash.new
|
16
|
+
@node_config.deep_merge!(server_config)
|
17
|
+
@node_config.merge!(options)
|
17
18
|
end
|
18
19
|
|
19
20
|
def run
|
@@ -23,7 +24,7 @@ module Remy
|
|
23
24
|
end
|
24
25
|
|
25
26
|
def self.rake_run(rake_options)
|
26
|
-
ip_addresses = Remy.determine_ip_addresses_for_remy_run(rake_options)
|
27
|
+
ip_addresses = Remy::Config::Chef.determine_ip_addresses_for_remy_run(rake_options)
|
27
28
|
ip_addresses.each do |ip_address|
|
28
29
|
Remy::Chef.new(:ip_address => ip_address).run
|
29
30
|
end
|
@@ -36,7 +37,7 @@ module Remy
|
|
36
37
|
copy_spec_cookbook_and_role_dirs_to_tmp_dir
|
37
38
|
create_solo_rb
|
38
39
|
create_bash_script_which_runs_chef
|
39
|
-
|
40
|
+
create_node_json_from_node_config
|
40
41
|
end
|
41
42
|
|
42
43
|
def rsync_temp_dir_with_cookbooks_to_remote_host
|
@@ -66,13 +67,8 @@ module Remy
|
|
66
67
|
end
|
67
68
|
|
68
69
|
def copy_spec_cookbook_and_role_dirs_to_tmp_dir
|
69
|
-
|
70
|
-
|
71
|
-
full_path = path.map{|p| File.expand_path(p) }
|
72
|
-
full_path.each do |a_path|
|
73
|
-
cp_r a_path, tmp_dir
|
74
|
-
end
|
75
|
-
end
|
70
|
+
flatten_paths(@node_config.roles_path, @node_config.cookbook_path, @node_config.spec_path).each do |a_path|
|
71
|
+
cp_r a_path, tmp_dir
|
76
72
|
end
|
77
73
|
end
|
78
74
|
|
@@ -102,9 +98,9 @@ EOF
|
|
102
98
|
chmod(0755, File.join(tmp_dir, run_chef_solo_bash_script))
|
103
99
|
end
|
104
100
|
|
105
|
-
def
|
101
|
+
def create_node_json_from_node_config
|
106
102
|
File.open(File.join(tmp_dir, node_json), 'w+') do |f|
|
107
|
-
f << @
|
103
|
+
f << @node_config.to_json
|
108
104
|
end
|
109
105
|
end
|
110
106
|
|
@@ -117,7 +113,7 @@ EOF
|
|
117
113
|
end
|
118
114
|
|
119
115
|
def remote_chef_dir
|
120
|
-
@
|
116
|
+
@node_config.remote_chef_dir
|
121
117
|
end
|
122
118
|
|
123
119
|
def tmp_dir
|
@@ -0,0 +1,56 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2011 Gregory S. Woodward
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
#++
|
23
|
+
|
24
|
+
module Remy
|
25
|
+
module Config
|
26
|
+
class Chef
|
27
|
+
extend Remy::Config
|
28
|
+
include ::Remy::Shell
|
29
|
+
include FileUtils
|
30
|
+
|
31
|
+
def self.configure
|
32
|
+
temp_config = Hashie::Mash.new(:node_attributes => {}, :yml_files => [], :remote_chef_dir => '/var/chef')
|
33
|
+
yield temp_config
|
34
|
+
yml_files = [temp_config.yml_files].compact.flatten
|
35
|
+
@config = Hashie::Mash.new({:yml_files => yml_files,
|
36
|
+
:remote_chef_dir => temp_config.remote_chef_dir,
|
37
|
+
:roles_path => [temp_config.roles_path].compact.flatten,
|
38
|
+
:spec_path => [temp_config.spec_path].compact.flatten,
|
39
|
+
:cookbook_path => [temp_config.cookbook_path].compact.flatten}.merge!(temp_config.node_attributes))
|
40
|
+
|
41
|
+
yml_files.each do |filename|
|
42
|
+
begin
|
43
|
+
@config.deep_merge!(YAML.load(ERB.new(File.read(filename)).result) || {})
|
44
|
+
rescue SystemCallError, IOError
|
45
|
+
# do nothing if the chef.yml file could not be read (it's not needed for every usage of remy, just certain ones)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.save_node_json(output_file_path)
|
51
|
+
FileUtils.mkdir_p File.dirname(output_file_path)
|
52
|
+
File.open(output_file_path, 'w') { |f| f << @config.to_json }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -22,52 +22,22 @@
|
|
22
22
|
#++
|
23
23
|
|
24
24
|
module Remy
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
def initialize
|
29
|
-
@yml_files = []
|
30
|
-
@node_attributes = {}
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
class << self
|
35
|
-
include ::Remy::Shell
|
36
|
-
include FileUtils
|
37
|
-
|
38
|
-
def configure
|
39
|
-
@config_instance = Configuration.new
|
40
|
-
yield @config_instance
|
41
|
-
@configuration = Hashie::Mash.new({:yml_files => [@config_instance.yml_files].compact.flatten,
|
42
|
-
:remote_chef_dir => (@config_instance.remote_chef_dir || '/var/chef'),
|
43
|
-
:roles_path => [@config_instance.roles_path].compact.flatten,
|
44
|
-
:spec_path => [@config_instance.spec_path].compact.flatten,
|
45
|
-
:cookbook_path => [@config_instance.cookbook_path].compact.flatten}.merge!(@config_instance.node_attributes))
|
46
|
-
|
47
|
-
@config_instance.yml_files.each do |filename|
|
48
|
-
begin
|
49
|
-
configuration.deep_merge!(YAML.load(ERB.new(File.read(filename)).result) || {})
|
50
|
-
rescue SystemCallError, IOError
|
51
|
-
# do nothing if the chef.yml file could not be read (it's not needed for every usage of remy, just certain ones)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def configuration
|
57
|
-
@configuration ? @configuration : Hashie::Mash.new
|
25
|
+
module Config
|
26
|
+
def config
|
27
|
+
@config ? @config : Hashie::Mash.new
|
58
28
|
end
|
59
29
|
|
60
30
|
def to_json
|
61
|
-
|
31
|
+
config.to_json
|
62
32
|
end
|
63
33
|
|
64
34
|
def servers
|
65
|
-
|
35
|
+
config.servers
|
66
36
|
end
|
67
37
|
|
68
38
|
def find_servers(options = {})
|
69
|
-
return nil unless
|
70
|
-
Hashie::Mash.new(
|
39
|
+
return nil unless config.servers
|
40
|
+
Hashie::Mash.new(config.servers.inject({}) do |hash, (server_name, server_config)|
|
71
41
|
found = options.all? { |(key, value)| server_config[key] == value }
|
72
42
|
hash[server_name] = server_config if found
|
73
43
|
hash
|
@@ -75,8 +45,8 @@ module Remy
|
|
75
45
|
end
|
76
46
|
|
77
47
|
def find_server(options = {})
|
78
|
-
return nil unless
|
79
|
-
server_name, server_config =
|
48
|
+
return nil unless config.servers
|
49
|
+
server_name, server_config = config.servers.detect do |(server_name, server_config)|
|
80
50
|
options.all? { |(key, value)| server_config[key] == value }
|
81
51
|
end
|
82
52
|
{server_name => server_config.nil? ? nil : server_config.dup}
|
@@ -87,16 +57,16 @@ module Remy
|
|
87
57
|
end
|
88
58
|
|
89
59
|
def find_server_config_by_name(name)
|
90
|
-
return nil unless
|
91
|
-
|
60
|
+
return nil unless config.servers
|
61
|
+
config.servers.find { |(server_name, _)| server_name == name }.try(:last)
|
92
62
|
end
|
93
63
|
|
94
|
-
def
|
95
|
-
|
64
|
+
def cloud_config
|
65
|
+
config && config.cloud_config
|
96
66
|
end
|
97
67
|
|
98
68
|
def bootstrap
|
99
|
-
|
69
|
+
config && config.bootstrap
|
100
70
|
end
|
101
71
|
|
102
72
|
def determine_ip_addresses_for_remy_run(rake_args)
|
@@ -104,12 +74,12 @@ module Remy
|
|
104
74
|
if options_hash = convert_properties_to_hash(rake_args)
|
105
75
|
servers = find_servers(options_hash)
|
106
76
|
if !servers.empty?
|
107
|
-
ip_addresses = servers.collect {|server_name, chef_option| chef_option.ip_address }
|
77
|
+
ip_addresses = servers.collect { |server_name, chef_option| chef_option.ip_address }
|
108
78
|
else
|
109
79
|
ip_addresses = [options_hash[:ip_address]]
|
110
80
|
end
|
111
81
|
else
|
112
|
-
names_or_ip_addresses = rake_args.present? ? rake_args.split(' ').collect {|name| name.strip } : []
|
82
|
+
names_or_ip_addresses = rake_args.present? ? rake_args.split(' ').collect { |name| name.strip } : []
|
113
83
|
names_or_ip_addresses.each do |name_or_ip_address|
|
114
84
|
# From: http://www.regular-expressions.info/examples.html
|
115
85
|
ip_address_regex = '\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b'
|
@@ -119,7 +89,7 @@ module Remy
|
|
119
89
|
ip_addresses << server_config.ip_address
|
120
90
|
end
|
121
91
|
end
|
122
|
-
ip_addresses <<
|
92
|
+
ip_addresses << config.ip_address
|
123
93
|
end
|
124
94
|
ip_addresses.compact
|
125
95
|
end
|
data/lib/remy/server.rb
CHANGED
@@ -6,7 +6,7 @@ class Remy::Server
|
|
6
6
|
:flavor_id => 4, # 2GB
|
7
7
|
:image_id => 49, # Ubuntu 10.04 LTS (lucid)
|
8
8
|
:quiet => false
|
9
|
-
}.merge(Remy.
|
9
|
+
}.merge(Remy::Config::Chef.cloud_config || {}).merge(options || {}).symbolize_keys
|
10
10
|
|
11
11
|
@server_name = options[:server_name]
|
12
12
|
@cloud_api_key = options[:cloud_api_key]
|
data/lib/remy/utility.rb
ADDED
data/lib/remy/version.rb
CHANGED
data/lib/remy.rb
CHANGED
@@ -40,9 +40,10 @@ require 'json'
|
|
40
40
|
require 'hashie'
|
41
41
|
require 'tmpdir'
|
42
42
|
require 'remy/shell'
|
43
|
+
require 'remy/utility'
|
43
44
|
require 'yaml'
|
44
45
|
dir = File.dirname(__FILE__)
|
45
|
-
Dir[File.join(
|
46
|
+
Dir[File.join(dir, 'remy', '**', '*.rb')].each {|f| require f.gsub(dir, '')[1, f.length] }
|
46
47
|
|
47
48
|
module Remy
|
48
49
|
begin
|
data/lib/tasks/remy.rake
CHANGED
@@ -1,18 +1,16 @@
|
|
1
1
|
require 'remy'
|
2
2
|
|
3
3
|
namespace :remy do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
rescue RuntimeError
|
8
|
-
end
|
4
|
+
desc 'Create a JSON file from the contents of the Chef yml config files for use on development boxes by the Rails application.'
|
5
|
+
task :save_node_json, :rake_args do |task, options|
|
6
|
+
Remy::Config::Chef.save_node_json(options[:rake_args])
|
9
7
|
end
|
10
8
|
|
11
9
|
desc 'ssh to a named box'
|
12
10
|
task :ssh, :rake_args do |task, options|
|
13
11
|
Rake::Task[:'remy:environment'].invoke
|
14
|
-
user = Remy.
|
15
|
-
if ip_address = Remy.determine_ip_addresses_for_remy_run(options[:rake_args]).try(:first)
|
12
|
+
user = Remy::Config::Chef.config.user || 'root'
|
13
|
+
if ip_address = Remy::Config::Chef.determine_ip_addresses_for_remy_run(options[:rake_args]).try(:first)
|
16
14
|
exec "ssh #{user}@#{ip_address}"
|
17
15
|
end
|
18
16
|
end
|
@@ -20,7 +18,6 @@ namespace :remy do
|
|
20
18
|
namespace :chef do
|
21
19
|
desc 'run chef solo'
|
22
20
|
task :run, :rake_args do |task, options|
|
23
|
-
Rake::Task[:'remy:environment'].invoke
|
24
21
|
Remy::Chef.rake_run(options[:rake_args])
|
25
22
|
end
|
26
23
|
end
|
@@ -28,19 +25,16 @@ namespace :remy do
|
|
28
25
|
namespace :server do
|
29
26
|
desc 'create a server'
|
30
27
|
task :create, :server_name, :flavor_id, :cloud_api_key, :cloud_username, :cloud_provider, :image_id do |task, options|
|
31
|
-
Rake::Task[:'remy:environment'].invoke
|
32
28
|
Remy::Server.new(options).create
|
33
29
|
end
|
34
30
|
|
35
31
|
desc 'bootstrap chef'
|
36
32
|
task :bootstrap, :ip_address, :password do |task, options|
|
37
|
-
Rake::Task[:'remy:environment'].invoke
|
38
33
|
Remy::Bootstrap.new(options).run
|
39
34
|
end
|
40
35
|
|
41
36
|
desc 'create a server and bootstrap chef'
|
42
37
|
task :create_and_bootstrap, :server_name, :flavor_id, :cloud_api_key, :cloud_username, :cloud_provider, :image_id do |task, options|
|
43
|
-
Rake::Task[:'remy:environment'].invoke
|
44
38
|
begin
|
45
39
|
result = Remy::Server.new({:raise_exception => true}.merge(options)).create
|
46
40
|
Rake::Task[:'remy:server:bootstrap'].invoke(result[:ip_address], result[:password])
|
data/remy.gemspec
CHANGED
@@ -19,13 +19,12 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.require_paths = ['lib']
|
20
20
|
|
21
21
|
# specify any dependencies here; for example:
|
22
|
-
s.add_development_dependency 'bourne'
|
23
|
-
s.add_development_dependency 'mocha'
|
24
22
|
s.add_development_dependency 'i18n'
|
25
23
|
s.add_development_dependency 'json'
|
26
24
|
s.add_development_dependency 'rspec', '~> 2.7.0'
|
27
25
|
s.add_runtime_dependency 'activesupport', '>= 2'
|
28
26
|
s.add_runtime_dependency 'chef'
|
27
|
+
s.add_runtime_dependency 'rake'
|
29
28
|
s.add_runtime_dependency 'fog'
|
30
29
|
s.add_runtime_dependency 'hashie'
|
31
30
|
end
|
data/spec/fixtures/chef.yml
CHANGED
@@ -10,7 +10,7 @@ rails_env: bogus_and_should_be_overridden_by_value_in_servers_section
|
|
10
10
|
servers:
|
11
11
|
web.sharespost.com:
|
12
12
|
<<: *APP
|
13
|
-
ip_address: <%=
|
13
|
+
ip_address: <%= IP_ADDRESS_OF_REMY_TEST %>
|
14
14
|
rails_env: demo
|
15
15
|
color: blue
|
16
16
|
|
@@ -27,7 +27,7 @@ servers:
|
|
27
27
|
rails_env: demo
|
28
28
|
color: green
|
29
29
|
|
30
|
-
|
30
|
+
cloud_config:
|
31
31
|
cloud_provider: Rackspace
|
32
32
|
cloud_username: sharespost
|
33
33
|
cloud_api_key: abcdefg12345
|
@@ -38,7 +38,7 @@ cloud_configuration:
|
|
38
38
|
bootstrap:
|
39
39
|
ruby_version: 1.9.2
|
40
40
|
gems:
|
41
|
-
bundler:
|
42
|
-
chef:
|
43
|
-
rspec: 2.
|
41
|
+
bundler: 3.0.0
|
42
|
+
chef: 10.12.0
|
43
|
+
rspec: 2.11.0
|
44
44
|
|
@@ -0,0 +1 @@
|
|
1
|
+
{"blah": "bar"}
|
data/spec/remy/bootstrap_spec.rb
CHANGED
@@ -15,19 +15,19 @@ describe Remy::Bootstrap do
|
|
15
15
|
|
16
16
|
describe "ruby_version" do
|
17
17
|
it 'should default to 1.8.7 if there is no Ruby version specified in the yml files' do
|
18
|
-
Remy.configure { |config| config.yml_files = File.join(File.dirname(__FILE__), '../fixtures/hello_world_chef.yml') }
|
18
|
+
Remy::Config::Chef.configure { |config| config.yml_files = File.join(File.dirname(__FILE__), '../fixtures/hello_world_chef.yml') }
|
19
19
|
bootstrap = Remy::Bootstrap.new
|
20
20
|
ruby_version(bootstrap).should == '1.8.7'
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'should get the Ruby version if specified in the yml files' do
|
24
|
-
Remy.configure { |config| config.yml_files = File.join(File.dirname(__FILE__), '../fixtures/chef.yml') }
|
24
|
+
Remy::Config::Chef.configure { |config| config.yml_files = File.join(File.dirname(__FILE__), '../fixtures/chef.yml') }
|
25
25
|
bootstrap = Remy::Bootstrap.new
|
26
26
|
ruby_version(bootstrap).should == '1.9.2'
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'should use the version passed in as an option, even if it exists in the yml files' do
|
30
|
-
Remy.configure { |config| config.yml_files = File.join(File.dirname(__FILE__), '../fixtures/chef.yml') }
|
30
|
+
Remy::Config::Chef.configure { |config| config.yml_files = File.join(File.dirname(__FILE__), '../fixtures/chef.yml') }
|
31
31
|
bootstrap = Remy::Bootstrap.new(:ruby_version => '1.9.1')
|
32
32
|
ruby_version(bootstrap).should == '1.9.1'
|
33
33
|
end
|
@@ -35,7 +35,7 @@ describe Remy::Bootstrap do
|
|
35
35
|
|
36
36
|
describe "gems" do
|
37
37
|
it 'should default to nil if not specified in the yml files' do
|
38
|
-
Remy.configure { |config| config.yml_files = File.join(File.dirname(__FILE__), '../fixtures/hello_world_chef.yml') }
|
38
|
+
Remy::Config::Chef.configure { |config| config.yml_files = File.join(File.dirname(__FILE__), '../fixtures/hello_world_chef.yml') }
|
39
39
|
bootstrap = Remy::Bootstrap.new
|
40
40
|
gem(bootstrap)[:chef].should be_nil
|
41
41
|
gem(bootstrap)[:bundler].should be_nil
|
@@ -43,17 +43,17 @@ describe Remy::Bootstrap do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
it 'should get gem version if it has been specified in the yml files' do
|
46
|
-
Remy.configure { |config| config.yml_files = File.join(File.dirname(__FILE__), '../fixtures/chef.yml') }
|
46
|
+
Remy::Config::Chef.configure { |config| config.yml_files = File.join(File.dirname(__FILE__), '../fixtures/chef.yml') }
|
47
47
|
bootstrap = Remy::Bootstrap.new
|
48
|
-
gem(bootstrap)[:chef].should == '
|
49
|
-
gem(bootstrap)[:bundler].should == '
|
50
|
-
gem(bootstrap)[:rspec].should == '2.
|
48
|
+
gem(bootstrap)[:chef].should == '10.12.0'
|
49
|
+
gem(bootstrap)[:bundler].should == '3.0.0'
|
50
|
+
gem(bootstrap)[:rspec].should == '2.11.0'
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
54
|
describe "ip_address" do
|
55
55
|
it 'should use the value from the options' do
|
56
|
-
Remy.configure { |config| config.yml_files = File.join(File.dirname(__FILE__), '../fixtures/hello_world_chef.yml') }
|
56
|
+
Remy::Config::Chef.configure { |config| config.yml_files = File.join(File.dirname(__FILE__), '../fixtures/hello_world_chef.yml') }
|
57
57
|
bootstrap = Remy::Bootstrap.new(:ip_address => '1.2.3.4', :password => 'abcdef')
|
58
58
|
ip_address(bootstrap).should == '1.2.3.4'
|
59
59
|
end
|