berkshelf 3.1.5 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/berkshelf.gemspec +6 -5
  4. data/features/commands/search.feature +2 -2
  5. data/features/commands/vendor.feature +6 -2
  6. data/features/commands/verify.feature +29 -0
  7. data/features/config.feature +13 -48
  8. data/features/step_definitions/filesystem_steps.rb +2 -2
  9. data/features/step_definitions/gem_steps.rb +3 -1
  10. data/features/step_definitions/utility_steps.rb +2 -2
  11. data/generator_files/Vagrantfile.erb +30 -30
  12. data/generator_files/metadata.rb.erb +0 -1
  13. data/lib/berkshelf.rb +5 -2
  14. data/lib/berkshelf/berksfile.rb +41 -41
  15. data/lib/berkshelf/cli.rb +11 -1
  16. data/lib/berkshelf/community_rest.rb +1 -0
  17. data/lib/berkshelf/config.rb +18 -4
  18. data/lib/berkshelf/cookbook_store.rb +1 -1
  19. data/lib/berkshelf/downloader.rb +4 -0
  20. data/lib/berkshelf/errors.rb +0 -1
  21. data/lib/berkshelf/file_syncer.rb +134 -0
  22. data/lib/berkshelf/locations/base.rb +6 -1
  23. data/lib/berkshelf/locations/git.rb +2 -2
  24. data/lib/berkshelf/lockfile.rb +14 -2
  25. data/lib/berkshelf/uploader.rb +10 -17
  26. data/lib/berkshelf/validator.rb +37 -0
  27. data/lib/berkshelf/version.rb +1 -1
  28. data/lib/berkshelf/visualizer.rb +13 -6
  29. data/spec/spec_helper.rb +1 -1
  30. data/spec/support/kitchen.rb +3 -1
  31. data/spec/support/matchers/file_system_matchers.rb +1 -1
  32. data/spec/support/matchers/filepath_matchers.rb +38 -2
  33. data/spec/support/shared_examples/formatter.rb +7 -7
  34. data/spec/unit/berkshelf/berksfile_spec.rb +51 -21
  35. data/spec/unit/berkshelf/cached_cookbook_spec.rb +5 -5
  36. data/spec/unit/berkshelf/cli_spec.rb +1 -1
  37. data/spec/unit/berkshelf/community_rest_spec.rb +12 -12
  38. data/spec/unit/berkshelf/config_spec.rb +4 -4
  39. data/spec/unit/berkshelf/cookbook_generator_spec.rb +2 -2
  40. data/spec/unit/berkshelf/cookbook_store_spec.rb +6 -6
  41. data/spec/unit/berkshelf/core_ext/file_utils_spec.rb +3 -3
  42. data/spec/unit/berkshelf/core_ext/pathname_spec.rb +23 -6
  43. data/spec/unit/berkshelf/dependency_spec.rb +4 -4
  44. data/spec/unit/berkshelf/downloader_spec.rb +5 -1
  45. data/spec/unit/berkshelf/errors_spec.rb +1 -1
  46. data/spec/unit/berkshelf/file_syncer_spec.rb +206 -0
  47. data/spec/unit/berkshelf/init_generator_spec.rb +19 -22
  48. data/spec/unit/berkshelf/installer_spec.rb +6 -6
  49. data/spec/unit/berkshelf/locations/base_spec.rb +17 -8
  50. data/spec/unit/berkshelf/locations/git_spec.rb +34 -34
  51. data/spec/unit/berkshelf/locations/path_spec.rb +3 -3
  52. data/spec/unit/berkshelf/lockfile_parser_spec.rb +1 -1
  53. data/spec/unit/berkshelf/lockfile_spec.rb +50 -36
  54. data/spec/unit/berkshelf/packager_spec.rb +6 -4
  55. data/spec/unit/berkshelf/resolver/graph_spec.rb +3 -3
  56. data/spec/unit/berkshelf/resolver_spec.rb +3 -3
  57. data/spec/unit/berkshelf/shell_spec.rb +30 -24
  58. data/spec/unit/berkshelf/uploader_spec.rb +10 -36
  59. data/spec/unit/berkshelf/validator_spec.rb +30 -0
  60. data/spec/unit/berkshelf/visualizer_spec.rb +17 -2
  61. metadata +34 -15
  62. data/lib/berkshelf/mixin/dsl_eval.rb +0 -58
  63. data/spec/unit/berkshelf/mixin/dsl_eval_spec.rb +0 -55
@@ -1,58 +0,0 @@
1
- module Berkshelf
2
- module Mixin
3
- module DSLEval
4
- class CleanRoom
5
- attr_reader :instance
6
-
7
- def initialize(instance)
8
- @instance = instance
9
- end
10
- end
11
-
12
- class << self
13
- def included(base)
14
- base.send(:extend, ClassMethods)
15
- end
16
- end
17
-
18
- module ClassMethods
19
- def clean_room
20
- @clean_room ||= begin
21
- exposed_methods = self.exposed_methods
22
-
23
- Class.new(DSLEval::CleanRoom) do
24
- exposed_methods.each do |exposed_method|
25
- define_method(exposed_method) do |*args, &block|
26
- instance.send(exposed_method, *args, &block)
27
- end
28
- end
29
- end
30
- end
31
- end
32
-
33
- def expose_method(method)
34
- exposed_methods << method.to_sym
35
- end
36
-
37
- def exposed_methods
38
- @exposed_methods ||= Array.new
39
- end
40
- end
41
-
42
- # @return [Object]
43
- def dsl_eval(&block)
44
- self.class.clean_room.new(self).instance_eval(&block)
45
- self
46
- end
47
-
48
- # @param [String] filepath
49
- #
50
- # @return [Object]
51
- def dsl_eval_file(filepath)
52
- filepath = filepath.to_s
53
- contents = File.read(filepath)
54
- dsl_eval { eval(contents, binding, filepath, 1) }
55
- end
56
- end
57
- end
58
- end
@@ -1,55 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Berkshelf::Mixin::DSLEval do
4
- let(:klass) do
5
- klass = Class.new
6
- klass.send(:include, described_class)
7
- klass
8
- end
9
-
10
- describe "ClassMethods" do
11
- describe "::clean_room" do
12
- subject { klass.clean_room }
13
-
14
- it "returns an anonymous class inheriting from DSLEval::CleanRoom" do
15
- expect(subject.superclass).to eql(described_class::CleanRoom)
16
- end
17
- end
18
-
19
- describe "::expose_method" do
20
- subject { klass }
21
-
22
- it "adds a method to the exposed methods" do
23
- klass.expose_method(:something)
24
- expect(subject.exposed_methods).to have(1).item
25
- end
26
- end
27
-
28
- describe "::exposed_methods" do
29
- it "returns an array" do
30
- expect(klass.exposed_methods).to be_a(Array)
31
- end
32
- end
33
- end
34
-
35
- describe "#dsl_eval" do
36
- subject do
37
- klass.new.dsl_eval { }
38
- end
39
-
40
- it "returns an instance of the including class" do
41
- expect(subject).to be_a(klass)
42
- end
43
- end
44
-
45
- describe "#dsl_eval_file" do
46
- let(:filepath) { tmp_path.join('somefile') }
47
- before { FileUtils.touch(filepath) }
48
-
49
- subject { klass.new.dsl_eval_file(filepath) }
50
-
51
- it "returns an instance of the including class" do
52
- expect(subject).to be_a(klass)
53
- end
54
- end
55
- end