summaryrefslogtreecommitdiff
path: root/hyperstack.rb
blob: abf022120a0c74fb38c59de1f287db1ddef696fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env ruby
# frozen_string_literal: true

begin
  require 'bundler/setup'
rescue LoadError, Gem::GemNotFoundException, Gem::LoadError, Errno::ENOENT
  nil
end

require 'json'
require 'fileutils'
require 'net/http'
require 'open3'
require 'optparse'
require 'ipaddr'
require 'shellwords'
require 'socket'
require 'time'
require 'timeout'

begin
  require 'toml-rb'
rescue LoadError
  warn "Missing dependency: toml-rb. Run `bundle install` in #{__dir__} first."
  exit 2
end

module HyperstackVM
  class Error < StandardError; end
end

require_relative 'lib/hyperstack/config'
require_relative 'lib/hyperstack/state'
require_relative 'lib/hyperstack/client'
require_relative 'lib/hyperstack/wireguard'
require_relative 'lib/hyperstack/provisioning'
require_relative 'lib/hyperstack/manager'
require_relative 'lib/hyperstack/watcher'
require_relative 'lib/hyperstack/cli'

begin
  HyperstackVM::CLI.new(ARGV).run
rescue HyperstackVM::Error => e
  warn "ERROR: #{e.message}"
  exit 1
end