highway 1.0.4 → 1.0.5

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
  SHA256:
3
- metadata.gz: fc25384b2e82e13b699027763e6f6fdc3f90d2a16922a22979b4bfd7301ce64b
4
- data.tar.gz: cf8c3e3ef8eab729104c25012dc2f2afae0ea0efe2ef68b7443cf81c2a4432b1
3
+ metadata.gz: 489e833227b29b1b471e2f9296a434ba99c351d2fe49189074b033aeb0c0b2ae
4
+ data.tar.gz: 36580683a8cd8dfedeb932e6528f6abcc551acb19834cea71f0a2eace5cb99c1
5
5
  SHA512:
6
- metadata.gz: 2838fb3a68877c578241966db7cdf4d659c2c90cb9e56199991700185c762206806f126a89d82495bf4dc13402aab05e8f434aaa87eaa5eebf38d59983796b6e
7
- data.tar.gz: 844e47c92d8659e804892c6f7e5c0eca5d9e2c4e2b0be9a257a408b17fa66d1204a044b2f9791e9f56bdf8428f1a5570413a483f773765307d7a4d076fc898ab
6
+ metadata.gz: 03b7609941bff19c3a8fabc78785244c96a33d039eadb2e601e916c6202d04099596516068641affa7ac725e0bb773f252b042afd8f140f1fbccecbb8fc560e7
7
+ data.tar.gz: d2b34da037b7ecf6647b6a14ebfe3f5b1c65fcb54492799ab40e43e869f27809b0a40585e57a24a5bc7ed7a045807ae9e92fb14ea3f6b80cc0fa8046dc9e749d
@@ -0,0 +1,128 @@
1
+ #
2
+ # code_sign.rb
3
+ # Copyright © 2020 Netguru S.A. All rights reserved.
4
+ #/
5
+
6
+ require "highway/steps/infrastructure"
7
+ require "gpgme"
8
+
9
+ module Highway
10
+ module Steps
11
+ module Library
12
+
13
+ class CodeSignStep < Step
14
+
15
+ def self.name
16
+ "code_sign"
17
+ end
18
+
19
+ def self.parameters
20
+ [
21
+ Parameters::Single.new(
22
+ name: "path",
23
+ required: true,
24
+ type: Types::String.new()
25
+ ),
26
+ Parameters::Single.new(
27
+ name: "passphrase",
28
+ required: true,
29
+ type: Types::String.new()
30
+ ),
31
+ Parameters::Single.new(
32
+ name: "keychain_name",
33
+ required: false,
34
+ type: Types::String.new()
35
+ ),
36
+ Parameters::Single.new(
37
+ name: "keychain_password",
38
+ required: false,
39
+ type: Types::String.new()
40
+ )
41
+ ]
42
+ end
43
+
44
+ def self.run(parameters:, context:, report:)
45
+ path = parameters["path"]
46
+ passphrase = parameters["passphrase"]
47
+ keychain_name = parameters["keychain_name"]
48
+ keychain_password = parameters["keychain_password"]
49
+
50
+ # First of all, check if file exist.
51
+
52
+ unless File.exist?(path)
53
+ context.interface.fatal!("File '#{path}' does not exist.")
54
+ end
55
+
56
+ # Now prepare output directory and file.
57
+
58
+ output_temp_dir = Dir.mktmpdir()
59
+ output_archive_name = "decrypted.zip"
60
+ output_file_path = File.join(output_temp_dir, output_archive_name)
61
+ output_file = File.open(output_file_path, "w+")
62
+
63
+ # Decrypt given archive.
64
+
65
+ crypto = GPGME::Crypto.new
66
+ begin
67
+ crypto.decrypt(File.open(path), { :password => passphrase, :output => output_file, :pinentry_mode => GPGME::PINENTRY_MODE_LOOPBACK })
68
+ rescue
69
+ context.interface.fatal!("Cannot decrypt with given passphrase.")
70
+ end
71
+
72
+ # Unzip decrypted archive.
73
+
74
+ zipped_files = Array[]
75
+ Zip::File.open(output_file_path) do |zip_file|
76
+ zip_file.each do |file|
77
+ file_path = File.join(output_temp_dir, file.name)
78
+ unless file_path.match?(/\.DS_Store|__MACOSX|(^|\/)\._/)
79
+ zip_file.extract(file, file_path) unless File.exist?(file_path)
80
+ zipped_files.push(file_path) unless File.directory?(file_path)
81
+ end
82
+ end
83
+ end
84
+
85
+ # Filter paths to certificates and profiles.
86
+
87
+ provisioning_profile_paths = zipped_files.grep(/.*\.mobileprovision/)
88
+ certificates_paths = zipped_files.grep(/.*\.p12/)
89
+
90
+ # Prepare new keychain.
91
+
92
+ keychain_name = "highway.keychain-db" if keychain_name.nil?
93
+ keychain_password = passphrase if keychain_password.nil?
94
+ context.run_action("create_keychain", options: {
95
+ name: keychain_name,
96
+ password: keychain_password,
97
+ default_keychain: true,
98
+ unlock: true,
99
+ timeout: 72000,
100
+ lock_when_sleeps: true,
101
+ lock_after_timeout: true,
102
+ add_to_search_list: true
103
+ })
104
+
105
+ # Install provisioning profiles.
106
+
107
+ provisioning_profile_paths.each do |path|
108
+ context.run_action("install_provisioning_profile", options: {
109
+ path: path
110
+ })
111
+ end
112
+
113
+ # Install certificates.
114
+
115
+ certificates_paths.each do |path|
116
+ context.run_action("import_certificate", options: {
117
+ certificate_path: path,
118
+ certificate_password: passphrase,
119
+ keychain_name: keychain_name,
120
+ keychain_password: keychain_password
121
+ })
122
+ end
123
+ end
124
+
125
+ end
126
+ end
127
+ end
128
+ end
@@ -6,6 +6,6 @@
6
6
  module Highway
7
7
 
8
8
  # Version of Highway gem.
9
- VERSION = "1.0.4".freeze
9
+ VERSION = "1.0.5".freeze
10
10
 
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: highway
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Netguru
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-01 00:00:00.000000000 Z
11
+ date: 2020-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fastlane
@@ -90,6 +90,46 @@ dependencies:
90
90
  - - "<="
91
91
  - !ruby/object:Gem::Version
92
92
  version: 1.0.0
93
+ - !ruby/object:Gem::Dependency
94
+ name: gpgme
95
+ requirement: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: 2.0.0
100
+ - - "<="
101
+ - !ruby/object:Gem::Version
102
+ version: 3.0.0
103
+ type: :runtime
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: 2.0.0
110
+ - - "<="
111
+ - !ruby/object:Gem::Version
112
+ version: 3.0.0
113
+ - !ruby/object:Gem::Dependency
114
+ name: rubyzip
115
+ requirement: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: 2.0.0
120
+ - - "<="
121
+ - !ruby/object:Gem::Version
122
+ version: 3.0.0
123
+ type: :runtime
124
+ prerelease: false
125
+ version_requirements: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: 2.0.0
130
+ - - "<="
131
+ - !ruby/object:Gem::Version
132
+ version: 3.0.0
93
133
  - !ruby/object:Gem::Dependency
94
134
  name: rake
95
135
  requirement: !ruby/object:Gem::Requirement
@@ -172,6 +212,7 @@ files:
172
212
  - lib/highway/steps/library/appstore.rb
173
213
  - lib/highway/steps/library/carthage.rb
174
214
  - lib/highway/steps/library/cocoapods.rb
215
+ - lib/highway/steps/library/code_sign.rb
175
216
  - lib/highway/steps/library/copy_artifacts.rb
176
217
  - lib/highway/steps/library/lane.rb
177
218
  - lib/highway/steps/library/sh.rb