Class: RokuBuilder::Loader
- Extended by:
- Plugin
- Defined in:
- lib/roku_builder/plugins/loader.rb
Overview
Load/Unload/Build roku applications
Class Method Summary collapse
Instance Method Summary collapse
-
#build(options:) ⇒ Object
Build an app to sideload later.
-
#delete(options:, ignoreFailure: false) ⇒ Object
Remove the currently sideloaded app.
-
#sideload(options:) ⇒ Object
Sideload an app onto a roku device.
Methods included from Plugin
commands, dependencies, parse_options
Methods inherited from Util
Constructor Details
This class inherits a constructor from RokuBuilder::Util
Class Method Details
.commands ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/roku_builder/plugins/loader.rb', line 9 def self.commands { sideload: {source: true, device: true, stage: true}, build: {source: true, stage: true, exclude: true}, delete: {device: true} } end |
.dependencies ⇒ Object
34 35 36 |
# File 'lib/roku_builder/plugins/loader.rb', line 34 def self.dependencies [Navigator] end |
.parse_options(parser:, options:) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/roku_builder/plugins/loader.rb', line 17 def self.(parser:, options:) parser.separator "Commands:" parser.on("-l", "--sideload", "Sideload an app") do [:sideload] = true end parser.on("-d", "--delete", "Delete the currently sideloaded app") do [:delete] = true end parser.on("-b", "--build", "Build a zip to be sideloaded") do [:build] = true end parser.separator "Options:" parser.on("-x", "--exclude", "Apply exclude config to sideload") do [:exclude] = true end end |
Instance Method Details
#build(options:) ⇒ Object
Build an app to sideload later
54 55 56 57 58 |
# File 'lib/roku_builder/plugins/loader.rb', line 54 def build(options:) @options = build_zip(setup_build_content) @config.in = @config.out #setting in path for possible sideload end |
#delete(options:, ignoreFailure: false) ⇒ Object
Remove the currently sideloaded app
61 62 63 64 65 66 67 |
# File 'lib/roku_builder/plugins/loader.rb', line 61 def delete(options:, ignoreFailure: false) payload = {mysubmit: "Delete", archive: ""} response = multipart_connection.post "/plugin_install", payload unless response.status == 200 and response.body =~ /Delete Succeeded/ or ignoreFailure raise ExecutionError, "Failed Unloading" end end |
#sideload(options:) ⇒ Object
Sideload an app onto a roku device
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/roku_builder/plugins/loader.rb', line 39 def sideload(options:) delete(options: , ignoreFailure: true) did_build = false unless [:in] did_build = true build(options: ) end keep_build_file = is_build_command() and [:out] upload # Cleanup File.delete(file_path(:in)) if did_build and not keep_build_file end |