Class: Cloudkeeper::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/cloudkeeper/cli.rb

Instance Method Summary collapse

Instance Method Details

#sync ⇒ Object



108
109
110
111
112
113
114
115
116
117
# File 'lib/cloudkeeper/cli.rb', line 108

def sync
  initialize_sync options
  File.open(Cloudkeeper::Settings[:'lock-file'], File::RDWR | File::CREAT, 0o644) do |file|
    lock = file.flock(File::LOCK_EX | File::LOCK_NB)
    Cloudkeeper::Managers::ApplianceManager.new.synchronize_appliances if lock
    abort 'cloudkeeper instance is already running, quitting' unless lock
  end
rescue Cloudkeeper::Errors::InvalidConfigurationError => ex
  abort ex.message
end

#version ⇒ Object



120
121
122
# File 'lib/cloudkeeper/cli.rb', line 120

def version
  $stdout.puts Cloudkeeper::VERSION
end