class Git::Plan::CLI

Public Class Methods

new(*) click to toggle source
Calls superclass method
# File lib/git/plan/cli.rb, line 9
def initialize(*)
  @cfile = Git::Plan::ConfigFile.instance
  super
end

Public Instance Methods

add(command, group) click to toggle source
# File lib/git/plan/cli.rb, line 15
def add(command, group)
  hash = {command => group}
  @cfile.add_command(hash)
end
inspect(command, variables) click to toggle source
# File lib/git/plan/cli.rb, line 29
def inspect(command, variables)
  get_command_list(command, variables).each { |value|
    say "#{value}"
  }
  say ""
end
r(command, variables) click to toggle source
# File lib/git/plan/cli.rb, line 21
def r(command, variables)
  get_command_list(command, variables).each { |value|
    say "########################EXECUTING #{value}##############################"
    system "bash", "-c", value
  }
end
showall() click to toggle source
# File lib/git/plan/cli.rb, line 37
def showall()
  @cfile.get_all.each do |key, value|
    say "#{key} - #{value}"
  end
  say ""
end

Private Instance Methods

get_command_list(command, variables) click to toggle source
# File lib/git/plan/cli.rb, line 47
def get_command_list(command, variables)
  variable_count = 0
  command_list = []
  group = @cfile.run(command).split(',')
  variables = variables.split(',')
  group.each { |value|
    if value.include? "#"
      value.gsub! '#', variables[variable_count]
      variable_count += 1
    end
    command_list << value
  }
  command_list
end