Class: Fudge::Cli
- Inherits:
-
Thor
- Object
- Thor
- Fudge::Cli
- Defined in:
- lib/fudge/cli.rb
Overview
Fudge command line interface
Instance Method Summary collapse
-
#build(build_name = 'default') ⇒ Object
Runs the parsed builds.
-
#init ⇒ Object
Initalizes the blank Fudgefile.
-
#list(filter = "") ⇒ Object
Lists builds defined in Fudgefile, with optional filtering.
Instance Method Details
#build(build_name = 'default') ⇒ Object
Runs the parsed builds
20 21 22 23 |
# 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, ) end |
#init ⇒ Object
Initalizes the blank Fudgefile
8 9 10 11 12 |
# 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 = "") ⇒ Object
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.
37 38 39 40 41 42 |
# 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 |