vanagon 0.15.32 → 0.15.33

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 375fd51fd8b1c6621ed0e099c37a0dc5eba86d71e95dfa46f5ec1377cf08e6d2
4
- data.tar.gz: 5674166cac8d6076372b19349eb067da104060690f0d2a50be8323e49321f6bd
3
+ metadata.gz: ef3ecc339b5f864a0ab7e3f63aade38439c35decacd7502a67867cdf3121a5df
4
+ data.tar.gz: e04110e53343d000e100230e11bf1083f07306a69c7a93c53bb0c7dcbe1cd965
5
5
  SHA512:
6
- metadata.gz: 9f700b9835591d643b30cd619f71515268a512a524b042aaf53f0884c99462eea30f9844b51f7b470c6afc16a41580f3336004e81cdcc393731e855531c929b8
7
- data.tar.gz: 41ff4776775dde183725b665fc83532dfba334acabdd5615f5e6d28e42f0aa6d738ee07a7e3ec2c81437cd01b68afc009d088828e748ed1944ef48b13ec6790b
6
+ metadata.gz: 1e5522d4f11a224d03011dd2d4eef0d6ad016ee12371b57d8bdc3309b509d71fae8262245551329e0e5556f4f12207fbc3ef00861da33054a9190237ce47a9fc
7
+ data.tar.gz: b25a4b76077dd3f5489d0523c60e0710c1b57341aad9c3cdd8c43ef70c92383b4057dcdfecada28565a0623012885275ad0c03b53117c169b2fb1a2af11ac992
@@ -333,6 +333,15 @@ class Vanagon
333
333
  @component.options[:ref] = the_ref
334
334
  end
335
335
 
336
+ # Sets clone option for git repository
337
+ #
338
+ # @param option for cloning and value
339
+ def clone_option(option, value)
340
+ option_sym = option.to_sym
341
+ @component.options[:clone_options] ||= {}
342
+ @component.options[:clone_options][option_sym] = value
343
+ end
344
+
336
345
  # Set a build dir relative to the source directory.
337
346
  #
338
347
  # The build dir will be created before the configure block runs and configure/build/install commands will be run
@@ -35,7 +35,8 @@ class Vanagon
35
35
  return Vanagon::Component::Source::Git.new uri,
36
36
  sum: options[:sum],
37
37
  ref: options[:ref],
38
- workdir: options[:workdir]
38
+ workdir: options[:workdir],
39
+ clone_options: options[:clone_options]
39
40
  end
40
41
 
41
42
  if source_type == :http
@@ -12,7 +12,7 @@ class Vanagon
12
12
  class Component
13
13
  class Source
14
14
  class Git
15
- attr_accessor :url, :ref, :workdir
15
+ attr_accessor :url, :ref, :workdir, :clone_options
16
16
  attr_reader :version, :default_options, :repo
17
17
 
18
18
  class << self
@@ -55,6 +55,7 @@ class Vanagon
55
55
  @url = URI.parse(url.to_s)
56
56
  @ref = opts[:ref]
57
57
  @workdir = File.realpath(workdir)
58
+ @clone_options = opts[:clone_options] ||= {}
58
59
 
59
60
  # We can test for Repo existence without cloning
60
61
  raise Vanagon::InvalidRepo, "#{url} not a valid Git repo" unless valid_remote?
@@ -98,7 +99,11 @@ class Vanagon
98
99
  # Perform a git clone of @url as a lazy-loaded
99
100
  # accessor for @clone
100
101
  def clone
101
- @clone ||= ::Git.clone(url, dirname, path: workdir)
102
+ if @clone_options.empty?
103
+ @clone ||= ::Git.clone(url, dirname, path: workdir)
104
+ else
105
+ @clone ||= ::Git.clone(url, dirname, path: workdir, **clone_options)
106
+ end
102
107
  end
103
108
 
104
109
  # Attempt to connect to whatever URL is provided and
@@ -118,7 +118,7 @@ class Vanagon
118
118
  # @raise if the instance_eval on Project fails, the exception is reraised
119
119
  def self.load_project(name, configdir, platform, include_components = [])
120
120
  projfile = File.join(configdir, "#{name}.rb")
121
- dsl = Vanagon::Project::DSL.new(name, platform, include_components)
121
+ dsl = Vanagon::Project::DSL.new(name, File.dirname(configdir), platform, include_components)
122
122
  dsl.instance_eval(File.read(projfile), projfile, 1)
123
123
  dsl._project
124
124
  rescue StandardError => e
@@ -153,6 +153,7 @@ class Vanagon
153
153
  @compiled_archive = false
154
154
  @generate_packages = true
155
155
  @yaml_settings = false
156
+ @upstream_metadata = {}
156
157
  @no_packaging = false
157
158
  @artifacts_to_fetch = []
158
159
  end
@@ -693,23 +694,42 @@ class Vanagon
693
694
  end
694
695
  end
695
696
 
697
+ # Recursive merge of metadata hashes
698
+ # Input is not modified
699
+ # In case of duplicate keys, original value is kept
700
+ #
701
+ # @param original [Hash] Metadata hash from original project
702
+ # @param upstream [Hash] Metadata hash from upstream project
703
+ # @return [Hash]
704
+ def metadata_merge(original, upstream)
705
+ upstream.merge(original) do |key, upstream_value, original_value|
706
+ if original_value.is_a?(Hash)
707
+ metadata_merge(original_value, upstream_value)
708
+ else
709
+ original_value
710
+ end
711
+ end
712
+ end
713
+
696
714
  # Writes a json file at `ext/build_metadata.<project>.<platform>.json` containing information
697
715
  # about what went into a built artifact
698
716
  #
699
717
  # @return [Hash] of build information
700
718
  def save_manifest_json(platform)
701
- manifest = build_manifest_json(true)
719
+ manifest = build_manifest_json
720
+ metadata = metadata_merge(manifest, @upstream_metadata)
721
+
702
722
  ext_directory = 'ext'
703
723
  FileUtils.mkdir_p ext_directory
704
724
 
705
725
  metadata_file_name = "build_metadata.#{name}.#{platform.name}.json"
706
726
  File.open(File.join(ext_directory, metadata_file_name), 'w') do |f|
707
- f.write(manifest)
727
+ f.write(JSON.pretty_generate(metadata))
708
728
  end
709
729
 
710
730
  ## VANAGON-132 Backwards compatibility: make a 'build_metadata.json' file
711
731
  File.open(File.join(ext_directory, 'build_metadata.json'), 'w') do |f|
712
- f.write(manifest)
732
+ f.write(JSON.pretty_generate(metadata))
713
733
  end
714
734
  end
715
735
 
@@ -749,17 +769,18 @@ class Vanagon
749
769
  # @param upstream_project_name [String] The name of the vanagon project to load
750
770
  # @param upstream_git_url [URI] The URL to clone this vanagon project from
