berkshelf 5.5.0 → 5.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -3
- data/Gemfile +31 -31
- data/Gemfile.lock +3 -3
- data/Guardfile +13 -13
- data/Rakefile +1 -0
- data/Thorfile +16 -16
- data/berkshelf.gemspec +35 -35
- data/features/step_definitions/chef/config_steps.rb +4 -4
- data/features/step_definitions/chef_server_steps.rb +6 -6
- data/features/step_definitions/cli_steps.rb +3 -3
- data/features/step_definitions/config_steps.rb +5 -5
- data/features/step_definitions/filesystem_steps.rb +12 -11
- data/features/support/env.rb +21 -21
- data/lib/berkshelf.rb +66 -66
- data/lib/berkshelf/base_generator.rb +10 -11
- data/lib/berkshelf/berksfile.rb +38 -38
- data/lib/berkshelf/cached_cookbook.rb +7 -7
- data/lib/berkshelf/cli.rb +126 -126
- data/lib/berkshelf/commands/shelf.rb +19 -18
- data/lib/berkshelf/commands/test_command.rb +2 -2
- data/lib/berkshelf/community_rest.rb +38 -38
- data/lib/berkshelf/config.rb +42 -41
- data/lib/berkshelf/cookbook_generator.rb +38 -38
- data/lib/berkshelf/cookbook_store.rb +4 -4
- data/lib/berkshelf/core_ext/file_utils.rb +1 -1
- data/lib/berkshelf/dependency.rb +23 -21
- data/lib/berkshelf/downloader.rb +24 -25
- data/lib/berkshelf/errors.rb +17 -17
- data/lib/berkshelf/file_syncer.rb +9 -8
- data/lib/berkshelf/formatters/human.rb +3 -3
- data/lib/berkshelf/formatters/json.rb +2 -2
- data/lib/berkshelf/init_generator.rb +64 -64
- data/lib/berkshelf/installer.rb +103 -102
- data/lib/berkshelf/location.rb +9 -9
- data/lib/berkshelf/locations/git.rb +16 -16
- data/lib/berkshelf/locations/github.rb +1 -1
- data/lib/berkshelf/locations/path.rb +2 -2
- data/lib/berkshelf/lockfile.rb +309 -315
- data/lib/berkshelf/mixin/git.rb +3 -3
- data/lib/berkshelf/packager.rb +4 -4
- data/lib/berkshelf/resolver.rb +2 -2
- data/lib/berkshelf/resolver/graph.rb +1 -1
- data/lib/berkshelf/shell.rb +1 -1
- data/lib/berkshelf/source.rb +6 -6
- data/lib/berkshelf/source_uri.rb +2 -2
- data/lib/berkshelf/ssl_policies.rb +3 -3
- data/lib/berkshelf/thor.rb +1 -1
- data/lib/berkshelf/uploader.rb +48 -48
- data/lib/berkshelf/validator.rb +2 -2
- data/lib/berkshelf/version.rb +1 -1
- data/lib/berkshelf/visualizer.rb +11 -11
- data/spec/config/knife.rb +2 -2
- data/spec/fixtures/Berksfile +3 -3
- data/spec/fixtures/cookbook-path/jenkins-config/metadata.rb +3 -3
- data/spec/fixtures/cookbook-store/jenkins-2.0.3/metadata.rb +5 -5
- data/spec/fixtures/cookbook-store/jenkins-2.0.4/metadata.rb +4 -4
- data/spec/fixtures/cookbooks/example_cookbook-0.5.0/metadata.rb +3 -3
- data/spec/fixtures/cookbooks/example_cookbook/metadata.rb +3 -3
- data/spec/spec_helper.rb +9 -9
- data/spec/support/chef_api.rb +11 -12
- data/spec/support/chef_server.rb +10 -10
- data/spec/support/git.rb +23 -23
- data/spec/support/kitchen.rb +2 -2
- data/spec/support/matchers/filepath_matchers.rb +2 -2
- data/spec/support/path_helpers.rb +12 -12
- data/spec/support/shared_examples/formatter.rb +1 -1
- data/spec/unit/berkshelf/berksfile_spec.rb +78 -78
- data/spec/unit/berkshelf/cached_cookbook_spec.rb +42 -42
- data/spec/unit/berkshelf/cli_spec.rb +6 -6
- data/spec/unit/berkshelf/community_rest_spec.rb +83 -83
- data/spec/unit/berkshelf/config_spec.rb +13 -13
- data/spec/unit/berkshelf/cookbook_generator_spec.rb +39 -39
- data/spec/unit/berkshelf/cookbook_store_spec.rb +41 -41
- data/spec/unit/berkshelf/core_ext/file_utils_spec.rb +5 -6
- data/spec/unit/berkshelf/core_ext/pathname_spec.rb +1 -1
- data/spec/unit/berkshelf/dependency_spec.rb +43 -43
- data/spec/unit/berkshelf/downloader_spec.rb +20 -20
- data/spec/unit/berkshelf/errors_spec.rb +3 -3
- data/spec/unit/berkshelf/file_syncer_spec.rb +86 -86
- data/spec/unit/berkshelf/formatters/base_spec.rb +23 -23
- data/spec/unit/berkshelf/formatters/human_spec.rb +2 -2
- data/spec/unit/berkshelf/formatters/json_spec.rb +2 -2
- data/spec/unit/berkshelf/formatters/null_spec.rb +3 -3
- data/spec/unit/berkshelf/init_generator_spec.rb +92 -92
- data/spec/unit/berkshelf/installer_spec.rb +8 -8
- data/spec/unit/berkshelf/location_spec.rb +11 -11
- data/spec/unit/berkshelf/locations/base_spec.rb +35 -35
- data/spec/unit/berkshelf/locations/git_spec.rb +87 -87
- data/spec/unit/berkshelf/locations/path_spec.rb +40 -40
- data/spec/unit/berkshelf/lockfile_parser_spec.rb +71 -71
- data/spec/unit/berkshelf/lockfile_spec.rb +197 -197
- data/spec/unit/berkshelf/logger_spec.rb +3 -3
- data/spec/unit/berkshelf/mixin/logging_spec.rb +5 -5
- data/spec/unit/berkshelf/packager_spec.rb +2 -2
- data/spec/unit/berkshelf/resolver/graph_spec.rb +1 -1
- data/spec/unit/berkshelf/resolver_spec.rb +17 -17
- data/spec/unit/berkshelf/shell_spec.rb +34 -34
- data/spec/unit/berkshelf/source_spec.rb +12 -11
- data/spec/unit/berkshelf/source_uri_spec.rb +1 -1
- data/spec/unit/berkshelf/ssl_policies_spec.rb +25 -25
- data/spec/unit/berkshelf/uploader_spec.rb +54 -54
- data/spec/unit/berkshelf/validator_spec.rb +16 -16
- data/spec/unit/berkshelf/visualizer_spec.rb +17 -17
- data/spec/unit/berkshelf_spec.rb +18 -18
- metadata +5 -5
data/lib/berkshelf/mixin/git.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "buff/shell_out"
|
2
2
|
|
3
3
|
module Berkshelf
|
4
4
|
module Mixin
|
@@ -13,11 +13,11 @@ module Berkshelf
|
|
13
13
|
# @raise [String]
|
14
14
|
# the +$stdout+ from the command
|
15
15
|
def git(command, error = true)
|
16
|
-
unless Berkshelf.which(
|
16
|
+
unless Berkshelf.which("git") || Berkshelf.which("git.exe") || Berkshelf.which("git.bat")
|
17
17
|
raise GitNotInstalled.new
|
18
18
|
end
|
19
19
|
|
20
|
-
response = Buff::ShellOut.shell_out(
|
20
|
+
response = Buff::ShellOut.shell_out(%{git #{command}})
|
21
21
|
|
22
22
|
if error && !response.success?
|
23
23
|
raise GitCommandError.new(command, cache_path, response.stderr)
|
data/lib/berkshelf/packager.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "archive/tar/minitar"
|
2
|
+
require "zlib"
|
3
3
|
|
4
4
|
module Berkshelf
|
5
5
|
# A class for archiving and compressing directory containing one or more cookbooks.
|
@@ -65,9 +65,9 @@ module Berkshelf
|
|
65
65
|
private
|
66
66
|
|
67
67
|
# @return [String]
|
68
|
-
|
68
|
+
attr_reader :out_dir
|
69
69
|
|
70
70
|
# @return [String]
|
71
|
-
|
71
|
+
attr_reader :filename
|
72
72
|
end
|
73
73
|
end
|
data/lib/berkshelf/resolver.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Berkshelf
|
2
2
|
class Resolver
|
3
3
|
|
4
|
-
require_relative
|
4
|
+
require_relative "resolver/graph"
|
5
5
|
|
6
6
|
extend Forwardable
|
7
7
|
|
@@ -75,7 +75,7 @@ module Berkshelf
|
|
75
75
|
graph.populate_store
|
76
76
|
graph.populate(berksfile.sources)
|
77
77
|
|
78
|
-
Solve.it!(graph, demand_array, ENV[
|
78
|
+
Solve.it!(graph, demand_array, ENV["DEBUG_RESOLVER"] ? { ui: Berkshelf.ui } : {}).collect do |name, version|
|
79
79
|
dependency = get_demand(name) || Dependency.new(berksfile, name)
|
80
80
|
dependency.locked_version = version
|
81
81
|
|
@@ -50,7 +50,7 @@ module Berkshelf
|
|
50
50
|
# @return [Array<Berkshelf::RemoteCookbook>]
|
51
51
|
def universe(sources)
|
52
52
|
cookbooks = []
|
53
|
-
Array(sources).each { |source| cookbooks
|
53
|
+
Array(sources).each { |source| cookbooks |= source.universe }
|
54
54
|
cookbooks
|
55
55
|
end
|
56
56
|
end
|
data/lib/berkshelf/shell.rb
CHANGED
data/lib/berkshelf/source.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "berkshelf/api-client"
|
2
|
+
require "berkshelf/ssl_policies"
|
3
|
+
require "openssl"
|
4
4
|
|
5
5
|
module Berkshelf
|
6
6
|
class Source
|
@@ -11,7 +11,7 @@ module Berkshelf
|
|
11
11
|
# @param [String, Berkshelf::SourceURI] source
|
12
12
|
def initialize(source)
|
13
13
|
@source = source
|
14
|
-
@universe
|
14
|
+
@universe = nil
|
15
15
|
end
|
16
16
|
|
17
17
|
def ssl_policy
|
@@ -20,7 +20,7 @@ module Berkshelf
|
|
20
20
|
|
21
21
|
def api_client
|
22
22
|
@api_client ||= begin
|
23
|
-
ssl_options = {verify: Berkshelf::Config.instance.ssl.verify}
|
23
|
+
ssl_options = { verify: Berkshelf::Config.instance.ssl.verify }
|
24
24
|
ssl_options[:cert_store] = ssl_policy.store if ssl_policy.store
|
25
25
|
|
26
26
|
if source == :chef_server
|
@@ -30,7 +30,7 @@ module Berkshelf
|
|
30
30
|
open_timeout: [(api_timeout / 10), 3].max,
|
31
31
|
client_name: Berkshelf::Config.instance.chef.node_name,
|
32
32
|
server_url: Berkshelf::Config.instance.chef.chef_server_url,
|
33
|
-
client_key: Berkshelf::Config.instance.chef.client_key
|
33
|
+
client_key: Berkshelf::Config.instance.chef.client_key
|
34
34
|
)
|
35
35
|
else
|
36
36
|
APIClient.new(uri,
|
data/lib/berkshelf/source_uri.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "addressable/uri"
|
2
2
|
|
3
3
|
module Berkshelf
|
4
4
|
class SourceURI < Addressable::URI
|
@@ -22,7 +22,7 @@ module Berkshelf
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
VALID_SCHEMES =
|
25
|
+
VALID_SCHEMES = %w{http https}.freeze
|
26
26
|
|
27
27
|
# @raise [Berkshelf::InvalidSourceURI]
|
28
28
|
def validate
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "openssl"
|
2
2
|
|
3
3
|
module Berkshelf
|
4
4
|
class SSLPolicy
|
@@ -18,13 +18,13 @@ module Berkshelf
|
|
18
18
|
def add_trusted_cert(cert)
|
19
19
|
@store.add_cert(cert)
|
20
20
|
rescue OpenSSL::X509::StoreError => e
|
21
|
-
raise e unless e.message ==
|
21
|
+
raise e unless e.message == "cert already in hash table"
|
22
22
|
end
|
23
23
|
|
24
24
|
def trusted_certs_dir
|
25
25
|
config_dir = Berkshelf.config.chef.trusted_certs_dir.to_s
|
26
26
|
if config_dir.empty? || !::File.exist?(config_dir)
|
27
|
-
File.join(ENV[
|
27
|
+
File.join(ENV["HOME"], ".chef", "trusted_certs")
|
28
28
|
else
|
29
29
|
config_dir
|
30
30
|
end
|
data/lib/berkshelf/thor.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require
|
1
|
+
require "berkshelf/cli"
|
data/lib/berkshelf/uploader.rb
CHANGED
@@ -44,32 +44,32 @@ module Berkshelf
|
|
44
44
|
# wrapping.
|
45
45
|
#
|
46
46
|
# @param [Array<String>] cookbooks
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
end
|
67
|
-
|
68
|
-
Berkshelf.formatter.skipping(cookbook, connection)
|
47
|
+
def upload(cookbooks)
|
48
|
+
Berkshelf.log.info "Starting upload"
|
49
|
+
|
50
|
+
Berkshelf.ridley_connection(options) do |connection|
|
51
|
+
cookbooks.each do |cookbook|
|
52
|
+
Berkshelf.log.debug " Uploading #{cookbook}"
|
53
|
+
|
54
|
+
begin
|
55
|
+
connection.cookbook.upload(cookbook.path,
|
56
|
+
name: cookbook.cookbook_name,
|
57
|
+
force: options[:force],
|
58
|
+
freeze: options[:freeze],
|
59
|
+
validate: options[:validate]
|
60
|
+
)
|
61
|
+
|
62
|
+
Berkshelf.formatter.uploaded(cookbook, connection)
|
63
|
+
rescue Ridley::Errors::FrozenCookbook
|
64
|
+
if options[:halt_on_frozen]
|
65
|
+
raise FrozenCookbook.new(cookbook)
|
69
66
|
end
|
67
|
+
|
68
|
+
Berkshelf.formatter.skipping(cookbook, connection)
|
70
69
|
end
|
71
70
|
end
|
72
71
|
end
|
72
|
+
end
|
73
73
|
|
74
74
|
# Filter cookbooks based off the list of dependencies in the Berksfile.
|
75
75
|
#
|
@@ -80,37 +80,37 @@ module Berkshelf
|
|
80
80
|
#
|
81
81
|
# @return [Array<CachedCookbook>]
|
82
82
|
#
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
83
|
+
def filtered_cookbooks
|
84
|
+
# Create a copy of the dependencies. We need to make a copy, or else
|
85
|
+
# we would be adding dependencies directly to the Berksfile object, and
|
86
|
+
# that would be a bad idea...
|
87
|
+
dependencies = berksfile.dependencies.map(&:name)
|
88
88
|
|
89
|
-
|
90
|
-
|
89
|
+
checked = {}
|
90
|
+
cookbooks = {}
|
91
91
|
|
92
|
-
|
93
|
-
|
92
|
+
dependencies.each do |dependency|
|
93
|
+
next if checked[dependency]
|
94
94
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
end
|
99
|
-
|
100
|
-
checked[dependency] = true
|
101
|
-
cookbooks[dependency] ||= lockfile.retrieve(dependency)
|
95
|
+
lockfile.graph.find(dependency).dependencies.each do |name, _|
|
96
|
+
cookbooks[name] ||= lockfile.retrieve(name)
|
97
|
+
dependencies << name
|
102
98
|
end
|
103
99
|
|
104
|
-
|
105
|
-
|
106
|
-
# to define their upload strategy instead of using Ridley.
|
107
|
-
#
|
108
|
-
# See https://github.com/berkshelf/berkshelf/pull/1316 for details.
|
109
|
-
if Berkshelf.chef_config.knife[:chef_guard] == true
|
110
|
-
cookbooks.values
|
111
|
-
else
|
112
|
-
cookbooks.values.sort
|
113
|
-
end
|
100
|
+
checked[dependency] = true
|
101
|
+
cookbooks[dependency] ||= lockfile.retrieve(dependency)
|
114
102
|
end
|
103
|
+
|
104
|
+
# This is a temporary change and will be removed in a future release. We should
|
105
|
+
# add the ability to define a custom uploader which would allow the authors of Chef-Guard
|
106
|
+
# to define their upload strategy instead of using Ridley.
|
107
|
+
#
|
108
|
+
# See https://github.com/berkshelf/berkshelf/pull/1316 for details.
|
109
|
+
if Berkshelf.chef_config.knife[:chef_guard] == true
|
110
|
+
cookbooks.values
|
111
|
+
else
|
112
|
+
cookbooks.values.sort
|
113
|
+
end
|
114
|
+
end
|
115
115
|
end
|
116
116
|
end
|
data/lib/berkshelf/validator.rb
CHANGED
@@ -24,9 +24,9 @@ module Berkshelf
|
|
24
24
|
Array(cookbooks).each do |cookbook|
|
25
25
|
path = cookbook.path.to_s
|
26
26
|
|
27
|
-
files = Dir.glob(File.join(path,
|
27
|
+
files = Dir.glob(File.join(path, "**", "*.rb")).select do |f|
|
28
28
|
parent = Pathname.new(path).dirname.to_s
|
29
|
-
f.gsub(parent,
|
29
|
+
f.gsub(parent, "") =~ /[[:space:]]/
|
30
30
|
end
|
31
31
|
|
32
32
|
raise InvalidCookbookFiles.new(cookbook, files) unless files.empty?
|
data/lib/berkshelf/version.rb
CHANGED
data/lib/berkshelf/visualizer.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "buff/shell_out"
|
2
|
+
require "set"
|
3
|
+
require "tempfile"
|
4
4
|
|
5
5
|
module Berkshelf
|
6
6
|
class Visualizer
|
@@ -56,7 +56,7 @@ module Berkshelf
|
|
56
56
|
out = %|digraph Solve__Graph {\n|
|
57
57
|
|
58
58
|
nodes.each do |node|
|
59
|
-
out <<
|
59
|
+
out << %{ "#{node}" [ fontsize = 10, label = "#{node}" ]\n}
|
60
60
|
end
|
61
61
|
|
62
62
|
nodes.each do |node|
|
@@ -67,7 +67,7 @@ module Berkshelf
|
|
67
67
|
else
|
68
68
|
label = " #{version}"
|
69
69
|
end
|
70
|
-
out <<
|
70
|
+
out << %{ "#{node}" -> "#{name}" [ fontsize = 10, label = "#{label}" ]\n}
|
71
71
|
end
|
72
72
|
end
|
73
73
|
end
|
@@ -76,8 +76,8 @@ module Berkshelf
|
|
76
76
|
out
|
77
77
|
end
|
78
78
|
|
79
|
-
def to_dot_file(outfile =
|
80
|
-
File.open(outfile,
|
79
|
+
def to_dot_file(outfile = "graph.dot")
|
80
|
+
File.open(outfile, "w") { |f| f.write(to_dot) }
|
81
81
|
File.expand_path(outfile)
|
82
82
|
end
|
83
83
|
|
@@ -88,16 +88,16 @@ module Berkshelf
|
|
88
88
|
#
|
89
89
|
# @return [String]
|
90
90
|
# the path where the file was written
|
91
|
-
def to_png(outfile =
|
92
|
-
tempfile = Tempfile.new(
|
91
|
+
def to_png(outfile = "graph.png")
|
92
|
+
tempfile = Tempfile.new("dotdotfile")
|
93
93
|
tempfile.write(to_dot)
|
94
94
|
tempfile.rewind
|
95
95
|
|
96
|
-
unless Berkshelf.which(
|
96
|
+
unless Berkshelf.which("dot") || Berkshelf.which("dot.exe")
|
97
97
|
raise GraphvizNotInstalled.new
|
98
98
|
end
|
99
99
|
|
100
|
-
command =
|
100
|
+
command = %{dot -T png #{tempfile.path} -o "#{outfile}"}
|
101
101
|
response = shell_out(command)
|
102
102
|
|
103
103
|
unless response.success?
|
data/spec/config/knife.rb
CHANGED
@@ -5,6 +5,6 @@ client_key File.expand_path("spec/config/berkshelf.pem")
|
|
5
5
|
validation_client_name "validator"
|
6
6
|
validation_key File.expand_path("spec/config/validator.pem")
|
7
7
|
chef_server_url "http://localhost:26310"
|
8
|
-
cache_type
|
8
|
+
cache_type "BasicFile"
|
9
9
|
cache_options( :path => "#{ENV['HOME']}/.chef/checksums" )
|
10
|
-
cookbook_path
|
10
|
+
cookbook_path []
|
data/spec/fixtures/Berksfile
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
cookbook
|
2
|
-
cookbook
|
3
|
-
cookbook
|
1
|
+
cookbook "ntp", "<= 1.0.0"
|
2
|
+
cookbook "mysql"
|
3
|
+
cookbook "nginx", "< 0.101.2"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
name
|
2
|
-
version
|
1
|
+
name "jenkins-config"
|
2
|
+
version "0.1.0"
|
3
3
|
|
4
|
-
depends
|
4
|
+
depends "jenkins", "~> 2.0"
|
@@ -1,6 +1,6 @@
|
|
1
|
-
name
|
2
|
-
version
|
1
|
+
name "jenkins"
|
2
|
+
version "2.0.3"
|
3
3
|
|
4
|
-
depends
|
5
|
-
depends
|
6
|
-
depends
|
4
|
+
depends "apt", "~> 2.0"
|
5
|
+
depends "runit", "~> 1.5"
|
6
|
+
depends "yum", "~> 3.0"
|
@@ -1,5 +1,5 @@
|
|
1
|
-
name
|
2
|
-
version
|
1
|
+
name "jenkins"
|
2
|
+
version "2.0.4"
|
3
3
|
|
4
|
-
depends
|
5
|
-
depends
|
4
|
+
depends "apt", "~> 2.0"
|
5
|
+
depends "runit", "~> 1.5"
|
@@ -1,3 +1,3 @@
|
|
1
|
-
name
|
2
|
-
maintainer
|
3
|
-
version
|
1
|
+
name "example_cookbook"
|
2
|
+
maintainer "Berkshelf Core"
|
3
|
+
version "0.5.0"
|
@@ -1,3 +1,3 @@
|
|
1
|
-
name
|
2
|
-
maintainer
|
3
|
-
version
|
1
|
+
name "example_cookbook"
|
2
|
+
maintainer "Berkshelf Core"
|
3
|
+
version "0.5.0"
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "spork"
|
2
2
|
|
3
3
|
def windows?
|
4
4
|
!!(RUBY_PLATFORM =~ /mswin|mingw|windows/)
|
@@ -7,12 +7,12 @@ end
|
|
7
7
|
BERKS_SPEC_DATA = File.expand_path("../data", __FILE__)
|
8
8
|
|
9
9
|
Spork.prefork do
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
13
|
-
require
|
10
|
+
require "rspec"
|
11
|
+
require "cleanroom/rspec"
|
12
|
+
require "webmock/rspec"
|
13
|
+
require "berkshelf/api/rspec" unless windows?
|
14
14
|
|
15
|
-
Dir[
|
15
|
+
Dir["spec/support/**/*.rb"].each { |f| require File.expand_path(f) }
|
16
16
|
|
17
17
|
RSpec.configure do |config|
|
18
18
|
config.include Berkshelf::RSpec::FileSystemMatchers
|
@@ -44,7 +44,7 @@ Spork.prefork do
|
|
44
44
|
end
|
45
45
|
|
46
46
|
config.before(:all) do
|
47
|
-
ENV[
|
47
|
+
ENV["BERKSHELF_PATH"] = berkshelf_path.to_s
|
48
48
|
end
|
49
49
|
|
50
50
|
config.before(:each) do
|
@@ -71,7 +71,7 @@ Spork.prefork do
|
|
71
71
|
end
|
72
72
|
|
73
73
|
Spork.each_run do
|
74
|
-
require
|
74
|
+
require "berkshelf"
|
75
75
|
|
76
76
|
module Berkshelf
|
77
77
|
class GitLocation
|
@@ -80,7 +80,7 @@ Spork.each_run do
|
|
80
80
|
alias :real_clone :clone
|
81
81
|
def clone
|
82
82
|
fake_remote = generate_fake_git_remote(uri, tags: @branch ? [@branch] : [])
|
83
|
-
tmp_clone = File.join(self.class.tmpdir, uri.gsub(/[\/:]/,
|
83
|
+
tmp_clone = File.join(self.class.tmpdir, uri.gsub(/[\/:]/, "-"))
|
84
84
|
@uri = "file://#{fake_remote}"
|
85
85
|
real_clone
|
86
86
|
end
|