class Spring::CommandWrapper

Attributes

command[R]
name[R]

Public Class Methods

new(name, command = nil) click to toggle source
# File lib/spring/command_wrapper.rb, line 7
def initialize(name, command = nil)
  @name    = name
  @command = command
  @setup   = false
end

Public Instance Methods

binstub() click to toggle source
# File lib/spring/command_wrapper.rb, line 60
def binstub
  Spring.application_root_path.join(binstub_name)
end
binstub_name() click to toggle source
# File lib/spring/command_wrapper.rb, line 64
def binstub_name
  "bin/#{name}"
end
call() click to toggle source
# File lib/spring/command_wrapper.rb, line 36
def call
  if command.respond_to?(:call)
    command.call
  else
    load exec
  end
end
description() click to toggle source
# File lib/spring/command_wrapper.rb, line 13
def description
  if command.respond_to?(:description)
    command.description
  else
    "Runs the #{name} command"
  end
end
env(args) click to toggle source
# File lib/spring/command_wrapper.rb, line 76
def env(args)
  if command.respond_to?(:env)
    command.env(args)
  end
end
exec() click to toggle source
# File lib/spring/command_wrapper.rb, line 68
def exec
  if binstub.exist?
    binstub.to_s
  else
    Gem.bin_path(gem_name, exec_name)
  end
end
exec_name() click to toggle source
# File lib/spring/command_wrapper.rb, line 52
def exec_name
  if command.respond_to?(:exec_name)
    command.exec_name
  else
    name
  end
end
gem_name() click to toggle source
# File lib/spring/command_wrapper.rb, line 44
def gem_name
  if command.respond_to?(:gem_name)
    command.gem_name
  else
    exec_name
  end
end
setup() click to toggle source
# File lib/spring/command_wrapper.rb, line 25
def setup
  if !setup? && command.respond_to?(:setup)
    command.setup
    @setup = true
    return true
  else
    @setup = true
    return false
  end
end
setup?() click to toggle source
# File lib/spring/command_wrapper.rb, line 21
def setup?
  @setup
end