Class: IsaacToolbelt::Local

Inherits:
Thor
  • Object
show all
Extended by:
Helper
Defined in:
lib/isaac_toolbelt.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helper

check_file, config_network, host, mkdir_if_not, reboot, ssh_run_command, temp_path, transfer_files, upload_string_as_file, waitfor, waitfor_network

Class Method Details

.is_thor_reserved_word?(word, type) ⇒ Boolean

Hackery. Take the run method away from Thor so that we can redefine it.

Returns:

  • (Boolean)


177
178
179
180
# File 'lib/isaac_toolbelt.rb', line 177

def is_thor_reserved_word?(word, type)
  return false if word == "run"
  super
end

Instance Method Details

#debug_nodeObject



211
212
213
214
215
216
217
218
219
# File 'lib/isaac_toolbelt.rb', line 211

def debug_node
  temp_path = self.class.make_temp_dir(TEMP_ROOT)
  result = self.class.transfer_files(temp_path)
  if result
    self.class.ssh_run_command('cd %s; npm install; node app.js' % [temp_path])
  else
    puts 'Transfer failed'
  end
end

#run(*args) ⇒ Object



204
205
206
207
208
# File 'lib/isaac_toolbelt.rb', line 204

def run(*args)
  temp_path = self.class.temp_path
  self.class.transfer_files(temp_path)
  self.class.ssh_run_command("cd #{temp_path}; " + 'honcho run ' + args.shelljoin)
end

#startObject



184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/isaac_toolbelt.rb', line 184

def start
  temp_path = self.class.temp_path
  self.class.transfer_files(temp_path)
  SSHKit::Coordinator.new(self.class.host).each do
    # start isaac-local
    execute :systemctl, *%w(stop isaac-local)
    #execute :systemctl, *%w(start isaac-local)
    execute :ln, '-nfs', temp_path, '/var/isaac/development'
  end
  #self.class.ssh_run_command('journalctl -n 5 -f -u isaac-local')
  #self.class.ssh_run_command('tail -f /var/log/isaac-local.log')
  #self.class.ssh_run_command("cd #{temp_path}; " + 'honcho start')
  self.class.ssh_run_command("cd /var/isaac/development; " + 'shoreman')
end

#stopObject



200
201
# File 'lib/isaac_toolbelt.rb', line 200

def stop
end