r10k 1.3.5 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +1 -1
  3. data/CHANGELOG.mkd +210 -0
  4. data/CONTRIBUTING.mkd +105 -0
  5. data/Gemfile +2 -6
  6. data/README.mkd +97 -0
  7. data/doc/common-patterns.mkd +44 -0
  8. data/doc/dynamic-environments.mkd +12 -5
  9. data/doc/dynamic-environments/configuration.mkd +16 -1
  10. data/doc/dynamic-environments/{git-environments.markdown → git-environments.mkd} +13 -9
  11. data/doc/dynamic-environments/introduction.mkd +1 -2
  12. data/doc/dynamic-environments/master-configuration.mkd +70 -0
  13. data/doc/dynamic-environments/quickstart.mkd +241 -0
  14. data/doc/dynamic-environments/svn-environments.mkd +45 -0
  15. data/doc/dynamic-environments/usage.mkd +44 -5
  16. data/doc/dynamic-environments/workflow-guide.mkd +247 -0
  17. data/doc/faq.mkd +52 -0
  18. data/doc/puppetfile.mkd +203 -0
  19. data/lib/r10k/action/cri_runner.rb +75 -0
  20. data/lib/r10k/action/deploy.rb +9 -0
  21. data/lib/r10k/action/deploy/display.rb +104 -0
  22. data/lib/r10k/action/deploy/environment.rb +92 -0
  23. data/lib/r10k/action/deploy/module.rb +70 -0
  24. data/lib/r10k/action/puppetfile.rb +10 -0
  25. data/lib/r10k/action/puppetfile/check.rb +41 -0
  26. data/lib/r10k/action/puppetfile/cri_runner.rb +32 -0
  27. data/lib/r10k/action/puppetfile/install.rb +53 -0
  28. data/lib/r10k/action/puppetfile/purge.rb +37 -0
  29. data/lib/r10k/action/runner.rb +36 -0
  30. data/lib/r10k/action/visitor.rb +31 -0
  31. data/lib/r10k/cli/deploy.rb +14 -45
  32. data/lib/r10k/cli/puppetfile.rb +15 -53
  33. data/lib/r10k/deployment.rb +113 -58
  34. data/lib/r10k/deployment/basedir.rb +3 -38
  35. data/lib/r10k/deployment/config.rb +2 -1
  36. data/lib/r10k/deployment/source.rb +2 -0
  37. data/lib/r10k/environment/base.rb +40 -0
  38. data/lib/r10k/environment/git.rb +14 -17
  39. data/lib/r10k/environment/svn.rb +31 -15
  40. data/lib/r10k/errors.rb +33 -22
  41. data/lib/r10k/errors/formatting.rb +28 -0
  42. data/lib/r10k/execution.rb +2 -0
  43. data/lib/r10k/git/cache.rb +1 -6
  44. data/lib/r10k/git/errors.rb +1 -2
  45. data/lib/r10k/git/ref.rb +1 -1
  46. data/lib/r10k/module.rb +1 -1
  47. data/lib/r10k/module/base.rb +94 -2
  48. data/lib/r10k/module/forge.rb +33 -30
  49. data/lib/r10k/module/git.rb +13 -9
  50. data/lib/r10k/module/svn.rb +41 -28
  51. data/lib/r10k/puppetfile.rb +17 -1
  52. data/lib/r10k/semver.rb +2 -0
  53. data/lib/r10k/source/base.rb +8 -0
  54. data/lib/r10k/source/git.rb +1 -1
  55. data/lib/r10k/source/svn.rb +23 -5
  56. data/lib/r10k/svn/remote.rb +23 -3
  57. data/lib/r10k/svn/working_dir.rb +60 -9
  58. data/lib/r10k/task.rb +1 -0
  59. data/lib/r10k/task/deployment.rb +9 -1
  60. data/lib/r10k/task/environment.rb +2 -0
  61. data/lib/r10k/task/module.rb +1 -0
  62. data/lib/r10k/task/puppetfile.rb +3 -0
  63. data/lib/r10k/task_runner.rb +1 -0
  64. data/lib/r10k/util/attempt.rb +84 -0
  65. data/lib/r10k/util/basedir.rb +65 -0
  66. data/lib/r10k/util/purgeable.rb +55 -45
  67. data/lib/r10k/util/setopts.rb +53 -0
  68. data/lib/r10k/util/subprocess.rb +6 -30
  69. data/lib/r10k/util/subprocess/posix/runner.rb +29 -2
  70. data/lib/r10k/util/subprocess/result.rb +17 -4
  71. data/lib/r10k/util/subprocess/subprocess_error.rb +24 -0
  72. data/lib/r10k/version.rb +1 -1
  73. data/r10k.gemspec +7 -29
  74. data/spec/fixtures/unit/puppetfile/invalid-syntax/Puppetfile +1 -0
  75. data/spec/fixtures/unit/puppetfile/load-error/Puppetfile +1 -0
  76. data/spec/matchers/exit_with.rb +28 -0
  77. data/spec/r10k-mocks.rb +3 -0
  78. data/spec/r10k-mocks/mock_config.rb +28 -0
  79. data/spec/r10k-mocks/mock_env.rb +7 -0
  80. data/spec/r10k-mocks/mock_source.rb +10 -0
  81. data/spec/shared-examples/git-ref.rb +7 -7
  82. data/spec/spec_helper.rb +17 -5
  83. data/spec/unit/action/cri_runner_spec.rb +76 -0
  84. data/spec/unit/action/puppetfile/cri_action_spec.rb +65 -0
  85. data/spec/unit/action/runner_spec.rb +64 -0
  86. data/spec/unit/action/visitor_spec.rb +39 -0
  87. data/spec/unit/deployment_spec.rb +142 -0
  88. data/spec/unit/environment/base_spec.rb +38 -0
  89. data/spec/unit/environment/git_spec.rb +40 -10
  90. data/spec/unit/environment/svn_spec.rb +41 -4
  91. data/spec/unit/errors/formatting_spec.rb +84 -0
  92. data/spec/unit/git/alternates_spec.rb +1 -1
  93. data/spec/unit/git/head_spec.rb +1 -1
  94. data/spec/unit/git/ref_spec.rb +1 -1
  95. data/spec/unit/git/working_dir_spec.rb +1 -1
  96. data/spec/unit/module/base_spec.rb +72 -0
  97. data/spec/unit/module/forge_spec.rb +49 -8
  98. data/spec/unit/module/git_spec.rb +78 -0
  99. data/spec/unit/module/svn_spec.rb +40 -4
  100. data/spec/unit/module_spec.rb +3 -3
  101. data/spec/unit/puppetfile_spec.rb +84 -0
  102. data/spec/unit/settings/container_spec.rb +1 -1
  103. data/spec/unit/source/base_spec.rb +31 -0
  104. data/spec/unit/source/git_spec.rb +7 -7
  105. data/spec/unit/source/svn_spec.rb +1 -1
  106. data/spec/unit/svn/working_dir_spec.rb +56 -0
  107. data/spec/unit/util/attempt_spec.rb +82 -0
  108. data/spec/unit/util/setopts_spec.rb +59 -0
  109. data/spec/unit/util/subprocess/result_spec.rb +36 -0
  110. data/spec/unit/util/subprocess/subprocess_error_spec.rb +26 -0
  111. data/spec/unit/util/subprocess_spec.rb +2 -7
  112. metadata +83 -100
  113. data/.nodeset.yml +0 -7
  114. data/.rspec +0 -1
  115. data/README.markdown +0 -276
  116. data/Rakefile +0 -1
  117. data/doc/puppetfile.markdown +0 -87
  118. data/spec/rspec-system-r10k/puppetfile.rb +0 -24
  119. data/spec/rspec-system-r10k/tmpdir.rb +0 -32
  120. data/spec/system-provisioning/el.rb +0 -38
  121. data/spec/system/module/forge/install_spec.rb +0 -51
  122. data/spec/system/module/git/install_spec.rb +0 -117
  123. data/spec/system/module/svn/install_spec.rb +0 -51
  124. data/spec/system/module/svn/update_spec.rb +0 -38
  125. data/spec/system/spec_helper.rb +0 -60
  126. data/spec/system/system-helpers.rb +0 -4
  127. data/spec/system/version_spec.rb +0 -7
