class Bower::Command

Attributes

cwd[R]

Public Class Methods

new(cwd) click to toggle source
# File lib/rab/bower/command.rb, line 7
def initialize(cwd)
  @cwd = cwd
end

Public Instance Methods

install!() click to toggle source
# File lib/rab/bower/command.rb, line 11
def install!
  bower(cwd, "install --production --force-latest")
end
list!() click to toggle source
# File lib/rab/bower/command.rb, line 15
def list!
  bower(cwd, "list --offline")
end
list_paths!() click to toggle source
# File lib/rab/bower/command.rb, line 19
def list_paths!
  bower(cwd, "list --paths --offline")
end

Private Instance Methods

bower(cwd, *command) click to toggle source
# File lib/rab/bower/command.rb, line 25
def bower(cwd, *command)
  command = "bower #{command.join(' ')} --json"
  command += " --config.interactive=false"
  sh(cwd, command)
end
sh(cwd, *cmd) click to toggle source
# File lib/rab/bower/command.rb, line 31
def sh(cwd, *cmd)
  cmd = cmd.join(" ")

  output, error, status =
    Open3.capture3(cmd, :chdir => cwd)

  raise CommandError.new(error, cwd, cmd) unless status.success?

  output
end