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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bee147204dd4460b4bcf0834bc98afdc95b636b9
4
- data.tar.gz: 2c580bb0b62fd6259a62dc0c2d085a37a18d1957
3
+ metadata.gz: 9e8eefc83aaedbcac1b2d739260c6fe1640f0102
4
+ data.tar.gz: 2e9faee4cff0689bd39c9f2530aeda3eb47df43a
5
5
  SHA512:
6
- metadata.gz: 4c3b48fafe6632d6088b694dce95aa4f0bf234109a299221fe65c129d4ee224533d84bc0e3b36b7b888463b2597a886d8ae2e1b2c958d33b5fc66f2962c7d42f
7
- data.tar.gz: 03dd5bf1168791d6f151165d2b5f951d1de790d167ba32222379e6e5c6733d850e5444dd19345d38c4f52b9169dd1ac8d0a3c49fcb313404d2168d0fe2de6e14
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[shop_id shop_url sync_url icon source signing_cert signing_key target]
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
- missing = REQUIRED_VALUES.select { |key| send(key).nil? }
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
- signcode build_dir or raise Exception, 'signcode failed'
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 build_dir + 'signed.exe', target
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(build_dir)
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 = build_dir + 'nsis_generated.exe'
125
- b.target_path = build_dir + 'signed.exe'
134
+ b.source_path = source
135
+ b.target_path = target
126
136
  b.run output_device
127
137
  end
128
138
 
@@ -1,5 +1,5 @@
1
1
  module Netfira
2
2
  class InstallerGenerator
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: netfira-installer-generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neil E. Pearson