netfira-installer-generator 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/netfira/installer_generator.rb +19 -9
- data/lib/netfira/installer_generator/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e8eefc83aaedbcac1b2d739260c6fe1640f0102
|
4
|
+
data.tar.gz: 2e9faee4cff0689bd39c9f2530aeda3eb47df43a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce181f471ec525eb3cec3801953c87e7ee444e1c9b638fbe924cab6d13563c818487e54a4268273dc493d4d899a5b525d03bdc6b189cc0eb67006d54b32108af
|
7
|
+
data.tar.gz: bc495314f068e423cbe3243f527c18330b494e937cb56f9fd9ec77bc54eaf9cac573280035a74c0c7ad2ec318441476c6c421e3ccac802d30635b12ce58ee757
|
@@ -29,7 +29,7 @@ module Netfira
|
|
29
29
|
:signing_description, :signing_url,
|
30
30
|
:output_device
|
31
31
|
|
32
|
-
REQUIRED_VALUES = %i[
|
32
|
+
REQUIRED_VALUES = %i[source icon target shop_id shop_url sync_url]
|
33
33
|
|
34
34
|
def initialize
|
35
35
|
self.output_device = :null
|
@@ -47,7 +47,7 @@ module Netfira
|
|
47
47
|
|
48
48
|
}.each do |method, description|
|
49
49
|
define_method :"#{method}=" do |path|
|
50
|
-
raise "#{description} not found at #{path}" unless File.exist? path
|
50
|
+
raise Exception, "#{description} not found at #{path}" unless File.exist? path
|
51
51
|
instance_variable_set :"@#{method}", path
|
52
52
|
end
|
53
53
|
end
|
@@ -58,8 +58,7 @@ module Netfira
|
|
58
58
|
self.class.preflight!
|
59
59
|
|
60
60
|
# Ensure we have no missing required values
|
61
|
-
|
62
|
-
raise Exception, "Missing value(s) for #{missing.join ', '}" unless missing.empty?
|
61
|
+
require_values! REQUIRED_VALUES
|
63
62
|
|
64
63
|
# Make a temporary build dir
|
65
64
|
build_dir = Pathname(Dir.tmpdir) + SecureRandom.uuid
|
@@ -76,13 +75,19 @@ module Netfira
|
|
76
75
|
|
77
76
|
# Run makensis
|
78
77
|
makensis build_dir or raise Exception, 'makensis failed'
|
78
|
+
output_path = build_dir + 'nsis_generated.exe'
|
79
79
|
|
80
80
|
# Run signcode
|
81
|
-
|
81
|
+
if signing_key || signing_cert
|
82
|
+
require_values! %i[signing_key signing_cert]
|
83
|
+
input_path = output_path
|
84
|
+
output_path = build_dir + 'signed.exe'
|
85
|
+
signcode input_path, output_path or raise Exception, 'signcode failed'
|
86
|
+
end
|
82
87
|
|
83
88
|
# Write target file
|
84
89
|
mkdir_p File.dirname(target)
|
85
|
-
mv
|
90
|
+
mv output_path, target
|
86
91
|
|
87
92
|
ensure
|
88
93
|
rm_rf build_dir
|
@@ -92,6 +97,11 @@ module Netfira
|
|
92
97
|
|
93
98
|
private
|
94
99
|
|
100
|
+
def require_values!(keys)
|
101
|
+
missing = keys.select { |key| send(key).nil? }
|
102
|
+
raise Exception, "Missing value(s) for #{missing.join ', '}" unless missing.empty?
|
103
|
+
end
|
104
|
+
|
95
105
|
def render_nsis_template
|
96
106
|
# noinspection RubyStringKeysInHashInspection
|
97
107
|
values = {
|
@@ -115,14 +125,14 @@ module Netfira
|
|
115
125
|
b.run output_device
|
116
126
|
end
|
117
127
|
|
118
|
-
def signcode(
|
128
|
+
def signcode(source, target)
|
119
129
|
b = Binary::Signcode.new
|
120
130
|
b.spc_path = signing_cert
|
121
131
|
b.key_path = signing_key
|
122
132
|
b.url = signing_url || shop_url
|
123
133
|
b.description = signing_description || installer_name
|
124
|
-
b.source_path =
|
125
|
-
b.target_path =
|
134
|
+
b.source_path = source
|
135
|
+
b.target_path = target
|
126
136
|
b.run output_device
|
127
137
|
end
|
128
138
|
|