berkshelf 3.1.1 → 3.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +26 -0
- data/PLUGINS.md +2 -1
- data/README.md +0 -6
- data/berkshelf.gemspec +1 -1
- data/features/commands/install.feature +15 -5
- data/features/commands/viz.feature +1 -0
- data/features/step_definitions/filesystem_steps.rb +4 -0
- data/generator_files/README.md.erb +1 -1
- data/lib/berkshelf.rb +3 -4
- data/lib/berkshelf/berksfile.rb +1 -1
- data/lib/berkshelf/commands/shelf.rb +1 -1
- data/lib/berkshelf/installer.rb +1 -1
- data/lib/berkshelf/locations/git.rb +4 -0
- data/lib/berkshelf/lockfile.rb +3 -3
- data/lib/berkshelf/shell.rb +31 -0
- data/lib/berkshelf/version.rb +1 -1
- data/spec/unit/berkshelf/lockfile_spec.rb +46 -0
- data/spec/unit/berkshelf/shell_spec.rb +127 -0
- data/spec/unit/berkshelf/visualizer_spec.rb +1 -1
- metadata +7 -8
- data/lib/berkshelf/thor_ext/shell.rb +0 -4
- data/lib/berkshelf/ui.rb +0 -46
- data/spec/unit/berkshelf/ui_spec.rb +0 -131
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f5a7d0c79975c9b1f6c2a3407a1d649b68e9d1f
|
4
|
+
data.tar.gz: 409e94aa67b4fc4ca58bf3cbfc4ba394307c4bf0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f25d4557214df0297c370439d06ff22f3c8da2b94b72176cd086ad3461c441c68f7bf482e5b28be4f651731a8b9498d83c455ac050ed8b78d607bfcf1e5574f
|
7
|
+
data.tar.gz: c571c05d0bb93b8c85524c22a06d8fb38cf4c470c346d419908baf10db1c15922dc0dad0c74b3c2518682cdd907f4de7e5dbd3ed3cd5917b7f029418f64140a0
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
> This is a high level digest of changes. For the complete CHANGELOG diff two tags in the project's [commit history](https://github.com/berkshelf/berkshelf/commits/master).
|
2
|
+
|
3
|
+
# 3.1.2
|
4
|
+
|
5
|
+
* Enhancements
|
6
|
+
* SCM history is now stripped from cookbooks retrieved from an SCM location which will conserve disk space for cookbooks with a large history
|
7
|
+
* Bug Fixes
|
8
|
+
* Fix formatting issue with console output on some systems
|
9
|
+
* Handle crash on install on some machines which do not properly report their number of CPU cores
|
10
|
+
* Fix infinite loop in checking if the lockfile is synced under certain conditions
|
11
|
+
* Fix console output crash on Windows
|
12
|
+
* Fix issue where updating a cookbook would result in a non resolvable lockfile
|
13
|
+
* Various spelling mistakes in console output
|
14
|
+
|
1
15
|
# 3.1.1
|
2
16
|
|
3
17
|
* Bug Fixes
|
@@ -36,6 +50,18 @@
|
|
36
50
|
* Backwards incompatible changes
|
37
51
|
* `berks package` has had it's argument and options list updated. The first argument is now the name, or fulle path, of the archive file that will be generated. As with before, the first argument is not required.
|
38
52
|
|
53
|
+
# 2.0.16
|
54
|
+
|
55
|
+
* Update constraint on Ridley
|
56
|
+
|
57
|
+
# 2.0.14
|
58
|
+
|
59
|
+
* Backport changes from master to allow detecting cookbooks by metadata.json
|
60
|
+
|
61
|
+
# 2.0.13
|
62
|
+
|
63
|
+
* Lock transitive dependency on Faraday
|
64
|
+
|
39
65
|
# 2.0.10
|
40
66
|
|
41
67
|
* Huge performance increase when resolving a Berksfile when the Berkshelf contains a lot of cookbooks
|
data/PLUGINS.md
CHANGED
@@ -7,7 +7,8 @@ This is a list of community-contributed plugins for Berkshelf. A few notes:
|
|
7
7
|
|
8
8
|
Plugins
|
9
9
|
-------
|
10
|
-
- [berkshelf-
|
10
|
+
- [berkshelf-bzr](https://github.com/berkshelf/berkshelf-bzr) - Add support for downloading cookbooks from Bazaar locations.
|
11
|
+
- [berkshelf-hg](https://github.com/berkshelf/berkshelf-hg) - Add support for downloading cookbooks from Mercurial locations.
|
11
12
|
- [vagrant-berkshelf](https://github.com/berkshelf/vagrant-berkshelf) - A Vagrant plugin to add Berkshelf integration to the Chef provisioners.
|
12
13
|
|
13
14
|
I want to add my plugin!
|
data/README.md
CHANGED
@@ -11,12 +11,6 @@ Manage a Cookbook or an Application's Cookbook dependencies
|
|
11
11
|
|
12
12
|
Berkshelf is now included as part of the [Chef-DK](http://getchef.com/downloads/chef-dk). This is fastest, easiest, and the recommended installation method for getting up and running with Berkshelf.
|
13
13
|
|
14
|
-
Add the Chef-DK binaries directory to your path once you've installed the Chef-DK.
|
15
|
-
|
16
|
-
$ export PATH=/opt/chefdk/embedded/bin:$PATH
|
17
|
-
$ which berks
|
18
|
-
/opt/chefdk/embedded/bin/berks
|
19
|
-
|
20
14
|
> note: You may need to uninstall the Berkshelf gem especially if you are using a Ruby version manager you may need to uninstall all Berkshelf gems from each Ruby installation.
|
21
15
|
|
22
16
|
### From Rubygems
|
data/berkshelf.gemspec
CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
|
|
32
32
|
|
33
33
|
s.add_dependency 'addressable', '~> 2.3.4'
|
34
34
|
s.add_dependency 'berkshelf-api-client', '~> 1.2'
|
35
|
-
s.add_dependency 'buff-config', '~> 0.
|
35
|
+
s.add_dependency 'buff-config', '~> 0.4'
|
36
36
|
s.add_dependency 'buff-extensions', '~> 0.4'
|
37
37
|
s.add_dependency 'buff-shell_out', '~> 0.1'
|
38
38
|
s.add_dependency 'faraday', '~> 0.9.0'
|
@@ -54,11 +54,8 @@ Feature: berks install
|
|
54
54
|
| elixir | 1.0.0 |
|
55
55
|
And the Berkshelf API server's cache is up to date
|
56
56
|
When I successfully run `berks install`
|
57
|
-
Then the output should contain
|
58
|
-
|
59
|
-
Installing elixir (1.0.0) from http://0.0.0.0:26210 ([chef_server] http://localhost:26310/)
|
60
|
-
Installing ruby (1.0.0) from http://0.0.0.0:26210 ([chef_server] http://localhost:26310/)
|
61
|
-
"""
|
57
|
+
Then the output should contain "Installing elixir (1.0.0)"
|
58
|
+
And the output should contain "Installing ruby (1.0.0)"
|
62
59
|
And the cookbook store should have the cookbooks:
|
63
60
|
| ruby | 1.0.0 |
|
64
61
|
| elixir | 1.0.0 |
|
@@ -242,6 +239,19 @@ Feature: berks install
|
|
242
239
|
Using berkshelf-cookbook-fixture (1.0.0) from git://github.com/RiotGames/berkshelf-cookbook-fixture.git (at rel/cookbooks/berkshelf-cookbook-fixture)
|
243
240
|
"""
|
244
241
|
|
242
|
+
Scenario: installing a Berksfile that contains a Git location
|
243
|
+
Given I have a Berksfile pointing at the local Berkshelf API with:
|
244
|
+
"""
|
245
|
+
cookbook 'berkshelf-cookbook-fixture',
|
246
|
+
git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git',
|
247
|
+
tag: 'v0.2.0'
|
248
|
+
"""
|
249
|
+
When I successfully run `berks install`
|
250
|
+
Then the cookbook store should have the git cookbooks:
|
251
|
+
| berkshelf-cookbook-fixture | 0.2.0 | 70a527e17d91f01f031204562460ad1c17f972ee |
|
252
|
+
And the git cookbook "berkshelf-cookbook-fixture-70a527e17d91f01f031204562460ad1c17f972ee" should not have the following directories:
|
253
|
+
| .git |
|
254
|
+
|
245
255
|
Scenario: installing a Berksfile that contains a Git location with a tag
|
246
256
|
Given I have a Berksfile pointing at the local Berkshelf API with:
|
247
257
|
"""
|
@@ -224,6 +224,10 @@ Then /^the cookbook "(.*?)" should not have the following files:$/ do |name, fil
|
|
224
224
|
check_file_presence(files.raw.map{|file_row| ::File.join(name, file_row[0])}, false)
|
225
225
|
end
|
226
226
|
|
227
|
+
Then /^the git cookbook "(.*?)" should not have the following directories:$/ do |name, directories|
|
228
|
+
check_directory_presence(directories.raw.map{|directory_row| ::File.join(cookbook_store.storage_path.to_path, name, directory_row[0])}, false)
|
229
|
+
end
|
230
|
+
|
227
231
|
Then /^the file "(.*?)" in the cookbook "(.*?)" should contain:$/ do |file_name, cookbook_name, content|
|
228
232
|
expect(Pathname.new(current_dir).join(cookbook_name)).to have_structure {
|
229
233
|
file "Berksfile" do
|
@@ -41,7 +41,7 @@ Include `<%= name %>` in your node's `run_list`:
|
|
41
41
|
|
42
42
|
1. Fork the repository on Github
|
43
43
|
2. Create a named feature branch (i.e. `add-new-recipe`)
|
44
|
-
3. Write
|
44
|
+
3. Write your change
|
45
45
|
4. Write tests for your change (if applicable)
|
46
46
|
5. Run the tests, ensuring they all pass
|
47
47
|
6. Submit a Pull Request
|
data/lib/berkshelf.rb
CHANGED
@@ -25,6 +25,7 @@ module Berkshelf
|
|
25
25
|
autoload :Logging, 'berkshelf/mixin/logging'
|
26
26
|
end
|
27
27
|
|
28
|
+
autoload :Shell, 'berkshelf/shell'
|
28
29
|
autoload :Uploader, 'berkshelf/uploader'
|
29
30
|
autoload :Visualizer, 'berkshelf/visualizer'
|
30
31
|
|
@@ -52,10 +53,9 @@ module Berkshelf
|
|
52
53
|
@root ||= Pathname.new(File.expand_path('../', File.dirname(__FILE__)))
|
53
54
|
end
|
54
55
|
|
55
|
-
# @return [
|
56
|
-
# A basic shell on Windows, colored everywhere else
|
56
|
+
# @return [Berkshelf::Shell]
|
57
57
|
def ui
|
58
|
-
@ui ||=
|
58
|
+
@ui ||= Berkshelf::Shell.new
|
59
59
|
end
|
60
60
|
|
61
61
|
# Returns the filepath to the location Berkshelf will use for
|
@@ -217,7 +217,6 @@ require_relative 'berkshelf/logger'
|
|
217
217
|
require_relative 'berkshelf/resolver'
|
218
218
|
require_relative 'berkshelf/source'
|
219
219
|
require_relative 'berkshelf/source_uri'
|
220
|
-
require_relative 'berkshelf/ui'
|
221
220
|
|
222
221
|
Ridley.logger = Berkshelf.logger
|
223
222
|
Berkshelf.logger.level = Logger::WARN
|
data/lib/berkshelf/berksfile.rb
CHANGED
@@ -207,7 +207,7 @@ module Berkshelf
|
|
207
207
|
if args.first == :opscode
|
208
208
|
Berkshelf.formatter.deprecation "Your Berksfile contains a site location pointing to the Opscode Community " +
|
209
209
|
"Site (site :opscode). Site locations have been replaced by the source location. Change this to: " +
|
210
|
-
"'source \"
|
210
|
+
"'source \"https://api.berkshelf.com\"' to remove this warning. For more information visit " +
|
211
211
|
"https://github.com/berkshelf/berkshelf/wiki/deprecated-locations"
|
212
212
|
source(DEFAULT_API_URL)
|
213
213
|
return
|
@@ -19,7 +19,7 @@ module Berkshelf
|
|
19
19
|
end
|
20
20
|
|
21
21
|
method_option :version, aliases: '-v', type: :string, desc: 'Version to show'
|
22
|
-
desc 'show', 'Display
|
22
|
+
desc 'show', 'Display information about a cookbook in the Berkshelf shelf'
|
23
23
|
def show(name)
|
24
24
|
cookbooks = find(name, options[:version])
|
25
25
|
|
data/lib/berkshelf/installer.rb
CHANGED
@@ -10,7 +10,7 @@ module Berkshelf
|
|
10
10
|
def initialize(berksfile)
|
11
11
|
@berksfile = berksfile
|
12
12
|
@lockfile = berksfile.lockfile
|
13
|
-
@worker = Worker.pool(size: [(Celluloid.cores - 1), 2].max, args: [berksfile])
|
13
|
+
@worker = Worker.pool(size: [(Celluloid.cores.to_i - 1), 2].max, args: [berksfile])
|
14
14
|
end
|
15
15
|
|
16
16
|
def build_universe
|
@@ -91,6 +91,10 @@ module Berkshelf
|
|
91
91
|
# If we got this far, we should copy
|
92
92
|
FileUtils.rm_rf(install_path) if install_path.exist?
|
93
93
|
FileUtils.cp_r(scratch_path, install_path)
|
94
|
+
|
95
|
+
# Remove the git history
|
96
|
+
FileUtils.rm_rf(File.join(install_path, '.git'))
|
97
|
+
|
94
98
|
install_path.chmod(0777 & ~File.umask)
|
95
99
|
ensure
|
96
100
|
# Ensure the scratch directory is cleaned up
|
data/lib/berkshelf/lockfile.rb
CHANGED
@@ -174,12 +174,12 @@ module Berkshelf
|
|
174
174
|
return false
|
175
175
|
end
|
176
176
|
|
177
|
+
checked[name] = true
|
178
|
+
|
177
179
|
unless satisfies_transitive?(graphed, checked, level + 2)
|
178
180
|
Berkshelf.log.debug "#{indent} Transitive are not satisifed"
|
179
181
|
return false
|
180
182
|
end
|
181
|
-
|
182
|
-
checked[name] = true
|
183
183
|
end
|
184
184
|
end
|
185
185
|
|
@@ -723,7 +723,7 @@ module Berkshelf
|
|
723
723
|
|
724
724
|
cookbooks.each do |cookbook|
|
725
725
|
@graph[cookbook.cookbook_name.to_s] = GraphItem.new(
|
726
|
-
cookbook.
|
726
|
+
cookbook.cookbook_name,
|
727
727
|
cookbook.version,
|
728
728
|
cookbook.dependencies,
|
729
729
|
)
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
module Berkshelf
|
4
|
+
# Subclass the current shell (which is different based on the OS)
|
5
|
+
Shell = Class.new(Thor::Base.shell) do
|
6
|
+
# Mute the output of this instance of UI until {#unmute!} is called
|
7
|
+
def mute!
|
8
|
+
@mute = true
|
9
|
+
end
|
10
|
+
|
11
|
+
# Unmute the output of this instance of UI until {#mute!} is called
|
12
|
+
def unmute!
|
13
|
+
@mute = false
|
14
|
+
end
|
15
|
+
|
16
|
+
def say(*args)
|
17
|
+
return if quiet?
|
18
|
+
super(*args)
|
19
|
+
end
|
20
|
+
alias_method :info, :say
|
21
|
+
|
22
|
+
def warn(message, color = :yellow)
|
23
|
+
say(message, color)
|
24
|
+
end
|
25
|
+
|
26
|
+
def error(message, color = :red)
|
27
|
+
message = set_color(message, *color) if color
|
28
|
+
super(message)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/berkshelf/version.rb
CHANGED
@@ -92,6 +92,32 @@ describe Berkshelf::Lockfile do
|
|
92
92
|
expect(subject.trusted?).to be_true
|
93
93
|
end
|
94
94
|
|
95
|
+
it 'returns true when the lockfile is trusted with cyclic transitive dependencies' do
|
96
|
+
cookbook = double('apt-1.0.0', dependencies: { 'bacon' => '1.0.0' })
|
97
|
+
apt = double('apt',
|
98
|
+
name: 'apt',
|
99
|
+
version_constraint: Semverse::Constraint.new('>= 0.0.0'),
|
100
|
+
version: '1.0.0',
|
101
|
+
location: 'api',
|
102
|
+
dependencies: { 'bacon' => '1.0.0' },
|
103
|
+
cached_cookbook: cookbook,
|
104
|
+
)
|
105
|
+
bacon = double('bacon',
|
106
|
+
name: 'bacon',
|
107
|
+
version_constraint: Semverse::Constraint.new('>= 0.0.0'),
|
108
|
+
version: '1.0.0',
|
109
|
+
location: 'api',
|
110
|
+
dependencies: { 'apt' => '1.0.0' }
|
111
|
+
)
|
112
|
+
berksfile = double('berksfile', dependencies: [apt])
|
113
|
+
subject.instance_variable_set(:@berksfile, berksfile)
|
114
|
+
subject.stub(:find).with(apt).and_return(apt)
|
115
|
+
subject.graph.stub(:find).with('bacon').and_return(bacon)
|
116
|
+
subject.graph.stub(:find).with(apt).and_return(apt)
|
117
|
+
|
118
|
+
expect(subject.trusted?).to be_true
|
119
|
+
end
|
120
|
+
|
95
121
|
it 'returns false when the lockfile is not trusted because of transitive dependencies' do
|
96
122
|
cookbook = double('apt-1.0.0', dependencies: { 'bacon' => '1.0.0', 'flip' => '2.0.0' })
|
97
123
|
apt = double('apt',
|
@@ -253,3 +279,23 @@ describe Berkshelf::Lockfile do
|
|
253
279
|
end
|
254
280
|
end
|
255
281
|
end
|
282
|
+
|
283
|
+
describe Berkshelf::Lockfile::Graph do
|
284
|
+
let(:filepath) { fixtures_path.join('lockfiles/empty.lock').to_s }
|
285
|
+
let(:lockfile) { Berkshelf::Lockfile.new(filepath: filepath) }
|
286
|
+
subject { described_class.new(lockfile) }
|
287
|
+
|
288
|
+
describe '#update' do
|
289
|
+
it 'uses cookbook_name as GraphItem name' do
|
290
|
+
cookbook = double('test',
|
291
|
+
name: 'test-0.0.1',
|
292
|
+
version: '0.0.1',
|
293
|
+
cookbook_name: 'test',
|
294
|
+
dependencies: {}
|
295
|
+
)
|
296
|
+
subject.update([cookbook])
|
297
|
+
|
298
|
+
expect(subject.locks.keys).to include(cookbook.cookbook_name)
|
299
|
+
end
|
300
|
+
end
|
301
|
+
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Berkshelf
|
4
|
+
describe Shell do
|
5
|
+
let(:stdout) { double('stdout', tty?: true) }
|
6
|
+
let(:stderr) { double('stderr') }
|
7
|
+
|
8
|
+
before do
|
9
|
+
described_class.any_instance.stub(:stdout).and_return(stdout)
|
10
|
+
described_class.any_instance.stub(:stderr).and_return(stderr)
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '#mute!' do
|
14
|
+
it 'sets @mute to true' do
|
15
|
+
subject.mute!
|
16
|
+
expect(subject.instance_variable_get(:@mute)).to be_true
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#unmute!' do
|
21
|
+
it 'sets @mute to false' do
|
22
|
+
subject.unmute!
|
23
|
+
expect(subject.instance_variable_get(:@mute)).to be_false
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '#say' do
|
28
|
+
context 'when quiet?' do
|
29
|
+
before do
|
30
|
+
subject.stub(:quiet?).and_return(true)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'does not output anything', :not_supported_on_windows do
|
34
|
+
stdout.should_not_receive(:print)
|
35
|
+
subject.say 'message'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'with not quiet?' do
|
40
|
+
before do
|
41
|
+
subject.stub(:quiet?).and_return(false)
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'prints to stdout' do
|
45
|
+
stdout.should_receive(:print).once
|
46
|
+
stdout.should_receive(:flush).with(no_args())
|
47
|
+
subject.say 'message'
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe '#say_status' do
|
53
|
+
context 'when quiet?' do
|
54
|
+
before do
|
55
|
+
subject.stub(:quiet?).and_return(true)
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'does not output anything' do
|
59
|
+
stdout.should_not_receive(:puts)
|
60
|
+
subject.say_status 5, 'message'
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
context 'with not quiet?' do
|
65
|
+
before do
|
66
|
+
subject.stub(:quiet?).and_return(false)
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'prints to stdout' do
|
70
|
+
stdout.should_receive(:print).once
|
71
|
+
stdout.should_receive(:flush).with(no_args())
|
72
|
+
subject.say_status 5, 'message'
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe '#warn' do
|
78
|
+
context 'when quiet?' do
|
79
|
+
before do
|
80
|
+
subject.stub(:quiet?).and_return(true)
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'does not output anything' do
|
84
|
+
stdout.should_not_receive(:print)
|
85
|
+
subject.warn 'warning'
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
context 'with not quiet?' do
|
90
|
+
before do
|
91
|
+
subject.stub(:quiet?).and_return(false)
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'calls #say with yellow coloring' do
|
95
|
+
stdout.should_receive(:print)
|
96
|
+
stdout.should_receive(:flush).with(no_args())
|
97
|
+
subject.warn 'warning'
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
context '#error' do
|
103
|
+
context 'when quiet?' do
|
104
|
+
before do
|
105
|
+
subject.stub(:quiet?).and_return(true)
|
106
|
+
end
|
107
|
+
|
108
|
+
it "outputs an error message", :not_supported_on_windows do
|
109
|
+
stderr.should_receive(:puts)
|
110
|
+
subject.error 'error!'
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
context 'with not quiet?' do
|
115
|
+
before do
|
116
|
+
subject.stub(:quiet?).and_return(false)
|
117
|
+
end
|
118
|
+
|
119
|
+
it 'prints to stderr' do
|
120
|
+
stderr.should_receive(:puts).with(windows? ? "error!" : "\e[31merror!\e[0m")
|
121
|
+
subject.error 'error!'
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
@@ -15,7 +15,7 @@ module Berkshelf
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
context 'when the graphviz command fails' do
|
18
|
+
context 'when the graphviz command fails', :graphviz do
|
19
19
|
before do
|
20
20
|
response = double(success?: false, stderr: 'Something happened!')
|
21
21
|
subject.stub(:shell_out).and_return(response)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: berkshelf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Winsor
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2014-
|
15
|
+
date: 2014-05-08 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: addressable
|
@@ -48,14 +48,14 @@ dependencies:
|
|
48
48
|
requirements:
|
49
49
|
- - "~>"
|
50
50
|
- !ruby/object:Gem::Version
|
51
|
-
version: '0.
|
51
|
+
version: '0.4'
|
52
52
|
type: :runtime
|
53
53
|
prerelease: false
|
54
54
|
version_requirements: !ruby/object:Gem::Requirement
|
55
55
|
requirements:
|
56
56
|
- - "~>"
|
57
57
|
- !ruby/object:Gem::Version
|
58
|
-
version: '0.
|
58
|
+
version: '0.4'
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: buff-extensions
|
61
61
|
requirement: !ruby/object:Gem::Requirement
|
@@ -451,13 +451,12 @@ files:
|
|
451
451
|
- lib/berkshelf/packager.rb
|
452
452
|
- lib/berkshelf/resolver.rb
|
453
453
|
- lib/berkshelf/resolver/graph.rb
|
454
|
+
- lib/berkshelf/shell.rb
|
454
455
|
- lib/berkshelf/source.rb
|
455
456
|
- lib/berkshelf/source_uri.rb
|
456
457
|
- lib/berkshelf/thor.rb
|
457
458
|
- lib/berkshelf/thor_ext.rb
|
458
459
|
- lib/berkshelf/thor_ext/hash_with_indifferent_access.rb
|
459
|
-
- lib/berkshelf/thor_ext/shell.rb
|
460
|
-
- lib/berkshelf/ui.rb
|
461
460
|
- lib/berkshelf/uploader.rb
|
462
461
|
- lib/berkshelf/version.rb
|
463
462
|
- lib/berkshelf/visualizer.rb
|
@@ -518,9 +517,9 @@ files:
|
|
518
517
|
- spec/unit/berkshelf/packager_spec.rb
|
519
518
|
- spec/unit/berkshelf/resolver/graph_spec.rb
|
520
519
|
- spec/unit/berkshelf/resolver_spec.rb
|
520
|
+
- spec/unit/berkshelf/shell_spec.rb
|
521
521
|
- spec/unit/berkshelf/source_spec.rb
|
522
522
|
- spec/unit/berkshelf/source_uri_spec.rb
|
523
|
-
- spec/unit/berkshelf/ui_spec.rb
|
524
523
|
- spec/unit/berkshelf/uploader_spec.rb
|
525
524
|
- spec/unit/berkshelf/visualizer_spec.rb
|
526
525
|
- spec/unit/berkshelf_spec.rb
|
@@ -643,9 +642,9 @@ test_files:
|
|
643
642
|
- spec/unit/berkshelf/packager_spec.rb
|
644
643
|
- spec/unit/berkshelf/resolver/graph_spec.rb
|
645
644
|
- spec/unit/berkshelf/resolver_spec.rb
|
645
|
+
- spec/unit/berkshelf/shell_spec.rb
|
646
646
|
- spec/unit/berkshelf/source_spec.rb
|
647
647
|
- spec/unit/berkshelf/source_uri_spec.rb
|
648
|
-
- spec/unit/berkshelf/ui_spec.rb
|
649
648
|
- spec/unit/berkshelf/uploader_spec.rb
|
650
649
|
- spec/unit/berkshelf/visualizer_spec.rb
|
651
650
|
- spec/unit/berkshelf_spec.rb
|
data/lib/berkshelf/ui.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
module Berkshelf
|
2
|
-
module UI
|
3
|
-
# Mute the output of this instance of UI until {#unmute!} is called
|
4
|
-
def mute!
|
5
|
-
@mute = true
|
6
|
-
end
|
7
|
-
|
8
|
-
# Unmute the output of this instance of UI until {#mute!} is called
|
9
|
-
def unmute!
|
10
|
-
@mute = false
|
11
|
-
end
|
12
|
-
|
13
|
-
def say(message = '', color = nil, force_new_line = (message.to_s !~ /( |\t)\Z/))
|
14
|
-
return if quiet?
|
15
|
-
|
16
|
-
super(message, color, force_new_line)
|
17
|
-
end
|
18
|
-
|
19
|
-
# @see {say}
|
20
|
-
def info(message = '', color = nil, force_new_line = (message.to_s !~ /( |\t)\Z/))
|
21
|
-
say(message, color, force_new_line)
|
22
|
-
end
|
23
|
-
|
24
|
-
def say_status(status, message, log_status = true)
|
25
|
-
return if quiet?
|
26
|
-
|
27
|
-
super(status, message, log_status)
|
28
|
-
end
|
29
|
-
|
30
|
-
def warn(message, color = :yellow)
|
31
|
-
return if quiet?
|
32
|
-
|
33
|
-
say(message, color)
|
34
|
-
end
|
35
|
-
|
36
|
-
def deprecated(message)
|
37
|
-
warn("[DEPRECATION] #{message}")
|
38
|
-
end
|
39
|
-
|
40
|
-
def error(message, color = :red)
|
41
|
-
message = set_color(message, *color) if color
|
42
|
-
super(message)
|
43
|
-
end
|
44
|
-
alias_method :fatal, :error
|
45
|
-
end
|
46
|
-
end
|
@@ -1,131 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Thor::Base.shell do
|
4
|
-
let(:stdout) { double('stdout', tty?: true) }
|
5
|
-
let(:stderr) { double('stderr') }
|
6
|
-
|
7
|
-
before do
|
8
|
-
described_class.any_instance.stub(:stdout).and_return(stdout)
|
9
|
-
described_class.any_instance.stub(:stderr).and_return(stderr)
|
10
|
-
end
|
11
|
-
|
12
|
-
describe '#mute!' do
|
13
|
-
it 'sets @mute to true' do
|
14
|
-
subject.mute!
|
15
|
-
expect(subject.instance_variable_get(:@mute)).to be_true
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe '#unmute!' do
|
20
|
-
it 'sets @mute to false' do
|
21
|
-
subject.unmute!
|
22
|
-
expect(subject.instance_variable_get(:@mute)).to be_false
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe '#say' do
|
27
|
-
context 'when quiet?' do
|
28
|
-
before do
|
29
|
-
subject.stub(:quiet?).and_return(true)
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'does not output anything', :not_supported_on_windows do
|
33
|
-
stdout.should_not_receive(:print)
|
34
|
-
subject.say 'message'
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
context 'with not quiet?' do
|
39
|
-
before do
|
40
|
-
subject.stub(:quiet?).and_return(false)
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'prints to stdout' do
|
44
|
-
stdout.should_receive(:print).once
|
45
|
-
stdout.should_receive(:flush).with(no_args())
|
46
|
-
subject.say 'message'
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
describe '#say_status' do
|
52
|
-
context 'when quiet?' do
|
53
|
-
before do
|
54
|
-
subject.stub(:quiet?).and_return(true)
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'does not output anything' do
|
58
|
-
stdout.should_not_receive(:puts)
|
59
|
-
subject.say_status 5, 'message'
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
context 'with not quiet?' do
|
64
|
-
before do
|
65
|
-
subject.stub(:quiet?).and_return(false)
|
66
|
-
end
|
67
|
-
|
68
|
-
it 'prints to stdout' do
|
69
|
-
stdout.should_receive(:print).once
|
70
|
-
stdout.should_receive(:flush).with(no_args())
|
71
|
-
subject.say_status 5, 'message'
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
describe '#warn' do
|
77
|
-
context 'when quiet?' do
|
78
|
-
before do
|
79
|
-
subject.stub(:quiet?).and_return(true)
|
80
|
-
end
|
81
|
-
|
82
|
-
it 'does not output anything' do
|
83
|
-
stdout.should_not_receive(:print)
|
84
|
-
subject.warn 'warning'
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
context 'with not quiet?' do
|
89
|
-
before do
|
90
|
-
subject.stub(:quiet?).and_return(false)
|
91
|
-
end
|
92
|
-
|
93
|
-
it 'calls #say with yellow coloring' do
|
94
|
-
stdout.should_receive(:print)
|
95
|
-
stdout.should_receive(:flush).with(no_args())
|
96
|
-
subject.warn 'warning'
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
describe '#deprecated' do
|
102
|
-
it 'prefixes the message with "[DEPRECATED]"' do
|
103
|
-
subject.should_receive(:warn).with('[DEPRECATION] That was deprecated!')
|
104
|
-
subject.deprecated 'That was deprecated!'
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
context '#error' do
|
109
|
-
context 'when quiet?' do
|
110
|
-
before do
|
111
|
-
subject.stub(:quiet?).and_return(true)
|
112
|
-
end
|
113
|
-
|
114
|
-
it "outputs an error message", :not_supported_on_windows do
|
115
|
-
stderr.should_receive(:puts)
|
116
|
-
subject.error 'error!'
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
context 'with not quiet?' do
|
121
|
-
before do
|
122
|
-
subject.stub(:quiet?).and_return(false)
|
123
|
-
end
|
124
|
-
|
125
|
-
it 'prints to stderr' do
|
126
|
-
stderr.should_receive(:puts).with(windows? ? "error!" : "\e[31merror!\e[0m")
|
127
|
-
subject.error 'error!'
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|
131
|
-
end
|