Class: Cloudkeeper::CLI

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

Instance Method Summary collapse

Instance Method Details

#sync ⇒ Object



112
113
114
115
116
117
118
119
120
121
# File 'lib/cloudkeeper/cli.rb', line 112

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



124
125
126
# File 'lib/cloudkeeper/cli.rb', line 124

def version
  $stdout.puts Cloudkeeper::VERSION
end