Module: Landrush::Action::Common
- Included in:
- InstallPrerequisites, RedirectDns, Setup, Teardown
- Defined in:
- lib/landrush/action/common.rb
Constant Summary collapse
- SUPPORTED_PROVIDERS =
{ 'VagrantPlugins::ProviderVirtualBox::Provider' => :virtualbox, 'HashiCorp::VagrantVMwarefusion::Provider' => :vmware_fusion, 'Landrush::FakeProvider' => :fake_provider, }
Class Method Summary collapse
Instance Method Summary collapse
- #enabled? ⇒ Boolean
- #global_config ⇒ Object
- #handle_action_stack(env) ⇒ Object
- #info(msg) ⇒ Object
- #initialize(app, env) ⇒ Object
- #machine ⇒ Object
- #machine_hostname ⇒ Object
- #provider ⇒ Object
- #virtualbox? ⇒ Boolean
- #vmware? ⇒ Boolean
Class Method Details
.included(base) ⇒ Object
10 11 12 |
# File 'lib/landrush/action/common.rb', line 10 def self.included(base) base.send :attr_reader, :app, :env end |
Instance Method Details
#enabled? ⇒ Boolean
52 53 54 |
# File 'lib/landrush/action/common.rb', line 52 def enabled? global_config.landrush.enabled? end |
#global_config ⇒ Object
40 41 42 |
# File 'lib/landrush/action/common.rb', line 40 def global_config env[:global_config] end |
#handle_action_stack(env) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/landrush/action/common.rb', line 18 def handle_action_stack(env) @env = env yield app.call(env) end |
#info(msg) ⇒ Object
56 57 58 |
# File 'lib/landrush/action/common.rb', line 56 def info(msg) env[:ui].info "[landrush] #{msg}" end |
#initialize(app, env) ⇒ Object
14 15 16 |
# File 'lib/landrush/action/common.rb', line 14 def initialize(app, env) @app = app end |
#machine ⇒ Object
44 45 46 |
# File 'lib/landrush/action/common.rb', line 44 def machine env[:machine] end |
#machine_hostname ⇒ Object
48 49 50 |
# File 'lib/landrush/action/common.rb', line 48 def machine_hostname machine.config.vm.hostname end |
#provider ⇒ Object
34 35 36 37 38 |
# File 'lib/landrush/action/common.rb', line 34 def provider SUPPORTED_PROVIDERS.fetch(machine.provider.class.name) { |key| raise "The landrush plugin does not support the #{key} provider yet!" } end |
#virtualbox? ⇒ Boolean
26 27 28 |
# File 'lib/landrush/action/common.rb', line 26 def virtualbox? provider == :virtualbox end |
#vmware? ⇒ Boolean
30 31 32 |
# File 'lib/landrush/action/common.rb', line 30 def vmware? provider == :vmware_fusion end |