librarian-puppet-lmco 0.9.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +5 -0
  3. data/LICENSE +20 -0
  4. data/README.md +187 -0
  5. data/bin/librarian-puppet +9 -0
  6. data/lib/librarian/puppet.rb +22 -0
  7. data/lib/librarian/puppet/cli.rb +85 -0
  8. data/lib/librarian/puppet/dsl.rb +16 -0
  9. data/lib/librarian/puppet/environment.rb +54 -0
  10. data/lib/librarian/puppet/extension.rb +47 -0
  11. data/lib/librarian/puppet/lockfile/parser.rb +53 -0
  12. data/lib/librarian/puppet/source.rb +4 -0
  13. data/lib/librarian/puppet/source/forge.rb +348 -0
  14. data/lib/librarian/puppet/source/git.rb +121 -0
  15. data/lib/librarian/puppet/source/githubtarball.rb +249 -0
  16. data/lib/librarian/puppet/source/local.rb +57 -0
  17. data/lib/librarian/puppet/source/path.rb +12 -0
  18. data/lib/librarian/puppet/templates/Puppetfile +10 -0
  19. data/lib/librarian/puppet/version.rb +5 -0
  20. data/vendor/librarian/CHANGELOG.md +224 -0
  21. data/vendor/librarian/Gemfile +6 -0
  22. data/vendor/librarian/MIT-LICENSE +20 -0
  23. data/vendor/librarian/README.md +401 -0
  24. data/vendor/librarian/Rakefile +34 -0
  25. data/vendor/librarian/bin/librarian-chef +7 -0
  26. data/vendor/librarian/bin/librarian-mock +7 -0
  27. data/vendor/librarian/config/cucumber.yaml +1 -0
  28. data/vendor/librarian/features/chef/cli/init.feature +11 -0
  29. data/vendor/librarian/features/chef/cli/install.feature +64 -0
  30. data/vendor/librarian/features/chef/cli/show.feature +77 -0
  31. data/vendor/librarian/features/chef/cli/version.feature +11 -0
  32. data/vendor/librarian/features/support/env.rb +9 -0
  33. data/vendor/librarian/lib/librarian.rb +11 -0
  34. data/vendor/librarian/lib/librarian/action.rb +5 -0
  35. data/vendor/librarian/lib/librarian/action/base.rb +24 -0
  36. data/vendor/librarian/lib/librarian/action/clean.rb +44 -0
  37. data/vendor/librarian/lib/librarian/action/ensure.rb +24 -0
  38. data/vendor/librarian/lib/librarian/action/install.rb +95 -0
  39. data/vendor/librarian/lib/librarian/action/persist_resolution_mixin.rb +51 -0
  40. data/vendor/librarian/lib/librarian/action/resolve.rb +46 -0
  41. data/vendor/librarian/lib/librarian/action/update.rb +44 -0
  42. data/vendor/librarian/lib/librarian/chef.rb +1 -0
  43. data/vendor/librarian/lib/librarian/chef/cli.rb +47 -0
  44. data/vendor/librarian/lib/librarian/chef/dsl.rb +16 -0
  45. data/vendor/librarian/lib/librarian/chef/environment.rb +27 -0
  46. data/vendor/librarian/lib/librarian/chef/extension.rb +9 -0
  47. data/vendor/librarian/lib/librarian/chef/integration/knife.rb +46 -0
  48. data/vendor/librarian/lib/librarian/chef/manifest_reader.rb +59 -0
  49. data/vendor/librarian/lib/librarian/chef/source.rb +4 -0
  50. data/vendor/librarian/lib/librarian/chef/source/git.rb +25 -0
  51. data/vendor/librarian/lib/librarian/chef/source/github.rb +27 -0
  52. data/vendor/librarian/lib/librarian/chef/source/local.rb +69 -0
  53. data/vendor/librarian/lib/librarian/chef/source/path.rb +12 -0
  54. data/vendor/librarian/lib/librarian/chef/source/site.rb +442 -0
  55. data/vendor/librarian/lib/librarian/chef/templates/Cheffile +15 -0
  56. data/vendor/librarian/lib/librarian/cli.rb +223 -0
  57. data/vendor/librarian/lib/librarian/cli/manifest_presenter.rb +93 -0
  58. data/vendor/librarian/lib/librarian/config.rb +7 -0
  59. data/vendor/librarian/lib/librarian/config/database.rb +205 -0
  60. data/vendor/librarian/lib/librarian/config/file_source.rb +47 -0
  61. data/vendor/librarian/lib/librarian/config/hash_source.rb +33 -0
  62. data/vendor/librarian/lib/librarian/config/source.rb +149 -0
  63. data/vendor/librarian/lib/librarian/dependency.rb +147 -0
  64. data/vendor/librarian/lib/librarian/dsl.rb +108 -0
  65. data/vendor/librarian/lib/librarian/dsl/receiver.rb +46 -0
  66. data/vendor/librarian/lib/librarian/dsl/target.rb +171 -0
  67. data/vendor/librarian/lib/librarian/environment.rb +182 -0
  68. data/vendor/librarian/lib/librarian/error.rb +4 -0
  69. data/vendor/librarian/lib/librarian/helpers.rb +13 -0
  70. data/vendor/librarian/lib/librarian/linter/source_linter.rb +55 -0
  71. data/vendor/librarian/lib/librarian/lockfile.rb +29 -0
  72. data/vendor/librarian/lib/librarian/lockfile/compiler.rb +66 -0
  73. data/vendor/librarian/lib/librarian/lockfile/parser.rb +123 -0
  74. data/vendor/librarian/lib/librarian/logger.rb +46 -0
  75. data/vendor/librarian/lib/librarian/manifest.rb +140 -0
  76. data/vendor/librarian/lib/librarian/manifest_set.rb +151 -0
  77. data/vendor/librarian/lib/librarian/mock.rb +1 -0
  78. data/vendor/librarian/lib/librarian/mock/cli.rb +19 -0
  79. data/vendor/librarian/lib/librarian/mock/dsl.rb +15 -0
  80. data/vendor/librarian/lib/librarian/mock/environment.rb +24 -0
  81. data/vendor/librarian/lib/librarian/mock/extension.rb +9 -0
  82. data/vendor/librarian/lib/librarian/mock/source.rb +1 -0
  83. data/vendor/librarian/lib/librarian/mock/source/mock.rb +80 -0
  84. data/vendor/librarian/lib/librarian/mock/source/mock/registry.rb +83 -0
  85. data/vendor/librarian/lib/librarian/resolution.rb +46 -0
  86. data/vendor/librarian/lib/librarian/resolver.rb +81 -0
  87. data/vendor/librarian/lib/librarian/resolver/implementation.rb +223 -0
  88. data/vendor/librarian/lib/librarian/source.rb +2 -0
  89. data/vendor/librarian/lib/librarian/source/basic_api.rb +45 -0
  90. data/vendor/librarian/lib/librarian/source/git.rb +134 -0
  91. data/vendor/librarian/lib/librarian/source/git/repository.rb +217 -0
  92. data/vendor/librarian/lib/librarian/source/local.rb +54 -0
  93. data/vendor/librarian/lib/librarian/source/path.rb +56 -0
  94. data/vendor/librarian/lib/librarian/spec.rb +13 -0
  95. data/vendor/librarian/lib/librarian/spec_change_set.rb +173 -0
  96. data/vendor/librarian/lib/librarian/specfile.rb +17 -0
  97. data/vendor/librarian/lib/librarian/support/abstract_method.rb +21 -0
  98. data/vendor/librarian/lib/librarian/ui.rb +64 -0
  99. data/vendor/librarian/lib/librarian/version.rb +3 -0
  100. data/vendor/librarian/librarian.gemspec +35 -0
  101. data/vendor/librarian/spec/functional/chef/cli_spec.rb +194 -0
  102. data/vendor/librarian/spec/functional/chef/source/git_spec.rb +432 -0
  103. data/vendor/librarian/spec/functional/chef/source/site_spec.rb +266 -0
  104. data/vendor/librarian/spec/functional/source/git/repository_spec.rb +150 -0
  105. data/vendor/librarian/spec/integration/chef/source/git_spec.rb +441 -0
  106. data/vendor/librarian/spec/integration/chef/source/site_spec.rb +217 -0
  107. data/vendor/librarian/spec/support/cli_macro.rb +114 -0
  108. data/vendor/librarian/spec/support/method_patch_macro.rb +30 -0
  109. data/vendor/librarian/spec/support/with_env_macro.rb +20 -0
  110. data/vendor/librarian/spec/unit/action/base_spec.rb +18 -0
  111. data/vendor/librarian/spec/unit/action/clean_spec.rb +102 -0
  112. data/vendor/librarian/spec/unit/action/ensure_spec.rb +37 -0
  113. data/vendor/librarian/spec/unit/action/install_spec.rb +111 -0
  114. data/vendor/librarian/spec/unit/config/database_spec.rb +327 -0
  115. data/vendor/librarian/spec/unit/dependency_spec.rb +212 -0
  116. data/vendor/librarian/spec/unit/dsl_spec.rb +173 -0
  117. data/vendor/librarian/spec/unit/environment_spec.rb +173 -0
  118. data/vendor/librarian/spec/unit/lockfile/parser_spec.rb +162 -0
  119. data/vendor/librarian/spec/unit/lockfile_spec.rb +65 -0
  120. data/vendor/librarian/spec/unit/manifest_set_spec.rb +202 -0
  121. data/vendor/librarian/spec/unit/manifest_spec.rb +36 -0
  122. data/vendor/librarian/spec/unit/mock/source/mock_spec.rb +22 -0
  123. data/vendor/librarian/spec/unit/resolver_spec.rb +233 -0
  124. data/vendor/librarian/spec/unit/source/git_spec.rb +29 -0
  125. data/vendor/librarian/spec/unit/spec_change_set_spec.rb +169 -0
  126. metadata +220 -0
