roku_builder 3.10.1 → 3.10.2

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
  SHA1:
3
- metadata.gz: 8bd8c2a637ccfb6ed15cb7f75744609c341ed98e
4
- data.tar.gz: 73b474739d29c61ff97316f648928dd3c2963423
3
+ metadata.gz: 89eb827a28c4963403052c57452f7d8eb6c0f23c
4
+ data.tar.gz: 3ad6a214d6c19145c031da0826e1d0fd39107476
5
5
  SHA512:
6
- metadata.gz: d2af13f0a73178b307f1a0a031773ec437b415946d3eca67d5c4beb74ad846c382b7c09f697b1001fe10f877785570a62630c7c0f5e060aa3715cdb4e415d4a6
7
- data.tar.gz: 93516a66dea643bbad6e8ecd2cca0c2d6f949564f70897b0ebb19268b3451751f7f710d45f54bd08f68a4049c244a9828b5574d606676931267bb16b338a3ba5
6
+ metadata.gz: 691beafcc3b44dbba577d9f9a6df0648034175902c88ce73eccd801e7c8828440570e7238477a1a94a9cf84226f4088f8a49852d80ae33d090cb4a7792e6fa5f
7
+ data.tar.gz: ea13f123359361a924ac43c1c4a3c8de13314d1b084d46b8d18852a6cf7777f7316e59e76c6c3bc9165925a906a9a8bf9b7ce2014396f8f2062c152813a04d9c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- roku_builder (3.10.1)
4
+ roku_builder (3.10.2)
5
5
  faraday (~> 0.9)
6
6
  faraday-digestauth (~> 0.2)
7
7
  git (~> 1.3)
data/README.md CHANGED
@@ -30,6 +30,7 @@ The tool allows scripting of the following:
30
30
 
31
31
  Other tasks the tool can complete:
32
32
 
33
+ * Device navigation
33
34
  * Configuration Generation
34
35
  * Configuration Validation
35
36
  * Configuration Updating
@@ -82,6 +83,12 @@ configuration options:
82
83
  * key -> keyed_pkg: path to a pkg file that has been signed
83
84
  * key -> password: password for the signed pkg
84
85
 
86
+ There is an optional "input_mappings" section that will allow you to override
87
+ the default input mappings. In the section each key is a key press code. The
88
+ value is a array with the desired command to run and a human readable key name.
89
+ To see the key press code for a specific key the --navigate command can be run
90
+ with the --debug option on to see a print out of all the keys pressed.
91
+
85
92
 
86
93
  #### Sideloading
87
94
 
@@ -254,10 +261,18 @@ You can delete the currently sideloaded app using the following command:
254
261
 
255
262
  You can use a differnt configuration file useing the following option:
256
263
 
257
- & roku --delete --config <path>
264
+ $ roku --delete --config <path>
258
265
 
259
266
  This path will be expanded so you do not have to use the full path
260
267
 
268
+ You can use your keyboard to control the roku by running the following command:
269
+
270
+ $ roku --navigate
271
+
272
+ To see the key mapings you can run the following command:
273
+
274
+ $ roku --navigate -V
275
+
261
276
  ## Projects
262
277
 
263
278
  The project used in the above examples is a smart default. If you are in a
data/config.json.example CHANGED
@@ -29,5 +29,33 @@
29
29
  "keyed_pkg": "<path/to/signed/package>",
30
30
  "password": "<password>"
31
31
  }
