cookbook-omnifetch 0.1.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.
@@ -0,0 +1,108 @@
1
+ require 'spec_helper'
2
+ require 'cookbook-omnifetch/path'
3
+
4
+ module CookbookOmnifetch
5
+ describe PathLocation do
6
+ let(:relative_paths_root) { File.dirname(__FILE__) }
7
+ let(:constraint) { double('constraint', satisfies?: true) }
8
+ let(:dependency) do
9
+ double('dependency',
10
+ name: 'nginx',
11
+ version_constraint: constraint,
12
+ relative_paths_root: relative_paths_root
13
+ )
14
+ end
15
+ let(:path) { fixtures_path.join('cookbooks', 'example_cookbook') }
16
+ let(:relative_path) { Pathname.new('../fixtures/cookbooks/example_cookbook') }
17
+
18
+ subject { described_class.new(dependency, path: path) }
19
+
20
+ describe '#installed?' do
21
+ it 'returns false' do
22
+ expect(subject.installed?).to be false
23
+ end
24
+ end
25
+
26
+ describe '#install' do
27
+ it 'validates the cached cookbook' do
28
+ expect(subject).to receive(:validate_cached!).with(path)
29
+ subject.install
30
+ end
31
+ end
32
+
33
+ describe '#cached_cookbook' do
34
+ it 'loads the cached cookbook at the path' do
35
+ expect(MockCachedCookbook).to receive(:from_path).with(path)
36
+ subject.cached_cookbook
37
+ end
38
+ end
39
+
40
+ describe '#relative_path' do
41
+ it 'returns the path to the Berksfile' do
42
+ expect(subject.relative_path).to eq(relative_path)
43
+ end
44
+ end
45
+
46
+ describe '#expanded_path' do
47
+ it 'returns the expanded path, relative to the Berksfile' do
48
+ absolute_path = Pathname.new(File.expand_path(relative_path, relative_paths_root))
49
+ expect(subject.expanded_path).to eq(absolute_path)
50
+ end
51
+ end
52
+
53
+ describe '#==' do
54
+ it 'is false when compared with a non-PathLocation' do
55
+ this = PathLocation.new(dependency, path: '.')
56
+ that = 'A string'
57
+ expect(this).to_not eq(that)
58
+ end
59
+
60
+ it 'is false when the metadata? is not the same' do
61
+ this = PathLocation.new(dependency, path: '.')
62
+ that = PathLocation.new(dependency, path: '.', metadata: true)
63
+ expect(this).to_not eq(that)
64
+ end
65
+
66
+ it 'is false when the expanded paths are different' do
67
+ this = PathLocation.new(dependency, path: '.')
68
+ that = PathLocation.new(dependency, path: '..')
69
+ expect(this).to_not eq(that)
70
+ end
71
+
72
+ it 'is true when they are the same' do
73
+ this = PathLocation.new(dependency, path: '.', metadata: true)
74
+ that = PathLocation.new(dependency, path: '.', metadata: true)
75
+ expect(this).to eq(that)
76
+ end
77
+ end
78
+
79
+ describe '#to_lock' do
80
+ it 'includes the path relative to the Berksfile' do
81
+ expect(subject.to_lock).to eq <<-EOH.gsub(/^ {10}/, '')
82
+ path: #{relative_path}
83
+ EOH
84
+ end
85
+
86
+ it 'includes the metadata attribute' do
87
+ subject.stub(:metadata?).and_return(true)
88
+ expect(subject.to_lock).to eq <<-EOH.gsub(/^ {10}/, '')
89
+ path: #{relative_path}
90
+ metadata: true
91
+ EOH
92
+ end
93
+ end
94
+
95
+ describe '#to_s' do
96
+ it 'uses the relative path' do
97
+ expect(subject.to_s).to eq("source at #{relative_path}")
98
+ end
99
+ end
100
+
101
+ describe '#inspect' do
102
+ it 'includes the right information' do
103
+ subject.stub(:metadata?).and_return(true)
104
+ expect(subject.inspect).to eq("#<CookbookOmnifetch::PathLocation metadata: true, path: #{relative_path}>")
105
+ end
106
+ end
107
+ end
108
+ end
metadata ADDED
@@ -0,0 +1,144 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cookbook-omnifetch
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jamie Winsor
8
+ - Josiah Kiehl
9
+ - Michael Ivey
10
+ - Justin Campbell
11
+ - Seth Vargo
12
+ - Daniel DeLeo
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+ date: 2014-06-30 00:00:00.000000000 Z
17
+ dependencies:
18
+ - !ruby/object:Gem::Dependency
19
+ name: minitar
20
+ requirement: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ~>
23
+ - !ruby/object:Gem::Version
24
+ version: 0.5.4
25
+ type: :runtime
26
+ prerelease: false
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ~>
30
+ - !ruby/object:Gem::Version
31
+ version: 0.5.4
32
+ - !ruby/object:Gem::Dependency
33
+ name: rake
34
+ requirement: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ~>
37
+ - !ruby/object:Gem::Version
38
+ version: '10.3'
39
+ type: :development
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '10.3'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ~>
51
+ - !ruby/object:Gem::Version
52
+ version: '3.0'
53
+ type: :development
54
+ prerelease: false
55
+ version_requirements: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ~>
58
+ - !ruby/object:Gem::Version
59
+ version: '3.0'
60
+ description:
61
+ email:
62
+ - jamie@vialstudios.com
63
+ - jkiehl@riotgames.com
64
+ - michael.ivey@riotgames.com
65
+ - justin@justincampbell.me
66
+ - sethvargo@gmail.com
67
+ - dan@getchef.com
68
+ executables: []
69
+ extensions: []
70
+ extra_rdoc_files: []
71
+ files:
72
+ - .gitignore
73
+ - .rspec
74
+ - Gemfile
75
+ - LICENSE
76
+ - README.md
77
+ - Rakefile
78
+ - cookbook-omnifetch.gemspec
79
+ - lib/cookbook-omnifetch.rb
80
+ - lib/cookbook-omnifetch/artifactserver.rb
81
+ - lib/cookbook-omnifetch/base.rb
82
+ - lib/cookbook-omnifetch/exceptions.rb
83
+ - lib/cookbook-omnifetch/git.rb
84
+ - lib/cookbook-omnifetch/github.rb
85
+ - lib/cookbook-omnifetch/integration.rb
86
+ - lib/cookbook-omnifetch/path.rb
87
+ - lib/cookbook-omnifetch/version.rb
88
+ - spec/fixtures/cookbooks/example_cookbook-0.5.0/README.md
89
+ - spec/fixtures/cookbooks/example_cookbook-0.5.0/metadata.rb
90
+ - spec/fixtures/cookbooks/example_cookbook-0.5.0/recipes/default.rb
91
+ - spec/fixtures/cookbooks/example_cookbook/.gitignore
92
+ - spec/fixtures/cookbooks/example_cookbook/.kitchen.yml
93
+ - spec/fixtures/cookbooks/example_cookbook/Berksfile
94
+ - spec/fixtures/cookbooks/example_cookbook/Berksfile.lock
95
+ - spec/fixtures/cookbooks/example_cookbook/README.md
96
+ - spec/fixtures/cookbooks/example_cookbook/metadata.rb
97
+ - spec/fixtures/cookbooks/example_cookbook/recipes/default.rb
98
+ - spec/spec_helper.rb
99
+ - spec/unit/artifactserver_spec.rb
100
+ - spec/unit/base_spec.rb
101
+ - spec/unit/git_spec.rb
102
+ - spec/unit/path_spec.rb
103
+ homepage: http://www.getchef.com/
104
+ licenses:
105
+ - Apache 2.0
106
+ metadata: {}
107
+ post_install_message:
108
+ rdoc_options: []
109
+ require_paths:
110
+ - lib
111
+ required_ruby_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - '>='
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ required_rubygems_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ requirements: []
122
+ rubyforge_project:
123
+ rubygems_version: 2.0.3
124
+ signing_key:
125
+ specification_version: 4
126
+ summary: Library code to fetch Chef cookbooks from a variety of sources to a local
127
+ cache
128
+ test_files:
129
+ - spec/fixtures/cookbooks/example_cookbook-0.5.0/README.md
130
+ - spec/fixtures/cookbooks/example_cookbook-0.5.0/metadata.rb
131
+ - spec/fixtures/cookbooks/example_cookbook-0.5.0/recipes/default.rb
132
+ - spec/fixtures/cookbooks/example_cookbook/.gitignore
133
+ - spec/fixtures/cookbooks/example_cookbook/.kitchen.yml
134
+ - spec/fixtures/cookbooks/example_cookbook/Berksfile
135
+ - spec/fixtures/cookbooks/example_cookbook/Berksfile.lock
136
+ - spec/fixtures/cookbooks/example_cookbook/README.md
137
+ - spec/fixtures/cookbooks/example_cookbook/metadata.rb
138
+ - spec/fixtures/cookbooks/example_cookbook/recipes/default.rb
139
+ - spec/spec_helper.rb
140
+ - spec/unit/artifactserver_spec.rb
141
+ - spec/unit/base_spec.rb
142
+ - spec/unit/git_spec.rb
143
+ - spec/unit/path_spec.rb
144
+ has_rdoc: