class Builderator::Tasks::CLI
Top-level command line tasks
Constants
- VERSION
Public Class Methods
exit_on_failure?()
click to toggle source
# File lib/builderator/tasks.rb, line 45 def self.exit_on_failure? true end
new(*_)
click to toggle source
Calls superclass method
# File lib/builderator/tasks.rb, line 25 def initialize(*_) super # Ignore existing config when we don't need it: i.e. `help` ignore_existing_config = ['help'] + VERSION return if ignore_existing_config.any? do |i| ARGV.include?(i) || ARGV.empty? end Config.argv(options) ## Load command flags Config.load(File.join(ENV['HOME'], '.builderator/Buildfile')) Config.load(Util.relative_path('Buildfile').to_s) Config.compile end
Public Instance Methods
berks SUBCOMMAND()
click to toggle source
CLI
Wrappers
# File lib/builderator/tasks.rb, line 132 desc 'berks SUBCOMMAND', 'Berkshelf helpers'
clean()
click to toggle source
# File lib/builderator/tasks.rb, line 123 def clean invoke Tasks::Vagrant, :clean invoke Tasks::Berkshelf, :clean invoke Tasks::Vendor, :clean end
config()
click to toggle source
Helper/utility commands
# File lib/builderator/tasks.rb, line 114 desc 'config', 'Print compiled configuration'
container(profile = :docker)
click to toggle source
# File lib/builderator/tasks.rb, line 96 def container(profile = :docker) prepare invoke Tasks::Packer, :build, [profile], options end
ec2(*args)
click to toggle source
# File lib/builderator/tasks.rb, line 77 def ec2(*args) prepare invoke Tasks::Vagrant, :ec2, args, options end
generate(project = :default)
click to toggle source
# File lib/builderator/tasks.rb, line 149 def generate(project = :default) fail 'Please provide a valid build name with the `--build-name=VALUE` option!' unless Config.has?(:build_name) Config.generator.project.use(project) Config.generator.project.current.resource.each do |rname, resource| next if (options['ignore'] && options['ignore'].include?(rname.to_s)) || resource.action == :ignore if (options['sync'] && options['sync'].include?(rname.to_s)) || resource.action == :sync template resource.template, resource.path.first next end if (options['rm'] && options['rm'].include?(rname.to_s)) || resource.action == :rm resource.path.each { |rm| remove_file rm } next end ## Create template resource.template, resource.path.first, :skip => true end end
generate [PROJECT=default]()
click to toggle source
Generator
# File lib/builderator/tasks.rb, line 144 desc 'generate [PROJECT=default]', 'Run a generator'
image(profile = :default)
click to toggle source
# File lib/builderator/tasks.rb, line 86 def image(profile = :default) prepare invoke Tasks::Packer, :build, [profile], options invoke Tasks::Packer, :copy, [profile], options if options['copy'] invoke Tasks::Packer, :remote_tag, [profile], options if options['remote_tag'] end
local(*args)
click to toggle source
# File lib/builderator/tasks.rb, line 71 def local(*args) prepare invoke Tasks::Vagrant, :local, args, options end
local [PROFILE = default VAGRANT_ARGS]()
click to toggle source
Main commands.
`local`, `ec2`, and `build` invoke sets of subcommands to build VMs or images
# File lib/builderator/tasks.rb, line 70 desc 'local [PROFILE = default VAGRANT_ARGS]', 'Provision a local VM of PROFILE'
prepare()
click to toggle source
Tasks
common to local, ec2, and ami builds
# File lib/builderator/tasks.rb, line 55 desc 'prepare', 'Common preparation tasks for Vagrant and Packer'
print_version()
click to toggle source
# File lib/builderator/tasks.rb, line 41 def print_version say Gem.loaded_specs['builderator'].version end