751
771
  # @param upstream_git_branch [String] The branch of the vanagon project to clone from
752
- def load_upstream_settings(upstream_project_name, upstream_git_url, upstream_git_branch)
772
+ def load_upstream_settings(upstream_project_name, upstream_git_url, upstream_git_branch) # rubocop:disable Metrics/AbcSize
753
773
  Dir.mktmpdir do |working_directory|
754
774
  upstream_source = Vanagon::Component::Source::Git.new(upstream_git_url, workdir: working_directory, ref: upstream_git_branch)
755
775
  upstream_source.fetch
756
- # We don't want to load any of the upstream components, so we're going to
757
- # pass an array with an empty string as the component list for load_project
758
- no_components = ['']
759
- upstream_platform = Vanagon::Platform.load_platform(platform.name, File.join(working_directory, upstream_source.dirname, "configs", "platforms"))
760
- upstream_project = Vanagon::Project.load_project(upstream_project_name, File.join(working_directory, upstream_source.dirname, "configs", "projects"), upstream_platform, no_components)
761
- @settings.merge!(upstream_project.settings)
762
- upstream_project.cleanup
776
+
777
+ Dir.chdir(File.join(working_directory, upstream_source.dirname)) do
778
+ upstream_platform = Vanagon::Platform.load_platform(platform.name, File.join(working_directory, upstream_source.dirname, "configs", "platforms"))
779
+ upstream_project = Vanagon::Project.load_project(upstream_project_name, File.join(working_directory, upstream_source.dirname, "configs", "projects"), upstream_platform)
780
+ @settings.merge!(upstream_project.settings)
781
+ @upstream_metadata = upstream_project.build_manifest_json
782
+ upstream_project.cleanup
783
+ end
763
784
  end
764
785
  end
765
786
 
@@ -799,5 +820,18 @@ class Vanagon
799
820
  @settings.merge!(YAML.safe_load(File.read(yaml_path), [Symbol]))
800
821
  end
801
822
  end
823
+
824
+ def load_upstream_metadata(metadata_uri)
825
+ puts "Loading metadata from #{metadata_uri}"
826
+ case metadata_uri
827
+ when /^http/
828
+ @upstream_metadata = JSON.parse(Net::HTTP.get(URI(metadata_uri)))
829
+ when /^file/
830
+ filename = metadata_uri.sub(/^file:\/\//, '')
831
+ @upstream_metadata = JSON.parse(File.read(filename))
832
+ else
833
+ raise Vanagon::Error, "Metadata URI must be 'file://' or 'http://', don't know how to parse #{metadata_uri}"
834
+ end
835
+ end
802
836
  end
803
837
  end
@@ -12,13 +12,15 @@ class Vanagon
12
12
  # Constructor for the DSL object
13
13
  #
14
14
  # @param name [String] name of the project
15
+ # @param configdir [String] location for 'configs' directory for this project
15
16
  # @param platform [Vanagon::Platform] platform for the project to build against
16
17
  # @param include_components [List] optional list restricting the loaded components
17
18
  # @return [Vanagon::Project::DSL] A DSL object to describe the {Vanagon::Project}
18
- def initialize(name, platform, include_components = [])
19
+ def initialize(name, configdir, platform, include_components = [])
19
20
  @name = name
20
21
  @project = Vanagon::Project.new(@name, platform)
21
22
  @include_components = include_components.to_set
23
+ @configdir = configdir
22
24
  end
23
25
 
24
26
  # Primary way of interacting with the DSL
@@ -179,11 +181,11 @@ class Vanagon
179
181
  # and reachable from the current commit in that repository.
180
182
  #
181
183
  def release_from_git
182
- repo_object = Git.open(File.expand_path("..", Vanagon::Driver.configdir))
184
+ repo_object = Git.open(File.expand_path("..", @configdir))
183
185
  last_tag = repo_object.describe('HEAD', { :abbrev => 0 })
184
186
  release(repo_object.rev_list("#{last_tag}..HEAD", { :count => true }))
185
187
  rescue Git::GitExecuteError
186
- warn "Directory '#{dirname}' cannot be versioned by git. Maybe it hasn't been tagged yet?"
188
+ warn "Directory '#{File.expand_path('..', @configdir)}' cannot be versioned by git. Maybe it hasn't been tagged yet?"
187
189
  end
188
190
 
189
191
  # Sets the version for the project based on a git describe of the
@@ -191,10 +193,10 @@ class Vanagon
191
193
  # and reachable from the current commit in that repository.
192
194
  #
193
195
  def version_from_git
194
- git_version = Git.open(File.expand_path("..", Vanagon::Driver.configdir)).describe('HEAD', tags: true)
196
+ git_version = Git.open(File.expand_path("..", @configdir)).describe('HEAD', tags: true)
195
197
  version(git_version.split('-').reject(&:empty?).join('.'))
196
198
  rescue Git::GitExecuteError
197
- warn "Directory '#{dirname}' cannot be versioned by git. Maybe it hasn't been tagged yet?"
199
+ warn "Directory '#{File.expand_path('..', @configdir)}' cannot be versioned by git. Maybe it hasn't been tagged yet?"
198
200
  end
199
201
 
200
202
  # Get the version string from a git branch name. This will look for a '.'
@@ -204,7 +206,7 @@ class Vanagon
204
206
  #
205
207
  # @return version string parsed from branch name, fails if unable to find version
206
208
  def version_from_branch
207
- branch = Git.open(File.expand_path("..", Vanagon::Driver.configdir)).current_branch
209
+ branch = Git.open(File.expand_path("..", @configdir)).current_branch
208
210
  if branch =~ /(\d+(\.\d+)+)/
209
211
  return $1
210
212
  else
@@ -268,7 +270,7 @@ class Vanagon
268
270
  def component(name)
269
271
  warn "Loading #{name}" if @project.settings[:verbose]
270
272
  if @include_components.empty? or @include_components.include?(name)
271
- component = Vanagon::Component.load_component(name, File.join(Vanagon::Driver.configdir, "components"), @project.settings, @project.platform)
273
+ component = Vanagon::Component.load_component(name, File.join(@configdir, "components"), @project.settings, @project.platform)
272
274
  @project.components << component
273
275
  end
274
276
  end
@@ -334,8 +336,9 @@ class Vanagon
334
336
  #
335
337
  # @param yaml_settings_uri [String] URI (file://... or http://...) to a file containing a yaml representation of vanagon settings
336
338
  # @param yaml_settings_sha1_uri [String] URI (file://... or http://...) to a file the sha1sum for the settings file
337
- def inherit_yaml_settings(yaml_settings_uri, yaml_settings_sha1_uri = nil)
339
+ def inherit_yaml_settings(yaml_settings_uri, yaml_settings_sha1_uri = nil, metadata_uri: nil)
338
340
  @project.load_yaml_settings(yaml_settings_uri, yaml_settings_sha1_uri)
341
+ @project.load_upstream_metadata(metadata_uri) if metadata_uri
339
342
  end
340
343
 
341
344
  # Set a package override. Will call the platform-specific implementation
@@ -869,4 +869,15 @@ end" }
869
869
  expect(comp._component.rpm_ghost_files).to eq([Vanagon::Common::Pathname.file('ghost')])
870
870
  end
871
871
  end
872
+
873
+ describe "#clone option" do
874
+ it "sets a branch and depth options correctly" do
875
+ comp = Vanagon::Component::DSL.new('test-fixture', {}, {})
876
+ comp.clone_option 'depth', 10
877
+ comp.clone_option 'branch', 'foo'
878
+
879
+ expect(comp._component.options[:clone_options][:depth]).to eq(10)
880
+ expect(comp._component.options[:clone_options][:branch]).to eq('foo')
881
+ end
882
+ end
872
883
  end
@@ -38,6 +38,40 @@ describe "Vanagon::Component::Source::Git" do
38
38
  expect(git_source.workdir)
39
39
  .to eq('/tmp/bar')
40
40
  end
41
+
42
+ it "with no clone options should be empty" do
43
+ git_source = @klass.new(@local_url, ref: @ref_tag, workdir: "/tmp/foo")
44
+ expect(git_source.clone_options)
45
+ .to be {}
46
+ end
47
+
48
+ it "add clone options depth and branch" do
49
+ expected_clone_options = {:branch => "bar", :depth => 50 }
50
+ git_source = @klass.new(@local_url, ref: @ref_tag, workdir: "/tmp/foo", :clone_options => expected_clone_options)
51
+ expect(git_source.clone_options)
52
+ .to be(expected_clone_options)
53
+ end
54
+ end
55
+
56
+ describe "#clone" do
57
+ before :each do
58
+ clone = double(Git::Base)
59
+ @file_path = "/tmp/foo"
60
+ allow(::Git).to receive(:clone).and_return(clone)
61
+ expect(File).to receive(:realpath).and_return(@file_path)
62
+ end
63
+ it "repository" do
64
+ git_source = @klass.new(@url, ref: @ref_tag, workdir: "/tmp/foo")
65
+ expect(::Git).to receive(:clone).with(git_source.url, git_source.dirname, path: @file_path)
66
+ git_source.clone
67
+ end
68
+
69
+ it "a particular branch with a depth" do
70
+ expected_clone_options = {:branch => "foo", :depth => 50 }
71
+ git_source = @klass.new(@url, ref: @ref_tag, workdir: "/tmp/foo", :clone_options => expected_clone_options)
72
+ expect(::Git).to receive(:clone).with(git_source.url, git_source.dirname, path: @file_path, **expected_clone_options)
73
+ git_source.clone
74
+ end
41
75
  end
42
76
 
43
77
  describe "#dirname" do
@@ -19,6 +19,7 @@ WORKDIR = "#{WORK_BASE}/workdir"
19
19
  WIXTESTFILES = File.expand_path("./spec/fixtures/wix/resources/windows/wix")
20
20
 
21
21
  describe "Vanagon::Platform::Windows" do
22
+ let(:configdir) { '/a/b/c' }
22
23
  platforms =[
23
24
  {
24
25
  :name => "windows-2012r2-x64",
@@ -75,7 +76,7 @@ describe "Vanagon::Platform::Windows" do
75
76
  it "skips package generation for 'archive' package types" do
76
77
  cur_plat.instance_eval(plat[:block])
77
78
  cur_plat.package_type 'archive'
78
- proj = Vanagon::Project::DSL.new('test-fixture', cur_plat._platform, [])
79
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, cur_plat._platform, [])
79
80
  proj.instance_eval(project_block)
80
81
  expect(cur_plat._platform.generate_package(proj._project)).to eq([])
81
82
  end
@@ -83,7 +84,7 @@ describe "Vanagon::Platform::Windows" do
83
84
  it "generates a package_name for 'archive' package types" do
84
85
  cur_plat.instance_eval(plat[:block])
85
86
  cur_plat.package_type 'archive'
86
- proj = Vanagon::Project::DSL.new('test-fixture', cur_plat._platform, [])
87
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, cur_plat._platform, [])
87
88
  proj.instance_eval(project_block)
88
89
  expect(cur_plat._platform.package_name(proj._project)).to eq('test-fixture-0.0.0-archive')
89
90
  end
@@ -91,7 +92,7 @@ describe "Vanagon::Platform::Windows" do
91
92
  it "skips packaging artifact generation for 'archive' package types" do
92
93
  cur_plat.instance_eval(plat[:block])
93
94
  cur_plat.package_type 'archive'
94
- proj = Vanagon::Project::DSL.new('test-fixture', cur_plat._platform, [])
95
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, cur_plat._platform, [])
95
96
  proj.instance_eval(project_block)
96
97
  expect(cur_plat._platform.generate_packaging_artifacts('',proj._project.name,'',proj._project)).to eq(nil)
97
98
  end
@@ -207,7 +208,7 @@ describe "Vanagon::Platform::Windows" do
207
208
  describe "generate_wix_dirs" do
208
209
 
209
210
  it "returns one directory with install_service defaults" do
210
- proj = Vanagon::Project::DSL.new('test-fixture', vanagon_platform, [])
211
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, vanagon_platform, [])
211
212
  proj.instance_eval(project_block)
212
213
  cur_plat.instance_eval(plat[:block])
213
214
  comp = Vanagon::Component::DSL.new('service-test', {}, cur_plat._platform)
@@ -223,7 +224,7 @@ describe "Vanagon::Platform::Windows" do
223
224
  end
224
225
 
225
226
  it "returns one directory with non-default name" do
226
- proj = Vanagon::Project::DSL.new('test-fixture', vanagon_platform, [])
227
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, vanagon_platform, [])
227
228
  proj.instance_eval(project_block)
228
229
  cur_plat.instance_eval(plat[:block])
229
230
  comp = Vanagon::Component::DSL.new('service-test', {}, cur_plat._platform)
@@ -239,7 +240,7 @@ describe "Vanagon::Platform::Windows" do
239
240
  end
240
241
 
241
242
  it "returns nested directory correctly with \\" do
242
- proj = Vanagon::Project::DSL.new('test-fixture', vanagon_platform, [])
243
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, vanagon_platform, [])
243
244
  proj.instance_eval(project_block)
244
245
  cur_plat.instance_eval(plat[:block])
245
246
  comp = Vanagon::Component::DSL.new('service-test', {}, cur_plat._platform)
@@ -259,7 +260,7 @@ describe "Vanagon::Platform::Windows" do
259
260
 
260
261
 
261
262
  it "adds a second directory for the same input but different components" do