@@ -0,0 +1,53 @@
1
+ module R10K
2
+ module Util
3
+
4
+ # Allow for easy setting of instance options based on a hash
5
+ #
6
+ # This emulates the behavior of Ruby 2.0 named arguments, but since r10k
7
+ # supports Ruby 1.8.7+ we cannot use that functionality.
8
+ module Setopts
9
+
10
+ private
11
+
12
+ # @param opts [Hash]
13
+ # @param allowed [Hash<Symbol, Symbol>]
14
+ #
15
+ # @example
16
+ # opts = {:one => "one value"}
17
+ # allowed => {:one => :self}
18
+ # setopts(opts, allowed)
19
+ # @one # => "one value"
20
+ #
21
+ # @example
22
+ # opts = {:uno => "one value"}
23
+ # allowed => {:one => :one, :uno => :one}
24
+ # setopts(opts, allowed)
25
+ # @one # => "one value"
26
+ #
27
+ # @example
28
+ #
29
+ # opts = {:trace => "something"}
30
+ # allowed = {:trace => nil}
31
+ # setopts(opts, allowed)
32
+ # @trace # => nil
33
+ #
34
+ def setopts(opts, allowed)
35
+ opts.each_pair do |key, value|
36
+ if allowed.key?(key)
37
+ rhs = allowed[key]
38
+ case rhs
39
+ when NilClass, FalseClass
40
+ # Ignore nil options
41
+ when :self, TrueClass
42
+ instance_variable_set("@#{key}".to_sym, value)
43
+ else
44
+ instance_variable_set("@#{rhs}".to_sym, value)
45
+ end
46
+ else
47
+ raise ArgumentError, "#{self.class.name} cannot handle option '#{key}'"
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -1,4 +1,3 @@
1
- require 'r10k/errors'
2
1
  require 'r10k/util/platform'
