roku_builder 4.29.2 → 4.29.6

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: f65c1d45145a53ba384191e6ca28de7698ce3f38300133293ae9d1639945ee8f
4
- data.tar.gz: 556b118faaa21814e4c8bf7c3d68c94a1a6360e029ce3bc2351d1f7a24fb5563
3
+ metadata.gz: 9bc7d9e5e21ebb561758e53ba2852cd5ec8437d2720a076f9882cd57ec921c73
4
+ data.tar.gz: 6d4a8c2e618f385a924751a66103518587ca2051461705079ebf8e6b4f468f4f
5
5
  SHA512:
6
- metadata.gz: ab7e70ba97918b750a18ea9774ad2bb871d0e5162d1f006d8ab7a20f2981fe212ac48bc89a66bac2a666ee744c73720e7b51c52f2f3136ff6e72193d6e880313
7
- data.tar.gz: ddb429ba2119e3a26e8bc775dbd7092c8d37f0d6ee38567f5fe2875cae2a1a12a32d4c8a5cae5b79cb678fe8c908f5422d15cab5b9cd14aa96804ac519ffbfc3
6
+ metadata.gz: 20ee85adc9ab4f11223e25e28f20bc4941068895efc92b4af0752a649245f99f6634b4b2fdc77a067e490469b5a4c912850d4a8cced39ac70d1bab402250547d
7
+ data.tar.gz: 4e959b8fa4007e03ff671b2c855da967ee0b087311ba122f0dbf24c7256c1e381b0fc319d4d8cc6c0587b292f69697e0c5c4d4eb53679ee118a427dcf7dea302
@@ -31,6 +31,7 @@ module RokuBuilder
31
31
  setup_root_dir
32
32
  setup_input_mappings
33
33
  setup_console_log
34
+ setup_deeplinks
34
35
  end
35
36
 
36
37
  def process_in_argument
@@ -222,5 +223,10 @@ module RokuBuilder
222
223
  def setup_console_log
223
224
  @parsed[:console_log] = @config[:console_log]
224
225
  end
226
+
227
+ def setup_deeplinks
228
+ @parsed[:deeplinks] = @config[:deeplinks]
229
+ end
230
+
225
231
  end
226
232
  end
@@ -39,12 +39,23 @@ module RokuBuilder
39
39
  File.delete(lock) if File.exist?(lock)
40
40
  end
41
41
 
42
+ def release_all
43
+ all_devices.each do |device_name|
44
+ device = Device.new(device_name, @config.devices[device_name])
45
+ release_device(device)
46
+ end
47
+ end
48
+
42
49
  private
43
50
 
44
- def reserve_any(no_lock: false)
51
+ def all_devices
45
52
  default = @config.device_default
46
- all_devices = @config.devices.keys.reject{|key, value| default == key}
47
- all_devices.unshift(default)
53
+ devices = @config.devices.keys.reject{|key, value| default == key}
54
+ devices.unshift(default)
55
+ devices
56
+ end
57
+
58
+ def reserve_any(no_lock: false)
48
59
  all_devices.each do |device_name|
49
60
  device = Device.new(device_name, @config.devices[device_name])
50
61
  if device_available!(device: device, no_lock: no_lock)
@@ -11,7 +11,8 @@ module RokuBuilder
11
11
  validate: {keyed: true},
12
12
  increment: {source: true, stage: true},
13
13
  dostage: {source: true},
14
- dounstage: {source: true}
14
+ dounstage: {source: true},
15
+ release_all_devices: {},
15
16
  }
16
17
  end
17
18
 
@@ -32,6 +33,9 @@ module RokuBuilder
32
33
  parser.on("--do-unstage", "Run the unstager. Used for scripting. Always run --do-script first") do
33
34
  options[:dounstage] = true
34
35
  end
36
+ parser.on("--release-all-devices", "Releases all devices, deleting lock files") do
37
+ options[:release_all_devices] = true
38
+ end
35
39
  parser.separator ""
36
40
  parser.separator "Config Options:"
37
41
  parser.on("-e", "--edit PARAMS", "Edit config params when configuring. (eg. a:b, c:d,e:f)") do |p|
@@ -123,6 +127,11 @@ module RokuBuilder
123
127
  def dounstage(options:)
124
128
  Stager.new(config: @config, options: options).unstage
125
129
  end
130
+ def release_all_devices(options:)
131
+ manager = DeviceManager.new(config: @config, options: @options)
132
+ manager.release_all
133
+ Logger.instance.info "All devices unlocked"
134
+ end
126
135
 
127
136
  def self.get_help_text(parser:, options:, plugin_name:)
128
137
  plugin = self.get_plugin_by_name(plugin_name)
@@ -16,10 +16,10 @@ module RokuBuilder
16
16
 
17
17
  def self.parse_options(parser:, options:)
18
18
  parser.separator "Commands:"