262
- proj = Vanagon::Project::DSL.new('test-fixture', vanagon_platform, [])
263
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, vanagon_platform, [])
263
264
  proj.instance_eval(project_block)
264
265
  cur_plat.instance_eval(plat[:block])
265
266
  comp = Vanagon::Component::DSL.new('service-test', {}, cur_plat._platform)
@@ -278,7 +279,7 @@ describe "Vanagon::Platform::Windows" do
278
279
  end
279
280
 
280
281
  it "returns correctly formatted multiple nested directories" do
281
- proj = Vanagon::Project::DSL.new('test-fixture', vanagon_platform, [])
282
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, vanagon_platform, [])
282
283
  proj.instance_eval(project_block)
283
284
  cur_plat.instance_eval(plat[:block])
284
285
  comp = Vanagon::Component::DSL.new('service-test-1', {}, cur_plat._platform)
@@ -14,8 +14,7 @@ end" }
14
14
 
15
15
  describe '#version_from_git' do
16
16
  it 'sets the version based on the git describe' do
17
- expect(Vanagon::Driver).to receive(:configdir).and_return(configdir)
18
- proj = Vanagon::Project::DSL.new('test-fixture', platform)
17
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform)
19
18
  proj.instance_eval(project_block)
20
19
 
21
20
  # Lying is bad. You shouldn't lie. But sometimes when you're
@@ -37,8 +36,7 @@ end" }
37
36
  expect(proj._project.version).to eq('1.2.3.1234')
38
37
  end
39
38
  it 'sets the version based on the git describe with multiple dashes' do
40
- expect(Vanagon::Driver).to receive(:configdir).and_return(configdir)
41
- proj = Vanagon::Project::DSL.new('test-fixture', platform)
39
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform)
42
40
  proj.instance_eval(project_block)
43
41
 
44
42
  # See previous description of "indescribable cyclopean obelisk"
@@ -62,8 +60,7 @@ end" }
62
60
  tag = double
63
61
  log = double
64
62
  diff = double
65
- expect(Vanagon::Driver).to receive(:configdir).and_return(configdir)
66
- proj = Vanagon::Project::DSL.new('test-fixture', platform)
63
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform)
67
64
  proj.instance_eval(project_block)
68
65
  repo = double("repo")
69
66
  expect(::Git)
@@ -93,8 +90,7 @@ end" }
93
90
  '3.8' => '3.8',
94
91
  }
95
92
 
96
- expect(Vanagon::Driver).to receive(:configdir).exactly(branches.length).times.and_return(configdir)
97
- proj = Vanagon::Project::DSL.new('test-fixture', platform)
93
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform)
98
94
  proj.instance_eval(project_block)
99
95
 
100
96
  branches.each do |branch, version|
@@ -118,8 +114,7 @@ end" }
118
114
  'just-a-branch-name'
119
115
  ]
120
116
 
121
- expect(Vanagon::Driver).to receive(:configdir).exactly(branches.length).times.and_return(configdir)
122
- proj = Vanagon::Project::DSL.new('test-fixture', platform)
117
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform)
123
118
  proj.instance_eval(project_block)
124
119
 
125
120
  branches.each do |branch|
@@ -140,7 +135,7 @@ end" }
140
135
 
141
136
  describe '#directory' do
142
137
  it 'adds a directory to the list of directories' do
143
- proj = Vanagon::Project::DSL.new('test-fixture', platform)
138
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform)
144
139
  proj.instance_eval(project_block)
145
140
  proj.directory('/a/b/c/d', mode: '0755')
146
141
  expect(proj._project.directories).to include(Vanagon::Common::Pathname.new('/a/b/c/d', mode: '0755'))
@@ -149,7 +144,7 @@ end" }
149
144
 
150
145
  describe '#user' do
151
146
  it 'sets a user for the project' do
152
- proj = Vanagon::Project::DSL.new('test-fixture', platform)
147
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform)
153
148
  proj.instance_eval(project_block)
154
149
  proj.user('test-user')
155
150
  expect(proj._project.user).to eq(Vanagon::Common::User.new('test-user'))
@@ -158,7 +153,7 @@ end" }
158
153
 
159
154
  describe '#target_repo' do
160
155
  it 'sets the target_repo for the project' do
161
- proj = Vanagon::Project::DSL.new('test-fixture', platform)
156
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform)
162
157
  proj.instance_eval(project_block)
163
158
  proj.target_repo "pc1"
164
159
  expect(proj._project.repo).to eq("pc1")
@@ -167,7 +162,7 @@ end" }
167
162
 
168
163
  describe '#noarch' do
169
164
  it 'sets noarch on the project to true' do
170
- proj = Vanagon::Project::DSL.new('test-fixture', platform)
165
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform)
171
166
  proj.instance_eval(project_block)
172
167
  proj.noarch
173
168
  expect(proj._project.noarch).to eq(true)
@@ -176,20 +171,20 @@ end" }
176
171
 
177
172
  describe '#generate_source_artifacts' do
178
173
  it 'defaults to false' do
179
- proj = Vanagon::Project::DSL.new('test-fixture', platform)
174
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform)
180
175
  proj.instance_eval(project_block)
181
176
  expect(proj._project.source_artifacts).to eq(false)
182
177
  end
183
178
 
184
179
  it 'sets source_artifacts to true' do
185
- proj = Vanagon::Project::DSL.new('test-fixture', platform)
180
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform)
186
181
  proj.instance_eval(project_block)
187
182
  proj.generate_source_artifacts true
188
183
  expect(proj._project.source_artifacts).to eq(true)
189
184
  end
190
185
 
191
186
  it 'sets source_artifacts to false' do
192
- proj = Vanagon::Project::DSL.new('test-fixture', platform)
187
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform)
193
188
  proj.instance_eval(project_block)
194
189
  proj.generate_source_artifacts false
195
190
  expect(proj._project.source_artifacts).to eq(false)
@@ -198,7 +193,7 @@ end" }
198
193
 
199
194
  describe '#identifier' do
200
195
  it 'sets the identifier for the project' do
201
- proj = Vanagon::Project::DSL.new('test-fixture', platform)
196
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform)
202
197
  proj.instance_eval(project_block)
203
198
  proj.identifier "com.example"
204
199
  expect(proj._project.identifier).to eq("com.example")
@@ -207,14 +202,14 @@ end" }
207
202
 
208
203
  describe '#cleanup_during_build' do
209
204
  it 'sets @cleanup to true' do
210
- proj = Vanagon::Project::DSL.new('test-fixture', platform)
205
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform)
211
206
  proj.instance_eval(project_block)
212
207
  proj.cleanup_during_build
213
208
  expect(proj._project.cleanup).to eq(true)
214
209
  end
215
210
 
216
211
  it 'defaults to nil' do
217
- proj = Vanagon::Project::DSL.new('test-fixture', platform)
212
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform)
218
213
  proj.instance_eval(project_block)
