vanagon 0.5.3 → 0.5.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd0b8d155b61fe71dc4b21216f3cd8674734c790
4
- data.tar.gz: b3b1554b32d14049b08eb56c89206f9b71e120ff
3
+ metadata.gz: d9ab396670efad7619b917bf141a6663f46b263c
4
+ data.tar.gz: 434efe6733bca07c8784502bb4d4191cd0af42cb
5
5
  SHA512:
6
- metadata.gz: f9646e8ab2503dfe9433e91f25af53c2a7debcadb276d9d4338a4f8ff11749a3125f7ec04a007c855bf7e6a5b9878e5bba9227fb42e2aa73d14e9d8e9bcf5462
7
- data.tar.gz: 945246b7da4cc69b58a919c6f91df69db236e9be28039c7b1c0e78acf90e2b285c268b3730204a03050026901a4f890245fec9e89918098026fa6067eaf8ff47
6
+ metadata.gz: 1a0b2555e93cc7f808b53f58ce5d2a98709e99ebb1775ccaeaf9c8625d7255793e3f4179673ff567816982c8a952b5477bcde76e4056b654854e59014906f53e
7
+ data.tar.gz: 5b4be2a7a70c6452ad19cca584488b7e9eb77f03504d310b68fd934b53b3a8eb67167af5dc625f3cd4242c4a7e219f7b732f70917398f3848d122bee7d3fa883
@@ -7,6 +7,7 @@ class Vanagon
7
7
  # @return [Array] list of commands required to build a debian package for the given project from a tarball
8
8
  def generate_package(project)
9
9
  target_dir = project.repo ? output_dir(project.repo) : output_dir
10
+ pkg_arch_opt = project.noarch ? "" : "-a #{@architecture}"
10
11
  ["mkdir -p output/#{target_dir}",
11
12
  "mkdir -p $(tempdir)/#{project.name}-#{project.version}",
12
13
  "cp #{project.name}-#{project.version}.tar.gz $(tempdir)/#{project.name}_#{project.version}.orig.tar.gz",
@@ -14,7 +15,7 @@ class Vanagon
14
15
  "cp -pr debian $(tempdir)/#{project.name}-#{project.version}",
15
16
  "gunzip -c #{project.name}-#{project.version}.tar.gz | '#{@tar}' -C '$(tempdir)/#{project.name}-#{project.version}' --strip-components 1 -xf -",
16
17
  "sed -i 's/\ /?/g' $(tempdir)/#{project.name}-#{project.version}/debian/install",
17
- "(cd $(tempdir)/#{project.name}-#{project.version}; debuild --no-lintian -uc -us)",
18
+ "(cd $(tempdir)/#{project.name}-#{project.version}; debuild --no-lintian #{pkg_arch_opt} -uc -us)",
18
19
  "cp $(tempdir)/*.deb ./output/#{target_dir}"]
19
20
  end
20
21
 
@@ -163,9 +163,25 @@ class Vanagon
163
163
  # @return [Array] list of commands required to build an msi package for the given project from a tarball
164
164
  def generate_msi_package(project)
165
165
  target_dir = project.repo ? output_dir(project.repo) : output_dir
166
- cg_name = "ProductComponentGroup"
167
- wix_extensions = "-ext WiXUtilExtension -ext WixUIExtension"
168
- candle_flags = "-dPlatform=#{@architecture} -arch #{@architecture} #{wix_extensions}"
166
+ wix_extensions = "-ext WiXUtilExtension -ext WixUIExtension"
167
+ # Heat command documentation at: http://wixtoolset.org/documentation/manual/v3/overview/heat.html
168
+ # dir <directory> - Traverse directory to find all sub-files and directories.
169
+ # -ke - Keep Empty directories
170
+ # -cg - Component Group Name
171
+ # -gg - Generate GUIDS now
172
+ # -srd - Suppress root element generation, we want to reference one of the default root elements
173
+ # INSTALLDIR or APPDATADIR in the directorylist.wxs file, not a newly generated one.
174
+ # -sreg - Suppress registry harvesting.
175
+ # -dr - Root DirectoryRef to point all components to
176
+ # -var - Replace "SourceDir" in the @source attributes of all components with a preprocessor variable
177
+ app_heat_flags = " -dr INSTALLDIR -v -ke -indent 2 -cg AppComponentGroup -gg -srd -t wix/filter.xslt -sreg -var var.AppSourcePath "
178
+ app_source_path = "SourceDir/#{project.settings[:base_dir]}/#{project.settings[:company_id]}/#{project.settings[:product_id]}"
179
+ appdata_heat_flags = " -dr APPDATADIR -v -ke -indent 2 -cg AppDataComponentGroup -gg -srd -t wix/filter.xslt -sreg -var var.AppDataSourcePath "
180
+ appdata_source_path = "SourceDir/CommonAppDataFolder/#{project.settings[:company_id]}"
181
+ # Candle.exe preprocessor vars are required due to the above double run of heat.exe, both runs of heat use
182
+ # preprocessor variables
183
+ candle_preprocessor = "-dAppSourcePath=\"#{app_source_path}\" -dAppDataSourcePath=\"#{appdata_source_path}\""
184
+ candle_flags = "-dPlatform=#{@architecture} -arch #{@architecture} #{wix_extensions}"
169
185
  # Enable verbose mode for the moment (will be removed for production)
170
186
  # localisation flags to be added
171
187
  light_flags = "-v -cultures:en-us #{wix_extensions}"
@@ -174,22 +190,17 @@ class Vanagon
174
190
  "mkdir -p $(tempdir)/{SourceDir,wix/wixobj}",
175
191
  "#{@copy} -r wix/* $(tempdir)/wix/",
176
192
  "gunzip -c #{project.name}-#{project.version}.tar.gz | '#{@tar}' -C '$(tempdir)/SourceDir' --strip-components 1 -xf -",
177
- # Run the Heat command in a single pass
178
- # Heat command documentation at: http://wixtoolset.org/documentation/manual/v3/overview/heat.html
179
- # dir <directory> - Traverse directory to find all sub-files and directories.
180
- # -ke - Keep Empty directories
181
- # -cg - Component Group Name
182
- # -gg - Generate GUIDS now
183
- # -srd - Suppress root element generation, we want to reference the default root element
184
- # TARGETDIR in the project.wxs file, not a newly generated one.
185
- # -sreg - Suppress registry harvesting.
186
- "cd $(tempdir); \"$$WIX/bin/heat.exe\" dir SourceDir -v -ke -indent 2 -cg #{cg_name} -gg -srd -t wix/filter.xslt -sreg -out wix/#{project.name}-harvest.wxs",
193
+ "cd $(tempdir); \"$$WIX/bin/heat.exe\" dir #{app_source_path} #{app_heat_flags} -out wix/#{project.name}-harvest-app.wxs",
194
+ "cd $(tempdir); \"$$WIX/bin/heat.exe\" dir #{appdata_source_path} #{appdata_heat_flags} -out wix/#{project.name}-harvest-programdata.wxs",
187
195
  # Apply Candle command to all *.wxs files - generates .wixobj files in wix directory.
188
196
  # cygpath conversion is necessary as candle is unable to handle posix path specs
189
- "cd $(tempdir)/wix/wixobj; for wix_file in `find $(tempdir)/wix -name \'*.wxs\'`; do \"$$WIX/bin/candle.exe\" #{candle_flags} $$(cygpath -aw $$wix_file) || exit 1; done",
197
+ # the preprocessor variables AppDataSourcePath and ApplicationSourcePath are required due to the -var input to the heat
198
+ # runs listed above.
199
+ "cd $(tempdir)/wix/wixobj; for wix_file in `find $(tempdir)/wix -name \'*.wxs\'`; do \"$$WIX/bin/candle.exe\" #{candle_flags} #{candle_preprocessor} $$(cygpath -aw $$wix_file) || exit 1; done",
190
200
  # run all wix objects through light to produce the msi
191
201
  # the -b flag simply points light to where the SourceDir location is
192
- "cd $(tempdir)/wix/wixobj; \"$$WIX/bin/light.exe\" #{light_flags} -b $$(cygpath -aw $(tempdir)) -out $$(cygpath -aw $(workdir)/output/#{target_dir}/#{msi_package_name(project)}) *.wixobj",
202
+ # -loc is required for the UI localization it points to the actual localization .wxl
203
+ "cd $(tempdir)/wix/wixobj; \"$$WIX/bin/light.exe\" #{light_flags} -b $$(cygpath -aw $(tempdir)) -loc $$(cygpath -aw $(tempdir)/wix/localization/puppet_en-us.wxl) -out $$(cygpath -aw $(workdir)/output/#{target_dir}/#{msi_package_name(project)}) *.wixobj",
193
204
  ]
194
205
  end
195
206
 
@@ -289,35 +300,47 @@ class Vanagon
289
300
  File.join("windows", target_repo, @architecture)
290
301
  end
291
302
 
303
+ # Generate the underlying directory structure of
304
+ # any binary files referenced in services. note that
305
+ # this function does not generate the structure of
306
+ # the installation directory, only the structure above it.
307
+ #
308
+ # @param services, list of all services in a project
309
+ # @param project, actual project we are creating the directory structure for
310
+ def generate_service_bin_dirs(services, project)
311
+ # All service files will need a directory reference
312
+ items = services.map do |svc|
313
+ {
314
+ :path => strip_and_format_path(svc.service_file, project),
315
+ :element_to_add => "<Directory Id=\"#{svc.bindir_id}\" />\n"
316
+ }
317
+ end
318
+ generate_wix_dirs(items)
319
+ end
320
+
292
321
  # Generate correctly formatted wix elements that match the
293
- # structure of the directory input
322
+ # structure of the itemized input
294
323
  #
295
- # @param services, Array of components services
296
- # and optionally:
324
+ # @param items
297
325
  # @return [string] correctly formatted wix element string
298
- def generate_wix_dirs(services)
299
- directories = []
300
- services.map { |svc| directories.push({ :path => svc.service_file, :bindir_id => svc.bindir_id }) }
326
+ def generate_wix_dirs(items)
301
327
  # root refers to the root of an n-ary tree (which we are about to make)
302
328
  root = { :children => [] }
303
329
  # iterate over all paths specified and break each one
304
330
  # in to its specific directories. This will generate_wix_dirs
305
331
  # an n-ary tree structure matching the specs from the input
306
- directories.each do |dir|
332
+ items.each do |item|
307
333
  # Always start at the beginning
308
334
  curr = root
309
- names = strip_path(dir[:path])
310
- # The last entry in this list will be the actual file,
311
- # which we do not want, we only want it's base path
312
- names.pop
335
+ names = item[:path].split(File::SEPARATOR)
313
336
  names.each do |name|
314
337
  curr = insert_child(curr, name)
315
338
  end
316
339
  # at this point, curr will be the top dir, override the id if
317
340
  # id exists
318
- curr[:bindir_ids].push(dir[:bindir_id])
341
+ curr[:elements_to_add].push(item[:element_to_add])
319
342
  end
320
- return generate_wix_from_graph(root)
343
+ generate_wix_from_graph(root)
321
344
  end
322
345
 
323
346
  # insert a new object with the name "name" if it doesn't already
@@ -329,43 +352,34 @@ class Vanagon
329
352
  # create if necessary
330
353
  def insert_child(curr, name)
331
354
  #The Id field will default to name, but be overridden later
332
- new_obj = { :name => name, :id => name, :bindir_ids => [], :children => [] }
333
- if (child_index = includes_child(new_obj, curr[:children]))
355
+ new_obj = { :name => name, :id => name, :elements_to_add => [], :children => [] }
356
+ if (child_index = index_of_child(new_obj, curr[:children]))
334
357
  curr = curr[:children][child_index]
335
358
  else
336
359
  curr[:children].push(new_obj)
337
360
  curr = new_obj
338
361
  end
339
- return curr
362
+ curr
340
363
  end
341
364
 
342
- # strip and split the directory path into single names
365
+ # strip the leading install root and the filename from the service path
366
+ # and replace any \ with /
367
+ #
343
368
  # @param [string] path string of directory
344
- def strip_path(path)
345
- if path.include?("/") || path.include?("\\")
346
- # The regex in the last part of this if warrants some
347
- # explanation. Specifically it matches any combinations
348
- # of any letters, then the : char, then finally either
349
- # the char / or the char \. it's meant to parse out drive
350
- # roots on windows
351
- if path.start_with?("/") || path.start_with?("\\") || path.start_with?("SourceDir") || path =~ (/([A-Za-z])*\:(\/|\\)/)
352
- path = path.sub(/\/|\\|([A-Za-z])*\:(\/|\\)|(\/|\\)?(SourceDir)(\/|\\)?/, '')
353
- end
354
- names = path.split(/\/|\\/)
355
- end
356
- return names
369
+ # @param [@project] project object
370
+ def strip_and_format_path(path, project)
371
+ formatted_path = path.gsub(/\\/, "\/")
372
+ path_regex = /\/?SourceDir\/#{project.settings[:base_dir]}\/#{project.settings[:company_id]}\/#{project.settings[:product_id]}\//
373
+ File.dirname(formatted_path.sub(path_regex, ''))
357
374
  end
358
375
 
359
376
  # Find if child element is the same as one of
360
377
  # the old_children elements, return that child
361
- def includes_child(new_child, old_children)
362
- old_children.each_with_index do |curr_old_child, index|
363
- return index if curr_old_child[:name] == new_child[:name]
364
- end unless old_children.empty?
365
- return nil
378
+ def index_of_child(new_child, old_children)
379
+ return nil if old_children.empty?
380
+ old_children.index { |child| child[:name] == new_child[:name] }
366
381
  end
367
382
 
368
-
369
383
  # Recursively generate wix element structure
370
384
  #
371
385
  # @param root, the (empty) root of an n-ary tree containing the
@@ -375,9 +389,9 @@ class Vanagon
375
389
  unless root[:children].empty?
376
390
  root[:children].each do |child|
377
391
  string += ("<Directory Name=\"#{child[:name]}\" Id=\"#{child[:id]}\">\n")
378
- unless child[:bindir_ids].empty?
379
- child[:bindir_ids].each do |bindir_id|
380
- string += ("<Directory Id=\"#{bindir_id}\" />\n")
392
+ unless child[:elements_to_add].empty?
393
+ child[:elements_to_add].each do |element|
394
+ string += element
381
395
  end
382
396
  end
383
397
  string += generate_wix_from_graph(child)
@@ -385,7 +399,7 @@ class Vanagon
385
399
  end
386
400
  return string
387
401
  end
388
- return ''
402
+ string
389
403
  end
390
404
 
391
405
  # Constructor. Sets up some defaults for the windows platform and calls the parent constructor
@@ -1,7 +1,5 @@
1
1
  #!/bin/bash
2
2
 
3
- foundpkg=`/usr/sbin/pkgutil --volume "$3" --pkgs=<%= @identifier-%>.<%= @name -%>`
4
-
5
3
  # Move any new configfiles into place