19
- parser.on("-o", "--deeplink OPTIONS", "Launch and Deeplink into app. Define options as keypairs. (eg. a:b, c:d,e:f)") do |o|
19
+ parser.on("-o", "--deeplink OPTIONS", "Launch and Deeplink into app. Define options as keypairs (eg. \"a:b, c:d,e:f\") or name (eg. \"name\"). To use named deeplinks, including them in your config file: \"deeplinks\": { \"name\": \"a:b, c:d, e:f\" }") do |o|
20
20
  options[:deeplink] = o
21
21
  end
22
- parser.on("-i", "--input OPTIONS", "Deeplink into app. Define options as keypairs. (eg. a:b, c:d,e:f)") do |o|
22
+ parser.on("-i", "--input OPTIONS", "Deeplink into app. Define options as keypairs (eg. \"a:b, c:d,e:f\") or name (eg. \"name\"). To use named deeplinks, including them in your config file: \"deeplinks\": { \"name\": \"a:b, c:d, e:f\" }") do |o|
23
23
  options[:input] = o
24
24
  end
25
25
  parser.on("-A", "--app-list", "List currently installed apps") do
@@ -80,6 +80,13 @@ module RokuBuilder
80
80
  unless payload.keys.count > 0
81
81
  @logger.warn "No options sent to launched app"
82
82
  else
83
+ deeplinks = @config.deeplinks
84
+ firstKey = payload.keys.first
85
+ if !deeplinks.nil?
86
+ if !deeplinks[firstKey].nil?
87
+ payload = RokuBuilder.options_parse(options: deeplinks[firstKey])
88
+ end
89
+ end
83
90
  payload = parameterize(payload)
84
91
  path = "#{path}?#{payload}"
85
92
  @logger.info "Deeplink:"
@@ -139,8 +139,8 @@ module RokuBuilder
139
139
 
140
140
  # Print the node stats
141
141
  def get_stats
142
- end_reg = /<\/All_Nodes>/
143
- start_reg = /<All_Nodes>/
142
+ end_reg = /<\/All_Nodes/
143
+ start_reg = /<All_Nodes/
144
144
  lines = get_command_response(command: "sgnodes all", start_reg: start_reg, end_reg: end_reg)
145
145
  xml_string = lines.join("\n")
146
146
  stats = {"Total" => {count: 0}}
@@ -211,14 +211,14 @@ module RokuBuilder
211
211
  end
212
212
 
213
213
  def print_all_nodes
214
- start_reg = /<All_Nodes>/
215
- end_reg = /<\/All_Nodes>/
214
+ start_reg = /<All_Nodes/
215
+ end_reg = /<\/All_Nodes/
216
216
  lines = get_command_response(command: "sgnodes all", start_reg: start_reg, end_reg: end_reg)
217
217
  lines.each {|line| print line}
218
218
  end
219
219
  def print_root_nodes
220
- start_reg = /<Root_Nodes>/
221
- end_reg = /<\/Root_Nodes>/
220
+ start_reg = /<Root_Nodes/
221
+ end_reg = /<\/Root_Nodes/
222
222
  lines = get_command_response(command: "sgnodes roots", start_reg: start_reg, end_reg: end_reg)
223
223
  lines.each {|line| print line}
224
224
  end
@@ -230,14 +230,14 @@ module RokuBuilder
230
230
  end
231
231
  def print_image_information
232
232
  start_reg = /RoGraphics instance/
233
- end_reg = /Available memory/
233
+ end_reg = /Available texture memory/
234
234
  lines = get_command_response(command: "r2d2_bitmaps", start_reg: start_reg, end_reg: end_reg)
235
235
  lines = sort_image_lines(lines, /0x[^\s]+\s+\d+\s+\d+\s+\d+\s+\d+/, 4)
236
236
  lines.each {|line| print line}
237
237
  end
238
238
  def print_memmory_usage
239
239
  start_reg = /RoGraphics instance/
240
- end_reg = /Available memory/
240
+ end_reg = /Available texture memory/
241
241
  begin
242
242
  while true
243
243
  lines = get_command_response(command: "r2d2_bitmaps", start_reg: start_reg, end_reg: end_reg, ignore_warnings: true)
@@ -338,7 +338,7 @@ module RokuBuilder
338
338
  first_match = /RoGraphics instance (0x.*)/.match(line)
339
339
  if first_match
340
340
  while line != nil
341
- usage_match = /Available memory (\d*) used (\d*) max (\d*)/.match(line)
341
+ usage_match = /Available texture memory (\d*) used (\d*) max (\d*)/.match(line)
342
342
  if usage_match
343
343
  data[first_match[1]] = [usage_match[1].to_i, usage_match[2].to_i, usage_match[3].to_i]
344
344
  break
@@ -95,7 +95,7 @@ module RokuBuilder
95
95
  path = "/external/channels/#{channel}/versions"
96
96
  params = nil
97
97
  unless @no_publish
98
- params = {"channelState" => "Published"}
98
+ params = {"state" => "Published"}
99
99
  end
100
100
  api_post(path, path, package, params)
101
101
  end
@@ -124,7 +124,7 @@ module RokuBuilder
124
124
  "appFileBase64Encoded" => Base64.encode64(package.read)
125
125
  }.to_json
126
126
  end
127
- connection('POST', token_path, body).post(api_path+path) do |request|
127
+ connection('POST', token_path, body, params).post(api_path+path) do |request|
128
128
  if params
129
129
  request.params = params
130
130
  end if
@@ -143,10 +143,10 @@ module RokuBuilder
143
143
  end
144
144
  end
145
145
 
146
- def connection(method, path, body)
146
+ def connection(method, path, body, params = nil)
147
147
  service_urn = "urn:roku:cloud-services:chanprovsvc"
148
148
  connection = Faraday.new(url: HOST, headers: {
149
- 'Authorization' => "Bearer "+get_jwt_token(@api_key, service_urn, method, path, body),
149
+ 'Authorization' => "Bearer "+get_jwt_token(@api_key, service_urn, method, path, body, params),
150
150
  'Content-Type' => 'application/json',
151
151
  'Accept' => 'application/json',
152
152
  }) do |f|
@@ -154,10 +154,11 @@ module RokuBuilder
154
154
  end
155
155
  end
156
156
 
157
- def get_jwt_token(api_key, service_urn, method, path, body = nil)
157
+ def get_jwt_token(api_key, service_urn, method, path, body = nil, params = nil)
158
158
  key_file = File.expand_path(@config.api_keys[api_key.to_sym])
159
159
  raise InvalidOptions "Missing api key" unless key_file
160
160
  jwk = JWT::JWK.new(JSON.parse(File.read(key_file)))
161
+ path += "?" + URI.encode_www_form(params) if params
161
162
  header = {
162
163
  "typ" => "JWT",
163
164
  "kid" => jwk.export[:kid]
@@ -2,5 +2,5 @@
2
2
 
3
3
  module RokuBuilder
4
4
  # Version of the RokuBuilder Gem
5
- VERSION = "4.29.2"
5
+ VERSION = "4.29.6"
6
6
  end
@@ -103,16 +103,17 @@ module RokuBuilder
103
103
  assert_equal spec["path"], path
104
104
  end
105
105
 
106
- def test_get_jwt_token_with_body
106
+ def test_get_jwt_token_with_body_and_params
107
107
  api = RokuAPI.new(config: @config)
108
108
  urn = "test:urn"
109
109
  method = "GET"
110
110
  path = "/test/path"
111
+ params = {"param" => "value"}
111
112
  body = {
112
113
  "appFileBase64Encoded" => Base64.encode64(File.open(File.join(test_files_path(RokuAPITest), "test.pkg")).read)
113
114
  }
114
115
  sha256 = Digest::SHA256.base64digest(body.to_json)
115
- token = api.send(:get_jwt_token, @options[:api_key], urn, method, path, body.to_json)
116
+ token = api.send(:get_jwt_token, @options[:api_key], urn, method, path, body.to_json, params)
116
117
  jwk = JWT::JWK.new(JSON.parse(File.read(@config.api_keys[:key1])))
117
118
  decoded = JWT.decode(token, jwk.public_key, true, {algorithm: 'RS256'})
118
119
  assert_equal decoded[1]["typ"], "JWT"
@@ -124,7 +125,7 @@ module RokuBuilder
124
125
  refute_nil spec
125
126
  assert_equal spec["serviceUrn"], urn
126
127
  assert_equal spec["httpMethod"], method
127
- assert_equal spec["path"], path
128
+ assert_equal spec["path"], path+"?"+URI.encode_www_form(params)
128
129
  assert_equal spec["bodySha256Base64"], sha256
129
130
  end
130
131
 
@@ -346,7 +347,7 @@ module RokuBuilder
346
347
  called = true
347
348
  assert_equal path, "/external/channels/#{channel}/versions"
348
349
  assert_equal token_path, "/external/channels/#{channel}/versions"
349
- assert_equal "Published", params["channelState"]
350
+ assert_equal "Published", params["state"]
350
351
  assert_kind_of File, package
351
352
  end
352
353
  api.stub(:api_post, post_proc) do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roku_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.29.2
4
+ version: 4.29.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - greeneca
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-31 00:00:00.000000000 Z
11
+ date: 2024-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -671,7 +671,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
671
671
  - !ruby/object:Gem::Version
672
672
  version: '0'
673
673
  requirements: []
674
- rubygems_version: 3.3.7
674
+ rubygems_version: 3.5.9
675
675
  signing_key:
676
676
  specification_version: 4
677
677
  summary: Build Tool for Roku Apps