219
214
  expect(proj._project.cleanup).to be_nil
220
215
  end
@@ -224,7 +219,7 @@ end" }
224
219
  let(:version_file) { '/opt/puppetlabs/puppet/VERSION' }
225
220
 
226
221
  it 'sets version_file for the project' do
227
- proj = Vanagon::Project::DSL.new('test-fixture', platform)
222
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform)
228
223
  proj.instance_eval(project_block)
229
224
  proj.write_version_file(version_file)
230
225
  expect(proj._project.version_file.path).to eq(version_file)
@@ -233,14 +228,14 @@ end" }
233
228
 
234
229
  describe "#release" do
235
230
  it 'sets the release for the project' do
236
- proj = Vanagon::Project::DSL.new('test-fixture', platform)
231
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform)
237
232
  proj.instance_eval(project_block)
238
233
  proj.release '12'
239
234
  expect(proj._project.release).to eq('12')
240
235
  end
241
236
 
242
237
  it 'defaults to 1' do
243
- proj = Vanagon::Project::DSL.new('test-fixture', platform)
238
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform)
244
239
  proj.instance_eval(project_block)
245
240
  expect(proj._project.release).to eq('1')
246
241
  end
@@ -249,7 +244,6 @@ end" }
249
244
  describe "#provides" do
250
245
  before do
251
246
  allow_any_instance_of(Vanagon::Project::DSL).to receive(:puts)
252
- allow(Vanagon::Driver).to receive(:configdir).and_return(configdir)
253
247
  @el_plat = Vanagon::Platform::DSL.new('el-5-x86_64')
254
248
  @el_plat.instance_eval("platform 'el-5-x86_64' do |plat| end")
255
249
  @deb_plat = Vanagon::Platform::DSL.new('ubuntu-16.04-amd64')
@@ -257,7 +251,7 @@ end" }
257
251
  end
258
252
 
259
253
  it 'adds the package provide to the list of provides' do
260
- proj = Vanagon::Project::DSL.new('test-fixture', platform)
254
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform)
261
255
  proj.instance_eval(project_block)
262
256
  proj.provides('thing1')
263
257
  proj.provides('thing2')
@@ -269,7 +263,7 @@ end" }
269
263
  # we don't actually use deb versions for provides at this point, but
270
264
  # testing it works nonetheless
271
265
  it 'supports deb versioned provides' do
272
- proj = Vanagon::Project::DSL.new('test-fixture', @deb_plat._platform, [])
266
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, @deb_plat._platform, [])
273
267
  proj.instance_eval(project_block)
274
268
  proj.provides('thing1', '1.2.3')
275
269
  expect(proj._project.get_provides.count).to eq(1)
@@ -288,7 +282,7 @@ end" }
288
282
  '=' => '='
289
283
  }
290
284
  operators.each do |initial, munged|
291
- proj = Vanagon::Project::DSL.new('test-fixture', @deb_plat._platform, [])
285
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, @deb_plat._platform, [])
292
286
  proj.instance_eval(project_block)
293
287
  proj.provides('thing1', "#{initial}1.2.3")
294
288
  expect(proj._project.get_provides.count).to eq(1)
@@ -300,7 +294,7 @@ end" }
300
294
  it 'adds whitespace for rpm versions' do
301
295
  operators=['<','>','<=','>=','=']
302
296
  operators.each do |operator|
303
- proj = Vanagon::Project::DSL.new('test-fixture', @el_plat._platform, [])
297
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, @el_plat._platform, [])
304
298
  proj.instance_eval(project_block)
305
299
  proj.provides('thing1', "#{operator}1.2.3")
306
300
  expect(proj._project.get_provides.count).to eq(1)
@@ -310,7 +304,7 @@ end" }
310
304
  end
311
305
 
312
306
  it 'supports versioned provides' do
313
- proj = Vanagon::Project::DSL.new('test-fixture', @el_plat._platform, [])
307
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, @el_plat._platform, [])
314
308
  proj.instance_eval(project_block)
315
309
  proj.provides('thing1', '1.2.3')
316
310
  expect(proj._project.get_provides.count).to eq(1)
@@ -319,7 +313,7 @@ end" }
319
313
  end
320
314
 
321
315
  it 'gets rid of duplicates' do
322
- proj = Vanagon::Project::DSL.new('test-fixture', @el_plat._platform, [])
316
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, @el_plat._platform, [])
323
317
  proj.instance_eval(project_block)
324
318
  proj.provides('thing1', '1.2.3')
325
319
  proj.provides('thing1', '>=1.2.3')
@@ -332,7 +326,6 @@ end" }
332
326
  describe "#replaces" do
333
327
  before do
334
328
  allow_any_instance_of(Vanagon::Project::DSL).to receive(:puts)
335
- allow(Vanagon::Driver).to receive(:configdir).and_return(configdir)
336
329
  @el_plat = Vanagon::Platform::DSL.new('el-5-x86_64')
337
330
  @el_plat.instance_eval("platform 'el-5-x86_64' do |plat| end")
338
331
  @deb_plat = Vanagon::Platform::DSL.new('ubuntu-16.04-amd64')
@@ -340,7 +333,7 @@ end" }
340
333
  end
341
334
 
342
335
  it 'adds the package replacement to the list of replacements' do
343
- proj = Vanagon::Project::DSL.new('test-fixture', platform)
336
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform)
344
337
  proj.instance_eval(project_block)
345
338
  proj.replaces('thing1')
346
339
  proj.replaces('thing2')
@@ -350,7 +343,7 @@ end" }
350
343
  end
351
344
 
352
345
  it 'supports versioned replaces' do
353
- proj = Vanagon::Project::DSL.new('test-fixture', @el_plat._platform, [])
346
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, @el_plat._platform, [])
354
347
  proj.instance_eval(project_block)
355
348
  proj.replaces('thing1', '1.2.3')
356
349
  expect(proj._project.get_replaces.count).to eq(1)
@@ -359,7 +352,7 @@ end" }
359
352
  end
360
353
 
361
354
  it 'supports deb versioned replaces' do
362
- proj = Vanagon::Project::DSL.new('test-fixture', @deb_plat._platform, [])
355
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, @deb_plat._platform, [])
363
356
  proj.instance_eval(project_block)
364
357
  proj.replaces('thing1', '1.2.3')
365
358
  expect(proj._project.get_replaces.count).to eq(1)
@@ -376,7 +369,7 @@ end" }
376
369
  '=' => '='
377
370
  }
378
371
  operators.each do |initial, munged|
379
- proj = Vanagon::Project::DSL.new('test-fixture', @deb_plat._platform, [])
372
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, @deb_plat._platform, [])
380
373
  proj.instance_eval(project_block)
381
374
  proj.replaces('thing1', "#{initial}1.2.3")
382
375
  expect(proj._project.get_replaces.count).to eq(1)
@@ -388,7 +381,7 @@ end" }
388
381
  it 'adds whitespace for rpm versions' do
389
382
  operators=['<','>','<=','>=','=']
390
383
  operators.each do |operator|
391
- proj = Vanagon::Project::DSL.new('test-fixture', @el_plat._platform, [])
384
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, @el_plat._platform, [])
392
385
  proj.instance_eval(project_block)
393
386
  proj.replaces('thing1', "#{operator}1.2.3")
394
387
  expect(proj._project.get_replaces.count).to eq(1)
@@ -398,7 +391,7 @@ end" }
398
391
  end
399
392
 
400
393
  it 'gets rid of duplicates' do
401
- proj = Vanagon::Project::DSL.new('test-fixture', @el_plat._platform, [])
394
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, @el_plat._platform, [])
402
395
  proj.instance_eval(project_block)
403
396
  proj.replaces('thing1', '1.2.3')
404
397
  proj.replaces('thing1', '<1.2.3')
@@ -411,7 +404,6 @@ end" }
411
404
  describe "#conflicts" do
412
405
  before do
413
406
  allow_any_instance_of(Vanagon::Project::DSL).to receive(:puts)
414
- allow(Vanagon::Driver).to receive(:configdir).and_return(configdir)
415
407
  @el_plat = Vanagon::Platform::DSL.new('el-5-x86_64')
416
408
  @el_plat.instance_eval("platform 'el-5-x86_64' do |plat| end")
417
409
  @deb_plat = Vanagon::Platform::DSL.new('ubuntu-16.04-amd64')
@@ -419,7 +411,7 @@ end" }
419
411
  end
420
412
 
421
413
  it 'adds the package conflict to the list of conflicts' do
422
- proj = Vanagon::Project::DSL.new('test-fixture', platform)
414
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform)
423
415
  proj.instance_eval(project_block)
424
416
  proj.conflicts('thing1')
425
417
  proj.conflicts('thing2')
@@ -429,7 +421,7 @@ end" }
429
421
  end
430
422
 
431
423
  it 'supports versioned conflicts' do
432
- proj = Vanagon::Project::DSL.new('test-fixture', @el_plat._platform, [])
424
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, @el_plat._platform, [])
433
425
  proj.instance_eval(project_block)
434
426
  proj.conflicts('thing1', '1.2.3')
435
427
  expect(proj._project.get_conflicts.count).to eq(1)
@@ -438,7 +430,7 @@ end" }
438
430
  end
439
431
 
440
432
  it 'supports deb versioned conflicts' do
441
- proj = Vanagon::Project::DSL.new('test-fixture', @deb_plat._platform, [])
433
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, @deb_plat._platform, [])
442
434
  proj.instance_eval(project_block)
443
435
  proj.conflicts('thing1', '1.2.3')
444
436
  expect(proj._project.get_conflicts.count).to eq(1)
@@ -455,7 +447,7 @@ end" }
455
447
  '=' => '='
456
448
  }
457
449
  operators.each do |initial, munged|
458
- proj = Vanagon::Project::DSL.new('test-fixture', @deb_plat._platform, [])
450
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, @deb_plat._platform, [])
459
451
  proj.instance_eval(project_block)
460
452
  proj.conflicts('thing1', "#{initial}1.2.3")
461
453
  expect(proj._project.get_conflicts.count).to eq(1)
@@ -467,7 +459,7 @@ end" }
467
459
  it 'adds whitespace for rpm versions' do
468
460
  operators=['<','>','<=','>=','=']
469
461
  operators.each do |operator|
470
- proj = Vanagon::Project::DSL.new('test-fixture', @el_plat._platform, [])
462
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, @el_plat._platform, [])
471
463
  proj.instance_eval(project_block)
472
464
  proj.conflicts('thing1', "#{operator}1.2.3")
473
465
  expect(proj._project.get_conflicts.count).to eq(1)
@@ -477,7 +469,7 @@ end" }
477
469
  end
478
470
 
479
471
  it 'gets rid of duplicates' do
480
- proj = Vanagon::Project::DSL.new('test-fixture', @el_plat._platform, [])
472
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, @el_plat._platform, [])
481
473
  proj.instance_eval(project_block)
482
474
  proj.conflicts('thing1', '1.2.3')
483
475
  proj.conflicts('thing1', '<1.2.3')
@@ -496,7 +488,6 @@ end"
496
488
 
497
489
  before do
498
490
  allow_any_instance_of(Vanagon::Project::DSL).to receive(:puts)
499
- allow(Vanagon::Driver).to receive(:configdir).and_return(configdir)
500
491
  @el_plat = Vanagon::Platform::DSL.new('el-5-x86_64')
501
492
  @el_plat.instance_eval("platform 'el-5-x86_64' do |plat| end")
502
493
  @osx_plat = Vanagon::Platform::DSL.new('osx-10.10-x86_64')
@@ -505,13 +496,13 @@ end"
505
496
  end
506
497
 
507
498
  it 'adds package_overrides on supported platforms' do
508
- proj = Vanagon::Project::DSL.new('test-fixture', @el_plat._platform, [])
499
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, @el_plat._platform, [])
509
500
  proj.instance_eval(project_block)
510
501
  expect(proj._project.package_overrides).to include("TEST_VAR='foo'")
511
502
  end
512
503
 
513
504
  it 'fails on usupported platforms' do
514
- proj = Vanagon::Project::DSL.new('test-fixture', @osx_plat._platform, [])
505
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, @osx_plat._platform, [])
515
506
  expect{ proj.instance_eval(project_block) }.to raise_error(RuntimeError)
516
507
  end
517
508
  end
@@ -527,24 +518,23 @@ end"
527
518
 
528
519
  before do
529
520
  allow_any_instance_of(Vanagon::Project::DSL).to receive(:puts)
530
- allow(Vanagon::Driver).to receive(:configdir).and_return(configdir)
531
521
  allow(Vanagon::Component).to receive(:load_component).with('some-component', any_args).and_return(component)
532
522
  end
533
523
 
534
524
  it 'stores the component in the project if the included components set is empty' do
535
- proj = Vanagon::Project::DSL.new('test-fixture', platform, [])
525
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform, [])
536
526
  proj.instance_eval(project_block)
537
527
  expect(proj._project.components).to include(component)
538
528
  end
539
529
 
540
530
  it 'stores the component in the project if the component name is listed in the included components set' do
541
- proj = Vanagon::Project::DSL.new('test-fixture', platform, ['some-component'])
531
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform, ['some-component'])
542
532
  proj.instance_eval(project_block)
543
533
  expect(proj._project.components).to include(component)
544
534
  end
545
535
 
546
536
  it 'does not store the component if the included components set is not empty and does not include the component name' do
547
- proj = Vanagon::Project::DSL.new('test-fixture', platform, ['some-different-component'])
537
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform, ['some-different-component'])
548
538
  proj.instance_eval(project_block)
549
539
  expect(proj._project.components).to_not include(component)
550
540
  end
@@ -568,19 +558,19 @@ end"
568
558
  }
569
559
 
570
560
  it 'has an empty project.fetch_artifact when fetch_artifact is not called' do
571
- proj = Vanagon::Project::DSL.new('test-fixture', platform, [])
561
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform, [])
572
562
  proj.instance_eval(empty_project_block)
573
563
  expect(proj._project.artifacts_to_fetch).to eq([])
574
564
  end
575
565
 
576
566
  it 'Adds a path to project.fetch_artifact when fetch_artifact is called' do
577
- proj = Vanagon::Project::DSL.new('test-fixture', platform, [])
567
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform, [])
578
568
  proj.instance_eval(project_block)
579
569
  expect(proj._project.artifacts_to_fetch).to eq(['foo/bar/baz.file'])
580
570
  end
581
571
 
582
572
  it 'Adds multiple paths to project.fetch_artifact when fetch_artifact is called more than once' do
583
- proj = Vanagon::Project::DSL.new('test-fixture', platform, [])
573
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform, [])
584
574
  proj.instance_eval(project_block_multiple)
585
575
  expect(proj._project.artifacts_to_fetch).to eq(['foo/bar/baz.file', 'foo/foobar/foobarbaz.file'])
586
576
  end
@@ -603,19 +593,19 @@ end"
603
593
  }
604
594
 
605
595
  it 'has no_packaging set to false by default' do
606
- proj = Vanagon::Project::DSL.new('test-fixture', platform, [])
596
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform, [])
607
597
  proj.instance_eval(empty_project_block)
608
598
  expect(proj._project.no_packaging).to eq(false)
609
599
  end
610
600
 
611
601
  it 'sets no_packaging to true when proj.no_packaging true is called' do
612
- proj = Vanagon::Project::DSL.new('test-fixture', platform, [])
602
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform, [])
613
603
  proj.instance_eval(project_block)
614
604
  expect(proj._project.no_packaging).to eq(true)
615
605
  end
616
606
 
617
607
  it 'sets no_packaging to false when proj.no_packaging false is called' do
618
- proj = Vanagon::Project::DSL.new('test-fixture', platform, [])
608
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform, [])
619
609
  proj.instance_eval(project_block_false)
620
610
  expect(proj._project.no_packaging).to eq(false)
621
611
  end
@@ -121,7 +121,7 @@ describe 'Vanagon::Project' do
121
121
  it 'returns only the highest level directories' do
122
122
  test_sets.each do |set|
123
123
  expect(component).to receive(:directories).and_return([])
124
- proj = Vanagon::Project::DSL.new('test-fixture', platform, [])
124
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform, [])
125
125
  proj.instance_eval(project_block)
126
126
  set[:directories].each {|dir| proj.directory dir }
127
127
  expect(proj._project.get_root_directories.sort).to eq(set[:results].sort)
@@ -138,32 +138,40 @@ describe 'Vanagon::Project' do
138
138
  expect(git_source).to receive(:fetch).and_return(true)
139
139
 
140
140
  # stubs for the upstream project
141
- upstream_proj = Vanagon::Project::DSL.new('upstream-test', upstream_platform, [])
141
+ upstream_proj = Vanagon::Project::DSL.new('upstream-test', configdir, upstream_platform, [])
142
142
  upstream_proj.instance_eval(upstream_project_block)
143
143
  expect(Vanagon::Project).to receive(:load_project).and_return(upstream_proj._project)
144
144
  expect(Vanagon::Platform).to receive(:load_platform).and_return(upstream_platform)
145
+
146
+ class Vanagon
147
+ class Project
148
+ BUILD_TIME = '2017-07-10T13:34:25-07:00'
149
+ VANAGON_VERSION = '0.0.0-rspec'
150
+ end
151
+ end
152
+
145
153
  end
146
154
 
147
155
  it 'loads upstream settings' do
148
- inheriting_proj = Vanagon::Project::DSL.new('inheritance-test', platform, [])
156
+ inheriting_proj = Vanagon::Project::DSL.new('inheritance-test', configdir, platform, [])
149
157
  inheriting_proj.instance_eval(inheriting_project_block)
150
158
  expect(inheriting_proj._project.settings[:test]).to eq('upstream-test')
151
159
  end
152
160
 
153
161
  it 'overrides duplicate settings from before the load' do
154
- inheriting_proj = Vanagon::Project::DSL.new('inheritance-test', platform, [])
162
+ inheriting_proj = Vanagon::Project::DSL.new('inheritance-test', configdir, platform, [])
155
163
  inheriting_proj.instance_eval(preset_inheriting_project_block)
156
164
  expect(inheriting_proj._project.settings[:test]).to eq('upstream-test')
157
165
  end
158
166
 
159
167
  it 'lets you override settings after the load' do
160
- inheriting_proj = Vanagon::Project::DSL.new('inheritance-test', platform, [])
168
+ inheriting_proj = Vanagon::Project::DSL.new('inheritance-test', configdir, platform, [])
161
169
  inheriting_proj.instance_eval(postset_inheriting_project_block)
162
170
  expect(inheriting_proj._project.settings[:test]).to eq('inheritance-test')
163
171
  end
164
172
 
165
173
  it 'merges settings' do
166
- inheriting_proj = Vanagon::Project::DSL.new('inheritance-test', platform, [])
174
+ inheriting_proj = Vanagon::Project::DSL.new('inheritance-test', configdir, platform, [])
167
175
  inheriting_proj.instance_eval(inheriting_project_block_with_settings)
168
176
  expect(inheriting_proj._project.settings[:test]).to eq('upstream-test')
169
177
  expect(inheriting_proj._project.settings[:merged]).to eq('yup')
@@ -176,7 +184,7 @@ describe 'Vanagon::Project' do
176
184
  end
177
185
 
178
186
  it 'loads settings set in platforms' do
179
- settings_proj = Vanagon::Project::DSL.new('settings-test', dummy_platform_settings, [])
187
+ settings_proj = Vanagon::Project::DSL.new('settings-test', configdir, dummy_platform_settings, [])
180
188
  settings_proj.instance_eval(project_block)
181
189
  expect(settings_proj._project.settings[:platform_test]).to eq('debian')
182
190
  end
@@ -531,7 +539,7 @@ describe 'Vanagon::Project' do
531
539
  it "builds packages by default" do
532
540
  platform = Vanagon::Platform::DSL.new('el-7-x86_64')
533
541
  platform.instance_eval("platform 'el-7-x86_6' do |plat| end")
534
- proj = Vanagon::Project::DSL.new('test-fixture', platform._platform, [])
542
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform._platform, [])
535
543
  expect(platform._platform).to receive(:generate_package) { ["# making a package"] }
536
544
  expect(proj._project.generate_package).to eq(["# making a package"])
537
545
  end
@@ -539,7 +547,7 @@ describe 'Vanagon::Project' do
539
547
  it "builds packages and archives if configured for both" do
540
548
  platform = Vanagon::Platform::DSL.new('el-7-x86_64')
541
549
  platform.instance_eval("platform 'el-7-x86_6' do |plat| end")
542
- proj = Vanagon::Project::DSL.new('test-fixture', platform._platform, [])
550
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform._platform, [])
543
551
  proj.generate_archives(true)
544
552
  expect(platform._platform).to receive(:generate_package) { ["# making a package"] }
545
553
  expect(platform._platform).to receive(:generate_compiled_archive) { ["# making an archive"] }
@@ -549,7 +557,7 @@ describe 'Vanagon::Project' do
549
557
  it "can build only archives" do
550
558
  platform = Vanagon::Platform::DSL.new('el-7-x86_64')
551
559
  platform.instance_eval("platform 'el-7-x86_6' do |plat| end")
552
- proj = Vanagon::Project::DSL.new('test-fixture', platform._platform, [])
560
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform._platform, [])
553
561
  proj.generate_archives(true)
554
562
  proj.generate_packages(false)
555
563
  expect(platform._platform).to receive(:generate_compiled_archive) { ["# making an archive"] }
@@ -559,7 +567,7 @@ describe 'Vanagon::Project' do
559
567
  it "builds nothing if that's what you really want" do
560
568
  platform = Vanagon::Platform::DSL.new('el-7-x86_64')
561
569
  platform.instance_eval("platform 'el-7-x86_6' do |plat| end")
562
- proj = Vanagon::Project::DSL.new('test-fixture', platform._platform, [])
570
+ proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform._platform, [])
563
571
  proj.generate_packages(false)
564
572
  expect(proj._project.generate_package).to eq([])
565
573
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vanagon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.32
4
+ version: 0.15.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-11 00:00:00.000000000 Z
11
+ date: 2020-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: git
@@ -266,40 +266,40 @@ specification_version: 3
266
266
  summary: All of your packages will fit into this van with this one simple trick.
267
267
  test_files:
268
268
  - spec/lib/makefile_spec.rb
269
- - spec/lib/git/rev_list_spec.rb
270
- - spec/lib/vanagon/driver_spec.rb
271
269
  - spec/lib/vanagon/utilities/shell_utilities_spec.rb
270
+ - spec/lib/vanagon/platform_spec.rb
271
+ - spec/lib/vanagon/project_spec.rb
272
+ - spec/lib/vanagon/component_spec.rb
273
+ - spec/lib/vanagon/extensions/set/json_spec.rb
274
+ - spec/lib/vanagon/extensions/string_spec.rb
275
+ - spec/lib/vanagon/extensions/ostruct/json_spec.rb
276
+ - spec/lib/vanagon/engine/ec2_spec.rb
277
+ - spec/lib/vanagon/engine/hardware_spec.rb
278
+ - spec/lib/vanagon/engine/pooler_spec.rb
279
+ - spec/lib/vanagon/engine/always_be_scheduling_spec.rb
280
+ - spec/lib/vanagon/engine/docker_spec.rb
281
+ - spec/lib/vanagon/engine/base_spec.rb
282
+ - spec/lib/vanagon/engine/local_spec.rb
272
283
  - spec/lib/vanagon/environment_spec.rb
273
- - spec/lib/vanagon/platform/deb_spec.rb
274
- - spec/lib/vanagon/platform/rpm_spec.rb
275
- - spec/lib/vanagon/platform/osx_spec.rb
276
- - spec/lib/vanagon/platform/solaris_10_spec.rb
277
- - spec/lib/vanagon/platform/rpm/aix_spec.rb
278
- - spec/lib/vanagon/platform/dsl_spec.rb
279
- - spec/lib/vanagon/platform/windows_spec.rb
280
- - spec/lib/vanagon/platform/solaris_11_spec.rb
284
+ - spec/lib/vanagon/utilities_spec.rb
285
+ - spec/lib/vanagon/driver_spec.rb
286
+ - spec/lib/vanagon/component/rules_spec.rb
287
+ - spec/lib/vanagon/component/dsl_spec.rb
288
+ - spec/lib/vanagon/component/source/rewrite_spec.rb
281
289
  - spec/lib/vanagon/component/source/git_spec.rb
282
290
  - spec/lib/vanagon/component/source/http_spec.rb
283
291
  - spec/lib/vanagon/component/source/local_spec.rb
284
- - spec/lib/vanagon/component/source/rewrite_spec.rb
285
- - spec/lib/vanagon/component/dsl_spec.rb
286
292
  - spec/lib/vanagon/component/source_spec.rb
287
- - spec/lib/vanagon/component/rules_spec.rb
288
- - spec/lib/vanagon/platform_spec.rb
293
+ - spec/lib/vanagon/project/dsl_spec.rb
294
+ - spec/lib/vanagon/optparse_spec.rb
289
295
  - spec/lib/vanagon/common/user_spec.rb
290
296
  - spec/lib/vanagon/common/pathname_spec.rb
291
- - spec/lib/vanagon/optparse_spec.rb
292
- - spec/lib/vanagon/utilities_spec.rb
293
- - spec/lib/vanagon/engine/always_be_scheduling_spec.rb
294
- - spec/lib/vanagon/engine/hardware_spec.rb
295
- - spec/lib/vanagon/engine/ec2_spec.rb
296
- - spec/lib/vanagon/engine/base_spec.rb
297
- - spec/lib/vanagon/engine/docker_spec.rb
298
- - spec/lib/vanagon/engine/pooler_spec.rb
299
- - spec/lib/vanagon/engine/local_spec.rb
300
- - spec/lib/vanagon/component_spec.rb
301
- - spec/lib/vanagon/extensions/ostruct/json_spec.rb
302
- - spec/lib/vanagon/extensions/string_spec.rb
303
- - spec/lib/vanagon/extensions/set/json_spec.rb
304
- - spec/lib/vanagon/project/dsl_spec.rb
305
- - spec/lib/vanagon/project_spec.rb
297
+ - spec/lib/vanagon/platform/dsl_spec.rb
298
+ - spec/lib/vanagon/platform/windows_spec.rb
299
+ - spec/lib/vanagon/platform/solaris_10_spec.rb
300
+ - spec/lib/vanagon/platform/deb_spec.rb
301
+ - spec/lib/vanagon/platform/solaris_11_spec.rb
302
+ - spec/lib/vanagon/platform/rpm/aix_spec.rb
303
+ - spec/lib/vanagon/platform/osx_spec.rb
304
+ - spec/lib/vanagon/platform/rpm_spec.rb
305
+ - spec/lib/git/rev_list_spec.rb