module Packer::Binary
The Binary
namespace handles sub-commands using {#method_missing} metaprogramming as well as the global configuration object
Constants
Attributes
config[W]
@!attribute config
@return [Configuration] the global configuration object
Public Instance Methods
Version()
click to toggle source
The Convenience methods have been deprecated in favor of dynamic method handling. @deprecated Use {#method_missing} dynamic method handling for
binary sub-commands
# File lib/packer/binary.rb, line 59 def Version Command.run('version') end
config()
click to toggle source
defines the @config class variable
# File lib/packer/binary.rb, line 23 def config @config ||= Configuration.new end
configure() { |config| ... }
click to toggle source
Set the global settings. See the {file:README.md README} for more information
# File lib/packer/binary.rb, line 28 def configure yield(config) end
method_missing(method, *args, &block)
click to toggle source
This method maps Packer::Binary
method calls to Packer
sub-commands Ex. to run `packer build test.json -machine-readable`:
“`ruby Packer::Binary.build('test.json -machine-readable') “`
@note if the method is an invalid sub-command or if the command fails
you will get a {Command::CommandFailure} exception
@since 0.2.0
Calls superclass method
# File lib/packer/binary.rb, line 42 def method_missing(method, *args, &block) if method.to_s =~ /(\w+)/ Packer::Binary::Helpers.debug("#{method.to_s.downcase} #{args.join(' ')}") Command.run("#{method.to_s.downcase} #{args.join(' ')}") else super end end
respond_to_missing?(method, *)
click to toggle source
Calls superclass method
# File lib/packer/binary.rb, line 51 def respond_to_missing?(method, *) method =~ /(\w+)/ || super end