wixgem 0.23.0 → 0.24.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/README.md +46 -55
- data/example/example.msi +0 -0
- data/example/example.msm +0 -0
- data/example/install_files/directory/file2.txt +1 -0
- data/example/install_files/file1.txt +1 -0
- data/example/rakefile.rb +28 -0
- data/lib/templates/Install.wxs +26 -0
- data/lib/templates/mergemodule.wxs +15 -0
- data/lib/wixgem.rb +24 -5
- data/spec/execute.rb +8 -8
- data/spec/mergemodule_spec.rb +5 -4
- data/spec/multiple_product_installation_spec.rb +70 -70
- data/spec/test_files_exist.rb +34 -34
- data/spec/wixpath.rb +1 -1
- metadata +26 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e541abada7187822b5c9173bbf5d14fde571e290
|
4
|
+
data.tar.gz: d0c3e26ceb499a6a3347dc0308b40a3ef13c39e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71b0dc6d348aa8e3e0ce09a4358cce8d26ee899d08ca4c3a680a8dd650d3db0635e6a989573c821fec14c9cbf3fec2032e7e7cdad39e74f6f42a9307065b9e52
|
7
|
+
data.tar.gz: 82b5959f389af3d9bec38bff175b7abeb64b4915436dd2515a4002026a6ca938a2f3d924004a790f6792979fb836ba258c9724970f96dba2d248db11f9deff0e
|
data/README.md
CHANGED
@@ -1,69 +1,61 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# Wixgem
|
2
|
+
Ruby gem to facilitate automate constructing Windows installation files
|
3
3
|
with the Wix Toolset.
|
4
4
|
|
5
5
|
## Installation
|
6
|
-
|
6
|
+
Wixgem can be installed by the single command
|
7
7
|
gem install wixgem
|
8
8
|
|
9
|
-
## Usage
|
10
|
-
|
9
|
+
## Example Usage
|
10
|
+
#### Dependencies
|
11
|
+
The [WiX Toolset](http://wixtoolset.org) must be installed.
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
require 'wixgem'
|
13
|
+
#### Installation
|
14
|
+
```ruby
|
15
|
+
require 'wixgem'
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
17
|
+
WIX_TOOLSET_ROOT='path to root of Wix toolset'
|
18
|
+
Wix.make_installation('Product.msi', ['rakefile.rb']])
|
19
|
+
|
20
|
+
Wix.make_installation('Product.msi', {product_name: 'productname',
|
21
|
+
version: '1.1.0.0'
|
22
|
+
upgrade_code: '{1d5df00a-c18d-4897-95e6-8c936dd19647}',
|
23
|
+
files: ['rakefile.rb'] }
|
24
|
+
|
25
|
+
Wix.make_installation('Product.msi', {modify_file_paths: {/\Atest_files\// => ''}, files: Dir.glob("test_files/**/*")})
|
25
26
|
```
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
```
|
31
|
-
require 'wixgem'
|
28
|
+
#### Merge Module
|
29
|
+
```ruby
|
30
|
+
require 'wixgem'
|
32
31
|
|
33
|
-
|
34
|
-
|
35
|
-
task :create_installation_files do
|
36
|
-
FileUtils.mkpath('./install_files/directory')
|
37
|
-
sleep(1)
|
38
|
-
File.open('./install_files/file1.txt', 'w') { |f| f.write('Hello World') }
|
39
|
-
File.open('./install_files/directory/file2.txt', 'w') { |f| f.write('Hello World') }
|
40
|
-
end
|
41
|
-
|
42
|
-
desc "Generate an installation msi file"
|
43
|
-
task :installation => [:create_installation_files] do
|
44
|
-
Wix.install_path = WIX_TOOLSET_ROOT
|
45
|
-
|
46
|
-
installation_files = Dir.glob('./install_files/**/*')
|
47
|
-
Wix.make_installation("./example.msi",
|
48
|
-
{
|
49
|
-
manufacturer: 'Company', version: "1.0.0",
|
50
|
-
product_code: '{69d12c6c-63be-43e4-92ff-e31ec3c86dc0}',
|
51
|
-
upgrade_code: '{a62c35a7-6a6d-4392-822b-f6aca7eef88b}',
|
52
|
-
files: installation_files
|
53
|
-
}
|
54
|
-
)
|
55
|
-
end
|
56
|
-
|
57
|
-
task :mergemodule => [:create_installation_files] do
|
58
|
-
installation_files = Dir.glob('./install_files/**/*')
|
59
|
-
|
60
|
-
Wix.install_path = WIX_TOOLSET_ROOT
|
61
|
-
Wix.make_mergemodule('./example.msm', installation_files)
|
62
|
-
end
|
63
|
-
|
64
|
-
task :default => [:installation]
|
32
|
+
WIX_TOOLSET_ROOT='path to root of Wix toolset'
|
33
|
+
Wix.make_mergemodule('Product.msi', ['rakefile.rb']])
|
65
34
|
```
|
66
35
|
|
36
|
+
An example rakefile.rb is included in the example directory of the gem.
|
37
|
+
|
38
|
+
## Documenation
|
39
|
+
|
40
|
+
Wixgem will generate an installation or merge module from an array of files. The Wixgem also supports a
|
41
|
+
small set of optional arguments allowing the developer to customize the generated installation file.
|
42
|
+
|
43
|
+
#### Optional input hash arguments
|
44
|
+
* **product_name**: String specifing the product name of the installation.
|
45
|
+
* **manufacturer**: String specifing the manufacturer of the installation.
|
46
|
+
* **version**: String specifing the version of the installation. i.e. '1.1.0.0'
|
47
|
+
* **product_code**: Is a string GUID used to uniquely identify each version of the installation. i.e.' {4528ae5a-c7fa-40a6-a70e-ac8135f1114c}'
|
48
|
+
* **upgrade_code**: Is a string GUID used to identify all installed versions of the product. It is important to
|
49
|
+
properly address the upgrade code before shipping the first version of a product.
|
50
|
+
* **files**: A string array of file paths to be added to the installation.
|
51
|
+
* **modify_file_paths**: A hash of regex objects to replacement string pairs. The regular expressions are applied to
|
52
|
+
the file paths having the effect of changing the relative location of the files in the
|
53
|
+
installation.
|
54
|
+
* **has_vb6_files**: Required if installation contains any ocx's or dll's compiled with Visual Basic 6.
|
55
|
+
* **remove_existing_products**: A boolean value. If the value is true the installation will remove all existing
|
56
|
+
installations of the product before installing the product.
|
57
|
+
|
58
|
+
|
67
59
|
## License
|
68
60
|
Copyright 2013-2014 Kevin Marshall
|
69
61
|
|
@@ -78,4 +70,3 @@ Copyright 2013-2014 Kevin Marshall
|
|
78
70
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
79
71
|
See the License for the specific language governing permissions and
|
80
72
|
limitations under the License.
|
81
|
-
|
data/example/example.msi
ADDED
Binary file
|
data/example/example.msm
ADDED
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
Hello World
|
@@ -0,0 +1 @@
|
|
1
|
+
Hello World
|
data/example/rakefile.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'wixgem'
|
2
|
+
|
3
|
+
#Wix.install_path = 'E:\Development\dep\OpenSource\WixToolset\3.9'
|
4
|
+
Wix.install_path = '<Path to the root directory of the wix toolset>'
|
5
|
+
|
6
|
+
task :create_installation_files do
|
7
|
+
FileUtils.mkpath('./install_files/directory')
|
8
|
+
sleep(1)
|
9
|
+
File.open('./install_files/file1.txt', 'w') { |f| f.write('Hello World') }
|
10
|
+
File.open('./install_files/directory/file2.txt', 'w') { |f| f.write('Hello World') }
|
11
|
+
end
|
12
|
+
|
13
|
+
task :mergemodule => [:create_installation_files] do
|
14
|
+
installation_files = Dir.glob('./install_files/**/*')
|
15
|
+
|
16
|
+
Wix.make_mergemodule('./example.msm', installation_files)
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "Generate an installation msi file"
|
20
|
+
task :installation => [:mergemodule] do
|
21
|
+
installation_files = Dir.glob('./example.msm')
|
22
|
+
Wix.make_installation("./example.msi",
|
23
|
+
{ upgrade_code: '{a62c35a7-6a6d-4392-822b-f6aca7eef88b}',
|
24
|
+
files: installation_files }
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
task :default => [:installation]
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
3
|
+
<Product Id="PRODUCT_CODE" Name="PRODUCT_NAME" Language="1033" Version="VERSION" Manufacturer="MANUFACTURER" UpgradeCode="UPGRADE_CODE">
|
4
|
+
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
|
5
|
+
|
6
|
+
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
|
7
|
+
<Media Id="1" Cabinet="WixgemTest.cab" EmbedCab="yes" />
|
8
|
+
|
9
|
+
<!-- Step 1: Define the directory structure -->
|
10
|
+
<Directory Id="TARGETDIR" Name="SourceDir">
|
11
|
+
<Directory Id="ProgramFilesFolder">
|
12
|
+
INSTALL_DIR
|
13
|
+
</Directory>
|
14
|
+
</Directory>
|
15
|
+
|
16
|
+
<!-- Step 2: Add files to installer package -->
|
17
|
+
<DirectoryRef Id="INSTALLFOLDER">
|
18
|
+
FILES
|
19
|
+
</DirectoryRef>
|
20
|
+
|
21
|
+
<!-- Step 3: Tell Wix to install the files-->
|
22
|
+
<Feature Id="ProductFeature" Title="PRODUCT_NAME Installation" Level="1">
|
23
|
+
COMPONENT_REFS
|
24
|
+
</Feature>
|
25
|
+
</Product>
|
26
|
+
</Wix>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
3
|
+
<Module Id="MODULE_NAME" Language="1033" Version="VERSION">
|
4
|
+
<Package Id="PRODUCT_CODE" InstallerVersion="200" Manufacturer="MANUFACTURER" />
|
5
|
+
COMPONENT_REFS
|
6
|
+
<Directory Id="TARGETDIR" Name="SourceDir">
|
7
|
+
<Directory Id="MergeRedirectFolder" />
|
8
|
+
</Directory>
|
9
|
+
</Module>
|
10
|
+
<Fragment>
|
11
|
+
<DirectoryRef Id="MergeRedirectFolder">
|
12
|
+
FILES
|
13
|
+
</DirectoryRef>
|
14
|
+
</Fragment>
|
15
|
+
</Wix>
|
data/lib/wixgem.rb
CHANGED
@@ -22,14 +22,14 @@ class Wix
|
|
22
22
|
return @debug
|
23
23
|
end
|
24
24
|
|
25
|
-
def self.make_mergemodule(
|
25
|
+
def self.make_mergemodule(output_file, input)
|
26
26
|
gem_dir = File.dirname(__FILE__)
|
27
|
-
apply_wix_template(
|
27
|
+
apply_wix_template(output_file, input, "#{gem_dir}/templates/mergemodule.wxs")
|
28
28
|
end
|
29
29
|
|
30
|
-
def self.make_installation(
|
30
|
+
def self.make_installation(output_file, input)
|
31
31
|
gem_dir = File.dirname(__FILE__)
|
32
|
-
apply_wix_template(
|
32
|
+
apply_wix_template(output_file, input, "#{gem_dir}/templates/Install.wxs")
|
33
33
|
end
|
34
34
|
|
35
35
|
private
|
@@ -122,6 +122,23 @@ class Wix
|
|
122
122
|
missing_files.insert(missing_files.length, file)
|
123
123
|
end
|
124
124
|
end
|
125
|
+
|
126
|
+
if(@debug)
|
127
|
+
max_path = files.max { |a, b| a.length <=> b.length }
|
128
|
+
columen_size = max_path.length + 10
|
129
|
+
File.open('./installation_files.txt', 'w') do |f|
|
130
|
+
f.printf("%-#{columen_size}s %s\n" % ['File path', 'Installation Path'])
|
131
|
+
files.each do |file|
|
132
|
+
if(File.file?(file))
|
133
|
+
install_path = file
|
134
|
+
if(input.kind_of?(Hash) && input.has_key?(:modify_file_paths))
|
135
|
+
input[:modify_file_paths].each { |regex, replacement_string| install_path = install_path.gsub(regex, replacement_string) }
|
136
|
+
end
|
137
|
+
f.printf("%-#{columen_size}s %s\n" % [file, install_path])
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
125
142
|
|
126
143
|
if(missing_files.length > 0)
|
127
144
|
missing_files_str = ''
|
@@ -223,7 +240,9 @@ class Wix
|
|
223
240
|
end
|
224
241
|
end
|
225
242
|
end
|
226
|
-
|
243
|
+
|
244
|
+
FileUtils.mv('installation_files.txt', "#{File.dirname(output_absolute_path)}/#{File.basename(wxs_file,'.wxs')}_paths.txt") if(File.exists?('installation_files.txt'))
|
245
|
+
end
|
227
246
|
pdb_file = output_absolute_path.gsub(ext,'.wixpdb')
|
228
247
|
FileUtils.rm(pdb_file) if(File.exists?(pdb_file))
|
229
248
|
end
|
data/spec/execute.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require 'dev_tasks'
|
2
|
-
|
3
|
-
def execute(cmd)
|
4
|
-
command = Command.new(cmd)
|
5
|
-
command.execute
|
6
|
-
|
7
|
-
raise "Failed: #{cmd} Status: #{command[:exit_code]}\nStdout: #{command[:output]}\nStderr: #{command[:error]}" unless(command[:exit_code] == 0)
|
8
|
-
end
|
1
|
+
require 'dev_tasks'
|
2
|
+
|
3
|
+
def execute(cmd)
|
4
|
+
command = Command.new(cmd)
|
5
|
+
command.execute
|
6
|
+
|
7
|
+
raise "Failed: #{cmd} Status: #{command[:exit_code]}\nStdout: #{command[:output]}\nStderr: #{command[:error]}" unless(command[:exit_code] == 0)
|
8
|
+
end
|
data/spec/mergemodule_spec.rb
CHANGED
@@ -10,10 +10,10 @@ Wix.debug=true
|
|
10
10
|
describe 'Wixgem' do
|
11
11
|
describe 'Merge Module' do
|
12
12
|
test_arguments = {
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
test1: ['test/wixgem_merge_test1.msm', ['rakefile.rb']],
|
14
|
+
test2: ['test/wixgem_merge_test2.msm', {files: ['Gemfile']}],
|
15
|
+
test3: ['test/wixgem_merge_test3.msm', ['rakefile.rb', 'Gemfile']],
|
16
|
+
test4: ['test/wixgem_merge_test4.msm', Dir.glob("test_files/**/*")]
|
17
17
|
}
|
18
18
|
|
19
19
|
test_arguments.each { |key, value|
|
@@ -34,6 +34,7 @@ describe 'Wixgem' do
|
|
34
34
|
end
|
35
35
|
}
|
36
36
|
end
|
37
|
+
|
37
38
|
if(admin?)
|
38
39
|
describe 'Multiple merge Module' do
|
39
40
|
msi_file='test\\wixgem_multiple_merge_test1.msi'
|
@@ -1,71 +1,71 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require './lib/wixgem.rb'
|
3
|
-
require './spec/wixpath.rb'
|
4
|
-
require './admin.rb'
|
5
|
-
require './spec/test_install.rb'
|
6
|
-
require './spec/test_files_exist.rb'
|
7
|
-
require 'json'
|
8
|
-
|
9
|
-
if(admin?)
|
10
|
-
describe 'Wixgem' do
|
11
|
-
describe 'Side by side installations' do
|
12
|
-
product1='wixgem_multiple 1.0'
|
13
|
-
product2='wixgem_multiple 1.1'
|
14
|
-
begin
|
15
|
-
Wix.make_installation("test/wixgem_multiple.1.0.0.msi", {version: '1.0.0.0', product_name: product1, upgrade_code: '{face46ab-74ce-44eb-a2b7-81a8cfad5bab}', files: ['Gemfile']})
|
16
|
-
Wix.make_installation("test/wixgem_multiple.1.1.0.msi", {version: '1.1.0.0', product_name: product2, upgrade_code: '{face46ab-74ce-44eb-a2b7-81a8cfad5bab}', files: ['rakefile.rb']})
|
17
|
-
|
18
|
-
it "should install version 1.0.0" do
|
19
|
-
execute("msiexec.exe /i test\\wixgem_multiple.1.0.0.msi")
|
20
|
-
expect(WindowsInstaller.installed?(product1)).to be(true)
|
21
|
-
expect(WindowsInstaller.version?(product1)).to eq('1.0.0.0')
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should install version 1.1.0" do
|
25
|
-
execute("msiexec.exe /i test\\wixgem_multiple.1.1.0.msi")
|
26
|
-
expect(WindowsInstaller.installed?(product2)).to be(true)
|
27
|
-
expect(WindowsInstaller.version?(product2)).to eq('1.1.0.0')
|
28
|
-
end
|
29
|
-
|
30
|
-
it "version 1.0.0 should still be installed" do
|
31
|
-
expect(WindowsInstaller.installed?(product1)).to be(true)
|
32
|
-
end
|
33
|
-
|
34
|
-
it "product codes for version 1.0.0 and 1.0.0 should be different" do
|
35
|
-
expect(WindowsInstaller.product_code?(product1)).not_to eq(WindowsInstaller.product_code?(product2))
|
36
|
-
end
|
37
|
-
ensure
|
38
|
-
execute("msiexec.exe /quiet /x #{WindowsInstaller.product_code?(product1)}") while(WindowsInstaller.installed?(product1))
|
39
|
-
raise "Failed to uninstall product #{product1}" if(WindowsInstaller.installed?(product1))
|
40
|
-
execute("msiexec.exe /quiet /x #{WindowsInstaller.product_code?(product2)}") while(WindowsInstaller.installed?(product2))
|
41
|
-
raise "Failed to uninstall product #{product2}" if(WindowsInstaller.installed?(product2))
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
describe 'remove previous version' do
|
46
|
-
product1='wixgem_install 1.0'
|
47
|
-
product2='wixgem_install 1.1'
|
48
|
-
begin
|
49
|
-
Wix.make_installation("test/wixgem_install.1.0.0.msi", {version: '1.0.0.0', product_name: product1, upgrade_code: '{face46ab-74ce-44eb-a2b7-81a8cfad5bab}', files: ['Gemfile']})
|
50
|
-
Wix.make_installation("test/wixgem_install.1.1.0.msi", {version: '1.1.0.0', product_name: product2, remove_existing_products: true, upgrade_code: '{face46ab-74ce-44eb-a2b7-81a8cfad5bab}', files: ['rakefile.rb']})
|
51
|
-
|
52
|
-
it "should install version 1.0.0" do
|
53
|
-
execute("msiexec.exe /i test\\wixgem_install.1.0.0.msi")
|
54
|
-
expect(WindowsInstaller.installed?(product1)).to be(true)
|
55
|
-
end
|
56
|
-
|
57
|
-
it "should install version 1.1.0" do
|
58
|
-
execute("msiexec.exe /i test\\wixgem_install.1.1.0.msi")
|
59
|
-
expect(WindowsInstaller.installed?(product2)).to be(true)
|
60
|
-
end
|
61
|
-
|
62
|
-
it "the version 1.0.0 should have been uninstalled" do
|
63
|
-
expect(WindowsInstaller.installed?(product1)).to be(false)
|
64
|
-
end
|
65
|
-
ensure
|
66
|
-
execute("msiexec.exe /quiet /x #{WindowsInstaller.product_code?(product2)}") while(WindowsInstaller.installed?(product2))
|
67
|
-
raise "Failed to uninstall product #{product2}" if(WindowsInstaller.installed?(product2))
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
1
|
+
require 'rspec'
|
2
|
+
require './lib/wixgem.rb'
|
3
|
+
require './spec/wixpath.rb'
|
4
|
+
require './admin.rb'
|
5
|
+
require './spec/test_install.rb'
|
6
|
+
require './spec/test_files_exist.rb'
|
7
|
+
require 'json'
|
8
|
+
|
9
|
+
if(admin?)
|
10
|
+
describe 'Wixgem' do
|
11
|
+
describe 'Side by side installations' do
|
12
|
+
product1='wixgem_multiple 1.0'
|
13
|
+
product2='wixgem_multiple 1.1'
|
14
|
+
begin
|
15
|
+
Wix.make_installation("test/wixgem_multiple.1.0.0.msi", {version: '1.0.0.0', product_name: product1, upgrade_code: '{face46ab-74ce-44eb-a2b7-81a8cfad5bab}', files: ['Gemfile']})
|
16
|
+
Wix.make_installation("test/wixgem_multiple.1.1.0.msi", {version: '1.1.0.0', product_name: product2, upgrade_code: '{face46ab-74ce-44eb-a2b7-81a8cfad5bab}', files: ['rakefile.rb']})
|
17
|
+
|
18
|
+
it "should install version 1.0.0" do
|
19
|
+
execute("msiexec.exe /i test\\wixgem_multiple.1.0.0.msi")
|
20
|
+
expect(WindowsInstaller.installed?(product1)).to be(true)
|
21
|
+
expect(WindowsInstaller.version?(product1)).to eq('1.0.0.0')
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should install version 1.1.0" do
|
25
|
+
execute("msiexec.exe /i test\\wixgem_multiple.1.1.0.msi")
|
26
|
+
expect(WindowsInstaller.installed?(product2)).to be(true)
|
27
|
+
expect(WindowsInstaller.version?(product2)).to eq('1.1.0.0')
|
28
|
+
end
|
29
|
+
|
30
|
+
it "version 1.0.0 should still be installed" do
|
31
|
+
expect(WindowsInstaller.installed?(product1)).to be(true)
|
32
|
+
end
|
33
|
+
|
34
|
+
it "product codes for version 1.0.0 and 1.0.0 should be different" do
|
35
|
+
expect(WindowsInstaller.product_code?(product1)).not_to eq(WindowsInstaller.product_code?(product2))
|
36
|
+
end
|
37
|
+
ensure
|
38
|
+
execute("msiexec.exe /quiet /x #{WindowsInstaller.product_code?(product1)}") while(WindowsInstaller.installed?(product1))
|
39
|
+
raise "Failed to uninstall product #{product1}" if(WindowsInstaller.installed?(product1))
|
40
|
+
execute("msiexec.exe /quiet /x #{WindowsInstaller.product_code?(product2)}") while(WindowsInstaller.installed?(product2))
|
41
|
+
raise "Failed to uninstall product #{product2}" if(WindowsInstaller.installed?(product2))
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe 'remove previous version' do
|
46
|
+
product1='wixgem_install 1.0'
|
47
|
+
product2='wixgem_install 1.1'
|
48
|
+
begin
|
49
|
+
Wix.make_installation("test/wixgem_install.1.0.0.msi", {version: '1.0.0.0', product_name: product1, upgrade_code: '{face46ab-74ce-44eb-a2b7-81a8cfad5bab}', files: ['Gemfile']})
|
50
|
+
Wix.make_installation("test/wixgem_install.1.1.0.msi", {version: '1.1.0.0', product_name: product2, remove_existing_products: true, upgrade_code: '{face46ab-74ce-44eb-a2b7-81a8cfad5bab}', files: ['rakefile.rb']})
|
51
|
+
|
52
|
+
it "should install version 1.0.0" do
|
53
|
+
execute("msiexec.exe /i test\\wixgem_install.1.0.0.msi")
|
54
|
+
expect(WindowsInstaller.installed?(product1)).to be(true)
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should install version 1.1.0" do
|
58
|
+
execute("msiexec.exe /i test\\wixgem_install.1.1.0.msi")
|
59
|
+
expect(WindowsInstaller.installed?(product2)).to be(true)
|
60
|
+
end
|
61
|
+
|
62
|
+
it "the version 1.0.0 should have been uninstalled" do
|
63
|
+
expect(WindowsInstaller.installed?(product1)).to be(false)
|
64
|
+
end
|
65
|
+
ensure
|
66
|
+
execute("msiexec.exe /quiet /x #{WindowsInstaller.product_code?(product2)}") while(WindowsInstaller.installed?(product2))
|
67
|
+
raise "Failed to uninstall product #{product2}" if(WindowsInstaller.installed?(product2))
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
71
|
end
|
data/spec/test_files_exist.rb
CHANGED
@@ -1,35 +1,35 @@
|
|
1
|
-
def files(data)
|
2
|
-
files = data
|
3
|
-
if(data.kind_of?(Hash))
|
4
|
-
files = data[:files]
|
5
|
-
|
6
|
-
if(data.has_key?(:modify_file_paths))
|
7
|
-
modify_paths = data[:modify_file_paths]
|
8
|
-
files.each_index do |index|
|
9
|
-
file_path = files[index]
|
10
|
-
modify_paths.each { |regex, replacement_string| file_path = file_path.gsub(regex, replacement_string) }
|
11
|
-
files[index] = file_path
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
return files
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_files_exist(msi_file, data)
|
19
|
-
files = files(data)
|
20
|
-
|
21
|
-
product_name = File.basename(msi_file, File.extname(msi_file))
|
22
|
-
product_name = data[:product_name] if(data.kind_of?(Hash) && data.has_key?(:product_name))
|
23
|
-
|
24
|
-
manufacturer = ''
|
25
|
-
manufacturer = data[:manufacturer] if(data.kind_of?(Hash) && data.has_key?(:manufacturer))
|
26
|
-
|
27
|
-
relative_install_dir = product_name
|
28
|
-
raise "#{name}: relative_install_dir should be set to the product name" if(relative_install_dir.length == 0)
|
29
|
-
relative_install_dir = "#{manufacturer}/#{relative_install_dir}" if(manufacturer.length > 0)
|
30
|
-
|
31
|
-
files.each { |file|
|
32
|
-
full_path = "C:/Program Files (x86)/#{relative_install_dir}/#{file}"
|
33
|
-
raise "#{full_path} not installed." unless(File.exists?(full_path))
|
34
|
-
}
|
1
|
+
def files(data)
|
2
|
+
files = data
|
3
|
+
if(data.kind_of?(Hash))
|
4
|
+
files = data[:files]
|
5
|
+
|
6
|
+
if(data.has_key?(:modify_file_paths))
|
7
|
+
modify_paths = data[:modify_file_paths]
|
8
|
+
files.each_index do |index|
|
9
|
+
file_path = files[index]
|
10
|
+
modify_paths.each { |regex, replacement_string| file_path = file_path.gsub(regex, replacement_string) }
|
11
|
+
files[index] = file_path
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
return files
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_files_exist(msi_file, data)
|
19
|
+
files = files(data)
|
20
|
+
|
21
|
+
product_name = File.basename(msi_file, File.extname(msi_file))
|
22
|
+
product_name = data[:product_name] if(data.kind_of?(Hash) && data.has_key?(:product_name))
|
23
|
+
|
24
|
+
manufacturer = ''
|
25
|
+
manufacturer = data[:manufacturer] if(data.kind_of?(Hash) && data.has_key?(:manufacturer))
|
26
|
+
|
27
|
+
relative_install_dir = product_name
|
28
|
+
raise "#{name}: relative_install_dir should be set to the product name" if(relative_install_dir.length == 0)
|
29
|
+
relative_install_dir = "#{manufacturer}/#{relative_install_dir}" if(manufacturer.length > 0)
|
30
|
+
|
31
|
+
files.each { |file|
|
32
|
+
full_path = "C:/Program Files (x86)/#{relative_install_dir}/#{file}"
|
33
|
+
raise "#{full_path} not installed." unless(File.exists?(full_path))
|
34
|
+
}
|
35
35
|
end
|
data/spec/wixpath.rb
CHANGED
metadata
CHANGED
@@ -1,71 +1,77 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wixgem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.24.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Marshall
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: dev_tasks
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
|
+
- - '='
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 1.0.28
|
62
65
|
type: :development
|
63
66
|
prerelease: false
|
64
67
|
version_requirements: !ruby/object:Gem::Requirement
|
65
68
|
requirements:
|
66
|
-
- - ~>
|
69
|
+
- - "~>"
|
67
70
|
- !ruby/object:Gem::Version
|
68
71
|
version: '0'
|
72
|
+
- - '='
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 1.0.28
|
69
75
|
description: Simple Ruby interface to facilitate creating and compiling windows installation
|
70
76
|
files with the Wix Toolset.
|
71
77
|
email: KCCKSMarshall@gmail.com
|
@@ -75,6 +81,13 @@ extra_rdoc_files: []
|
|
75
81
|
files:
|
76
82
|
- LICENSE
|
77
83
|
- README.md
|
84
|
+
- example/example.msi
|
85
|
+
- example/example.msm
|
86
|
+
- example/install_files/directory/file2.txt
|
87
|
+
- example/install_files/file1.txt
|
88
|
+
- example/rakefile.rb
|
89
|
+
- lib/templates/Install.wxs
|
90
|
+
- lib/templates/mergemodule.wxs
|
78
91
|
- lib/wixgem.rb
|
79
92
|
- spec/execute.rb
|
80
93
|
- spec/installation_spec.rb
|
@@ -98,17 +111,17 @@ require_paths:
|
|
98
111
|
- lib
|
99
112
|
required_ruby_version: !ruby/object:Gem::Requirement
|
100
113
|
requirements:
|
101
|
-
- -
|
114
|
+
- - ">="
|
102
115
|
- !ruby/object:Gem::Version
|
103
116
|
version: 1.9.1
|
104
117
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
118
|
requirements:
|
106
|
-
- -
|
119
|
+
- - ">="
|
107
120
|
- !ruby/object:Gem::Version
|
108
121
|
version: '0'
|
109
122
|
requirements: []
|
110
123
|
rubyforge_project:
|
111
|
-
rubygems_version: 2.2.
|
124
|
+
rubygems_version: 2.2.2
|
112
125
|
signing_key:
|
113
126
|
specification_version: 4
|
114
127
|
summary: Simple Ruby interface to facilitate working with Wix Toolset
|