@@ -0,0 +1,217 @@
1
+ require 'pathname'
2
+ require 'json'
3
+ require 'webmock'
4
+
5
+ require 'librarian'
6
+ require 'librarian/helpers'
7
+ require 'librarian/action/resolve'
8
+ require 'librarian/action/install'
9
+ require 'librarian/chef'
10
+
11
+ module Librarian
12
+ module Chef
13
+ module Source
14
+ describe Site do
15
+
16
+ include WebMock::API
17
+
18
+ let(:project_path) do
19
+ project_path = Pathname.new(__FILE__).expand_path
20
+ project_path = project_path.dirname until project_path.join("Rakefile").exist?
21
+ project_path
22
+ end
23
+ let(:tmp_path) { project_path.join("tmp/spec/integration/chef/source/site") }
24
+ after { tmp_path.rmtree if tmp_path && tmp_path.exist? }
25
+ let(:sample_path) { tmp_path.join("sample") }
26
+ let(:sample_metadata) do
27
+ Helpers.strip_heredoc(<<-METADATA)
28
+ version "0.6.5"
29
+ METADATA
30
+ end
31
+
32
+ let(:api_url) { "http://site.cookbooks.com" }
33
+
34
+ let(:sample_index_data) do
35
+ {
36
+ "name" => "sample",
37
+ "versions" => [
38
+ "#{api_url}/cookbooks/sample/versions/0_6_5"
39
+ ]
40
+ }
41
+ end
42
+ let(:sample_0_6_5_data) do
43
+ {
44
+ "version" => "0.6.5",
45
+ "file" => "#{api_url}/cookbooks/sample/versions/0_6_5/file.tar.gz"
46
+ }
47
+ end
48
+ let(:sample_0_6_5_package) do
49
+ s = StringIO.new
50
+ z = Zlib::GzipWriter.new(s, Zlib::NO_COMPRESSION)
51
+ t = Archive::Tar::Minitar::Output.new(z)
52
+ t.tar.add_file_simple("sample/metadata.rb", :mode => 0700,
53
+ :size => sample_metadata.bytesize){|io| io.write(sample_metadata)}
54
+ t.close
55
+ z.close unless z.closed?
56
+ s.string
57
+ end
58
+
59
+ # depends on repo_path being defined in each context
60
+ let(:env) { Environment.new(:project_path => repo_path) }
61
+
62
+ before do
63
+ stub_request(:get, "#{api_url}/cookbooks/sample").
64
+ to_return(:body => JSON.dump(sample_index_data))
65
+
66
+ stub_request(:get, "#{api_url}/cookbooks/sample/versions/0_6_5").
67
+ to_return(:body => JSON.dump(sample_0_6_5_data))
68
+
69
+ stub_request(:get, "#{api_url}/cookbooks/sample/versions/0_6_5/file.tar.gz").
70
+ to_return(:body => sample_0_6_5_package)
71
+ end
72
+
73
+ after do
74
+ WebMock.reset!
75
+ end
76
+
77
+ context "a single dependency with a site source" do
78
+
79
+ context "resolving" do
80
+ let(:repo_path) { tmp_path.join("repo/resolve") }
81
+ before do
82
+ repo_path.rmtree if repo_path.exist?
83
+ repo_path.mkpath
84
+ repo_path.join("cookbooks").mkpath
85
+ cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
86
+ #!/usr/bin/env ruby
87
+ cookbook "sample", :site => #{api_url.inspect}
88
+ CHEFFILE
89
+ repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
90
+ end
91
+
92
+ context "the resolve" do
93
+ it "should not raise an exception" do
94
+ expect { Action::Resolve.new(env).run }.to_not raise_error
95
+ end
96
+ end
97
+
98
+ context "the results" do
99
+ before { Action::Resolve.new(env).run }
100
+
101
+ it "should create the lockfile" do
102
+ repo_path.join("Cheffile.lock").should exist
103
+ end
104
+
105
+ it "should not attempt to install the cookbok" do
106
+ repo_path.join("cookbooks/sample").should_not exist
107
+ end
108
+ end
109
+ end
110
+
111
+ context "intalling" do
112
+ let(:repo_path) { tmp_path.join("repo/install") }
113
+ before do
114
+ repo_path.rmtree if repo_path.exist?
115
+ repo_path.mkpath
116
+ repo_path.join("cookbooks").mkpath
117
+ cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
118
+ #!/usr/bin/env ruby
119
+ cookbook "sample", :site => #{api_url.inspect}
120
+ CHEFFILE
121
+ repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
122
+
123
+ Action::Resolve.new(env).run
124
+ end
125
+
126
+ context "the install" do
127
+ it "should not raise an exception" do
128
+ expect { Action::Install.new(env).run }.to_not raise_error
129
+ end
130
+ end
131
+
132
+ context "the results" do
133
+ before { Action::Install.new(env).run }
134
+
135
+ it "should create the lockfile" do
136
+ repo_path.join("Cheffile.lock").should exist
137
+ end
138
+
139
+ it "should create a directory for the cookbook" do
140
+ repo_path.join("cookbooks/sample").should exist
141
+ end
142
+
143
+ it "should copy the cookbook files into the cookbook directory" do
144
+ repo_path.join("cookbooks/sample/metadata.rb").should exist
145
+ end
146
+ end
147
+ end
148
+
149
+ context "resolving and separately installing" do
150
+ let(:repo_path) { tmp_path.join("repo/resolve-install") }
151
+ before do
152
+ repo_path.rmtree if repo_path.exist?
153
+ repo_path.mkpath
154
+ repo_path.join("cookbooks").mkpath
155
+ cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
156
+ #!/usr/bin/env ruby
157
+ cookbook "sample", :site => #{api_url.inspect}
158
+ CHEFFILE
159
+ repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
160
+
161
+ Action::Resolve.new(env).run
162
+ repo_path.join("tmp").rmtree if repo_path.join("tmp").exist?
163
+ end
164
+
165
+ context "the install" do
166
+ it "should not raise an exception" do
167
+ expect { Action::Install.new(env).run }.to_not raise_error
168
+ end
169
+ end
170
+
171
+ context "the results" do
172
+ before { Action::Install.new(env).run }
173
+
174
+ it "should create a directory for the cookbook" do
175
+ repo_path.join("cookbooks/sample").should exist
176
+ end
177
+
178
+ it "should copy the cookbook files into the cookbook directory" do
179
+ repo_path.join("cookbooks/sample/metadata.rb").should exist
180
+ end
181
+ end
182
+ end
183
+
184
+ end
185
+
186
+ context "when the repo path has a space" do
187
+
188
+ let(:repo_path) { tmp_path.join("repo/with extra spaces/resolve") }
189
+
190
+ before do
191
+ repo_path.rmtree if repo_path.exist?
192
+ repo_path.mkpath
193
+ repo_path.join("cookbooks").mkpath
194
+
195
+ cheffile = Helpers.strip_heredoc(<<-CHEFFILE)
196
+ #!/usr/bin/env ruby
197
+ cookbook "sample", :site => #{api_url.inspect}
198
+ CHEFFILE
199
+ repo_path.join("Cheffile").open("wb") { |f| f.write(cheffile) }
200
+ end
201
+
202
+ after do
203
+ repo_path.rmtree
204
+ end
205
+
206
+ context "the resolution" do
207
+ it "should not raise an exception" do
208
+ expect { Action::Resolve.new(env).run }.to_not raise_error
209
+ end
210
+ end
211
+
212
+ end
213
+
214
+ end
215
+ end
216
+ end
217
+ end
@@ -0,0 +1,114 @@
1
+ require "json"
2
+ require "pathname"
3
+ require "securerandom"
4
+ require "stringio"
5
+ require "thor"
6
+
7
+ require "librarian/helpers"
8
+
9
+ module CliMacro
10
+
11
+ class FakeShell < Thor::Shell::Basic
12
+ def stdout
13
+ @stdout ||= StringIO.new
14
+ end
15
+ def stderr
16
+ @stderr ||= StringIO.new
17
+ end
18
+ def stdin
19
+ raise "unsupported"
20
+ end
21
+ end
22
+
23
+ class FileMatcher
24
+ attr_accessor :rel_path, :content, :type, :base_path
25
+ def initialize(rel_path, content, options = { })
26
+ self.rel_path = rel_path
27
+ self.content = content
28
+ self.type = options[:type]
29
+ end
30
+ def full_path
31
+ @full_path ||= base_path + rel_path
32
+ end
33
+ def actual_content
34
+ @actual_content ||= begin
35
+ s = full_path.read
36
+ s = JSON.parse(s) if type == :json
37
+ s
38
+ end
39
+ end
40
+ def matches?(base_path)
41
+ base_path = Pathname(base_path) unless Pathname === base_path
42
+ self.base_path = base_path
43
+
44
+ full_path.file? && (!content || actual_content == content)
45
+ end
46
+ end
47
+
48
+ def self.included(base)
49
+ base.instance_exec do
50
+ let(:project_path) do
51
+ project_path = Pathname.new(__FILE__).expand_path
52
+ project_path = project_path.dirname until project_path.join("Rakefile").exist?
53
+ project_path
54
+ end
55
+ let(:tmp) { project_path.join("tmp/spec/cli") }
56
+ let(:pwd) { tmp + SecureRandom.hex(8) }
57
+
58
+ before { tmp.mkpath }
59
+ before { pwd.mkpath }
60
+
61
+ after { tmp.rmtree }
62
+ end
63
+ end
64
+
65
+ def cli!(*args)
66
+ @shell = FakeShell.new
67
+ @exit_status = Dir.chdir(pwd) do
68
+ described_class.with_environment do
69
+ described_class.returning_status do
70
+ described_class.start args, :shell => @shell
71
+ end
72
+ end
73
+ end
74
+ end
75
+
76
+ def write_file!(path, content)
77
+ path = pwd.join(path)
78
+ path.dirname.mkpath
79
+ path.open("wb"){|f| f.write(content)}
80
+ end
81
+
82
+ def write_json_file!(path, content)
83
+ write_file! path, JSON.dump(content)
84
+ end
85
+
86
+ def strip_heredoc(text)
87
+ Librarian::Helpers.strip_heredoc(text)
88
+ end
89
+
90
+ def shell
91
+ @shell
92
+ end
93
+
94
+ def stdout
95
+ shell.stdout.string
96
+ end
97
+
98
+ def stderr
99
+ shell.stderr.string
100
+ end
101
+
102
+ def exit_status
103
+ @exit_status
104
+ end
105
+
106
+ def have_file(rel_path, content = nil)
107
+ FileMatcher.new(rel_path, content)
108
+ end
109
+
110
+ def have_json_file(rel_path, content)
111
+ FileMatcher.new(rel_path, content, :type => :json)
112
+ end
113
+
114
+ end
@@ -0,0 +1,30 @@
1
+ require "securerandom"
2
+
3
+ module MethodPatchMacro
4
+
5
+ def self.included(base)
6
+ base.extend ClassMethods
7
+ end
8
+
9
+ module ClassMethods
10
+ def with_module_method(mod, meth, &block)
11
+ tag = SecureRandom.hex(8)
12
+ orig_meth = "_#{tag}_#{meth}".to_sym
13
+ around do |example|
14
+ mod.module_eval do
15
+ alias_method orig_meth, meth
16
+ define_method meth, &block
17
+ end
18
+ begin
19
+ example.run
20
+ ensure
21
+ mod.module_eval do
22
+ alias_method meth, orig_meth
23
+ remove_method orig_meth
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+
30
+ end
@@ -0,0 +1,20 @@
1
+ module WithEnvMacro
2
+
3
+ module ClassMethods
4
+
5
+ def with_env(new)
6
+ old = Hash[new.map{|k, v| [k, ENV[k]]}]
7
+
8
+ before { ENV.update(new) }
9
+ after { ENV.update(old) }
10
+ end
11
+
12
+ end
13
+
14
+ private
15
+
16
+ def self.included(base)
17
+ base.extend(ClassMethods)
18
+ end
19
+
20
+ end
@@ -0,0 +1,18 @@
1
+ require "librarian/action/base"
2
+
3
+ module Librarian
4
+ describe Action::Base do
5
+
6
+ let(:env) { mock }
7
+ let(:action) { described_class.new(env) }
8
+
9
+ subject { action }
10
+
11
+ it { should respond_to :environment }
12
+
13
+ it "should have the environment that was assigned to it" do
14
+ action.environment.should be env
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,102 @@
1
+ require "librarian/action/clean"
2
+
3
+ module Librarian
4
+ describe Action::Clean do
5
+
6
+ let(:env) { mock }
7
+ let(:action) { described_class.new(env) }
8
+
9
+ before do
10
+ action.stub(:debug)
11
+ end
12
+
13
+ describe "#run" do
14
+
15
+ describe "behavior" do
16
+
17
+ after do
18
+ action.run
19
+ end
20
+
21
+ describe "clearing the cache path" do
22
+
23
+ before do
24
+ action.stub(:clean_install_path)
25
+ end
26
+
27
+ context "when the cache path is missing" do
28
+ before do
29
+ env.stub_chain(:cache_path, :exist?) { false }
30
+ end
31
+
32
+ it "should not try to clear the cache path" do
33
+ env.cache_path.should_receive(:rmtree).never
34
+ end
35
+ end
36
+
37
+ context "when the cache path is present" do
38
+ before do
39
+ env.stub_chain(:cache_path, :exist?) { true }
40
+ end
41
+
42
+ it "should try to clear the cache path" do
43
+ env.cache_path.should_receive(:rmtree).exactly(:once)
44
+ end
45
+ end
46
+
47
+ end
48
+
49
+ describe "clearing the install path" do
50
+
51
+ before do
52
+ action.stub(:clean_cache_path)
53
+ end
54
+
55
+ context "when the install path is missing" do
56
+ before do
57
+ env.stub_chain(:install_path, :exist?) { false }
58
+ end
59
+
60
+ it "should not try to clear the install path" do
61
+ env.install_path.should_receive(:children).never
62
+ end
63
+ end
64
+
65
+ context "when the install path is present" do
66
+ before do
67
+ env.stub_chain(:install_path, :exist?) { true }
68
+ end
69
+
70
+ it "should try to clear the install path" do
71
+ children = [mock, mock, mock]
72
+ children.each do |child|
73
+ child.stub(:file?) { false }
74
+ end
75
+ env.stub_chain(:install_path, :children) { children }
76
+
77
+ children.each do |child|
78
+ child.should_receive(:rmtree).exactly(:once)
79
+ end
80
+ end
81
+
82
+ it "should only try to clear out directories from the install path, not files" do
83
+ children = [mock(:file? => false), mock(:file? => true), mock(:file? => true)]
84
+ env.stub_chain(:install_path, :children) { children }
85
+
86
+ children.select(&:file?).each do |child|
87
+ child.should_receive(:rmtree).never
88
+ end
89
+ children.reject(&:file?).each do |child|
90
+ child.should_receive(:rmtree).exactly(:once)
91
+ end
92
+ end
93
+ end
94
+
95
+ end
96
+
97
+ end
98
+
99
+ end
100
+
101
+ end
102
+ end