class Fudge::Cli

Fudge command line interface

Public Instance Methods

build(build_name='default') click to toggle source

Runs the parsed builds @param [String] build_name the given build to run (default 'default')

# File lib/fudge/cli.rb, line 20
def build(build_name='default')
  description = Fudge::Parser.new.parse('Fudgefile')
  Fudge::Runner.new(description).run_build(build_name, options)
end
init() click to toggle source

Initalizes the blank Fudgefile

# File lib/fudge/cli.rb, line 8
def init
  generator = Fudge::Generator.new(Dir.pwd)
  msg = generator.write_fudgefile
  shell.say msg
end
list(filter="") click to toggle source

Lists builds defined in Fudgefile, with optional filtering.

If given no filter, all builds are listed. If given a filter, lists builds whose names match the filter. Matching is based on sub-string matching and is case insensitive.

The listing includes the build name, followed by the about string if one was specified in the Fudgefile.

@param [String] filter a string by which to filter the builds listed

# File lib/fudge/cli.rb, line 37
def list(filter="")
  description = Fudge::Parser.new.parse('Fudgefile')
  builds = description.builds.map { |name, build| ["#{name}", build.about] }
  matches = builds.select { |name, _| name =~ /#{filter}/i }
  shell.print_table(matches, :indent => 2, :truncate => true)
end