Class: Freighthop::CLI::Vagrant

Inherits:
Object
  • Object
show all
Defined in:
lib/freighthop/cli/vagrant.rb

Constant Summary collapse

COMMANDS =
%w[
  up
  halt
  destroy
  provision
  reload
  status
]

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Vagrant

Returns a new instance of Vagrant.



15
16
17
# File 'lib/freighthop/cli/vagrant.rb', line 15

def initialize(*args)
  @subcommand, @rest = args
end

Class Method Details

.match?(*args) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/freighthop/cli/vagrant.rb', line 11

def self.match?(*args)
  COMMANDS.include?(args.first)
end

Instance Method Details

#argsObject



19
20
21
# File 'lib/freighthop/cli/vagrant.rb', line 19

def args
  ([*@rest] || []).join(' ')
end

#runObject



23
24
25
26
# File 'lib/freighthop/cli/vagrant.rb', line 23

def run
  Freighthop::CLI::Checks.ensure_config_exists!
  exec %Q(vagrant #{@subcommand} #{args})
end