Class: VagrantGrunt::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-grunt/middleware.rb

Overview

A Vagrant middleware which executes a rake task on a given VM. This task will run “rake” on the VM that this action sequence was run on. If an env variable “rake.command” is populated, then this command will be executed by rake.

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ Middleware

Returns a new instance of Middleware.



7
8
9
10
# File 'lib/vagrant-grunt/middleware.rb', line 7

def initialize(app, env)
  @app = app
  @env = env
end

Instance Method Details

#call(env) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/vagrant-grunt/middleware.rb', line 12

def call(env)
  @env.ui.info "Running middleware command"
  #if env["vm"].created? && env["vm"].vm.running?
  #  command = "grunt #{env["grunt.command"]}".strip

  #  env["vm"].ssh.execute do |ssh|
  #    # env.ui.info I18n.t("vagrant.plugins.apache2.executing", :command => command)

  #    ssh.exec!("#{command}") do |channel, type, data|
  #      # Print the data directly to STDOUT, not doing any newlines
  #      # or any extra formatting of our own
  #      $stdout.print(data) if type != :exit_status
  #    end

  #    # Puts out an ending newline just to make sure we end on a new
  #    # line.
  #    $stdout.puts
  #  end
  #end

  @app.call(env)
end