berkshelf 4.3.5 → 5.0.0
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.
- checksums.yaml +4 -4
- data/.travis.yml +12 -14
- data/CHANGELOG.md +326 -1131
- data/Gemfile +19 -2
- data/Gemfile.lock +152 -142
- data/README.md +4 -6
- data/Rakefile +10 -6
- data/berkshelf.gemspec +7 -21
- data/docs/berkshelf_for_newcomers.md +65 -0
- data/features/commands/install.feature +6 -6
- data/features/commands/search.feature +1 -1
- data/features/config.feature +5 -5
- data/features/lockfile.feature +2 -2
- data/features/step_definitions/utility_steps.rb +5 -3
- data/features/support/env.rb +3 -0
- data/lib/berkshelf.rb +3 -2
- data/lib/berkshelf/config.rb +10 -1
- data/lib/berkshelf/downloader.rb +34 -0
- data/lib/berkshelf/locations/git.rb +2 -2
- data/lib/berkshelf/locations/github.rb +13 -1
- data/lib/berkshelf/lockfile.rb +5 -2
- data/lib/berkshelf/version.rb +1 -1
- data/spec/unit/berkshelf/init_generator_spec.rb +1 -1
- data/spec/unit/berkshelf/lockfile_parser_spec.rb +8 -0
- data/spec/unit/berkshelf/lockfile_spec.rb +1 -0
- data/spec/unit/berkshelf/validator_spec.rb +1 -1
- data/spec/unit/berkshelf_spec.rb +27 -0
- metadata +26 -208
data/README.md
CHANGED
@@ -25,7 +25,9 @@ gem 'berkshelf'
|
|
25
25
|
|
26
26
|
Or run it as a standalone:
|
27
27
|
|
28
|
-
|
28
|
+
```shell
|
29
|
+
$ gem install berkshelf
|
30
|
+
```
|
29
31
|
|
30
32
|
## Usage
|
31
33
|
|
@@ -33,11 +35,7 @@ See [berkshelf.com](http://berkshelf.com) for up-to-date usage instructions.
|
|
33
35
|
|
34
36
|
## Supported Platforms
|
35
37
|
|
36
|
-
Berkshelf is tested on Ruby
|
37
|
-
|
38
|
-
Ruby 1.9 mode is required on all interpreters.
|
39
|
-
|
40
|
-
Ruby 1.9.1 and 1.9.2 are not officially supported. If you encounter problems, please upgrade to Ruby 2.0 or 1.9.3.
|
38
|
+
Berkshelf is tested and supported on Ruby 2.2 and 2.3.
|
41
39
|
|
42
40
|
## Configuration
|
43
41
|
|
data/Rakefile
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
|
3
|
-
|
3
|
+
begin
|
4
|
+
require "github_changelog_generator/task"
|
4
5
|
|
5
|
-
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
7
|
+
config.future_release = Berkshelf::VERSION
|
8
|
+
config.issues = false
|
9
|
+
config.enhancement_labels = "enhancement,Enhancement,New Feature,Feature".split(",")
|
10
|
+
config.bug_labels = "bug,Bug,Improvement".split(",")
|
11
|
+
config.exclude_labels = "duplicate,question,invalid,wontfix,no_changelog,Exclude From Changelog,Question,Upstream Bug,Discussion".split(",")
|
12
|
+
end
|
13
|
+
rescue LoadError
|
10
14
|
end
|
data/berkshelf.gemspec
CHANGED
@@ -27,36 +27,22 @@ Gem::Specification.new do |s|
|
|
27
27
|
s.name = 'berkshelf'
|
28
28
|
s.require_paths = ['lib']
|
29
29
|
s.version = Berkshelf::VERSION
|
30
|
-
s.required_ruby_version = '>= 2.
|
31
|
-
s.required_rubygems_version = '>=
|
30
|
+
s.required_ruby_version = '>= 2.2.0'
|
31
|
+
s.required_rubygems_version = '>= 2.0.0'
|
32
32
|
|
33
33
|
s.add_dependency 'addressable', '~> 2.3', '>= 2.3.4'
|
34
|
-
s.add_dependency 'berkshelf-api-client', '
|
35
|
-
s.add_dependency 'buff-config', '~>
|
36
|
-
s.add_dependency 'buff-extensions', '~>
|
34
|
+
s.add_dependency 'berkshelf-api-client', '>= 2.0.2', '< 4.0'
|
35
|
+
s.add_dependency 'buff-config', '~> 2.0'
|
36
|
+
s.add_dependency 'buff-extensions', '~> 2.0'
|
37
37
|
s.add_dependency 'buff-shell_out', '~> 0.1'
|
38
38
|
s.add_dependency 'cleanroom', '~> 1.0'
|
39
39
|
s.add_dependency 'faraday', '~> 0.9'
|
40
40
|
s.add_dependency 'httpclient', '~> 2.7'
|
41
41
|
s.add_dependency 'minitar', '~> 0.5', '>= 0.5.4'
|
42
42
|
s.add_dependency 'retryable', '~> 2.0'
|
43
|
-
s.add_dependency 'ridley', '~>
|
44
|
-
s.add_dependency 'solve', '
|
43
|
+
s.add_dependency 'ridley', '~> 5.0'
|
44
|
+
s.add_dependency 'solve', '> 2.0', '< 4.0'
|
45
45
|
s.add_dependency 'thor', '~> 0.19'
|
46
46
|
s.add_dependency 'octokit', '~> 4.0'
|
47
|
-
s.add_dependency 'celluloid', '= 0.16.0'
|
48
|
-
s.add_dependency 'celluloid-io', '~> 0.16.1'
|
49
47
|
s.add_dependency 'mixlib-archive', '~> 0.1'
|
50
|
-
|
51
|
-
s.add_development_dependency 'aruba', '~> 0.10.0' # Lock this here to avoid problems with public API changes
|
52
|
-
s.add_development_dependency 'chef-zero', '~> 4.0'
|
53
|
-
s.add_development_dependency 'dep_selector', '~> 1.0'
|
54
|
-
s.add_development_dependency 'fuubar', '~> 2.0'
|
55
|
-
s.add_development_dependency 'rake', '~> 10.1'
|
56
|
-
s.add_development_dependency 'rspec', '~> 3.0'
|
57
|
-
s.add_development_dependency 'spork', '~> 0.9'
|
58
|
-
s.add_development_dependency 'test-kitchen', '~> 1.2'
|
59
|
-
s.add_development_dependency 'webmock', '~> 1.11'
|
60
|
-
s.add_development_dependency 'yard', '~> 0.8'
|
61
|
-
s.add_development_dependency 'http', '~> 0.9', '>= 0.9.8'
|
62
48
|
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# Berkshelf for Newcomers
|
2
|
+
|
3
|
+
Berkshelf is a tool to help manage cookbook dependencies. If your cookbook depends on other cookbooks, Berkshelf lets you do the following:
|
4
|
+
|
5
|
+
* download all cookbooks you depend on to your local machine for development and testing using `berks install`
|
6
|
+
* upload your cookbook and all dependencies to your Chef server using `berks upload`
|
7
|
+
* update your dependencies using `berks update`
|
8
|
+
|
9
|
+
The above are the main Berkshelf commands that will comprise the bulk of your workflow.
|
10
|
+
|
11
|
+
Berkshelf is included in the ChefDK (at least at v.0.10.0), and `chef generate cookbook` will set up your cookbook with the necessary files for Berkshelf usage.
|
12
|
+
|
13
|
+
## A quick example
|
14
|
+
|
15
|
+
Suppose you have a cookbook with the following `metadata.rb`:
|
16
|
+
|
17
|
+
```
|
18
|
+
name 'example_cookbook'
|
19
|
+
description 'Installs/Configures example_cookbook'
|
20
|
+
long_description 'Installs/Configures example_cookbook'
|
21
|
+
version '0.1.0'
|
22
|
+
|
23
|
+
depends 'apt', '~> 2.3'
|
24
|
+
```
|
25
|
+
|
26
|
+
To work on this cookbook locally, you need to download an `apt` cookbook matching the constraints. Berkshelf handles this for you:
|
27
|
+
|
28
|
+
```
|
29
|
+
$ berks install
|
30
|
+
Resolving cookbook dependencies...
|
31
|
+
Fetching 'example_cookbook' from source at .
|
32
|
+
Fetching cookbook index from https://supermarket.chef.io...
|
33
|
+
Using example_cookbook (0.1.0) from source at .
|
34
|
+
Using apt (2.9.2)
|
35
|
+
```
|
36
|
+
|
37
|
+
When done your work, you need to push both your cookbook and the apt cookbook up to your Chef server. With Berkshelf:
|
38
|
+
|
39
|
+
```
|
40
|
+
$ berks upload
|
41
|
+
Uploaded apt (2.9.2) to: 'https://your_chef_server_url'
|
42
|
+
Uploaded example_cookbook (0.1.0) to: 'your_chef_server_url'
|
43
|
+
```
|
44
|
+
|
45
|
+
The above is a trivial example. If your cookbook has several dependencies, which in turn have dependencies, Berkshelf handles it all automatically, significantly improving your workflow.
|
46
|
+
|
47
|
+
## What's in the background
|
48
|
+
|
49
|
+
* the cookbook's `metadata.rb` specifies the cookbook dependencies and required versions
|
50
|
+
* the [Berksfile](http://berkshelf.com/v2.0/#the-berksfile) in your cookbook's root directory tells Berkshelf where to find cookbooks. You can have multiple sources, or can pull individual cookbooks from specific locations, such as your own Supermarket, GitHub, or a file server.
|
51
|
+
* `berks install` downloads cookbooks and their dependencies to the [Berkshelf](http://berkshelf.com/v2.0/#the-berkshelf), a place on your local disk.
|
52
|
+
* a Berksfile.lock is generated on `berks install` which specifies the exact cookbook versions that were used at that point
|
53
|
+
|
54
|
+
## Cookbook versioning
|
55
|
+
|
56
|
+
Berkshelf relies on cookbook versioning to work correctly. A cookbook's version is tracked in its `metadata.rb`, and should follow the guidelines outlined at http://semver.org/.
|
57
|
+
|
58
|
+
# Further reading
|
59
|
+
|
60
|
+
* The project homepage, http://http://berkshelf.com/v2.0/
|
61
|
+
* https://sethvargo.com/berkshelf-workflow/
|
62
|
+
|
63
|
+
--
|
64
|
+
|
65
|
+
Good luck with Berkshelf!
|
@@ -234,9 +234,9 @@ Feature: berks install
|
|
234
234
|
| berkshelf-cookbook-fixture | 1.0.0 | 93f5768b7d14df45e10d16c8bf6fe98ba3ff809a |
|
235
235
|
And the output should contain:
|
236
236
|
"""
|
237
|
-
Fetching 'berkshelf-cookbook-fixture' from
|
237
|
+
Fetching 'berkshelf-cookbook-fixture' from https://github.com/RiotGames/berkshelf-cookbook-fixture.git (at rel/cookbooks/berkshelf-cookbook-fixture)
|
238
238
|
Fetching cookbook index from http://0.0.0.0:26210...
|
239
|
-
Using berkshelf-cookbook-fixture (1.0.0) from
|
239
|
+
Using berkshelf-cookbook-fixture (1.0.0) from https://github.com/RiotGames/berkshelf-cookbook-fixture.git (at rel/cookbooks/berkshelf-cookbook-fixture)
|
240
240
|
"""
|
241
241
|
|
242
242
|
Scenario: installing a Berksfile that contains a Git location
|
@@ -307,9 +307,9 @@ Feature: berks install
|
|
307
307
|
| berkshelf-cookbook-fixture | 0.2.0 | 70a527e17d91f01f031204562460ad1c17f972ee |
|
308
308
|
And the output should contain:
|
309
309
|
"""
|
310
|
-
Fetching 'berkshelf-cookbook-fixture' from
|
310
|
+
Fetching 'berkshelf-cookbook-fixture' from https://github.com/RiotGames/berkshelf-cookbook-fixture.git (at v0.2.0)
|
311
311
|
Fetching cookbook index from http://0.0.0.0:26210...
|
312
|
-
Using berkshelf-cookbook-fixture (0.2.0) from
|
312
|
+
Using berkshelf-cookbook-fixture (0.2.0) from https://github.com/RiotGames/berkshelf-cookbook-fixture.git (at v0.2.0)
|
313
313
|
"""
|
314
314
|
|
315
315
|
Scenario: installing a Berksfile that contains a GitHub location
|
@@ -322,9 +322,9 @@ Feature: berks install
|
|
322
322
|
| berkshelf-cookbook-fixture | 0.2.0 | 70a527e17d91f01f031204562460ad1c17f972ee |
|
323
323
|
And the output should contain:
|
324
324
|
"""
|
325
|
-
Fetching 'berkshelf-cookbook-fixture' from
|
325
|
+
Fetching 'berkshelf-cookbook-fixture' from https://github.com/RiotGames/berkshelf-cookbook-fixture.git (at v0.2.0)
|
326
326
|
Fetching cookbook index from http://0.0.0.0:26210...
|
327
|
-
Using berkshelf-cookbook-fixture (0.2.0) from
|
327
|
+
Using berkshelf-cookbook-fixture (0.2.0) from https://github.com/RiotGames/berkshelf-cookbook-fixture.git (at v0.2.0)
|
328
328
|
"""
|
329
329
|
|
330
330
|
Scenario: running install when current project is a cookbook and the 'metadata' is specified
|
data/features/config.feature
CHANGED
@@ -3,7 +3,7 @@ Feature: Reading a Berkshelf configuration file
|
|
3
3
|
When I successfully run `berks cookbook sparkle_motion`
|
4
4
|
Then the resulting "sparkle_motion" Vagrantfile should contain:
|
5
5
|
| config.omnibus.chef_version = 'latest' |
|
6
|
-
| config.vm.box = '
|
6
|
+
| config.vm.box = 'bento/ubuntu-14.04' |
|
7
7
|
|
8
8
|
Scenario: Using a Berkshelf configuration file that sets the vagrant-omnibus plugin chef version
|
9
9
|
Given I have a Berkshelf config file containing:
|
@@ -14,7 +14,7 @@ Feature: Reading a Berkshelf configuration file
|
|
14
14
|
"version": "11.4.4"
|
15
15
|
},
|
16
16
|
"vm": {
|
17
|
-
"box": "
|
17
|
+
"box": "bento/ubuntu-14.04",
|
18
18
|
"forward_port": {
|
19
19
|
"12345": "54321"
|
20
20
|
}
|
@@ -25,7 +25,7 @@ Feature: Reading a Berkshelf configuration file
|
|
25
25
|
When I successfully run `berks cookbook sparkle_motion`
|
26
26
|
Then the resulting "sparkle_motion" Vagrantfile should contain:
|
27
27
|
| config.omnibus.chef_version = '11.4.4' |
|
28
|
-
| config.vm.box = '
|
28
|
+
| config.vm.box = 'bento/ubuntu-14.04' |
|
29
29
|
| config.vm.network :forwarded_port, guest: 12345, host: 54321 |
|
30
30
|
| config.vm.network :private_network, type: 'dhcp' |
|
31
31
|
And the exit status should be 0
|
@@ -39,7 +39,7 @@ Feature: Reading a Berkshelf configuration file
|
|
39
39
|
"version": "latest"
|
40
40
|
},
|
41
41
|
"vm": {
|
42
|
-
"box": "
|
42
|
+
"box": "bento/ubuntu-14.04",
|
43
43
|
"forward_port": {
|
44
44
|
"12345": "54321"
|
45
45
|
}
|
@@ -50,7 +50,7 @@ Feature: Reading a Berkshelf configuration file
|
|
50
50
|
When I successfully run `berks cookbook sparkle_motion`
|
51
51
|
Then the resulting "sparkle_motion" Vagrantfile should contain:
|
52
52
|
| config.omnibus.chef_version = 'latest' |
|
53
|
-
| config.vm.box = '
|
53
|
+
| config.vm.box = 'bento/ubuntu-14.04' |
|
54
54
|
| config.vm.network :forwarded_port, guest: 12345, host: 54321 |
|
55
55
|
| config.vm.network :private_network, type: 'dhcp' |
|
56
56
|
|
data/features/lockfile.feature
CHANGED
@@ -230,7 +230,7 @@ Feature: Creating and reading the Berkshelf lockfile
|
|
230
230
|
"""
|
231
231
|
DEPENDENCIES
|
232
232
|
berkshelf-cookbook-fixture
|
233
|
-
git:
|
233
|
+
git: https://github.com/RiotGames/berkshelf-cookbook-fixture.git
|
234
234
|
revision: 919afa0c402089df23ebdf36637f12271b8a96b4
|
235
235
|
ref: 919afa0
|
236
236
|
|
@@ -248,7 +248,7 @@ Feature: Creating and reading the Berkshelf lockfile
|
|
248
248
|
"""
|
249
249
|
DEPENDENCIES
|
250
250
|
berkshelf-cookbook-fixture
|
251
|
-
git:
|
251
|
+
git: https://github.com/RiotGames/berkshelf-cookbook-fixture.git
|
252
252
|
revision: 93f5768b7d14df45e10d16c8bf6fe98ba3ff809a
|
253
253
|
branch: rel
|
254
254
|
rel: cookbooks/berkshelf-cookbook-fixture
|
@@ -3,7 +3,9 @@ Given /^skip\s+"([^\"]+)"$/ do |msg|
|
|
3
3
|
end
|
4
4
|
|
5
5
|
Then /the output from \`(.+)\` should be the same as \`(.+)\`/ do |actual, expected|
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
run(actual)
|
7
|
+
actual_output = last_command_started.stdout
|
8
|
+
run(expected)
|
9
|
+
expected_output = last_command_started.stdout
|
10
|
+
expect(actual_output).to eql(expected_output)
|
9
11
|
end
|
data/features/support/env.rb
CHANGED
@@ -26,7 +26,9 @@ Spork.prefork do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
Before do
|
29
|
+
|
29
30
|
# Legacy ENV variables until we can move over to all InProcess
|
31
|
+
Berkshelf.instance_variable_set(:@berkshelf_path, nil)
|
30
32
|
ENV['BERKSHELF_PATH'] = berkshelf_path.to_s
|
31
33
|
ENV['BERKSHELF_CONFIG'] = Berkshelf.config.path.to_s
|
32
34
|
ENV['BERKSHELF_CHEF_CONFIG'] = chef_config_path.to_s
|
@@ -63,6 +65,7 @@ Spork.prefork do
|
|
63
65
|
Before('@spawn') do
|
64
66
|
aruba.config.command_launcher = :spawn
|
65
67
|
|
68
|
+
Berkshelf.instance_variable_set(:@berkshelf_path, nil)
|
66
69
|
set_environment_variable('BERKSHELF_PATH', berkshelf_path.to_s)
|
67
70
|
set_environment_variable('BERKSHELF_CONFIG', Berkshelf.config.path.to_s)
|
68
71
|
set_environment_variable('BERKSHELF_CHEF_CONFIG', chef_config_path.to_s)
|
data/lib/berkshelf.rb
CHANGED
@@ -17,6 +17,8 @@ require_relative 'berkshelf/core_ext'
|
|
17
17
|
require_relative 'berkshelf/thor_ext'
|
18
18
|
|
19
19
|
module Berkshelf
|
20
|
+
Encoding.default_external = Encoding::UTF_8
|
21
|
+
|
20
22
|
require_relative 'berkshelf/version'
|
21
23
|
require_relative 'berkshelf/errors'
|
22
24
|
|
@@ -67,8 +69,7 @@ module Berkshelf
|
|
67
69
|
#
|
68
70
|
# @return [String]
|
69
71
|
def berkshelf_path
|
70
|
-
|
71
|
-
File.expand_path(path)
|
72
|
+
@berkshelf_path ||= File.expand_path(ENV['BERKSHELF_PATH'] || '~/.berkshelf')
|
72
73
|
end
|
73
74
|
|
74
75
|
# The Berkshelf configuration.
|
data/lib/berkshelf/config.rb
CHANGED
@@ -107,7 +107,7 @@ module Berkshelf
|
|
107
107
|
default: false
|
108
108
|
attribute 'vagrant.vm.box',
|
109
109
|
type: String,
|
110
|
-
default: '
|
110
|
+
default: 'bento/ubuntu-14.04',
|
111
111
|
required: true
|
112
112
|
# @todo Deprecated, remove?
|
113
113
|
attribute 'vagrant.vm.box_url',
|
@@ -135,5 +135,14 @@ module Berkshelf
|
|
135
135
|
type: Array,
|
136
136
|
default: [],
|
137
137
|
required: false
|
138
|
+
attribute 'gitlab',
|
139
|
+
type: Array,
|
140
|
+
default: [],
|
141
|
+
required: false
|
142
|
+
attribute 'github_protocol',
|
143
|
+
# :git, :ssh, or :https
|
144
|
+
type: Symbol,
|
145
|
+
default: :https,
|
146
|
+
required: false
|
138
147
|
end
|
139
148
|
end
|
data/lib/berkshelf/downloader.rb
CHANGED
@@ -137,6 +137,40 @@ module Berkshelf
|
|
137
137
|
(! filename.to_s.start_with?('.')) && (unpack_dir + filename).cookbook?
|
138
138
|
end.first
|
139
139
|
|
140
|
+
(unpack_dir + cookbook_directory).to_s
|
141
|
+
when :gitlab
|
142
|
+
#Thread.exclusive { require 'octokit' unless defined?(Octokit) }
|
143
|
+
|
144
|
+
tmp_dir = Dir.mktmpdir
|
145
|
+
archive_path = Pathname.new(tmp_dir) + "#{name}-#{version}.tar.gz"
|
146
|
+
unpack_dir = Pathname.new(tmp_dir) + "#{name}-#{version}"
|
147
|
+
|
148
|
+
# Find the correct gitlab connection options for this specific cookbook.
|
149
|
+
cookbook_uri = URI.parse(remote_cookbook.location_path)
|
150
|
+
if cookbook_uri.host
|
151
|
+
options = Berkshelf::Config.instance.gitlab.detect { |opts| opts["web_endpoint"] == "#{cookbook_uri.scheme}://#{cookbook_uri.host}" }
|
152
|
+
raise ConfigurationError.new "Missing github endpoint configuration for #{cookbook_uri.scheme}://#{cookbook_uri.host}" if options == nil
|
153
|
+
end
|
154
|
+
|
155
|
+
connection ||= Faraday.new(url: options[:web_endpoint]) do |faraday|
|
156
|
+
faraday.headers[:accept] = 'application/x-tar'
|
157
|
+
faraday.response :logger, @logger unless @logger.nil?
|
158
|
+
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
|
159
|
+
end
|
160
|
+
|
161
|
+
resp = connection.get(cookbook_uri.request_uri + '&private_token=' + options[:private_token])
|
162
|
+
return nil unless resp.status == 200
|
163
|
+
open(archive_path, "wb") { |file| file.write(resp.body) }
|
164
|
+
|
165
|
+
tgz = Zlib::GzipReader.new(File.open(archive_path, "rb"))
|
166
|
+
Archive::Tar::Minitar.unpack(tgz, unpack_dir)
|
167
|
+
|
168
|
+
# The top level directory is inconsistant. So we unpack it and
|
169
|
+
# use the only directory created in the unpack_dir.
|
170
|
+
cookbook_directory = unpack_dir.entries.select do |filename|
|
171
|
+
(! filename.to_s.start_with?('.')) && (unpack_dir + filename).cookbook?
|
172
|
+
end.first
|
173
|
+
|
140
174
|
(unpack_dir + cookbook_directory).to_s
|
141
175
|
when :file_store
|
142
176
|
tmp_dir = Dir.mktmpdir
|
@@ -66,9 +66,9 @@ module Berkshelf
|
|
66
66
|
# Validate the scratched path is a valid cookbook
|
67
67
|
validate_cached!(scratch_path)
|
68
68
|
|
69
|
-
# If we got this far, we should
|
69
|
+
# If we got this far, we should atomically move
|
70
70
|
FileUtils.rm_rf(install_path) if install_path.exist?
|
71
|
-
FileUtils.
|
71
|
+
FileUtils.mv(scratch_path, install_path)
|
72
72
|
|
73
73
|
# Remove the git history
|
74
74
|
FileUtils.rm_rf(File.join(install_path, '.git'))
|
@@ -1,7 +1,19 @@
|
|
1
1
|
module Berkshelf
|
2
2
|
class GithubLocation < GitLocation
|
3
|
+
HOST = 'github.com'
|
3
4
|
def initialize(dependency, options = {})
|
4
|
-
|
5
|
+
protocol = Berkshelf::Config.instance.github_protocol || :https
|
6
|
+
case protocol
|
7
|
+
when :ssh
|
8
|
+
options[:git] = "git@#{HOST}:#{options.delete(:github)}.git"
|
9
|
+
when :https
|
10
|
+
options[:git] = "https://#{HOST}/#{options.delete(:github)}.git"
|
11
|
+
when :git
|
12
|
+
options[:git] = "git://#{HOST}/#{options.delete(:github)}.git"
|
13
|
+
else
|
14
|
+
# if some bizarre value is provided, treat it as :https
|
15
|
+
options[:git] = "https://#{HOST}/#{options.delete(:github)}.git"
|
16
|
+
end
|
5
17
|
super
|
6
18
|
end
|
7
19
|
end
|
data/lib/berkshelf/lockfile.rb
CHANGED
@@ -113,7 +113,7 @@ module Berkshelf
|
|
113
113
|
return false
|
114
114
|
end
|
115
115
|
|
116
|
-
if cookbook =
|
116
|
+
if cookbook = locked.cached_cookbook
|
117
117
|
Berkshelf.log.debug " Detected there is a cached cookbook"
|
118
118
|
|
119
119
|
unless (cookbook.dependencies.keys - graphed.dependencies.keys).empty?
|
@@ -587,6 +587,9 @@ module Berkshelf
|
|
587
587
|
end
|
588
588
|
|
589
589
|
@parsed_dependencies.each do |name, options|
|
590
|
+
graph_item = @lockfile.graph.find(name)
|
591
|
+
options[:locked_version] = graph_item.version if graph_item
|
592
|
+
|
590
593
|
dependency = Dependency.new(@berksfile, name, options)
|
591
594
|
@lockfile.add(dependency)
|
592
595
|
end
|
@@ -667,7 +670,7 @@ module Berkshelf
|
|
667
670
|
# We need to make a copy of the dependency, or else we could be
|
668
671
|
# modifying an existing object that other processes depend on!
|
669
672
|
dependency = dependency.dup
|
670
|
-
dependency.locked_version = item.version
|
673
|
+
dependency.locked_version = item.version unless dependency.locked_version
|
671
674
|
|
672
675
|
hash[item.name] = dependency
|
673
676
|
hash
|
data/lib/berkshelf/version.rb
CHANGED