3
2
 
4
3
  module R10K
@@ -14,6 +13,7 @@ module R10K
14
13
  require 'r10k/util/subprocess/runner'
15
14
  require 'r10k/util/subprocess/io'
16
15
  require 'r10k/util/subprocess/result'
16
+ require 'r10k/util/subprocess/subprocess_error'
17
17
 
18
18
  require 'r10k/util/subprocess/posix'
19
19
  require 'r10k/util/subprocess/windows'
@@ -68,43 +68,19 @@ module R10K
68
68
  subprocess = self.class.runner.new(@argv)
69
69
  subprocess.cwd = @cwd if @cwd
70
70
 
71
- logmsg = "Execute: #{@argv.join(' ')}"
71
+ logmsg = "Starting process: #{@argv.inspect}"
72
72
  logmsg << "(cwd: #{@cwd})" if @cwd
73
- logger.debug1 logmsg
73
+ logger.debug2(logmsg)
74
74
 
75
- subprocess.run
76
-
77
- result = subprocess.result
78
-
79
- logger.debug2 "[#{result.cmd}] STDOUT: #{result.stdout.chomp}" unless result.stdout.empty?
80
- logger.debug2 "[#{result.cmd}] STDERR: #{result.stderr.chomp}" unless result.stderr.empty?
75
+ result = subprocess.run
76
+ logger.debug2("Finished process:\n#{result.format}")
81
77
 
82
78
  if @raise_on_fail and subprocess.crashed?
83
- raise SubprocessError.new(:result => result)
79
+ raise SubprocessError.new("Command exited with non-zero exit code", :result => result)
84
80
  end
85
81
 
86
82
  result
87
83
  end
88
-
89
- class SubprocessError < R10KError
90
-
91
- # !@attribute [r] result
92
- # @return [R10K::Util::Subprocess::Result]
93
- attr_reader :result
94
-
95
- def initialize(mesg = nil, options = {})
96
- super
97
- @result = @options[:result]
98
- end
99
-
100
- def to_s
101
- if @mesg
102
- @mesg
103
- else
104
- "Command #{@result.cmd} exited with #{@result.exit_code}: #{@result.stderr}"
105
- end
106
- end
107
- end
108
84
  end
109
85
  end
110
86
  end
@@ -39,8 +39,14 @@ class R10K::Util::Subprocess::POSIX::Runner < R10K::Util::Subprocess::Runner
39
39
  end
40
40
 
41
41
  stdout = @stdout_r.read
42
- stderr = @stderr_r.read
43
-
42
+ # Use non-blocking read for stderr_r to work around an issue with OpenSSH
43
+ # ControlPersist: https://bugzilla.mindrot.org/show_bug.cgi?id=1988
44
+ # Blocking should not occur in any other case since the process that was
45
+ # attached to the pipe has already terminated.
46
+ stderr = read_nonblock(@stderr_r)
47
+
48
+ @stdout_r.close
49
+ @stderr_r.close
44
50
  @result = R10K::Util::Subprocess::Result.new(@argv, stdout, stderr, @status.exitstatus)
