Class: VagrantWorkspace::Action::Run

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant_workspace/action/run.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ Run

Returns a new instance of Run.



6
7
8
9
10
11
# File 'lib/vagrant_workspace/action/run.rb', line 6

def initialize(app, env)
  @app = app
  @env = env
  @machine = env[:machine]
  @workspace_file = env[:workspace_file]
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



4
5
6
# File 'lib/vagrant_workspace/action/run.rb', line 4

def app
  @app
end

#envObject (readonly)

Returns the value of attribute env.



4
5
6
# File 'lib/vagrant_workspace/action/run.rb', line 4

def env
  @env
end

#machineObject (readonly)

Returns the value of attribute machine.



4
5
6
# File 'lib/vagrant_workspace/action/run.rb', line 4

def machine
  @machine
end

#workspace_fileObject (readonly)

Returns the value of attribute workspace_file.



4
5
6
# File 'lib/vagrant_workspace/action/run.rb', line 4

def workspace_file
  @workspace_file
end

Instance Method Details

#call(env) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/vagrant_workspace/action/run.rb', line 13

def call(env)
  workspace_hash.each do |project_name, project|
    next if project_name == '_all'

    puts "Executing commands on #{project_name}:"
    execute(project_name, before_commands)
    execute(project_name, project['run'])
    execute(project_name, after_commands)
  end
  app.call(env)
end