roku_builder 4.10.1 → 4.11.0

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: 973c3b52d95a2b760527ed584aee3292bb4e49c7
4
- data.tar.gz: 761ef924235b9ae56d848e875edf9d2def81feac
3
+ metadata.gz: 74fa60531d4c42c06f388863fcd9fc574c6baa8f
4
+ data.tar.gz: e0d23f7e93e5e9c9674f4dda343605ab5b6a71c0
5
5
  SHA512:
6
- metadata.gz: 1377d4e3220f0bb77de35f926fd44a2eef77df8dfa38f7400f06ad3850db33f5c63b5d354e0a85cfc4142583b3f3689a25cd1c20584d37569c1b0f3ba4b3a37b
7
- data.tar.gz: ab19de941d8b3675236d757e9dc8eb734158c2f9c9e1180142de24605cf2158ef5af2e4a68e0ac12c57a70de051264ac511388dc2147bbbd1f62e43199a00b89
6
+ metadata.gz: ec3b3d0e804b33326f07d577574cd229bf974f00afc42f43717a86a89195ed449dc1182de433fc3f884c373d354c357e520631273101956127e89e99fa41d10c
7
+ data.tar.gz: 87b428ec4501d3329acf31bafb39d7684df33b20eaf91ec58a156d2fb7786e4a8cebf546d5173ac2d1081652142b54d2a8317c003de1046f440873b071c712f1
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ = 4.11.0 =
2
+
3
+ - Add --input command to allow sending input parameters to running app
4
+
1
5
  = 4.10.1 =
2
6
 
3
7
  - Remove debug code
@@ -9,15 +9,19 @@ module RokuBuilder
9
9
  def self.commands
10
10
  {
11
11
  deeplink: {device: true, stage: true},
12
+ input: {device: true},
12
13
  applist: {device: true}
13
14
  }
14
15
  end
15
16
 
16
17
  def self.parse_options(parser:, options:)
17
18
  parser.separator "Commands:"
18
- parser.on("-o", "--deeplink OPTIONS", "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)") do |o|
19
20
  options[:deeplink] = o
20
21
  end
22
+ parser.on("-i", "--input OPTIONS", "Deeplink into app. Define options as keypairs. (eg. a:b, c:d,e:f)") do |o|
23
+ options[:input] = o
24
+ end
21
25
  parser.on("-A", "--app-list", "List currently installed apps") do
22
26
  options[:applist] = true
23
27
  end
@@ -39,21 +43,11 @@ module RokuBuilder
39
43
  app_id = options[:app_id]
40
44
  app_id ||= "dev"
41
45
  path = "/launch/#{app_id}"
42
- payload = RokuBuilder.options_parse(options: options[:deeplink])
43
-
44
- unless payload.keys.count > 0
45
- @logger.warn "No options sent to launched app"
46
- else
47
- payload = parameterize(payload)
48
- path = "#{path}?#{payload}"
49
- @logger.info "Deeplink:"
50
- @logger.info payload
51
- @logger.info "CURL:"
52
- @logger.info "curl -d '' '#{@url}:8060#{path}'"
53
- end
46
+ send_options(path: path, options: options[:deeplink])
47
+ end
54
48
 
55
- response = multipart_connection(port: 8060).post path
56
- @logger.fatal("Failed Deeplinking") unless response.success?
49
+ def input(options:)
50
+ send_options(path: "/input", options: options[:input])
57
51
  end
58
52
 
59
53
  # List currently installed apps
@@ -76,6 +70,24 @@ module RokuBuilder
76
70
 
77
71
  private
78
72
 
73
+ def send_options(path:, options:)
74
+ payload = RokuBuilder.options_parse(options: options)
75
+
76
+ unless payload.keys.count > 0
77
+ @logger.warn "No options sent to launched app"
78
+ else
79
+ payload = parameterize(payload)
80
+ path = "#{path}?#{payload}"
81
+ @logger.info "Deeplink:"
82
+ @logger.info payload
83
+ @logger.info "CURL:"
84
+ @logger.info "curl -d '' '#{@url}:8060#{path}'"
85
+ end
86
+
87
+ response = multipart_connection(port: 8060).post path
88
+ @logger.fatal("Failed Deeplinking") unless response.success?
89
+ end
90
+
79
91
  # Parameterize options to be sent to the app
80
92
  # @param params [Hash] Parameters to be sent
81
93
  # @return [String] Parameters as a string, URI escaped
@@ -25,7 +25,7 @@ module RokuBuilder
25
25
  options[:genkey] = true
26
26
  end
27
27
  parser.separator "Options:"
28
- parser.on("-i", "--inspect-package", "Inspect package after packaging") do
28
+ parser.on("--inspect-package", "Inspect package after packaging") do
29
29
  options[:inspect_package] = true
30
30
  end
31
31
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module RokuBuilder
4
4
  # Version of the RokuBuilder Gem
5
- VERSION = "4.10.1"
5
+ VERSION = "4.11.0"
6
6
  end
data/lib/roku_builder.rb CHANGED
@@ -50,6 +50,7 @@ module RokuBuilder
50
50
  execute
51
51
  rescue StandardError => e
52
52
  Logger.instance.fatal "#{e.class}: #{e.message}"
53
+ exit false
53
54
  end
54
55
  end
55
56
  end
@@ -95,6 +95,40 @@ module RokuBuilder
95
95
  linker = Linker.new(config: config)
96
96
  linker.deeplink(options: options)
97
97
  end
98
+ def test_linker_link_sideload_input
99
+ @requests.push(stub_request(:post, "http://192.168.0.100:8060/input?a=A&b=B:C&d=a%5Cb").
100
+ to_return(status: 200, body: "", headers: {}))
101
+ @requests.push(stub_request(:post, "http://192.168.0.100:8060/keypress/Home").
102
+ to_return(status: 200, body: "", headers: {}))
103
+ @requests.push(stub_request(:post, "http://192.168.0.100/plugin_install").
104
+ to_return(status: 200, body: "Install Success", headers: {}))
105
+
106
+ options = {input: 'a:A, b:B:C, d:a\b', working: true}
107
+ config, options = build_config_options_objects(LinkerTest, options, false)
108
+
109
+ linker = Linker.new(config: config)
110
+ linker.input(options: options)
111
+ end
112
+ def test_linker_link_app_input
113
+ @requests.push(stub_request(:post, "http://192.168.0.100:8060/input?a=A&b=B:C&d=a%5Cb").
114
+ to_return(status: 200, body: "", headers: {}))
115
+
116
+ options = {input: 'a:A, b:B:C, d:a\b', app_id: "1234"}
117
+ config, options = build_config_options_objects(LinkerTest, options, false)
118
+
119
+ linker = Linker.new(config: config)
120
+ linker.input(options: options)
121
+ end
122
+ def test_linker_link_nothing_input
123
+ @requests.push(stub_request(:post, "http://192.168.0.100:8060/input").
124
+ to_return(status: 200, body: "", headers: {}))
125
+
126
+ options = {input: ''}
127
+ config, options = build_config_options_objects(LinkerTest, options, false)
128
+
129
+ linker = Linker.new(config: config)
130
+ linker.input(options: options)
131
+ end
98
132
 
99
133
  def test_linker_list
100
134
  body = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<apps>\n\t
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.10.1
4
+ version: 4.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - greeneca
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-05 00:00:00.000000000 Z
11
+ date: 2018-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip