wixgem 0.53.0 → 0.54.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.
- checksums.yaml +4 -4
- data/lib/shortcut.rb +64 -0
- data/lib/wixgem.rb +13 -0
- metadata +2 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ea92ffe9cd98c7ca4aa623e484eeb2adf71bcba
|
4
|
+
data.tar.gz: 5921543edf18cdafafef4ac19bbf95baebaf6f94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be4fb592af412bd191596c8f5575eb70e174e89197fe96cfc035c54e631cf1ce16de02d912e3b1b457c00f2c050022d39ad8f9160952fa1357bc32fd5bf30611
|
7
|
+
data.tar.gz: 83d30d7c83b04db3485678536c6d3429e9bf9caa881965e25fb108aa903b63a61223f59590e005b50c6d0411afa62bafddf5138d5320bdb7058e409a2e918edb
|
data/lib/shortcut.rb
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'rexml/document'
|
2
|
+
require 'SecureRandom'
|
3
|
+
|
4
|
+
module Wixgem
|
5
|
+
|
6
|
+
class Shortcut
|
7
|
+
|
8
|
+
def initialize(file, hash)
|
9
|
+
@file = file
|
10
|
+
@hash = hash
|
11
|
+
end
|
12
|
+
|
13
|
+
def create(xml_doc)
|
14
|
+
raise "Shortcut #{@file} does not exist" unless(File.exists?(@file))
|
15
|
+
|
16
|
+
file_elements = REXML::XPath.match(xml_doc, "//File[@Source='.\\#{@file.gsub(/\//,'\\')}']")
|
17
|
+
raise "Shortcut #{@file} does not match an installation file" if(file_elements.length == 0)
|
18
|
+
create_shortcut_element(file_elements[0])
|
19
|
+
create_directory(xml_doc, @hash[:directory]) if(@hash.has_key?(:directory))
|
20
|
+
|
21
|
+
return xml_doc
|
22
|
+
end
|
23
|
+
|
24
|
+
def create_shortcut_element(file_element)
|
25
|
+
shortcut_element = file_element.add_element 'Shortcut'
|
26
|
+
|
27
|
+
shortcut_element.attributes['Id'] = "Shortcut_#{SecureRandom.uuid.gsub(/-/,'')}"
|
28
|
+
shortcut_element.attributes['Arguments'] = @hash[:arguments] if(@hash.has_key?(:arguments))
|
29
|
+
|
30
|
+
shortcut_name = File.basename(@file)
|
31
|
+
shortcut_name = @hash[:name] if(@hash.has_key?(:name))
|
32
|
+
shortcut_element.attributes['Name'] = shortcut_name
|
33
|
+
|
34
|
+
shortcut_element.attributes['Description'] = @hash[:description] if(@hash.has_key?(:description))
|
35
|
+
if(@hash.has_key?(:directory))
|
36
|
+
case @hash[:directory]
|
37
|
+
when :desktop
|
38
|
+
shortcut_element.attributes['Directory'] = 'DesktopFolder'
|
39
|
+
else
|
40
|
+
shortcut_element.attributes['Directory'] = @hash[:directory]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
shortcut_element.attributes['Advertise']="yes"
|
45
|
+
shortcut_element.attributes['Advertise'] = "no" if(@hash.has_key?(:advertise) && !@hash[:advertise])
|
46
|
+
|
47
|
+
return shortcut_element
|
48
|
+
end
|
49
|
+
|
50
|
+
def create_directory(xml_doc, directory)
|
51
|
+
raise 'Currently only supporting desktop shortcuts' unless(directory == :desktop)
|
52
|
+
if(directory == :desktop)
|
53
|
+
desktop_elements = REXML::XPath.match(xml_doc, "//DesktopFolder")
|
54
|
+
if(desktop_elements.length == 0)
|
55
|
+
wix_elements = REXML::XPath.match(xml_doc, "//Wix")
|
56
|
+
fragment_element = wix_elements[0].add_element 'Fragment'
|
57
|
+
target_dir = fragment_element.add_element 'DirectoryRef', { 'Id' => 'TARGETDIR' }
|
58
|
+
target_dir.add_element 'Directory', { 'Id' => 'DesktopFolder', 'Name' => 'Desktop' }
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
data/lib/wixgem.rb
CHANGED
@@ -4,6 +4,7 @@ require 'rexml/document'
|
|
4
4
|
require "#{File.dirname(__FILE__)}/command.rb"
|
5
5
|
require 'SecureRandom'
|
6
6
|
require_relative('file.rb')
|
7
|
+
require_relative('shortcut.rb')
|
7
8
|
|
8
9
|
module Wixgem
|
9
10
|
|
@@ -145,6 +146,17 @@ class Wix
|
|
145
146
|
return xml_doc
|
146
147
|
end
|
147
148
|
|
149
|
+
def self.manage_shortcuts(xml_doc,input)
|
150
|
+
return xml_doc unless(input.has_key?(:shortcuts))
|
151
|
+
|
152
|
+
input[:shortcuts].each do |file, shortcut_hash|
|
153
|
+
shortcut = Shortcut.new(file, shortcut_hash)
|
154
|
+
xml_doc = shortcut.create(xml_doc)
|
155
|
+
end
|
156
|
+
|
157
|
+
return xml_doc
|
158
|
+
end
|
159
|
+
|
148
160
|
def self.modify_file_path(input, file)
|
149
161
|
return file unless(input.kind_of?(Hash) && input.has_key?(:modify_file_paths))
|
150
162
|
|
@@ -384,6 +396,7 @@ class Wix
|
|
384
396
|
xml_doc = manage_upgrade(xml_doc,input)
|
385
397
|
xml_doc = manage_msm_files(xml_doc)
|
386
398
|
xml_doc = manage_read_only_files(xml_doc,input)
|
399
|
+
xml_doc = manage_shortcuts(xml_doc, input)
|
387
400
|
|
388
401
|
File.open(wxs_file, 'w') { |f| f.puts(xml_doc.to_s) }
|
389
402
|
#formatter = REXML::Formatters::Pretty.new(2)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wixgem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.54.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Marshall
|
@@ -66,20 +66,6 @@ dependencies:
|
|
66
66
|
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: ffi
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ~>
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ~>
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
69
|
description: Simple Ruby interface to facilitate creating and compiling windows installation
|
84
70
|
files with the Wix Toolset.
|
85
71
|
email: KCCKSMarshall@gmail.com
|
@@ -97,6 +83,7 @@ files:
|
|
97
83
|
- lib/WindowsInstaller.rb
|
98
84
|
- lib/command.rb
|
99
85
|
- lib/file.rb
|
86
|
+
- lib/shortcut.rb
|
100
87
|
- lib/wixgem.rb
|
101
88
|
homepage: http://rubygems.org/gems/wixgem
|
102
89
|
licenses:
|