45
51
  end
46
52
 
@@ -88,6 +94,7 @@ class R10K::Util::Subprocess::POSIX::Runner < R10K::Util::Subprocess::Runner
88
94
  msg = exec_r.read || "exec() failed"
89
95
  raise "Could not execute #{@argv.join(' ')}: #{msg}"
90
96
  end
97
+ exec_r.close
91
98
  end
92
99
 
93
100
  # Create a pipe so that the parent can verify that the child process
@@ -107,7 +114,27 @@ class R10K::Util::Subprocess::POSIX::Runner < R10K::Util::Subprocess::Runner
107
114
  @stdout_r, @stdout_w = ::IO.pipe
108
115
  @stderr_r, @stderr_w = ::IO.pipe
109
116
 
117
+ @stdout_r.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
118
+ @stdout_w.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
119
+ @stderr_r.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
120
+ @stderr_w.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
121
+
110
122
  @io.stdout = @stdout_w
111
123
  @io.stderr = @stderr_w
112
124
  end
125
+
126
+ # Perform non-blocking reads on a pipe that could still be open
127
+ # Give up on reaching EOF or blocking and return what was read
128
+ def read_nonblock(rd_io)
129
+ data = ''
130
+ begin
131
+ # Loop until EOF or blocking
132
+ loop do
133
+ # do an 8k non-blocking read and append the result
134
+ data << rd_io.read_nonblock(8192)
135
+ end
136
+ rescue EOFError, Errno::EAGAIN, Errno::EWOULDBLOCK
137
+ end
138
+ data
139
+ end
113
140
  end
@@ -24,13 +24,26 @@ class R10K::Util::Subprocess::Result
24
24
  def initialize(argv, stdout, stderr, exit_code)
25
25
  @argv = argv
26
26
  @cmd = argv.join(' ')
27
- @stdout = stdout
28
- @stderr = stderr
27
+ @stdout = stdout.chomp
28
+ @stderr = stderr.chomp
29
29
  @exit_code = exit_code
30
30
  end
31
31
 
32
- def [](field)
33
- send(field)
32
+ def format(with_cmd = true)
33
+ msg = []
34
+ if with_cmd
35
+ msg << "Command: #{@cmd}"
36
+ end
37
+ if !@stdout.empty?
38
+ msg << "Stdout:"
39
+ msg << @stdout
40
+ end
41
+ if !@stderr.empty?
42
+ msg << "Stderr:"
43
+ msg << @stderr
44
+ end
45
+ msg << "Exit code: #{@exit_code}"
46
+ msg.join("\n")
34
47
  end
35
48
 
36
49
  def failed?
@@ -0,0 +1,24 @@
1
+ require 'r10k/errors'
2
+ require 'r10k/util/subprocess'
3
+ require 'r10k/util/setopts'
4
+
5
+ class R10K::Util::Subprocess::SubprocessError < R10K::Error
6
+
7
+ # !@attribute [r] result
8
+ # @return [R10K::Util::Subprocess::Result]
9
+ attr_reader :result
10
+
11
+ include R10K::Util::Setopts
12
+
13
+ def initialize(mesg, options = {})
14
+ super
15
+ setopts(options, {:result => true})
16
+ end
17
+
18
+ def message
19
+ msg = []
20
+ msg << "#{super}:"
21
+ msg << @result.format
22
+ msg.join("\n")
23
+ end
24
+ end
@@ -1,3 +1,3 @@
1
1
  module R10K
2
- VERSION = '1.3.5'
2
+ VERSION = '1.4.0'
3
3
  end
@@ -18,23 +18,23 @@ Gem::Specification.new do |s|
18
18
  dynamic environments.
19
19
  DESCRIPTION
20
20
 
21
- s.license = 'Apache 2.0'
21
+ s.license = 'Apache-2.0'
22
22
 
23
- s.add_dependency 'colored', '>= 1.2'
24
- s.add_dependency 'cri', '~> 2.5.0'
23
+ s.add_dependency 'colored', '1.2'
24
+ s.add_dependency 'cri', '~> 2.6.1'
25
25
 
26
26
  s.add_dependency 'systemu', '~> 2.5.2'
27
27
 
