Module: VagrantPlugins::DigitalOcean::Actions

Includes:
Vagrant::Action::Builtin
Defined in:
lib/vagrant-digitalocean/actions.rb,
lib/vagrant-digitalocean/actions/create.rb,
lib/vagrant-digitalocean/actions/reload.rb,
lib/vagrant-digitalocean/actions/destroy.rb,
lib/vagrant-digitalocean/actions/rebuild.rb,
lib/vagrant-digitalocean/actions/power_on.rb,
lib/vagrant-digitalocean/actions/power_off.rb,
lib/vagrant-digitalocean/actions/setup_key.rb,
lib/vagrant-digitalocean/actions/setup_sudo.rb,
lib/vagrant-digitalocean/actions/setup_user.rb,
lib/vagrant-digitalocean/actions/check_state.rb,
lib/vagrant-digitalocean/actions/sync_folders.rb,
lib/vagrant-digitalocean/actions/modify_provision_path.rb

Defined Under Namespace

Classes: CheckState, Create, Destroy, ModifyProvisionPath, PowerOff, PowerOn, Rebuild, Reload, SetupKey, SetupSudo, SetupUser, SyncFolders

Class Method Summary collapse

Class Method Details

.destroyObject



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/vagrant-digitalocean/actions.rb', line 19

def self.destroy
  return Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, CheckState do |env, b|
      case env[:machine_state]
      when :not_created
        env[:ui].info I18n.t('vagrant_digital_ocean.info.not_created')
      else
        b.use Destroy
      end
    end
  end
end

.haltObject



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/vagrant-digitalocean/actions.rb', line 104

def self.halt
  return Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, CheckState do |env, b|
      case env[:machine_state]
      when :active
        b.use PowerOff
      when :off
        env[:ui].info I18n.t('vagrant_digital_ocean.info.already_off')
      when :not_created
        env[:ui].info I18n.t('vagrant_digital_ocean.info.not_created')
      end
    end
  end
end

.provisionObject



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/vagrant-digitalocean/actions.rb', line 65

def self.provision
  return Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, CheckState do |env, b|
      case env[:machine_state]
      when :active
        b.use Provision
        b.use ModifyProvisionPath
        b.use SyncFolders
      when :off
        env[:ui].info I18n.t('vagrant_digital_ocean.info.off')
      when :not_created
        env[:ui].info I18n.t('vagrant_digital_ocean.info.not_created')
      end
    end
  end
end

.rebuildObject



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/vagrant-digitalocean/actions.rb', line 137

def self.rebuild
  return Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, CheckState do |env, b|
      case env[:machine_state]
      when :active, :off
        b.use Rebuild
        b.use SetupSudo
        b.use SetupUser
        b.use provision
      when :not_created
        env[:ui].info I18n.t('vagrant_digital_ocean.info.not_created')
      end
    end
  end
end

.reloadObject



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/vagrant-digitalocean/actions.rb', line 120

def self.reload
  return Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, CheckState do |env, b|
      case env[:machine_state]
      when :active
        b.use Reload
        b.use provision
      when :off
        env[:ui].info I18n.t('vagrant_digital_ocean.info.off')
      when :not_created
        env[:ui].info I18n.t('vagrant_digital_ocean.info.not_created')
      end
    end
  end
end

.sshObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/vagrant-digitalocean/actions.rb', line 33

def self.ssh
  return Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, CheckState do |env, b|
      case env[:machine_state]
      when :active
        b.use SSHExec
      when :off
        env[:ui].info I18n.t('vagrant_digital_ocean.info.off')
      when :not_created
        env[:ui].info I18n.t('vagrant_digital_ocean.info.not_created')
      end
    end
  end
end

.ssh_runObject



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/vagrant-digitalocean/actions.rb', line 49

def self.ssh_run
  return Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, CheckState do |env, b|
      case env[:machine_state]
      when :active
        b.use SSHRun
      when :off
        env[:ui].info I18n.t('vagrant_digital_ocean.info.off')
      when :not_created
        env[:ui].info I18n.t('vagrant_digital_ocean.info.not_created')
      end
    end
  end
end

.upObject



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/vagrant-digitalocean/actions.rb', line 83

def self.up
  return Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, CheckState do |env, b|
      case env[:machine_state]
      when :active
        env[:ui].info I18n.t('vagrant_digital_ocean.info.already_active')
      when :off
        b.use PowerOn
        b.use provision
      when :not_created
        b.use SetupKey
        b.use Create
        b.use SetupSudo
        b.use SetupUser
        b.use provision
      end
    end
  end
end