32
+ },
33
+ "input_mapping": {
34
+ "\\e[1~": [ "home", "Home" ],
35
+ "<": [ "rew", "<" ],
36
+ ">": [ "ff", ">" ],
37
+ "=": [ "play", "=" ],
38
+ "\r": [ "select", "Enter" ],
39
+ "\\e[D": [ "left", "Left Arrow" ],
40
+ "\\e[C": [ "right", "Right Arrow" ],
41
+ "\\e[B": [ "down", "Down Arrow" ],
42
+ "\\e[A": [ "up", "Up Arrow" ],
43
+ "\t": [ "back", "Tab" ],
44
+ "": [ "replay", "" ],
45
+ "*": [ "info", "*" ],
46
+ "\u007f": [ "backspace", "Backspace" ],
47
+ "?": [ "search", "?" ],
48
+ "\\e\r": [ "enter", "Alt + Enter" ],
49
+ "\\e[5~": [ "volumeup", "Page Up" ],
50
+ "\\e[6~": [ "volumedown", "Page Down" ],
51
+ "\\e[4~": [ "mute", "End" ],
52
+ "": [ "channeldown", "" ],
53
+ "": [ "channelup", "" ],
54
+ "": [ "tuner", "" ],
55
+ "": [ "hdmi1", "" ],
56
+ "": [ "hdmi2", "" ],
57
+ "": [ "hdmi3", "" ],
58
+ "": [ "hdmi4", "" ],
59
+ "": [ "avi", "" ]
32
60
  }
33
61
  }
@@ -33,7 +33,7 @@ module RokuBuilder
33
33
  return [UNKNOWN_STAGE, nil, nil] unless stage
34
34
  setup_sideload_config(configs: configs, options: options)
35
35
  setup_package_config(config: config, configs: configs, options: options, stage: stage)
36
- setup_simple_configs(configs: configs, options: options, logger: logger)
36
+ setup_simple_configs(config: config, configs: configs, options: options, logger: logger)
37
37
  return [SUCCESS, configs]
38
38
  end
39
39
 
@@ -212,7 +212,7 @@ module RokuBuilder
212
212
  # @param configs [Hash] The parsed configs hash
213
213
  # @param options [Hash] The options hash
214
214
  # @param logger [Logger] System logger
215
- def self.setup_simple_configs(configs:, options:, logger:)
215
+ def self.setup_simple_configs(config:, configs:, options:, logger:)
216
216
  # Create Manifest Config
217
217
  configs[:manifest_config] = {
218
218
  root_dir: configs[:project_config][:directory]
@@ -227,6 +227,16 @@ module RokuBuilder
227
227
  configs[:monitor_config] = {type: options[:monitor].to_sym}
228
228
  end
229
229
  # Create Navigate Config
230
+ mappings = {}
231
+ if config[:input_mapping]
232
+ config[:input_mapping].each_pair {|key, value|
233
+ unless "".to_sym == key
234
+ key = key.to_s.sub(/\\e/, "\e").to_sym
235
+ mappings[key] = value
236
+ end
237
+ }
238
+ end
239
+ configs[:init_params][:navigator] = {mappings: mappings}
230
240
  if options[:navigate]
231
241
  commands = options[:navigate].split(/, */).map{|c| c.to_sym}
232
242
  configs[:navigate_config] = {commands: commands}
@@ -22,6 +22,7 @@ module RokuBuilder
22
22
  PROJECT_STAGE_METHOD_BAD = 18
23
23
  KEY_MISSING_PATH = 19
24
24
  KEY_MISSING_PASSWORD = 20
25
+ INVALID_MAPPING_INFO = 21
25
26
 
26
27
  MISSING_STAGE_METHOD = -1
27
28
 
@@ -56,6 +57,11 @@ module RokuBuilder
56
57
  validate_key(codes: codes, key: key_config)
57
58
  }
58
59
  end
60
+ if config[:input_mapping]
61
+ config[:input_mapping].each_value {|info|
62
+ validate_mapping(codes: codes, mapping: info)
63
+ }
64
+ end
59
65
  codes.uniq!
60
66
  codes.push(0) if codes.empty?
61
67
  codes
@@ -87,6 +93,7 @@ module RokuBuilder
87
93
  "A project as an invalid stage method.",
88
94
  "A key is missing its keyed package path.",
89
95
  "A key is missing its password.", #20
96
+ "A input mapping is invalid",
90
97
  #===============WARNINGS===============#
91
98
  "A project is missing its stage method."