28
- s.add_dependency 'log4r', '>= 1.1.10'
28
+ s.add_dependency 'log4r', '1.1.10'
29
29
  s.add_dependency 'multi_json', '~> 1.8.2'
30
- s.add_dependency 'json_pure', '~> 1.8.1'
30
+ s.add_dependency 'json_pure', '~> 1.8'
31
31
 
32
32
  s.add_dependency 'faraday', '~> 0.8.8'
33
33
  s.add_dependency 'faraday_middleware', '~> 0.9.0'
34
34
  s.add_dependency 'faraday_middleware-multi_json', '~> 0.0.5'
35
35
 
36
- s.add_development_dependency 'rspec', '~> 2.14.0'
37
- s.add_development_dependency 'vcr', '~> 2.8.0'
36
+ s.add_development_dependency 'rspec', '~> 3.1'
37
+ s.add_development_dependency 'vcr', '~> 2.9'
38
38
 
39
39
  s.add_development_dependency 'yard', '~> 0.8.7.3'
40
40
 
@@ -44,26 +44,4 @@ Gem::Specification.new do |s|
44
44
  s.executables = 'r10k'
45
45
 
46
46
  s.test_files = Dir.glob("spec/**/*_spec.rb")
47
-
48
- s.post_install_message = <<-EOD.gsub(/^ {4}/, '')
49
- NOTICE
50
- ======
51
-
52
- If you are upgrading from 1.1.0 and are using multiple sources, please read
53
- this. (If not, feel free to continue with your regularly scheduled day.)
54
-
55
- GH-48 (https://github.com/adrienthebo/r10k/issues/48) introduced the ability
56
- for environments to be prefixed with the source name so that multiple sources
57
- installed into the same directory would not overwrite each other. However
58
- prefixing was automatically enabled and would break existing setups where
59
- multiple sources were cloned into different directories.
60
-
61
- Because this introduced a breaking change, SemVer dictates that the automatic
62
- prefixing has to be rolled back. Prefixing can be enabled but always defaults
63
- to off. If you are relying on this behavior you will need to update your r10k.yaml
64
- to enable prefixing on a per-source basis.
65
-
66
- Please see the issue (https://github.com/adrienthebo/r10k/issues/48) for more
67
- information.
68
- EOD
69
47
  end
@@ -0,0 +1 @@
1
+ mod 'branan/eight_hundred' :git => 'https://github.com/branan/eight_hundred'
@@ -0,0 +1 @@
1
+ require 'a-shrubbery!'
@@ -0,0 +1,28 @@
1
+ RSpec::Matchers.define :exit_with do |expected|
2
+
3
+ supports_block_expectations
4
+
5
+ match do |block|
6
+ actual = nil
7
+ begin
8
+ block.call
9
+ rescue SystemExit => e
10
+ actual = e.status
11
+ end
12
+ actual and actual == expected
13
+ end
14
+
15
+ failure_message do |actual|
16
+ "expected exit with code #{expected} but " +
17
+ (actual.nil? ? " exit was not called" : "we exited with #{actual} instead")
18
+ end
19
+
20
+ failure_message_when_negated do |actual|
21
+ "expected that exit would not be called with #{expected}"
22
+ end
23
+
24
+ description do
25
+ "expect exit with #{expected}"
26
+ end
27
+ end
28
+
@@ -0,0 +1,3 @@
1
+ require 'r10k-mocks/mock_env'
2
+ require 'r10k-mocks/mock_source'
3
+ require 'r10k-mocks/mock_config'
@@ -0,0 +1,28 @@
1
+ require 'r10k/deployment/config'
2
+
3
+ module R10K
4
+ class Deployment
5
+ class MockConfig
6
+ def initialize(hash)
7
+ @hash = hash
8
+ end
9
+
10
+ # Perform a scan for key and check for both string and symbol keys
11
+ def setting(key)
12
+ keys = [key]
13
+ case key
14
+ when String
15
+ keys << key.to_sym
16
+ when Symbol
17
+ keys << key.to_s
18
+ end
19
+
20
+ # Scan all possible keys to see if the config has a matching value
21
+ keys.inject(nil) do |rv, k|
22
+ v = @hash[k]
23
+ break v unless v.nil?
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,7 @@
1
+ require 'r10k/environment'
2
+
3
+ class R10K::Environment::Mock < R10K::Environment::Base
4
+ def sync
5
+ "synced"
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ require 'r10k/source'
2
+ require 'r10k-mocks/mock_env'
3
+
4
+ class R10K::Source::Mock < R10K::Source::Base
5
+ R10K::Source.register(:mock, self)
6
+
7
+ def environments
8
+ @options[:environments].map { |n| R10K::Environment::Mock.new(n, @basedir, n) }
9
+ end
10
+ end
@@ -6,30 +6,30 @@ shared_examples_for "a git ref" do
6
6
  end
7
7
 
8
8
  describe "comparing to another object" do
9
- let(:other) { double('equal') }
9
+ let(:other) { R10K::Git::Ref.new('double') }
10
10
 
11
11
  it "is true if the resolved SHA1s match" do
12
12
  expect(other).to receive(:sha1).and_return 'fcf6140cf3e0b3738583167702176867833ec2a7'
13
13
  expect(subject).to receive(:sha1).and_return 'fcf6140cf3e0b3738583167702176867833ec2a7'
14
- expect(subject == other).to be_true
14
+ expect(subject == other).to be_truthy
15
15
  end
16
16
 
17
17
  it "is false if the resolved SHA1s don't match" do
18
18
  expect(other).to receive(:sha1).and_return '57d31c788610d7d6a1c139b4ffff0d60888ca742'
19
19
  expect(subject).to receive(:sha1).and_return 'fcf6140cf3e0b3738583167702176867833ec2a7'
20
- expect(subject == other).to be_false
20
+ expect(subject == other).to be_falsey
21
21
  end
22
22
 
23
23
  it "is false if an argumenterror is raised while comparing the SHA1s" do
24
24
  expect(other).to receive(:sha1).and_return 'fcf6140cf3e0b3738583167702176867833ec2a7'
25
25
  expect(subject).to receive(:sha1).and_raise(ArgumentError, "Cannot resolve")
26
- expect(subject == other).to be_false
26
+ expect(subject == other).to be_falsey
27
27
  end
28
28
 
29
29
  it "is false if a nonexistenthasherror is raised while comparing the SHA1s" do
30
30
  expect(other).to receive(:sha1).and_return 'fcf6140cf3e0b3738583167702176867833ec2a7'
31
31
  expect(subject).to receive(:sha1).and_raise(R10K::Git::UnresolvableRefError, :ref => "hash")
32
- expect(subject == other).to be_false
32
+ expect(subject == other).to be_falsey
33
33
  end
34
34
  end
35
35
  end
@@ -38,12 +38,12 @@ shared_examples_for "an immutable git ref" do
38
38
  describe "determining if the ref needs to be fetched" do
39
39
  it "is false when the ref can be resolved" do
40
40
  expect(subject).to receive(:resolvable?).and_return true
41
- expect(subject.fetch?).to be_false
41
+ expect(subject.fetch?).to be_falsey
42
42
  end
43
43
 
44
44
  it "is true when the ref cannot be resolved" do
45
45
  expect(subject).to receive(:resolvable?).and_return false
46
- expect(subject.fetch?).to be_true
46
+ expect(subject.fetch?).to be_truthy
47
47
  end
48
48
  end
49
49
  end
@@ -1,6 +1,21 @@
1
+ if ENV['COVERAGE']
2
+ require 'simplecov'
3
+ SimpleCov.start do
4
+ add_filter do |src|
5
+ !src.filename.match(%r[lib/r10k])
6
+ end
7
+
8
+ %w[Deployment Source Environment Module Git SVN Action Util].each do |group|
9
+ add_group group, "lib/r10k/#{group.downcase}"
10
+ end
11
+ end
12
+ end
13
+
1
14
  require 'r10k'
2
15
 
3
16
  require 'shared-examples/git-ref'
17
+ require 'matchers/exit_with'
18
+ require 'r10k-mocks'
4
19
 
5
20
  PROJECT_ROOT = File.expand_path('..', File.dirname(__FILE__))
6
21
 
@@ -16,12 +31,9 @@ RSpec.configure do |config|
16
31
  #
17
32
  # To run integration tests, run `rspec --tag integration`
18
33
  config.filter_run_excluding :integration => true
19
- end
20
34
 
21
- shared_context 'stub logging' do
22
- before do
23
- log = double('stub logger').as_null_object
24
- allow_any_instance_of(described_class).to receive(:logger).and_return log
35
+ config.before(:all) do
36
+ Log4r::Logger.global.level = 10
25
37
  end
26
38
  end
27
39