rconf 0.7.6 → 0.7.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rconf/configurator_registry.rb +1 -1
- data/lib/rconf/configurators/build_configurator.rb +73 -0
- data/lib/rconf/configurators/execute_configurator.rb +46 -0
- data/lib/rconf/configurators/git_repo_configurator.rb +18 -33
- data/lib/rconf/support/environment_updater.rb +1 -1
- data/lib/rconf/version.rb +1 -1
- data/spec/configurators/build_configurator_spec.rb +41 -0
- data/spec/configurators/bundler_configurator_spec.rb +9 -13
- data/spec/configurators/git_repo_configurator_spec.rb +21 -11
- data/spec/configurators/ruby_configurator_spec.rb +19 -36
- data/spec/spec_helper.rb +33 -0
- data/spec/support/package_installer_spec.rb +4 -8
- metadata +6 -2
@@ -0,0 +1,73 @@
|
|
1
|
+
# Copyright (C) 2011 RightScale, Inc, All Rights Reserved Worldwide.
|
2
|
+
#
|
3
|
+
# THIS PROGRAM IS CONFIDENTIAL AND PROPRIETARY TO RIGHTSCALE
|
4
|
+
# AND CONSTITUTES A VALUABLE TRADE SECRET. Any unauthorized use,
|
5
|
+
# reproduction, modification, or disclosure of this program is
|
6
|
+
# strictly prohibited. Any use of this program by an authorized
|
7
|
+
# licensee is strictly subject to the terms and conditions,
|
8
|
+
# including confidentiality obligations, set forth in the applicable
|
9
|
+
# License Agreement between RightScale.com, Inc. and
|
10
|
+
# the licensee
|
11
|
+
|
12
|
+
module RightConf
|
13
|
+
|
14
|
+
class BuildConfigurator
|
15
|
+
|
16
|
+
include Configurator
|
17
|
+
|
18
|
+
register :build
|
19
|
+
|
20
|
+
description 'Builds a repository using the ./configure, make, make install commands'
|
21
|
+
|
22
|
+
settings :path => 'Path to source files',
|
23
|
+
:pre_step => 'Command ran prior to ./configure',
|
24
|
+
:message => 'Progress message to display if any while building',
|
25
|
+
:configure_opts => 'Hash of options to be given to the configure script. ' +
|
26
|
+
'The keys are the platform families (:darwin, :linux or :windows)',
|
27
|
+
:only_if => 'Ruby code that should return true for build to proceed'
|
28
|
+
|
29
|
+
validate_has_settings :path
|
30
|
+
|
31
|
+
# Run command line
|
32
|
+
#
|
33
|
+
# === Return
|
34
|
+
# true:: Always return true
|
35
|
+
def run
|
36
|
+
if only_if.nil? || instance_eval(only_if)
|
37
|
+
message("Building #{path}") if message.nil?
|
38
|
+
report_check message
|
39
|
+
Dir.chdir(path) do
|
40
|
+
Command.execute(*command_args(pre_step)) if pre_step
|
41
|
+
opts = configure_opts && configure_opts[Platform.family]
|
42
|
+
Command.execute(*command_args("./configure #{opts}"))
|
43
|
+
Command.execute(*command_args('make'))
|
44
|
+
report_success
|
45
|
+
report("Please enter you password to run the install step")
|
46
|
+
Command.sudo('echo')
|
47
|
+
report_check 'Installing'
|
48
|
+
Command.sudo(*command_args('make install'))
|
49
|
+
end
|
50
|
+
report_success
|
51
|
+
end
|
52
|
+
true
|
53
|
+
end
|
54
|
+
|
55
|
+
protected
|
56
|
+
|
57
|
+
# Build arguments for Command.execute from command line
|
58
|
+
#
|
59
|
+
# === Arguments
|
60
|
+
# command(String):: Command line to run
|
61
|
+
#
|
62
|
+
# === Return
|
63
|
+
# args(Array):: Array of arguments to be passed to Command.execute
|
64
|
+
def command_args(command)
|
65
|
+
args = command.split(' ').compact
|
66
|
+
args += [ { :abort_on_failure => "Failed to run #{command.rstrip}" } ]
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
|
73
|
+
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# Copyright (C) 2011 RightScale, Inc, All Rights Reserved Worldwide.
|
2
|
+
#
|
3
|
+
# THIS PROGRAM IS CONFIDENTIAL AND PROPRIETARY TO RIGHTSCALE
|
4
|
+
# AND CONSTITUTES A VALUABLE TRADE SECRET. Any unauthorized use,
|
5
|
+
# reproduction, modification, or disclosure of this program is
|
6
|
+
# strictly prohibited. Any use of this program by an authorized
|
7
|
+
# licensee is strictly subject to the terms and conditions,
|
8
|
+
# including confidentiality obligations, set forth in the applicable
|
9
|
+
# License Agreement between RightScale.com, Inc. and
|
10
|
+
# the licensee
|
11
|
+
|
12
|
+
module RightConf
|
13
|
+
|
14
|
+
class ExecuteConfigurator
|
15
|
+
|
16
|
+
include Configurator
|
17
|
+
|
18
|
+
register :execute
|
19
|
+
|
20
|
+
description 'Run arbitraty shell commands'
|
21
|
+
|
22
|
+
settings :command_line => 'Command line to run',
|
23
|
+
:message => 'Progress message to display if any while command is running',
|
24
|
+
:abort_on_failure => 'Message to display when aborting configuration if command fails. ' +
|
25
|
+
'Do not abort if not set'
|
26
|
+
|
27
|
+
validate_has_settings :command_line
|
28
|
+
|
29
|
+
# Run command line
|
30
|
+
#
|
31
|
+
# === Return
|
32
|
+
# true:: Always return true
|
33
|
+
def run
|
34
|
+
report_check message if message
|
35
|
+
args = command_line.split(' ')
|
36
|
+
args += [ { :abort_on_failure => abort_on_failure } ] if abort_on_failure
|
37
|
+
Command.execute(*args)
|
38
|
+
report_success if message
|
39
|
+
true
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
|
@@ -19,38 +19,33 @@ module RightConf
|
|
19
19
|
|
20
20
|
description 'Clone git repository and build if needed'
|
21
21
|
|
22
|
-
settings :repo
|
23
|
-
:
|
24
|
-
:
|
25
|
-
:build_commands => 'Comma separated list of commands to run in repo after clone',
|
26
|
-
:only_if => 'Ruby lambda expression that should return true to proceed ' +
|
27
|
-
'with the cloning / build if defined'
|
22
|
+
settings :repo => 'git repo URL',
|
23
|
+
:path => 'Path where git repo should be cloned to',
|
24
|
+
:tag => 'git tag or branch or sha that should be checked out ("master" by default)'
|
28
25
|
|
29
|
-
validate_has_settings :repo, :
|
26
|
+
validate_has_settings :repo, :path
|
30
27
|
|
31
28
|
# Clone git repo and run build commands if given
|
32
29
|
#
|
33
30
|
# === Return
|
34
31
|
# true:: Always return true
|
35
32
|
def run
|
36
|
-
if
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
post_note "Had to move pre-existing #{install_path} to #{install_path}_old"
|
33
|
+
if File.exist?(path)
|
34
|
+
unless File.exist?(File.join(path, '.git'))
|
35
|
+
FileUtils.mv(path, "#{path}_old")
|
36
|
+
post_note "Had to move #{path} to #{path}_old"
|
41
37
|
end
|
42
|
-
|
43
|
-
|
44
|
-
|
38
|
+
end
|
39
|
+
unless File.exist?(path)
|
40
|
+
report_check("Cloning #{repo} into #{path}")
|
41
|
+
Command.execute('git', 'clone', repo, path,
|
42
|
+
:abort_on_failure => "Failed to clone #{repo} into #{path}")
|
45
43
|
report_success
|
46
|
-
if
|
47
|
-
report_check "
|
48
|
-
Dir.chdir(
|
49
|
-
|
50
|
-
|
51
|
-
args = c.split(' ') + [ { :abort_on_failure => "#{c} failed" } ]
|
52
|
-
Command.execute(*args)
|
53
|
-
end
|
44
|
+
if tag
|
45
|
+
report_check("Checking out #{tag}")
|
46
|
+
Dir.chdir(path) do
|
47
|
+
Command.execute('git', 'checkout', tag,
|
48
|
+
:abort_on_failure => "Failed to checkout #{tag}")
|
54
49
|
end
|
55
50
|
report_success
|
56
51
|
end
|
@@ -58,16 +53,6 @@ module RightConf
|
|
58
53
|
true
|
59
54
|
end
|
60
55
|
|
61
|
-
# Clone on Windows
|
62
|
-
#
|
63
|
-
# === Return
|
64
|
-
# true:: Always return true
|
65
|
-
def run_windows
|
66
|
-
# TBD
|
67
|
-
end
|
68
|
-
|
69
56
|
end
|
70
57
|
end
|
71
58
|
|
72
|
-
|
73
|
-
|
@@ -59,8 +59,8 @@ module RightConf
|
|
59
59
|
end
|
60
60
|
FileUtils.mv(bashrc_path, bashrc_path + '.old')
|
61
61
|
File.open(bashrc_path, 'w') { |f| f.puts content }
|
62
|
+
updated = true
|
62
63
|
end
|
63
|
-
updated = true
|
64
64
|
else
|
65
65
|
report_error "Failed to update bash resource or profile: file not found"
|
66
66
|
end
|
data/lib/rconf/version.rb
CHANGED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Copyright (C) 2011 RightScale, Inc, All Rights Reserved Worldwide.
|
2
|
+
#
|
3
|
+
# THIS PROGRAM IS CONFIDENTIAL AND PROPRIETARY TO RIGHTSCALE
|
4
|
+
# AND CONSTITUTES A VALUABLE TRADE SECRET. Any unauthorized use,
|
5
|
+
# reproduction, modification, or disclosure of this program is
|
6
|
+
# strictly prohibited. Any use of this program by an authorized
|
7
|
+
# licensee is strictly subject to the terms and conditions,
|
8
|
+
# including confidentiality obligations, set forth in the applicable
|
9
|
+
# License Agreement between RightScale.com, Inc. and
|
10
|
+
# the licensee
|
11
|
+
|
12
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
13
|
+
|
14
|
+
describe RightConf::BuildConfigurator do
|
15
|
+
|
16
|
+
before(:each) do
|
17
|
+
lang = RightConf::Language.parse('build { path "../source" }')
|
18
|
+
@configurator = lang.configurators.first
|
19
|
+
[:report_check, :report_result, :report_success].each do |meth|
|
20
|
+
flexmock(@configurator).should_receive(meth)
|
21
|
+
end
|
22
|
+
flexmock(@configurator).should_receive(:report_fatal).and_return { |*args| raise args.join(' ') }
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should build' do
|
26
|
+
flexmock(Dir).should_receive(:chdir).with('../source', Proc).once.and_yield
|
27
|
+
should_execute('./configure', {:abort_on_failure=>"Failed to run ./configure"}).once.ordered
|
28
|
+
should_execute('make', {:abort_on_failure=>"Failed to run make"}).once.ordered
|
29
|
+
should_sudo('echo').once.ordered
|
30
|
+
should_sudo('make', 'install', {:abort_on_failure=>"Failed to run make install"}).once.ordered
|
31
|
+
@configurator.run
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'should honor only_if' do
|
35
|
+
@configurator.instance_eval { only_if('false') }
|
36
|
+
should_execute.and_return { raise "Command should not execute" }
|
37
|
+
@configurator.run
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
@@ -32,23 +32,19 @@ describe RightConf::BundlerConfigurator do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'should succeed when bundler succeeds' do
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
'bundle','_0_', 'install', {:abort_on_failure=>"Failed to install gems"}).and_return(success_result)
|
35
|
+
should_execute_in_ruby('bundle', '--version').once.and_return(success_result('0'))
|
36
|
+
should_execute_in_ruby('bundle','_0_', 'install',
|
37
|
+
{:abort_on_failure=>"Failed to install gems"}).once.and_return(success_result)
|
39
38
|
@configurator.run_linux
|
40
39
|
end
|
41
40
|
|
42
41
|
it 'should install bunlder if needed' do
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
flexmock(RightConf::Command.instance).should_receive(:execute_in_ruby).once.with(
|
50
|
-
'gem', 'install', 'bundler', '-v', '0', '--no-ri', '--no-rdoc',
|
51
|
-
{:abort_on_failure=>"Failed to install bundler"}).once.and_return(success_result)
|
42
|
+
should_execute_in_ruby('bundle', '--version').twice.and_return(success_result('1'))
|
43
|
+
should_execute_in_ruby('bundle','_0_', 'install',
|
44
|
+
{:abort_on_failure=>"Failed to install gems"}).once.and_return(success_result)
|
45
|
+
should_execute_in_ruby('gem', 'uninstall', 'bundler', '-a', '-x').once.and_return(success_result)
|
46
|
+
should_execute_in_ruby('gem', 'install', 'bundler', '-v', '0', '--no-ri', '--no-rdoc',
|
47
|
+
{:abort_on_failure=>"Failed to install bundler"}).once.and_return(success_result)
|
52
48
|
@configurator.run_linux
|
53
49
|
end
|
54
50
|
|
@@ -14,7 +14,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
|
14
14
|
describe RightConf::GitRepoConfigurator do
|
15
15
|
|
16
16
|
before(:each) do
|
17
|
-
lang = RightConf::Language.parse('git_repo { repo "git";
|
17
|
+
lang = RightConf::Language.parse('git_repo { repo "git"; path "./git" }')
|
18
18
|
@configurator = lang.configurators.first
|
19
19
|
[:report_check, :report_result, :report_success].each do |meth|
|
20
20
|
flexmock(@configurator).should_receive(meth)
|
@@ -24,24 +24,34 @@ describe RightConf::GitRepoConfigurator do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'should clone' do
|
27
|
-
|
27
|
+
should_execute('git', 'clone', 'git', './git', @abf).once
|
28
28
|
@configurator.run
|
29
29
|
end
|
30
30
|
|
31
|
-
it '
|
32
|
-
@configurator.instance_eval {
|
33
|
-
|
34
|
-
flexmock(Dir).should_receive(:chdir).with('./git', Proc).
|
35
|
-
|
36
|
-
flexmock(RightConf::Command.instance).should_receive(:execute).with('do', 'two', :abort_on_failure => 'do two failed').once
|
31
|
+
it 'should checkout the right tag' do
|
32
|
+
@configurator.instance_eval { tag('tag') }
|
33
|
+
should_execute('git', 'clone', 'git', './git', @abf).once
|
34
|
+
flexmock(Dir).should_receive(:chdir).with('./git', Proc).and_yield
|
35
|
+
should_execute('git', 'checkout', 'tag', {:abort_on_failure=>"Failed to checkout tag"}).once
|
37
36
|
@configurator.run
|
38
37
|
end
|
39
38
|
|
40
|
-
it 'should
|
41
|
-
|
42
|
-
flexmock(
|
39
|
+
it 'should skip checkout if directory already exists and contains a .git subdirectory' do
|
40
|
+
flexmock(File).should_receive(:exist?).with('./git').twice.and_return(true)
|
41
|
+
flexmock(File).should_receive(:exist?).with('./git/.git').once.and_return(true)
|
42
|
+
should_execute.and_return { raise 'Command.execute should not be called' }
|
43
|
+
@configurator.run
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'should move directory if already exists but not a git repo' do
|
47
|
+
flexmock(File).should_receive(:exist?).with('./git').once.ordered.and_return(true)
|
48
|
+
flexmock(File).should_receive(:exist?).with('./git/.git').once.ordered.and_return(false)
|
49
|
+
flexmock(File).should_receive(:exist?).with('./git').once.ordered.and_return(false)
|
50
|
+
flexmock(FileUtils).should_receive(:mv).once
|
51
|
+
should_execute('git', 'clone', 'git', './git', @abf).once
|
43
52
|
@configurator.run
|
44
53
|
end
|
45
54
|
|
46
55
|
end
|
47
56
|
|
57
|
+
|
@@ -29,53 +29,36 @@ describe RightConf::RubyConfigurator do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'should succeed on linux when rvm succeeds' do
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
flexmock(RightConf::Command.instance).should_receive(:execute).once.with(
|
37
|
-
'rvm', 'use', '0').and_return(success_result('Using '))
|
38
|
-
flexmock(RightConf::Command.instance).should_receive(:execute).once.with(
|
39
|
-
'rvm', '0@', 'gem', '--version').and_return(success_result('1'))
|
32
|
+
should_execute('rvm', '--version').once.and_return(success_result("rvm #{RVM_VERSION}"))
|
33
|
+
should_execute('rvm', 'list').once.and_return(success_result("=> rvm #{RVM_VERSION}"))
|
34
|
+
should_execute('rvm', 'use', '0').once.and_return(success_result('Using '))
|
35
|
+
should_execute('rvm', '0@', 'gem', '--version').once.and_return(success_result('1'))
|
40
36
|
@configurator.run_linux
|
41
37
|
end
|
42
38
|
|
43
39
|
it 'should install rvm if needed' do
|
44
40
|
rvm_tar = "rvm-#{RVM_VERSION}.tar.gz"
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
"http://rvm.beginrescueend.com/releases/#{rvm_tar}",
|
52
|
-
{:abort_on_failure=>"Failed to download rvm #{RVM_VERSION}"}).and_return(success_result)
|
53
|
-
flexmock(RightConf::Command.instance).should_receive(:execute).once.with(
|
54
|
-
'tar', 'zxf', rvm_tar,
|
55
|
-
{:abort_on_failure=>"Failed to extract rvm tgz from #{File.expand_path(File.join(File.dirname(__FILE__), '..', '..', "rvm-#{RVM_VERSION}.tar.gz"))}"}).and_return(success_result)
|
41
|
+
should_execute('rvm', '--version').once.and_return(success_result("rvm"))
|
42
|
+
should_execute('rvm', 'list').once.and_return(success_result("=> rvm #{RVM_VERSION}"))
|
43
|
+
should_execute('curl', '-O', '-f', "http://rvm.beginrescueend.com/releases/#{rvm_tar}",
|
44
|
+
{:abort_on_failure=>"Failed to download rvm #{RVM_VERSION}"}).once.and_return(success_result)
|
45
|
+
should_execute('tar', 'zxf', rvm_tar,
|
46
|
+
{:abort_on_failure=>"Failed to extract rvm tgz from #{File.expand_path(File.join(File.dirname(__FILE__), '..', '..', "rvm-#{RVM_VERSION}.tar.gz"))}"}).once.and_return(success_result)
|
56
47
|
flexmock(Dir).should_receive(:chdir).and_yield
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
'rvm', 'use', '0').and_return(success_result('Using '))
|
61
|
-
flexmock(RightConf::Command.instance).should_receive(:execute).once.with(
|
62
|
-
'rvm', '0@', 'gem', '--version').and_return(success_result('1'))
|
48
|
+
should_execute('./install', {:abort_on_failure=>"Failed to install rvm #{RVM_VERSION}"}).once.and_return(success_result)
|
49
|
+
should_execute('rvm', 'use', '0').once.and_return(success_result('Using '))
|
50
|
+
should_execute('rvm', '0@', 'gem', '--version').once.and_return(success_result('1'))
|
63
51
|
flexmock(@configurator).should_receive(:setup_bashrc).once.and_return(true)
|
64
52
|
@configurator.run_linux
|
65
53
|
end
|
66
54
|
|
67
55
|
it 'should install rubygems if needed' do
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
'
|
74
|
-
flexmock(RightConf::Command.instance).should_receive(:execute).once.with(
|
75
|
-
'rvm', '0@', 'gem', '--version').and_return(success_result('0'))
|
76
|
-
flexmock(RightConf::Command.instance).should_receive(:execute).once.with(
|
77
|
-
'rvm', '0@', 'rubygems', '1',
|
78
|
-
{:abort_on_failure=>'Failed to install rubygems'}).and_return(success_result)
|
56
|
+
should_execute('rvm', '--version').once.and_return(success_result("rvm #{RVM_VERSION}"))
|
57
|
+
should_execute('rvm', 'list').once.and_return(success_result("=> rvm #{RVM_VERSION}"))
|
58
|
+
should_execute('rvm', 'use', '0').once.and_return(success_result('Using '))
|
59
|
+
should_execute('rvm', '0@', 'gem', '--version').once.and_return(success_result('0'))
|
60
|
+
should_execute('rvm', '0@', 'rubygems', '1',
|
61
|
+
{:abort_on_failure=>'Failed to install rubygems'}).once.and_return(success_result)
|
79
62
|
@configurator.run_linux
|
80
63
|
end
|
81
64
|
|
data/spec/spec_helper.rb
CHANGED
@@ -19,3 +19,36 @@ RSpec.configure do |c|
|
|
19
19
|
c.mock_with(:flexmock)
|
20
20
|
end
|
21
21
|
|
22
|
+
# Helper method to mock Command.execute
|
23
|
+
#
|
24
|
+
# === Parameters
|
25
|
+
# Parameters are passed through to flexmock 'with' method
|
26
|
+
#
|
27
|
+
# === Return
|
28
|
+
# mock(Flexmock):: Corresponding flexmock instance
|
29
|
+
def should_execute(*with)
|
30
|
+
mock = flexmock(RightConf::Command.instance).should_receive(:execute).with(*with)
|
31
|
+
end
|
32
|
+
|
33
|
+
# Helper method to mock Command.execute_in_ruby
|
34
|
+
#
|
35
|
+
# === Parameters
|
36
|
+
# Parameters are passed through to flexmock 'with' method
|
37
|
+
#
|
38
|
+
# === Return
|
39
|
+
# mock(Flexmock):: Corresponding flexmock instance
|
40
|
+
def should_execute_in_ruby(*with)
|
41
|
+
mock = flexmock(RightConf::Command.instance).should_receive(:execute_in_ruby).with(*with)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Helper method to mock Command.sudo
|
45
|
+
#
|
46
|
+
# === Parameters
|
47
|
+
# Parameters are passed through to flexmock 'with' method
|
48
|
+
#
|
49
|
+
# === Return
|
50
|
+
# mock(Flexmock):: Corresponding flexmock instance
|
51
|
+
def should_sudo(*with)
|
52
|
+
mock = flexmock(RightConf::Command.instance).should_receive(:sudo).with(*with)
|
53
|
+
end
|
54
|
+
|
@@ -26,25 +26,21 @@ describe RightConf::PackageInstaller do
|
|
26
26
|
it 'should install packages on Ubuntu' do
|
27
27
|
flexmock(RightConf::Platform.instance).should_receive(:family).and_return(:linux)
|
28
28
|
flexmock(RightConf::Platform.instance).should_receive(:flavor).and_return('ubuntu')
|
29
|
-
|
30
|
-
'apt-get', 'install', '-y', 'deb1', 'deb2').and_return(success_result)
|
29
|
+
should_sudo('apt-get', 'install', '-y', 'deb1', 'deb2').once.and_return(success_result)
|
31
30
|
RightConf::PackageInstaller.install(['deb1', 'deb2'])
|
32
31
|
end
|
33
32
|
|
34
33
|
it 'should install packages on Centos' do
|
35
34
|
flexmock(RightConf::Platform.instance).should_receive(:family).and_return(:linux)
|
36
35
|
flexmock(RightConf::Platform.instance).should_receive(:flavor).and_return('centos')
|
37
|
-
|
38
|
-
'yum', 'install', '-y', 'cent1', 'cent2').and_return(success_result)
|
36
|
+
should_sudo('yum', 'install', '-y', 'cent1', 'cent2').once.and_return(success_result)
|
39
37
|
RightConf::PackageInstaller.install(['cent1', 'cent2'])
|
40
38
|
end
|
41
39
|
|
42
40
|
it 'should install packages on Darwin' do
|
43
41
|
flexmock(RightConf::Platform.instance).should_receive(:family).and_return(:darwin)
|
44
|
-
|
45
|
-
|
46
|
-
flexmock(RightConf::Command.instance).should_receive(:execute).once.with(
|
47
|
-
'brew', 'install', 'mac2').and_return(success_result)
|
42
|
+
should_execute('brew', 'install', 'mac1').once.and_return(success_result)
|
43
|
+
should_execute('brew', 'install', 'mac2').once.and_return(success_result)
|
48
44
|
RightConf::PackageInstaller.install(['mac1', 'mac2'])
|
49
45
|
end
|
50
46
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: rconf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.7.
|
5
|
+
version: 0.7.8
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Raphael Simon
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-03-
|
13
|
+
date: 2011-03-31 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -74,8 +74,10 @@ files:
|
|
74
74
|
- lib/rconf/command.rb
|
75
75
|
- lib/rconf/configurator.rb
|
76
76
|
- lib/rconf/configurator_registry.rb
|
77
|
+
- lib/rconf/configurators/build_configurator.rb
|
77
78
|
- lib/rconf/configurators/bundler_configurator.rb
|
78
79
|
- lib/rconf/configurators/cassandra_configurator.rb
|
80
|
+
- lib/rconf/configurators/execute_configurator.rb
|
79
81
|
- lib/rconf/configurators/git_repo_configurator.rb
|
80
82
|
- lib/rconf/configurators/mercurial_configurator.rb
|
81
83
|
- lib/rconf/configurators/packages_configurator.rb
|
@@ -101,6 +103,7 @@ files:
|
|
101
103
|
- rconf.rconf
|
102
104
|
- spec/command_spec.rb
|
103
105
|
- spec/configurator_spec.rb
|
106
|
+
- spec/configurators/build_configurator_spec.rb
|
104
107
|
- spec/configurators/bundler_configurator_spec.rb
|
105
108
|
- spec/configurators/git_repo_configurator_spec.rb
|
106
109
|
- spec/configurators/packages_configurator_spec.rb
|
@@ -146,6 +149,7 @@ summary: Cross platform environment configuration
|
|
146
149
|
test_files:
|
147
150
|
- spec/command_spec.rb
|
148
151
|
- spec/configurator_spec.rb
|
152
|
+
- spec/configurators/build_configurator_spec.rb
|
149
153
|
- spec/configurators/bundler_configurator_spec.rb
|
150
154
|
- spec/configurators/git_repo_configurator_spec.rb
|
151
155
|
- spec/configurators/packages_configurator_spec.rb
|