Class: LegoEv3::Uploader

Inherits:
Object
  • Object
show all
Defined in:
lib/connection/upload.rb

Instance Method Summary collapse

Constructor Details

#initialize(host, user, password, project) ⇒ Uploader

Returns a new instance of Uploader.



5
6
7
8
9
10
# File 'lib/connection/upload.rb', line 5

def initialize(host, user, password, project)
  @host = host
  @user = user
  @password = password
  @project = project
end

Instance Method Details

#uploadObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/connection/upload.rb', line 12

def upload
  Net::SSH::Simple.sync({ host_name: @host, user: @user, password: @password, timeout: 600 }) do
    puts "Creating folder #{project_folder}..."
    ssh('ev3', "rm -rf #{project_folder}")

    puts "Upload project..."
    upload_folder(@project)

    puts "Downloading dependencies from Gemfile..."
    ssh('ev3', "cd #{project_folder} && gem install bundler && bundle install")
  end
end