roku_builder 3.4.1 → 3.4.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: e8e0c79c1201bbf18531f0f2e95232efac96caf3
4
- data.tar.gz: d4f003ef51e562e3ac405c81c2dabe023d065be0
3
+ metadata.gz: dc0d1c23db3b41b36ad688f25bd7cf265bace489
4
+ data.tar.gz: 8f480837cb1cbe27b24453a3b81c5606d65aa28d
5
5
  SHA512:
6
- metadata.gz: e427943879a47693406ebdb84b3a503bca7b6eff5a1e80cf9bb7ac0e15698fb8b8f7e705cf0a99e6a4f109068deb1f25e3ad7a56fa2278e561584f920b0d0c02
7
- data.tar.gz: 0db0e26b474643b8d19c3537b5c0de766a47c7b17a28f98311df21b2166ec32cb10943f35562a723136aa4a9350cb0594981042786b381bc0e11896bfb65f854
6
+ metadata.gz: 6f0472ac3122318632449e8f257312211867da471632d14f53bc1845bd3bd47f3ef3d55606f9273b4adaa19a1dd0039baab6666de91ff7cb207e1876a771a1d9
7
+ data.tar.gz: 2d130f6dd27005b871c4ea0c318f45fb5871feb615b92ec54af119a0f9a26701c773fcf36aaf42c7a728ef407dc5f43d725721da265a00d9df75e955993ddbca
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- roku_builder (3.4.1)
4
+ roku_builder (3.4.2)
5
5
  faraday (~> 0.9)
6
6
  faraday-digestauth (~> 0.2)
7
7
  git (~> 1.3)
data/README.md CHANGED
@@ -67,11 +67,15 @@ configuration options:
67
67
 
68
68
  * directory: full path of the git repository the houses the roku app
69
69
  * app_name: Name used when packaging the app
70
+ * stage_method: Which method to use for switching app stages (git or script)
70
71
  * stages: a hash of stage objects
71
72
 
72
73
  Each stage has the following options:
73
74
 
74
- * branch: name of the branch for the given stage
75
+ * branch: name of the branch for the given stage (if stage_method = git)
76
+ * script: scripts to use to stage the app (if stage_method = script)
77
+ * script -> stage: script run form the app root directory to stage app
78
+ * script -> unstage: script run form the app root directory to unstage app
75
79
  * key: has of key options for signing a package
76
80
  * key -> keyed_pkg: path to a pkg file that has been signed
77
81
  * key -> password: password for the signed pkg
@@ -240,9 +244,9 @@ This path will be expanded so you do not have to use the full path
240
244
  ## Projects
241
245
 
242
246
  The project used in the above examples is a smart default. If you are in a
243
- project directory then it will use that project. If you not then it will use
244
- the defualt that you have defined in your config. You can define what project
245
- you want the command to be run on using the --project option:
247
+ project directory then it will use that project. If you are not then it will
248
+ use the defualt that you have defined in your config. You can define what
249
+ project you want the command to be run on using the --project option:
246
250
 
247
251
  $ roku -lw --project project1
248
252
 
@@ -250,6 +254,20 @@ or:
250
254
 
251
255
  $ roku -lw -P project1
252
256
 
257
+ ## Stages
258
+
259
+ Each project can have any number of stages. stages can be defined in a number
260
+ of ways. The default is to use git branches to define stages. You can setup a
261
+ branch for each stage and the gem will automatically switch between them as
262
+ needed. If using git stages then the gem will ensure to stash any change you
263
+ currently have before checking out the required branch. When done it will
264
+ switch back and unstash the changes. You can use the -w or --working options
265
+ to avoid this.
266
+
267
+ The other method of staging is script staging. This will run a script you
268
+ define before and after performing any actions. This will let you stage your
269
+ app anyway you like as long as it can be done via script.
270
+
253
271
  ## Devices
254
272
 
255
273
  In the examples above the default device is used. If you have multiple devices
@@ -273,7 +291,6 @@ directory:
273
291
 
274
292
  ## Improvements
275
293
 
276
- * Pull build number from correct stage
277
294
  * Don't require a device for non device tasks
278
295
  * Account for missing folders or files
279
296
  * Increase testing
data/lib/roku_builder.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "logger"
2
2
  require "faraday"
3
3
  require "faraday/digestauth"
4
+ require "pathname"
4
5
  #controller
5
6
  require "net/ping"
6
7
  #loader
@@ -25,11 +25,10 @@ module RokuBuilder
25
25
  return [UNKNOWN_DEVICE, nil, nil] unless configs[:device_config]
26
26
  configs[:device_config][:logger] = logger
27
27
  project_config = setup_project_config(config: config, options: options)
28
- return [UNKNOWN_PROJECT, nil, nil] unless project_config
28
+ return [project_config, nil, nil] unless project_config.class == Hash
29
29
  configs[:project_config] = project_config
30
30
  stage_config, stage = setup_stage_config(configs: configs, options: options, logger: logger)
31
31
  return [UNKNOWN_STAGE, nil, nil] unless stage
32
- configs[:stage_config] = stage_config
33
32
  setup_sideload_config(configs: configs, options: options)
34
33
  setup_package_config(configs: configs, options: options, stage: stage)
35
34
  setup_simple_configs(configs: configs, options: options, logger: logger)
@@ -88,7 +87,7 @@ module RokuBuilder
88
87
  project_config = {}
89
88
  if options[:current]
90
89
  pwd = Controller.system(command: "pwd")
91
- return [MISSING_MANIFEST, nil, nil] unless File.exist?(File.join(pwd, "manifest"))
90
+ return MISSING_MANIFEST unless File.exist?(File.join(pwd, "manifest"))
92
91
  project_config = {
93
92
  directory: pwd,
94
93
  folders: nil,
@@ -97,6 +96,7 @@ module RokuBuilder
97
96
  }
98
97
  else
99
98
  project_config = config[:projects][options[:project].to_sym]
99
+ return UNKNOWN_PROJECT unless project_config
100
100
  project_config[:stage_method] = :working if options[:working]
101
101
  end
102
102
  project_config
@@ -126,7 +126,8 @@ module RokuBuilder
126
126
  return nil unless project_config[:stages][stage]
127
127
  stage_config[:key] = project_config[:stages][stage][:script]
128
128
  end
129
- configs[:stage] = stage_config
129
+ configs[:stage_config] = stage_config
130
+ configs[:stage] = stage
130
131
  [stage_config, stage]
131
132
  end
132
133
 
@@ -138,14 +139,12 @@ module RokuBuilder
138
139
  root_dir = configs[:project_config][:directory]
139
140
  # Create Sideload Config
140
141
  configs[:sideload_config] = {
141
- stage: configs[:stage_config],
142
142
  update_manifest: options[:update_manifest],
143
143
  folders: configs[:project_config][:folders],
144
144
  files: configs[:project_config][:files]
145
145
  }
146
146
  # Create Build Config
147
147
  configs[:build_config] = {
148
- stage: configs[:stage_config],
149
148
  folders: configs[:project_config][:folders],
150
149
  files: configs[:project_config][:files]
151
150
  }
@@ -8,8 +8,6 @@ module RokuBuilder
8
8
  # @return [Hash] options to run simple commands
9
9
  def self.simple_commands
10
10
  {
11
- sideload: { klass: Loader, method: :sideload, config_key: :sideload_config,
12
- failure: FAILED_SIDELOAD },
13
11
  deeplink: { klass: Linker, method: :link, config_key: :deeplink_config,
14
12
  failure: FAILED_DEEPLINKING },
15
13
  delete: { klass: Loader, method: :unload },
@@ -31,37 +29,61 @@ module RokuBuilder
31
29
  def self.validate()
32
30
  SUCCESS
33
31
  end
32
+ # Run Sideload
33
+ # @param options [Hash] user options
34
+ # @param configs [Hash] parsed configs
35
+ # @param logger [Logger] system logger
36
+ # @return [Integer] Success or Failure Code
37
+ def self.sideload(options:, configs:, logger:)
38
+ config = configs[:device_config].dup
39
+ config[:init_params] = configs[:init_params][:loader]
40
+ stager = Stager.new(**configs[:stage_config])
41
+ success = false
42
+ if stager.stage
43
+ loader = Loader.new(**config)
44
+ success = loader.sideload(**configs[:sideload_config])
45
+ end
46
+ stager.unstage
47
+ return FAILED_SIDELOAD unless success
48
+ SUCCESS
49
+ end
34
50
  # Run Package
35
51
  # @param options [Hash] user options
36
52
  # @param configs [Hash] parsed configs
37
53
  # @param logger [Logger] system logger
38
54
  # @return [Integer] Success or Failure Code
39
55
  def self.package(options:, configs:, logger:)
56
+ loader_config = configs[:device_config].dup
57
+ loader_config[:init_params] = configs[:init_params][:loader]
40
58
  keyer = Keyer.new(**configs[:device_config])
41
- loader = Loader.new(**configs[:device_config])
59
+ stager = Stager.new(**configs[:stage_config])
60
+ loader = Loader.new(**loader_config)
42
61
  packager = Packager.new(**configs[:device_config])
43
62
  inspector = Inspector.new(**configs[:device_config])
44
63
  logger.warn "Packaging working directory" if options[:working]
45
- # Sideload #
46
- build_version = loader.sideload(**configs[:sideload_config])
47
- return FAILED_SIGNING unless build_version
48
- # Key #
49
- success = keyer.rekey(**configs[:key])
50
- logger.info "Key did not change" unless success
51
- # Package #
52
- options[:build_version] = build_version
53
- configs = ConfigManager.update_configs(configs: configs, options: options)
54
- success = packager.package(**configs[:package_config])
55
- logger.info "Signing Successful: #{configs[:package_config][:out_file]}" if success
56
- return FAILED_SIGNING unless success
57
- # Inspect #
58
- if options[:inspect]
59
- info = inspector.inspect(configs[:inspect_config])
60
- logger.unknown "App Name: #{info[:app_name]}"
61
- logger.unknown "Dev ID: #{info[:dev_id]}"
62
- logger.unknown "Creation Date: #{info[:creation_date]}"
63
- logger.unknown "dev.zip: #{info[:dev_zip]}"
64
+ if stager.stage
65
+ # Sideload #
66
+ build_version = loader.sideload(**configs[:sideload_config])
67
+ return FAILED_SIGNING unless build_version
68
+ # Key #
69
+ success = keyer.rekey(**configs[:key])
70
+ logger.info "Key did not change" unless success
71
+ # Package #
72
+ options[:build_version] = build_version
73
+ configs = ConfigManager.update_configs(configs: configs, options: options)
74
+ success = packager.package(**configs[:package_config])
75
+ logger.info "Signing Successful: #{configs[:package_config][:out_file]}" if success
76
+ return FAILED_SIGNING unless success
77
+ # Inspect #
78
+ if options[:inspect]
79
+ info = inspector.inspect(configs[:inspect_config])
80
+ logger.unknown "App Name: #{info[:app_name]}"
81
+ logger.unknown "Dev ID: #{info[:dev_id]}"
82
+ logger.unknown "Creation Date: #{info[:creation_date]}"
83
+ logger.unknown "dev.zip: #{info[:dev_zip]}"
84
+ end
64
85
  end
86
+ stager.unstage
65
87
  SUCCESS
66
88
  end
67
89
  # Run Build
@@ -71,12 +93,18 @@ module RokuBuilder
71
93
  # @return [Integer] Success or Failure Code
72
94
  def self.build(options:, configs:, logger:)
73
95
  ### Build ###
74
- loader = Loader.new(**configs[:device_config])
75
- build_version = ManifestManager.build_version(**configs[:manifest_config])
76
- options[:build_version] = build_version
77
- configs = ConfigManager.update_configs(configs: configs, options: options)
78
- outfile = loader.build(**configs[:build_config])
79
- logger.info "Build: #{outfile}"
96
+ loader_config = configs[:device_config].dup
97
+ loader_config[:init_params] = configs[:init_params][:loader]
98
+ stager = Stager.new(**configs[:stage_config])
99
+ loader = Loader.new(**loader_config)
100
+ if stager.stage
101
+ build_version = ManifestManager.build_version(**configs[:manifest_config])
102
+ options[:build_version] = build_version
103
+ configs = ConfigManager.update_configs(configs: configs, options: options)
104
+ outfile = loader.build(**configs[:build_config])
105
+ logger.info "Build: #{outfile}"
106
+ end
107
+ stager.unstage
80
108
  SUCCESS
81
109
  end
82
110
  # Run update
@@ -85,9 +113,13 @@ module RokuBuilder
85
113
  # @return [Integer] Success or Failure Code
86
114
  def self.update(configs:, logger:)
87
115
  ### Update ###
88
- old_version = ManifestManager.build_version(**configs[:manifest_config])
89
- new_version = ManifestManager.update_build(**configs[:manifest_config])
90
- logger.info "Update build version from:\n#{old_version}\nto:\n#{new_version}"
116
+ stager = Stager.new(**configs[:stage_config])
117
+ if stager.stage
118
+ old_version = ManifestManager.build_version(**configs[:manifest_config])
119
+ new_version = ManifestManager.update_build(**configs[:manifest_config])
120
+ logger.info "Update build version from:\n#{old_version}\nto:\n#{new_version}"
121
+ end
122
+ stager.unstage
91
123
  SUCCESS
92
124
  end
93
125
 
@@ -11,92 +11,81 @@ module RokuBuilder
11
11
 
12
12
  # Sideload an app onto a roku device
13
13
  # @param root_dir [String] Path to the root directory of the roku app
14
- # @param stage [Hash] stage to use for sideloading.
15
- # @param update_manifest [Boolean] Flag to update the manifest file before sideloading. Default: false
16
14
  # @param folders [Array<String>] Array of folders to be sideloaded. Pass nil to send all folders. Default: nil
17
15
  # @param files [Array<String>] Array of files to be sideloaded. Pass nil to send all files. Default: nil
18
16
  # @return [String] Build version on success, nil otherwise
19
- def sideload(stage:, update_manifest: false, folders: nil, files: nil)
17
+ def sideload(update_manifest: false, folders: nil, files: nil)
20
18
  result = nil
21
- stager = Stager.new(**stage)
22
- if stager.stage
23
- # Update manifest
24
- build_version = ""
25
- if update_manifest
26
- build_version = ManifestManager.update_build(root_dir: @root_dir)
27
- else
28
- build_version = ManifestManager.build_version(root_dir: @root_dir)
29
- end
30
- outfile = build(stage: stage, build_version: build_version, folders: folders, files: files)
31
- path = "/plugin_install"
32
- # Connect to roku and upload file
33
- conn = multipart_connection
34
- payload = {
35
- mysubmit: "Replace",
36
- archive: Faraday::UploadIO.new(outfile, 'application/zip')
37
- }
38
- response = conn.post path, payload
39
- # Cleanup
40
- File.delete(outfile)
41
- result = build_version if response.status==200 and response.body=~/Install Success/
19
+ # Update manifest
20
+ build_version = ""
21
+ if update_manifest
22
+ build_version = ManifestManager.update_build(root_dir: @root_dir)
23
+ else
24
+ build_version = ManifestManager.build_version(root_dir: @root_dir)
42
25
  end
43
- stager.unstage
44
- result
26
+ outfile = build(build_version: build_version, folders: folders, files: files)
27
+ path = "/plugin_install"
28
+ # Connect to roku and upload file
29
+ conn = multipart_connection
30
+ payload = {
31
+ mysubmit: "Replace",
32
+ archive: Faraday::UploadIO.new(outfile, 'application/zip')
33
+ }
34
+ response = conn.post path, payload
35
+ # Cleanup
36
+ File.delete(outfile)
37
+ result = build_version if response.status==200 and response.body=~/Install Success/
38
+ result
45
39
  end
46
40
 
47
41
 
48
42
  # Build an app to sideload later
49
43
  # @param root_dir [String] Path to the root directory of the roku app
50
- # @param stage [Hash] stage to use for sideloading.
51
44
  # @param build_version [String] Version to assigne to the build. If nil will pull the build version form the manifest. Default: nil
52
45
  # @param outfile [String] Path for the output file. If nil will create a file in /tmp. Default: nil
53
46
  # @param folders [Array<String>] Array of folders to be sideloaded. Pass nil to send all folders. Default: nil
54
47
  # @param files [Array<String>] Array of files to be sideloaded. Pass nil to send all files. Default: nil
55
48
  # @return [String] Path of the build
56
- def build(stage:, build_version: nil, outfile: nil, folders: nil, files: nil)
57
- stager = Stager.new(**stage)
58
- if stager.stage
59
- build_version = ManifestManager.build_version(root_dir: @root_dir, logger: @logger) unless build_version
60
- unless folders
61
- folders = Dir.entries(@root_dir).select {|entry| File.directory? File.join(@root_dir, entry) and !(entry =='.' || entry == '..') }
62
- end
63
- unless files
64
- files = Dir.entries(@root_dir).select {|entry| File.file? File.join(@root_dir, entry)}
65
- end
66
- outfile = "/tmp/build_#{build_version}.zip" unless outfile
67
- File.delete(outfile) if File.exist?(outfile)
68
- io = Zip::File.open(outfile, Zip::File::CREATE)
69
- # Add folders to zip
70
- folders.each do |folder|
71
- base_folder = File.join(@root_dir, folder)
72
- entries = Dir.entries(base_folder)
73
- entries.delete(".")
74
- entries.delete("..")
75
- writeEntries(@root_dir, entries, folder, io)
76
- end
77
- # Add file to zip
78
- writeEntries(@root_dir, files, "", io)
79
- io.close()
49
+ def build(build_version: nil, outfile: nil, folders: nil, files: nil)
50
+ build_version = ManifestManager.build_version(root_dir: @root_dir) unless build_version
51
+ unless folders
52
+ folders = Dir.entries(@root_dir).select {|entry| File.directory? File.join(@root_dir, entry) and !(entry =='.' || entry == '..') }
80
53
  end
81
- stager.unstage
54
+ unless files
55
+ files = Dir.entries(@root_dir).select {|entry| File.file? File.join(@root_dir, entry)}
56
+ end
57
+ outfile = "/tmp/build_#{build_version}.zip" unless outfile
58
+ File.delete(outfile) if File.exist?(outfile)
59
+ io = Zip::File.open(outfile, Zip::File::CREATE)
60
+ # Add folders to zip
61
+ folders.each do |folder|
62
+ base_folder = File.join(@root_dir, folder)
63
+ entries = Dir.entries(base_folder)
64
+ entries.delete(".")
65
+ entries.delete("..")
66
+ writeEntries(@root_dir, entries, folder, io)
67
+ end
68
+ # Add file to zip
69
+ writeEntries(@root_dir, files, "", io)
70
+ io.close()
82
71
  outfile
83
72
  end
84
73
 
85
74
  # Remove the currently sideloaded app
86
75
  def unload()
87
- path = "/plugin_install"
76
+ path = "/plugin_install"
88
77
 
89
- # Connect to roku and upload file
90
- conn = multipart_connection
91
- payload = {
92
- mysubmit: "Delete",
93
- archive: ""
94
- }
95
- response = conn.post path, payload
96
- if response.status == 200 and response.body =~ /Install Success/
97
- return true
98
- end
99
- return false
78
+ # Connect to roku and upload file
79
+ conn = multipart_connection
80
+ payload = {
81
+ mysubmit: "Delete",
82
+ archive: ""
83
+ }
84
+ response = conn.post path, payload
85
+ if response.status == 200 and response.body =~ /Install Success/
86
+ return true
87
+ end
88
+ return false
100
89
  end
101
90
 
102
91
  private
@@ -1,4 +1,4 @@
1
1
  module RokuBuilder
2
2
  # Version of the RokuBuilder Gem
3
- VERSION = "3.4.1"
3
+ VERSION = "3.4.2"
4
4
  end
@@ -5,31 +5,44 @@ class ControllerCommandsTest < Minitest::Test
5
5
  def test_controller_commands_sideload
6
6
  logger = Logger.new("/dev/null")
7
7
  loader = Minitest::Mock.new
8
+ stager = Minitest::Mock.new
8
9
 
9
10
  options = {sideload: true, stage: 'production', config: "~/.roku_config.rb"}
10
11
  config = good_config
11
12
  code, configs = RokuBuilder::ConfigParser.parse_config(options: options, config: config, logger: logger)
12
13
  # Test Success
13
14
  loader.expect(:sideload, true, [configs[:sideload_config]])
15
+ stager.expect(:stage, true)
16
+ stager.expect(:unstage, true)
17
+
14
18
  RokuBuilder::Loader.stub(:new, loader) do
15
- code = RokuBuilder::Controller.send(:execute_commands, {options: options, config: config, configs: configs, logger: logger})
19
+ RokuBuilder::Stager.stub(:new, stager) do
20
+ code = RokuBuilder::Controller.send(:execute_commands, {options: options, config: config, configs: configs, logger: logger})
21
+ end
16
22
  end
17
23
  assert_equal RokuBuilder::SUCCESS, code
18
24
 
25
+ stager.expect(:stage, true)
26
+ stager.expect(:unstage, true)
27
+
19
28
  # Test Failure
20
29
  loader.expect(:sideload, false, [configs[:sideload_config]])
21
30
  RokuBuilder::Loader.stub(:new, loader) do
22
- code = RokuBuilder::Controller.send(:execute_commands, {options: options, config: config, configs: configs, logger: logger})
31
+ RokuBuilder::Stager.stub(:new, stager) do
32
+ code = RokuBuilder::Controller.send(:execute_commands, {options: options, config: config, configs: configs, logger: logger})
33
+ end
23
34
  end
24
35
  assert_equal RokuBuilder::FAILED_SIDELOAD, code
25
36
 
26
37
  loader.verify
38
+ stager.verify
27
39
  end
28
40
 
29
41
  def test_controller_commands_package
30
42
  logger = Logger.new("/dev/null")
31
43
  keyer = Minitest::Mock.new
32
44
  loader = Minitest::Mock.new
45
+ stager = Minitest::Mock.new
33
46
  packager = Minitest::Mock.new
34
47
  inspector = Minitest::Mock.new
35
48
 
@@ -42,13 +55,17 @@ class ControllerCommandsTest < Minitest::Test
42
55
  keyer.expect(:rekey, true, [configs[:key]])
43
56
  packager.expect(:package, true, [configs[:package_config]])
44
57
  inspector.expect(:inspect, info, [configs[:inspect_config]])
58
+ stager.expect(:stage, true)
59
+ stager.expect(:unstage, true)
45
60
 
46
61
  code = nil
47
62
  RokuBuilder::Keyer.stub(:new, keyer) do
48
63
  RokuBuilder::Loader.stub(:new, loader) do
49
64
  RokuBuilder::Packager.stub(:new, packager) do
50
65
  RokuBuilder::Inspector.stub(:new, inspector) do
51
- code = RokuBuilder::Controller.send(:execute_commands, {options: options, config: config, configs: configs, logger: logger})
66
+ RokuBuilder::Stager.stub(:new, stager) do
67
+ code = RokuBuilder::Controller.send(:execute_commands, {options: options, config: config, configs: configs, logger: logger})
68
+ end
52
69
  end
53
70
  end
54
71
  end
@@ -57,6 +74,7 @@ class ControllerCommandsTest < Minitest::Test
57
74
 
58
75
  keyer.verify
59
76
  loader.verify
77
+ stager.verify
60
78
  packager.verify
61
79
  inspector.verify
62
80
  end
@@ -65,6 +83,7 @@ class ControllerCommandsTest < Minitest::Test
65
83
  logger = Logger.new("/dev/null")
66
84
  keyer = Minitest::Mock.new
67
85
  loader = Minitest::Mock.new
86
+ stager = Minitest::Mock.new
68
87
  packager = Minitest::Mock.new
69
88
  inspector = Minitest::Mock.new
70
89
 
@@ -77,13 +96,17 @@ class ControllerCommandsTest < Minitest::Test
77
96
  keyer.expect(:rekey, true, [configs[:key]])
78
97
  packager.expect(:package, true, [configs[:package_config]])
79
98
  inspector.expect(:inspect, info, [configs[:inspect_config]])
99
+ stager.expect(:stage, true)
100
+ stager.expect(:unstage, true)
80
101
 
81
102
  code = nil
82
103
  RokuBuilder::Keyer.stub(:new, keyer) do
83
104
  RokuBuilder::Loader.stub(:new, loader) do
84
105
  RokuBuilder::Packager.stub(:new, packager) do
85
106
  RokuBuilder::Inspector.stub(:new, inspector) do
86
- code = RokuBuilder::Controller.send(:execute_commands, {options: options, config: config, configs: configs, logger: logger})
107
+ RokuBuilder::Stager.stub(:new, stager) do
108
+ code = RokuBuilder::Controller.send(:execute_commands, {options: options, config: config, configs: configs, logger: logger})
109
+ end
87
110
  end
88
111
  end
89
112
  end
@@ -92,6 +115,7 @@ class ControllerCommandsTest < Minitest::Test
92
115
 
93
116
  keyer.verify
94
117
  loader.verify
118
+ stager.verify
95
119
  packager.verify
96
120
  inspector.verify
97
121
  end
@@ -99,36 +123,50 @@ class ControllerCommandsTest < Minitest::Test
99
123
  def test_controller_commands_build
100
124
  logger = Logger.new("/dev/null")
101
125
  loader = Minitest::Mock.new
126
+ stager = Minitest::Mock.new
102
127
 
103
128
  code = nil
104
129
  options = {build: true, stage: 'production', out_folder: "/tmp", config: "~/.roku_config.json"}
105
130
  config = good_config
106
131
  code, configs = RokuBuilder::ConfigParser.parse_config(options: options, config: config, logger: logger)
107
132
  loader.expect(:build, "/tmp/build", [configs[:build_config]])
133
+ stager.expect(:stage, true)
134
+ stager.expect(:unstage, true)
135
+
108
136
  RokuBuilder::Loader.stub(:new, loader) do
109
137
  RokuBuilder::ManifestManager.stub(:build_version, "1") do
110
- code = RokuBuilder::Controller.send(:execute_commands, {options: options, config: config, configs: configs, logger: logger})
138
+ RokuBuilder::Stager.stub(:new, stager) do
139
+ code = RokuBuilder::Controller.send(:execute_commands, {options: options, config: config, configs: configs, logger: logger})
140
+ end
111
141
  end
112
142
  end
113
143
  assert_equal RokuBuilder::SUCCESS, code
114
144
  loader.verify
145
+ stager.verify
115
146
  end
116
147
  def test_controller_commands_update
117
148
  logger = Logger.new("/dev/null")
118
149
  mock = Minitest::Mock.new
150
+ stager = Minitest::Mock.new
119
151
 
120
152
  code = nil
121
- options = {update: true, stage: 'production', out_folder: "/tmp", config: ":execute_commands,/.roku_config.json"}
153
+ options = {update: true, stage: 'production', out_folder: "/tmp", config: "~/.roku_config.json"}
122
154
  config = good_config
123
155
  code, configs = RokuBuilder::ConfigParser.parse_config(options: options, config: config, logger: logger)
124
156
  mock.expect(:call, "1", [configs[:manifest_config]])
125
157
  mock.expect(:call, "2", [configs[:manifest_config]])
158
+ stager.expect(:stage, true)
159
+ stager.expect(:unstage, true)
160
+
126
161
  RokuBuilder::ManifestManager.stub(:build_version, mock) do
127
162
  RokuBuilder::ManifestManager.stub(:update_build, mock) do
128
- code = RokuBuilder::Controller.send(:execute_commands, {options: options, config: config, configs: configs, logger: logger})
163
+ RokuBuilder::Stager.stub(:new, stager) do
164
+ code = RokuBuilder::Controller.send(:execute_commands, {options: options, config: config, configs: configs, logger: logger})
165
+ end
129
166
  end
130
167
  end
131
168
  mock.verify
169
+ stager.verify
132
170
  assert_equal RokuBuilder::SUCCESS, code
133
171
  end
134
172
 
@@ -137,7 +175,7 @@ class ControllerCommandsTest < Minitest::Test
137
175
  mock = Minitest::Mock.new
138
176
 
139
177
  code = nil
140
- options = {deeplink: true, stage: 'production', deeplink_options: "a:b", config: ":execute_commands,/.roku_config.json"}
178
+ options = {deeplink: true, stage: 'production', deeplink_options: "a:b", config: "~/.roku_config.json"}
141
179
  config = good_config
142
180
  code, configs = RokuBuilder::ConfigParser.parse_config(options: options, config: config, logger: logger)
143
181
  mock.expect(:link, "true", [configs[:deeplink_config]])
@@ -151,7 +189,7 @@ class ControllerCommandsTest < Minitest::Test
151
189
  logger = Logger.new("/dev/null")
152
190
  loader = Minitest::Mock.new
153
191
 
154
- options = {delete: true, stage: 'production', config: ":execute_commands,/.roku_config.json"}
192
+ options = {delete: true, stage: 'production', config: "~/.roku_config.json"}
155
193
  config = good_config
156
194
  code, configs = RokuBuilder::ConfigParser.parse_config(options: options, config: config, logger: logger)
157
195
  loader.expect(:unload, nil)
@@ -168,7 +206,7 @@ class ControllerCommandsTest < Minitest::Test
168
206
  logger = Logger.new("/dev/null")
169
207
  monitor = Minitest::Mock.new
170
208
 
171
- options = {monitor: "main", stage: 'production', config: ":execute_commands,/.roku_config.json"}
209
+ options = {monitor: "main", stage: 'production', config: "~/.roku_config.json"}
172
210
  config = good_config
173
211
  code, configs = RokuBuilder::ConfigParser.parse_config(options: options, config: config, logger: logger)
174
212
  monitor.expect(:monitor, nil, [configs[:monitor_config]])
@@ -260,7 +298,7 @@ class ControllerCommandsTest < Minitest::Test
260
298
  logger = Logger.new("/dev/null")
261
299
  tester = Minitest::Mock.new
262
300
 
263
- options = {test: true, stage: 'production', config: ":execute_commands,/.roku_config.json"}
301
+ options = {test: true, stage: 'production', config: "~/.roku_config.json"}
264
302
  config = good_config
265
303
  code, configs = RokuBuilder::ConfigParser.parse_config(options: options, config: config, logger: logger)
266
304
  tester.expect(:run_tests, true, [configs[:test_config]])
@@ -275,7 +313,7 @@ class ControllerCommandsTest < Minitest::Test
275
313
  logger = Logger.new("/dev/null")
276
314
  inspector = Minitest::Mock.new
277
315
 
278
- options = {screencapture: true, stage: 'production', out: "/tmp/capture.jpg", config: ":execute_commands,/.roku_config.json"}
316
+ options = {screencapture: true, stage: 'production', out: "/tmp/capture.jpg", config: "~/.roku_config.json"}
279
317
  config = good_config
280
318
  code, configs = RokuBuilder::ConfigParser.parse_config(options: options, config: config, logger: logger)
281
319
  inspector.expect(:screencapture, true, [configs[:screencapture_config]])
@@ -290,7 +328,7 @@ class ControllerCommandsTest < Minitest::Test
290
328
  logger = Logger.new("/dev/null")
291
329
  inspector = Minitest::Mock.new
292
330
 
293
- options = {screencapture: true, stage: 'production', out: "/tmp", config: ":execute_commands,/.roku_config.json"}
331
+ options = {screencapture: true, stage: 'production', out: "/tmp", config: "~/.roku_config.json"}
294
332
  config = good_config
295
333
  code, configs = RokuBuilder::ConfigParser.parse_config(options: options, config: config, logger: logger)
296
334
  inspector.expect(:screencapture, false, [configs[:screencapture_config]])
@@ -17,7 +17,6 @@ class LoaderTest < Minitest::Test
17
17
  init_params: {root_dir: root_dir}
18
18
  }
19
19
  loader_config = {
20
- stage: {method: :working, root_dir: root_dir, logger: logger},
21
20
  folders: ["source"],
22
21
  files: ["manifest"]
23
22
  }
@@ -77,7 +76,6 @@ class LoaderTest < Minitest::Test
77
76
  init_params: {root_dir: root_dir}
78
77
  }
79
78
  loader_config = {
80
- stage: {method: :working, root_dir: root_dir, logger: logger},
81
79
  update_manifest: true,
82
80
  folders: ["source"],
83
81
  files: ["manifest"]
@@ -134,7 +132,6 @@ class LoaderTest < Minitest::Test
134
132
  init_params: {root_dir: root_dir}
135
133
  }
136
134
  build_config = {
137
- stage: {method: :working, root_dir: root_dir, logger: logger},
138
135
  folders: ["source"],
139
136
  files: ["manifest"]
140
137
  }
@@ -160,7 +157,7 @@ class LoaderTest < Minitest::Test
160
157
  logger: logger,
161
158
  init_params: {root_dir: root_dir}
162
159
  }
163
- build_config = {stage: {method: :working, root_dir: root_dir, logger: logger}}
160
+ build_config = {}
164
161
  loader = RokuBuilder::Loader.new(**device_config)
165
162
  outfile = nil
166
163
  RokuBuilder::ManifestManager.stub(:build_version, "build_version") 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: 3.4.1
4
+ version: 3.4.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-04-14 00:00:00.000000000 Z
11
+ date: 2016-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip