module Roku

Constants

VERSION

Public Instance Methods

build() click to toggle source
# File lib/roku.rb, line 19
def build
  puts "Build started."

  FileUtils.rm build_output if File.exists? build_output
  Zip.generate directory, build_output

  puts "Build complete! Build available at #{build_output}"
end
deploy() click to toggle source
# File lib/roku.rb, line 28
def deploy
  raise Exception::NotBuilt, "No build found at #{build_output}" unless File.exists? build_output

  puts "Deployment started."

  mount = "http://#{config['ip']}"

  agent = Mechanize.new
  agent.add_auth mount, config['username'], config['password']
  agent.get mount # Roku does not respond unless the page has been viewed first

  agent.post "#{mount}/plugin_install", {
    archive: File.new(build_output),
    mysubmit: "Replace"
  }

  puts "Deployment complete."
end
run() click to toggle source
# File lib/roku.rb, line 14
def run
  build
  deploy
end