roku_builder 4.29.2 → 4.29.4

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: 81cf2f851953864be0d4dd66937daf9e00386eabcd13b70afd4168dbd3b7b473
4
+ data.tar.gz: 8d58024ade2b9f3cc786f4f7ebb29b47884da7d1d7794becb631f977054dd492
5
5
  SHA512:
6
- metadata.gz: ab7e70ba97918b750a18ea9774ad2bb871d0e5162d1f006d8ab7a20f2981fe212ac48bc89a66bac2a666ee744c73720e7b51c52f2f3136ff6e72193d6e880313
7
- data.tar.gz: ddb429ba2119e3a26e8bc775dbd7092c8d37f0d6ee38567f5fe2875cae2a1a12a32d4c8a5cae5b79cb678fe8c908f5422d15cab5b9cd14aa96804ac519ffbfc3
6
+ metadata.gz: '060098efb871fc1e846634331e8b69d0738ba8ade3dda92da6ae931c9c7d5b595b37d8d35ce329832a05224ffa852f7990bad7605ad490d6d2b0504333e79e0a'
7
+ data.tar.gz: 6cb5e1aee0f27363a0021feb135a5675083916cb9f73670a2273968047cc3175034f5828bc528d0874492a26bf40cb770c61adb626badbf77a06e9a35a59f06d
@@ -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)
@@ -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.4"
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.4
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-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip