Class: Sumodev::Commands::Box

Inherits:
Sumodev::Command show all
Defined in:
lib/sumodev/commands/box.rb

Instance Method Summary collapse

Methods inherited from Sumodev::Command

banner

Instance Method Details

#installObject



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/sumodev/commands/box.rb', line 54

def install
  # install vagrant plugins
  %x(vagrant plugin install vagrant-share)
  %x(vagrant plugin install vagrant-berkshelf)

  # install .sumorc file
  unless File.exists?(File.expand_path("~/.sumorc"))
    File.open(File.expand_path("~/.sumorc"), 'w') do |f|
      f.write "export SUMO_VAGRANT_PATH=\"\"\n      SUMORC\n    end\n  end\n\n  # setup resolver\n  File.open(\"/tmp/vagrant-resolver\", 'w') do |f|\n    f.write <<-RESOLVER\n# Created by sumo command\nnameserver 10.11.12.13\nport 53\n    RESOLVER\n  end\n\n  %x(sudo mv /tmp/vagrant-resolver /etc/resolver/vagrant)\nend\n"

#upObject



44
45
46
47
48
49
50
51
# File 'lib/sumodev/commands/box.rb', line 44

def up
  say("There is already a box running, you should manually start the box. Or halt the running instance", :red) && exit(1) if box_running?

  convert_sumofile_into_env_variables
  run_vagrant_command("up", "--provision")
rescue Sumodev::Sumofile::NoSuchFileError
  say("No Sumofile found! Please define one so the correct versions will be used!", :red) && exit(1)
end