6
4
  <%- get_configfiles.each do |config|
7
5
  dest_file = config.path.gsub(/\.pristine$/, '') -%>
@@ -13,12 +11,17 @@ else
13
11
  fi
14
12
  <%- end -%>
15
13
 
16
- # If we appear to be in an upgrade load services.
17
-
18
- if [ -n "$foundpkg" ]; then
14
+ if [ -d "/tmp/.<%= @name %>.upgrade" ]
19
15
  <%- get_services.each do |service| -%>
20
- /bin/launchctl load -F "<%= service.service_file %>"
16
+ if [ -f "/tmp/.<%= @name %>.upgrade/<%= service.name %>" ]
17
+ /bin/launchctl load -F "<%= service.service_file %>"
18
+ fi
21
19
  <%- end -%>
22
20
  fi
23
21
 
24
22
  <%= File.read("resources/osx/postinstall-extras") if File.exist?("resources/osx/postinstall-extras") %>
23
+
24
+ # Cleanup after ourselves
25
+ if [ -e "/tmp/.<%= @name %>.upgrade" ]
26
+ rm -rf "/tmp/.<%= @name %>.upgrade"
27
+ fi
@@ -1,16 +1,24 @@
1
1
  #!/bin/bash
2
2
 
3
- # If we appear to be in an upgrade unload services.
3
+ # Cleanup previous operations
4
+ if [ -e "/tmp/.<%= @name %>.upgrade" ]
5
+ rm -rf "/tmp/.<%= @name %>.upgrade"
6
+ fi
4
7
 
8
+ # If we appear to be in an upgrade unload services.
5
9
  foundpkg=`/usr/sbin/pkgutil --volume "$3" --pkgs=<%= @identifier-%>.<%= @name -%>`
6
10
  oldbom="/usr/share/doc/<%= @name %>/bill-of-materials"
7
11
 
8
12
  if [ -n "$foundpkg" ]; then
13
+ mkdir -p "/tmp/.<%= @name %>.upgrade"
14
+ chmod 0700 "/tmp/.<%= @name %>.upgrade"
15
+
9
16
  <%- get_services.each do |service| -%>
10
17
  if /bin/launchctl list "<%= service.name %>" &> /dev/null; then
18
+ touch "/tmp/.<%= @name %>.upgrade/<%= service.name %>"
11
19
  /bin/launchctl unload "<%= service.service_file %>"
12
20
  fi
13
- if [ -f "$oldbom"]; then
21
+ if [ -f "$oldbom" ]; then
14
22
  /bin/rm "$oldbom"
15
23
  fi
16
24
  <%- end -%>
@@ -0,0 +1,33 @@
1
+ <?xml version="1.0" encoding="windows-1252"?>
2
+ <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
3
+
4
+ <!-- Default component groups that are to be included in this project.
5
+ This can be copied in the project specific area to add additional component groups.
6
+
7
+ Note that a number of the groups below are "pseudo-groups" that are necessary to
8
+ force the Wix Linker (light) to include fragments (e.g. FragmentProperties).
9
+
10
+ A UI reference is can also be included in the project specific area if required.
11
+ Otherwise, the project will default here to using the minimal UI (WixUI_Minimal). -->
12
+
13
+ <Fragment>
14
+ <ComponentGroup Id="MainComponentGroup">
15
+ <!-- We can add all components by referencing this one thing -->
16
+ <ComponentGroupRef Id="AppComponentGroup" />
17
+ <ComponentGroupRef Id="AppDataComponentGroup" />
18
+ <ComponentGroupRef Id="RegistryComponentGroup" />
19
+ <%- get_services.each do |service| -%>
20
+ <ComponentGroupRef Id="<%= service.component_group_id %>" />
21
+ <%- end -%>
22
+ <!-- All of these Include refs are expected to be present -->
23
+ <ComponentGroupRef Id="FragmentProperties" />
24
+ <ComponentGroupRef Id="FragmentSequences" />
25
+ <ComponentGroupRef Id="FragmentCustomActions" />
26
+ </ComponentGroup>
27
+
28
+ <UI>
29
+ <UIRef Id="WixUI_Minimal"/>
30
+ </UI>
31
+
32
+ </Fragment>
33
+ </Wix>
@@ -1,9 +1,17 @@
1
1
  <?xml version='1.0' encoding='windows-1252'?>
2
2
  <Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
3
-
4
3
  <Fragment>
5
4
  <DirectoryRef Id='TARGETDIR'>
6
- <%= @platform.generate_wix_dirs(self.get_services) %>
5
+ <Directory Id="<%= settings[:base_dir] %>" >
6
+ <Directory Id="<%= settings[:company_id] %>" Name="<%= settings[:company_name] %>">
7
+ <Directory Id='INSTALLDIR' Name="<%= settings[:product_id] %>">
8
+ <%= @platform.generate_service_bin_dirs(self.get_services, self) %>
9
+ </Directory>
10
+ </Directory>
11
+ </Directory>
12
+ <Directory Id="CommonAppDataFolder" Name="CommonAppData">
13
+ <Directory Id="APPDATADIR" Name="<%= settings[:company_id] %>"/>
14
+ </Directory>
7
15
  </DirectoryRef>
8
16
  </Fragment>
9
17
  </Wix>
@@ -13,9 +13,15 @@
13
13
  </xsl:template>
14
14
  <!-- Filter out all Service File Executables from the Harvest (heat) run as these are specified in the transformed service.components.wxs file -->
15
15
  <!-- The list of component service files are collected in an array so that a set of unique names can be extracted -->
16
+ <!-- we have to substitue the SourceDir\\etc. etc. for $(var.ProjectSourcePath) in order to facilitate heat -->
17
+ <!-- being run in two different places, specifically it no longer runs from SourceDir so we needed to pass -->
18
+ <!-- in ProjectSourcePath to the heat runs. Thus when this filter does its work the source attribute will -->
19
+ <!-- look like $(var.ProjectSourcePath)/puppet/bin/rubyw.exe for example, not -->
20
+ <!-- SourceDir/Program64FilesFolder/Puppet/puppet/bin/ruby.exe -->
16
21
  <%- service_files = Array.new -%>
17
22
  <%- get_services.each do |service| -%>
18
- <%- service_files << service.service_file -%>
23
+
24
+ <%- service_files << service.service_file.sub("SourceDir\\#{self.settings[:base_dir]}\\#{self.settings[:company_id]}\\#{self.settings[:product_id]}", "$(var.AppSourcePath)") -%>
19
25
  <%- end -%>
20
26
  <%- service_files.uniq.each do |service_file| -%>
21
27
  <xsl:template match="wix:Component[wix:File[@Source='<%= service_file %>']]" />
@@ -17,26 +17,18 @@
17
17
  Compressed="yes"
18
18
  Platform="<%= @platform.architecture %>" />
19
19
 
20
- <!-- We are discussing a MAINT PR to move the componentfilegroup to seperate file
21
- This would allow project to specify additional fragments if needed -->
20
+ <!-- We will use DirectoryRef at the project level to hook in the project directory structure -->
21
+ <Directory Id='TARGETDIR' Name='SourceDir' />
22
22
 
23
23
  <MajorUpgrade AllowDowngrades="yes" />
24
24
  <Media Id="1" Cabinet="<%= settings[:product_id] %>.cab" EmbedCab="yes" CompressionLevel="high" />
25
25
 
26
- <Feature Id="<%= settings[:product_id] %>Runtime" Title="<%= settings[:product_id] %> Runtime" Level="1">
27
- <!-- We can add all components by referencing this one thing -->
28
- <ComponentGroupRef Id="ProductComponentGroup" />
29
- <ComponentGroupRef Id="RegistryComponentGroup" />
30
- <%- get_services.each do |service| -%>
31
- <ComponentGroupRef Id="<%= service.component_group_id %>" />
32
- <%- end -%>
33
- <!-- All of these Include refs are expected to be present -->
34
- <ComponentGroupRef Id="FragmentProperties" />
35
- <ComponentGroupRef Id="FragmentSequences" />
36
- <ComponentGroupRef Id="FragmentCustomActions" />
26
+ <Feature
27
+ Id="<%= settings[:product_id] %>Runtime"
28
+ Title="<%= settings[:product_id] %> Runtime"
29
+ Level="1">
30
+ <ComponentGroupRef Id="MainComponentGroup" />
37
31
  </Feature>
38
- <!-- We will use DirectoryRef at the project level to hook in the project directory structure -->
39
- <Directory Id='TARGETDIR' Name='SourceDir' />
40
32
 
41
33
  </Product>
42
34
  </Wix>
@@ -1,15 +1,44 @@
1
1
  <?xml version='1.0' encoding='windows-1252'?>
2
2
  <Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
3
+
4
+ <!--
5
+ Registry Entries
6
+ This is a suggested set of entries that can be used to record the Installation Directory for upgrade installs.
7
+ Any definitions in this will be over-ridden if the same file name is used in the Product Specific resouces directory.
8
+ -->
3
9
  <Fragment>
4
10
  <ComponentGroup Id="RegistryComponentGroup">
5
- <Component Id="RegistryEntriesArchitectureDependent" Directory="TARGETDIR" Guid="E6D5AF4F-ACC4-4D11-AFCE-299A9ED2152C" Win64="<%= settings[:win64] %>" Permanent="yes">
6
- <RegistryKey Root="HKLM" Key="SOFTWARE\<%= settings[:company_name] %>\<%= settings[:product_name] %>" ForceCreateOnInstall="yes" >
7
- <RegistryValue Type="integer" Value="0"/>
11
+ <Component
12
+ Id="RegistryEntriesArchitectureDependent"
13
+ Directory="TARGETDIR"
14
+ Guid="*"
15
+ Win64="<%= settings[:win64] %>"
16
+ Permanent="yes">
17
+
18
+ <RegistryKey
19
+ Root="HKLM"
20
+ Key="SOFTWARE\<%= settings[:company_name] %>\<%= settings[:product_name] %>"
21
+ ForceCreateOnInstall="yes" >
22
+
23
+ <RegistryValue
24
+ Type="integer"
25
+ Value="0"/>
8
26
  <%- if @platform.architecture == "x64" -%>
9
- <RegistryValue Name="RememberedInstallDir" Type="string" Value="[INSTALLDIR_X86]" />
10
- <RegistryValue Name="RememberedInstallDir64" Type="string" Value="[INSTALLDIR]" KeyPath="yes" />
27
+ <RegistryValue
28
+ Name="RememberedInstallDir"
29
+ Type="string"
30
+ Value="[INSTALLDIR_X86]" />
31
+ <RegistryValue
32
+ Name="RememberedInstallDir64"
33
+ Type="string"
34
+ Value="[INSTALLDIR]"
35
+ KeyPath="yes" />
11
36
  <%- else %>
12
- <RegistryValue Name="RememberedInstallDir" Type="string" Value="[INSTALLDIR]" KeyPath="yes" />
37
+ <RegistryValue
38
+ Name="RememberedInstallDir"
39
+ Type="string"
40
+ Value="[INSTALLDIR]"
41
+ KeyPath="yes" />
13
42
  <%- end -%>
14
43
  </RegistryKey>
15
44
  </Component>
@@ -38,8 +38,15 @@ describe "Vanagon::Platform::Windows" do
38
38
  let(:platform) { plat }
39
39
  let(:cur_plat) { Vanagon::Platform::DSL.new(plat[:name]) }
40
40
  let (:project_block) {
41
- "project 'test-fixture' do |proj|
42
- end" }
41
+ <<-HERE
42
+ project 'test-fixture' do |proj|
43
+ proj.setting(:company_name, "Test Name")
44
+ proj.setting(:company_id, "TestID")
45
+ proj.setting(:product_id, "TestProduct")
46
+ proj.setting(:base_dir, "ProgramFilesFolder")
47
+ end
48
+ HERE
49
+ }
43
50
 
44
51
  before do
45
52
  cur_plat.instance_eval(plat[:block])
@@ -171,10 +178,12 @@ end" }
171
178
  describe "generate_wix_dirs" do
172
179
 
173
180
  it "returns one directory with install_service defaults" do
181
+ proj = Vanagon::Project::DSL.new('test-fixture', {}, [])
182
+ proj.instance_eval(project_block)
174
183
  cur_plat.instance_eval(plat[:block])
175
184
  comp = Vanagon::Component::DSL.new('service-test', {}, cur_plat._platform)
176
- comp.install_service('/opt/bin.exe')
177
- expect(cur_plat._platform.generate_wix_dirs([comp._component.service].flatten.compact)).to eq( \
185
+ comp.install_service('SourceDir/ProgramFilesFolder/TestID/TestProduct/opt/bin.exe')
186
+ expect(cur_plat._platform.generate_service_bin_dirs([comp._component.service].flatten.compact, proj._project)).to eq( \
178
187
  <<-HERE
179
188
  <Directory Name="opt" Id="opt">
180
189
  <Directory Id="SERVICETESTBINDIR" />
@@ -184,10 +193,13 @@ HERE
184
193
  end
185
194
 
186
195
  it "returns one directory with non-default name" do
196
+ proj = Vanagon::Project::DSL.new('test-fixture', {}, [])
197
+ proj.instance_eval(project_block)
187
198
  cur_plat.instance_eval(plat[:block])
188
199
  comp = Vanagon::Component::DSL.new('service-test', {}, cur_plat._platform)
189
- comp.install_service('/opt/bin.exe', nil, "service-test-2")
190
- expect(cur_plat._platform.generate_wix_dirs([comp._component.service].flatten.compact)).to eq( \
200
+ comp.install_service('SourceDir/ProgramFilesFolder/TestID/TestProduct/opt/bin.exe', nil, "service-test-2")
201
+ expect(cur_plat._platform.generate_service_bin_dirs([comp._component.service].flatten.compact, proj._project)).to eq( \
202
+
191
203
  <<-HERE
192
204
  <Directory Name="opt" Id="opt">
193
205
  <Directory Id="SERVICETEST2BINDIR" />
@@ -197,56 +209,36 @@ HERE
197
209
  end
198
210
 
199
211
  it "returns nested directory correctly with \\" do
212
+ proj = Vanagon::Project::DSL.new('test-fixture', {}, [])
213
+ proj.instance_eval(project_block)
200
214
  cur_plat.instance_eval(plat[:block])
201
215
  comp = Vanagon::Component::DSL.new('service-test', {}, cur_plat._platform)
202
- comp.install_service('root\\programfiles\\bin.exe')
203
- expect(cur_plat._platform.generate_wix_dirs([comp._component.service].flatten.compact)).to eq( \
204
- <<-HERE
205
- <Directory Name="root" Id="root">
206
- <Directory Name="programfiles" Id="programfiles">
207
- <Directory Id="SERVICETESTBINDIR" />
208
- </Directory>
209
- </Directory>
210
- HERE
211
- )
212
- end
216
+ comp.install_service('SourceDir\\ProgramFilesFolder\\TestID\\TestProduct\\somedir\\someotherdir\\bin.exe')
217
+ expect(cur_plat._platform.generate_service_bin_dirs([comp._component.service].flatten.compact, proj._project)).to eq( \
213
218
 
214
- it "removes any drive roots" do
215
- cur_plat.instance_eval(plat[:block])
216
- comp = Vanagon::Component::DSL.new('service-test', {}, cur_plat._platform)
217
- comp.install_service('C:\\programfiles\\bin.exe')
218
- expect(cur_plat._platform.generate_wix_dirs([comp._component.service].flatten.compact)).to eq( \
219
219
  <<-HERE
220
- <Directory Name="programfiles" Id="programfiles">
220
+ <Directory Name="somedir" Id="somedir">
221
+ <Directory Name="someotherdir" Id="someotherdir">
221
222
  <Directory Id="SERVICETESTBINDIR" />
222
223
  </Directory>
223
- HERE
224
- )
225
- end
226
-
227
- it "removes SourceDir" do
228
- cur_plat.instance_eval(plat[:block])
229
- comp = Vanagon::Component::DSL.new('service-test', {}, cur_plat._platform)
230
- comp.install_service('SourceDir\\programfiles\\bin.exe')
231
- expect(cur_plat._platform.generate_wix_dirs([comp._component.service].flatten.compact)).to eq( \
232
- <<-HERE
233
- <Directory Name="programfiles" Id="programfiles">
234
- <Directory Id="SERVICETESTBINDIR" />
235
224
  </Directory>
236
225
  HERE
237
226
  )
238
227
  end
239
228
 
240
229
 
230
+
241
231
  it "adds a second directory for the same input but different components" do
232
+ proj = Vanagon::Project::DSL.new('test-fixture', {}, [])
233
+ proj.instance_eval(project_block)
242
234
  cur_plat.instance_eval(plat[:block])
243
235
  comp = Vanagon::Component::DSL.new('service-test', {}, cur_plat._platform)
244
- comp.install_service('/programfiles/bin.exe')
236
+ comp.install_service('SourceDir\\ProgramFilesFolder\\TestID\\TestProduct\\somedir\\bin.exe')
245
237
  comp2 = Vanagon::Component::DSL.new('service-test-2', {}, cur_plat._platform)
246
- comp2.install_service('/programfiles/bin.exe')
247
- expect(cur_plat._platform.generate_wix_dirs([comp._component.service, comp2._component.service].flatten.compact)).to eq( \
238
+ comp2.install_service('SourceDir\\ProgramFilesFolder\\TestID\\TestProduct\\somedir\\bin.exe')
239
+ expect(cur_plat._platform.generate_service_bin_dirs([comp._component.service, comp2._component.service].flatten.compact, proj._project)).to eq( \
248
240
  <<-HERE
249
- <Directory Name="programfiles" Id="programfiles">
241
+ <Directory Name="somedir" Id="somedir">
250
242
  <Directory Id="SERVICETESTBINDIR" />
251
243
  <Directory Id="SERVICETEST2BINDIR" />
252
244
  </Directory>
@@ -255,16 +247,18 @@ HERE
255
247
  end
256
248
 
257
249
  it "returns correctly formatted multiple nested directories" do
250
+ proj = Vanagon::Project::DSL.new('test-fixture', {}, [])
251
+ proj.instance_eval(project_block)
258
252
  cur_plat.instance_eval(plat[:block])
259
- comp1 = Vanagon::Component::DSL.new('service-test1', {}, cur_plat._platform)
260
- comp1.install_service('/opt/oneUp/twoUp/bin.exe')
261
- comp2 = Vanagon::Component::DSL.new('service-test2', {}, cur_plat._platform)
262
- comp2.install_service('/opt/oneUpAgain/twoUp/bin.exe')
263
- comp3 = Vanagon::Component::DSL.new('service-test3', {}, cur_plat._platform)
264
- comp3.install_service('/opt/oneUpAgain/twoUpAgain/bin.exe')
265
- expect(cur_plat._platform.generate_wix_dirs([comp1._component.service, comp2._component.service, comp3._component.service].flatten.compact)).to eq( \
253
+ comp = Vanagon::Component::DSL.new('service-test-1', {}, cur_plat._platform)
254
+ comp.install_service('SourceDir\\ProgramFilesFolder\\TestID\\TestProduct\\somedir\\oneUp\\twoUp\\bin.exe')
255
+ comp2 = Vanagon::Component::DSL.new('service-test-2', {}, cur_plat._platform)
256
+ comp2.install_service('SourceDir\\ProgramFilesFolder\\TestID\\TestProduct\\somedir\\oneUpAgain\\twoUp\\bin.exe')
257
+ comp3 = Vanagon::Component::DSL.new('service-test-3', {}, cur_plat._platform)
258
+ comp3.install_service('SourceDir\\ProgramFilesFolder\\TestID\\TestProduct\\somedir\\oneUpAgain\\twoUpAgain\\bin.exe')
259
+ expect(cur_plat._platform.generate_service_bin_dirs([comp._component.service, comp2._component.service, comp3._component.service].flatten.compact, proj._project)).to eq( \
266
260
  <<-HERE
267
- <Directory Name="opt" Id="opt">
261
+ <Directory Name="somedir" Id="somedir">
268
262
  <Directory Name="oneUp" Id="oneUp">
269
263
  <Directory Name="twoUp" Id="twoUp">
270
264
  <Directory Id="SERVICETEST1BINDIR" />
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.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-15 00:00:00.000000000 Z
11
+ date: 2016-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -132,6 +132,7 @@ files:
132
132
  - resources/windows/nuget/chocolateyInstall.ps1
133
133
  - resources/windows/nuget/chocolateyUninstall.ps1
134
134
  - resources/windows/nuget/project.nuspec.erb
135
+ - resources/windows/wix/componentgroup.wxs.erb
135
136
  - resources/windows/wix/directorylist.wxs.erb
136
137
  - resources/windows/wix/filter.xslt.erb
137
138
  - resources/windows/wix/project.wxs.erb
@@ -157,7 +158,6 @@ files:
157
158
  - spec/lib/vanagon/component/source/http_spec.rb
158
159
  - spec/lib/vanagon/component/source_spec.rb
159
160
  - spec/lib/vanagon/component_spec.rb
160
- - spec/lib/vanagon/driver_spec.rb
161
161
  - spec/lib/vanagon/engine/base_spec.rb
162
162
  - spec/lib/vanagon/engine/docker_spec.rb
163
163
  - spec/lib/vanagon/engine/hardware_spec.rb
@@ -196,36 +196,34 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
196
  version: '0'
197
197
  requirements: []
198
198
  rubyforge_project:
199
- rubygems_version: 2.5.1
199
+ rubygems_version: 2.2.5
200
200
  signing_key:
201
201
  specification_version: 3
202
202
  summary: All of your packages will fit into this van with this one simple trick.
203
203
  test_files:
204
- - spec/lib/makefile_spec.rb
205
- - spec/lib/vanagon/common/pathname_spec.rb
204
+ - spec/lib/vanagon/utilities_spec.rb
205
+ - spec/lib/vanagon/platform_spec.rb
206
+ - spec/lib/vanagon/component_spec.rb
207
+ - spec/lib/vanagon/utilities/shell_utilities_spec.rb
208
+ - spec/lib/vanagon/project_spec.rb
209
+ - spec/lib/vanagon/project/dsl_spec.rb
206
210
  - spec/lib/vanagon/common/user_spec.rb
207
- - spec/lib/vanagon/component/dsl_spec.rb
208
- - spec/lib/vanagon/component/rules_spec.rb
209
- - spec/lib/vanagon/component/source/git_spec.rb
211
+ - spec/lib/vanagon/common/pathname_spec.rb
212
+ - spec/lib/vanagon/platform/windows_spec.rb
213
+ - spec/lib/vanagon/platform/rpm/aix_spec.rb
214
+ - spec/lib/vanagon/platform/solaris_11_spec.rb
215
+ - spec/lib/vanagon/platform/deb_spec.rb
216
+ - spec/lib/vanagon/platform/dsl_spec.rb
217
+ - spec/lib/vanagon/platform/rpm_spec.rb
210
218
  - spec/lib/vanagon/component/source/http_spec.rb
219
+ - spec/lib/vanagon/component/source/git_spec.rb
220
+ - spec/lib/vanagon/component/dsl_spec.rb
211
221
  - spec/lib/vanagon/component/source_spec.rb
212
- - spec/lib/vanagon/component_spec.rb
213
- - spec/lib/vanagon/driver_spec.rb
214
- - spec/lib/vanagon/engine/base_spec.rb
215
- - spec/lib/vanagon/engine/docker_spec.rb
216
- - spec/lib/vanagon/engine/hardware_spec.rb
222
+ - spec/lib/vanagon/component/rules_spec.rb
217
223
  - spec/lib/vanagon/engine/local_spec.rb
224
+ - spec/lib/vanagon/engine/docker_spec.rb
218
225
  - spec/lib/vanagon/engine/pooler_spec.rb
226
+ - spec/lib/vanagon/engine/hardware_spec.rb
227
+ - spec/lib/vanagon/engine/base_spec.rb
219
228
  - spec/lib/vanagon/optparse_spec.rb
220
- - spec/lib/vanagon/platform/deb_spec.rb
221
- - spec/lib/vanagon/platform/dsl_spec.rb
222
- - spec/lib/vanagon/platform/rpm/aix_spec.rb
223
- - spec/lib/vanagon/platform/rpm_spec.rb
224
- - spec/lib/vanagon/platform/solaris_11_spec.rb
225
- - spec/lib/vanagon/platform/windows_spec.rb
226
- - spec/lib/vanagon/platform_spec.rb
227
- - spec/lib/vanagon/project/dsl_spec.rb
228
- - spec/lib/vanagon/project_spec.rb
229
- - spec/lib/vanagon/utilities/shell_utilities_spec.rb
230
- - spec/lib/vanagon/utilities_spec.rb
231
- has_rdoc:
229
+ - spec/lib/makefile_spec.rb
File without changes