92
99
  ]
@@ -172,6 +179,15 @@ module RokuBuilder
172
179
  end
173
180
  private_class_method :validate_key
174
181
 
182
+ def self.validate_mapping(codes:, mapping:)
183
+ errors=[
184
+ [INVALID_MAPPING_INFO, mapping.nil?],
185
+ [INVALID_MAPPING_INFO, (mapping.count != 2)]
186
+ ]
187
+ process_errors(codes: codes, errors: errors)
188
+ end
189
+ private_class_method :validate_mapping
190
+
175
191
  def self.process_errors(codes:, errors:)
176
192
  errors.each do |error|
177
193
  codes.push(error[0]) if error[1]
@@ -6,7 +6,7 @@ module RokuBuilder
6
6
  class Navigator < Util
7
7
 
8
8
  # Setup navigation commands
9
- def init
9
+ def init(mappings:)
10
10
  @commands = {
11
11
  home: "Home",
12
12
  rew: "Rev",
@@ -36,64 +36,36 @@ module RokuBuilder
36
36
  avi: "InputAVI"
37
37
  }
38
38
 
39
- @keys = {
40
- "\e[1~": :home,
41
- "<": :rew,
42
- ">": :ff,
43
- "=": :play,
44
- "\\": :select,
45
- "\e[D": :left,
46
- "\e[C": :right,
47
- "\e[B": :down,
48
- "\e[A": :up,
49
- "\t": :back,
50
- "@": :replay,
51
- "*": :info,
52
- "\u007f": :backspace,
53
- "?": :search,
54
- "\r": :enter,
55
- "\e[5~": :volumeup,
56
- "\e[6~": :volumedown,
57
- "\e[4~": :mute
58
- #"": :channeldown,
59
- #"": :channelup,
60
- #"": :tuner,
61
- #"": :hdmi1,
62
- #"": :hdmi2,
63
- #"": :hdmi3,
64
- #"": :hdmi4,
65
- #"": :avi,
39
+ @mappings = {
40
+ "\e[1~": [ "home", "Home" ],
41
+ "<": [ "rew", "<" ],
42
+ ">": [ "ff", ">" ],
43
+ "=": [ "play", "=" ],
44
+ "\r": [ "select", "Enter" ],
45
+ "\e[D": [ "left", "Left Arrow" ],
46
+ "\e[C": [ "right", "Right Arrow" ],
47
+ "\e[B": [ "down", "Down Arrow" ],
48
+ "\e[A": [ "up", "Up Arrow" ],
49
+ "\t": [ "back", "Tab" ],
50
+ #"": [ "replay", "" ],
51
+ "*": [ "info", "*" ],
52
+ "\u007f": [ "backspace", "Backspace" ],
53
+ "?": [ "search", "?" ],
54
+ "\e\r": [ "enter", "Alt + Enter" ],
55
+ "\e[5~": [ "volumeup", "Page Up" ],
56
+ "\e[6~": [ "volumedown", "Page Down" ],
57
+ "\e[4~": [ "mute", "End" ],
58
+ #"": [ "channeldown", "" ],
59
+ #"": [ "channelup", "" ],
60
+ #"": [ "tuner", "" ],
61
+ #"": [ "hdmi1", "" ],
62
+ #"": [ "hdmi2", "" ],
63
+ #"": [ "hdmi3", "" ],
64
+ #"": [ "hdmi4", "" ],
65
+ #"": [ "avi", "" ]
66
66
  }
67
67
 
68
-
69
- @key_mappings = {
70
- "Home": :home,
71
- "<": :rew,
72
- ">": :ff,
73
- "=": :play,
74
- "\\": :select,
75
- "Left Arrow": :left,
76
- "Right Arrow": :right,
77
- "Down Arrow": :down,
78
- "Up Arrow": :up,
79
- "Tab": :back,
80
- "@": :replay,
81
- "*": :info,
82
- "Backspace": :backspace,
83
- "?": :search,
84
- "Enter": :enter,
85
- "Page Up": :volumeup,
86
- "Page Down": :volumedown,
87
- "End": :mute
88
- #"": :channeldown,
89
- #"": :channelup,
90
- #"": :tuner,
91
- #"": :hdmi1,
92
- #"": :hdmi2,
93
- #"": :hdmi3,
94
- #"": :hdmi4,
95
- #"": :avi,
96
- }
68
+ @mappings.merge!(mappings)
97
69
 
98
70
  @screens = {
99
71
  platform: [:home, :home, :home, :home, :home, :ff, :play, :rew, :play, :ff],
@@ -149,8 +121,8 @@ module RokuBuilder
149
121
  def interactive
150
122
  running = true
151
123
  @logger.info("Key Mappings:")
152
- @key_mappings.each_pair {|key, command|
153
- @logger.info("#{key} -> #{@commands[command]}")
124
+ @mappings.each_value {|key|
125
+ @logger.info("#{key[1]} -> #{@commands[key[0].to_sym]}")
154
126
  }
155
127
  @logger.info("Control-C -> Exit")
156
128
  while running
@@ -160,8 +132,8 @@ module RokuBuilder
160
132
  running = false
161
133
  else
162
134
  Thread.new(char) {|char|
163
- if @keys[char.to_sym] != nil
164
- nav(commands:[@keys[char.to_sym]])
135
+ if @mappings[char.to_sym] != nil
136
+ nav(commands:[@mappings[char.to_sym][0].to_sym])
165
137
  elsif char.inspect.force_encoding("UTF-8").ascii_only?
166
138
  type(text: char)
167
139
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module RokuBuilder
4
4
  # Version of the RokuBuilder Gem
5
- VERSION = "3.10.1"
5
+ VERSION = "3.10.2"
6
6
  end
@@ -126,7 +126,8 @@ class ConfigParserTest < Minitest::Test
126
126
 
127
127
  def test_deeplink_app_config
128
128
  args = {
129
- configs: {project_config: {directory: "dir"}},
129
+ config: {},
130
+ configs: {project_config: {directory: "dir"}, init_params: {}},
130
131
  options: {deeplink: "a:b", app_id: "xxxxxx"},
131
132
  logger: Logger.new("/dev/null")
132
133
  }
@@ -43,7 +43,8 @@ class NavigatorTest < Minitest::Test
43
43
  ip: "111.222.333",
44
44
  user: "user",
45
45
  password: "password",
46
- logger: Logger.new("/dev/null")
46
+ logger: Logger.new("/dev/null"),
47
+ init_params: {mappings: {}}
47
48
  }
48
49
  if success
49
50
  if type == :nav
@@ -87,7 +88,8 @@ class NavigatorTest < Minitest::Test
87
88
  ip: "111.222.333",
88
89
  user: "user",
89
90
  password: "password",
90
- logger: logger
91
+ logger: logger,
92
+ init_params: {mappings: {}}
91
93
  }
92
94
  navigator = RokuBuilder::Navigator.new(**device_config)
93
95
 
@@ -109,7 +111,8 @@ class NavigatorTest < Minitest::Test
109
111
  ip: "111.222.333",
110
112
  user: "user",
111
113
  password: "password",
112
- logger: logger
114
+ logger: logger,
115
+ init_params: {mappings: {}}
113
116
  }
114
117
  navigator = RokuBuilder::Navigator.new(**device_config)
115
118
 
@@ -124,7 +127,8 @@ class NavigatorTest < Minitest::Test
124
127
  ip: "111.222.333",
125
128
  user: "user",
126
129
  password: "password",
127
- logger: logger
130
+ logger: logger,
131
+ init_params: {mappings: {}}
128
132
  }
129
133
  navigator = RokuBuilder::Navigator.new(**device_config)
130
134
 
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: 3.10.1
4
+ version: 3.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - greeneca
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-03 00:00:00.000000000 Z
11
+ date: 2016-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip