Sha256: 9c758345daa481523005073469b5b5b3d3d4665811d58ff4f5841f8216ec4859

Contents?: true

Size: 819 Bytes

Versions: 2

Compression:

Stored size: 819 Bytes

Contents

module Kontena::Plugin::Vagrant::Nodes
  class StartCommand < Kontena::Command
    include Kontena::Cli::Common
    include Kontena::Cli::GridOptions
    include Kontena::Cli::ShellSpinner

    parameter "NAME", "Node name"

    def execute
      require_api_url
      require_current_grid

      require_relative '../../../machine/vagrant'
      
      vagrant_path = "#{Dir.home}/.kontena/#{current_grid}/#{name}"
      abort("Cannot find Vagrant node #{name}".colorize(:red)) unless Dir.exist?(vagrant_path)
      Dir.chdir(vagrant_path) do
        spinner "Starting Vagrant machine #{name.colorize(:cyan)} " do
          Open3.popen2('vagrant up') do |stdin, output, wait|
            while o = output.gets
              print o if ENV['DEBUG']
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kontena-plugin-vagrant-0.2.0 lib/kontena/plugin/vagrant/nodes/start_command.rb
kontena-plugin-vagrant-0.2.0.pre2 lib/kontena/plugin/vagrant/nodes/start_command.rb