Class: Prremote::Commands::Deploy

Inherits:
Object
  • Object
show all
Defined in:
lib/prremote/commands/deploy.rb

Constant Summary collapse

DEPLOY_MAGIC =
'DPLY'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(port:, baud:) ⇒ Deploy

Returns a new instance of Deploy.



10
11
12
13
# File 'lib/prremote/commands/deploy.rb', line 10

def initialize(port:, baud:)
  @port = port
  @baud = baud
end

Instance Method Details

#call(rb_path) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/prremote/commands/deploy.rb', line 15

def call(rb_path)
  raise "File not found: #{rb_path}" unless File.exist?(rb_path)

  warn "Compiling #{rb_path}..."
  mrb_data = compile(rb_path)

  warn 'Deploying to flash...'
  deploy_to_device(mrb_data)
  warn 'Deployed. Script will run automatically on next boot.'
end