Class: Prremote::Commands::Deploy

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

Constant Summary collapse

DEPLOY_MAGIC =
'DPLY'.freeze
META_MAGIC =
'META'.freeze

Instance Method Summary collapse

Methods included from SerialHelpers

#normalize, #wait_for_ready

Constructor Details

#initialize(port:, baud:) ⇒ Deploy

Returns a new instance of Deploy.



14
15
16
17
# File 'lib/prremote/commands/deploy.rb', line 14

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

Instance Method Details

#call(*rb_paths) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/prremote/commands/deploy.rb', line 19

def call(*rb_paths)
  rb_paths.each { |f| raise "File not found: #{f}" unless File.exist?(f) }

  warn "Compiling #{rb_paths.map { |f| File.basename(f) }.join(', ')}..."
  mrb_data = compile(*rb_paths)

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