Module: Packer::Binary
- Defined in:
- lib/packer/binary.rb,
lib/packer/binary/command.rb,
lib/packer/binary/helpers.rb,
lib/packer/binary/version.rb,
lib/packer/binary/compressor.rb,
lib/packer/binary/executable.rb
Overview
The Binary namespace handles sub-commands using #method_missing metaprogramming as well as the global configuration object
Defined Under Namespace
Modules: Command, Helpers Classes: Compressor, Configuration, Executable
Constant Summary collapse
- VERSION =
Gem Version
'0.2.0'.freeze
- PACKER_VERSION =
The version number of the Packer binary to download and use
'1.0.4'.freeze
Instance Attribute Summary collapse
-
#config ⇒ Object
writeonly
Sets the attribute config.
Class Method Summary collapse
-
.Build ⇒ Object
deprecated
Deprecated.
Use #method_missing dynamic method handling for binary sub-commands
-
.config ⇒ Object
defines the @config class variable.
-
.configure {|config| ... } ⇒ Object
Set the global settings.
-
.Fix ⇒ Object
deprecated
Deprecated.
Use #method_missing dynamic method handling for binary sub-commands
-
.Inspect ⇒ Object
deprecated
Deprecated.
Use #method_missing dynamic method handling for binary sub-commands
-
.method_missing(method, *args, &block) ⇒ Object
This method maps Packer::Binary method calls to Packer sub-commands Ex.
-
.Push ⇒ Object
deprecated
Deprecated.
Use #method_missing dynamic method handling for binary sub-commands
- .respond_to_missing?(method) ⇒ Boolean
-
.Validate ⇒ Object
deprecated
Deprecated.
Use #method_missing dynamic method handling for binary sub-commands
-
.Version ⇒ Object
deprecated
Deprecated.
Use #method_missing dynamic method handling for binary sub-commands
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object (private)
if the method is an invalid sub-command or if the command fails you will get a Packer::Binary::Command::CommandFailure exception
This method maps Packer::Binary method calls to Packer sub-commands
Ex. to run packer build test.json -machine-readable
:
Packer::Binary.build('test.json -machine-readable')
41 42 43 44 45 46 47 |
# File 'lib/packer/binary.rb', line 41 def method_missing(method, *args, &block) if method.to_s =~ /(\w+)/ Command.run("#{method.to_s.downcase} #{args}") else super end end |
Instance Attribute Details
#config=(value) ⇒ Object
Sets the attribute config
17 |
# File 'lib/packer/binary.rb', line 17 attr_writer :config |
Class Method Details
.Build ⇒ Object
Use #method_missing dynamic method handling for binary sub-commands
55 |
# File 'lib/packer/binary.rb', line 55 def Build; end |
.config ⇒ Object
defines the @config class variable
22 23 24 |
# File 'lib/packer/binary.rb', line 22 def config @config ||= Configuration.new end |
.configure {|config| ... } ⇒ Object
Set the global settings. See the README for more information
27 28 29 |
# File 'lib/packer/binary.rb', line 27 def configure yield(config) end |
.Fix ⇒ Object
Use #method_missing dynamic method handling for binary sub-commands
59 |
# File 'lib/packer/binary.rb', line 59 def Fix; end |
.Inspect ⇒ Object
Use #method_missing dynamic method handling for binary sub-commands
63 |
# File 'lib/packer/binary.rb', line 63 def Inspect; end |
.method_missing(method, *args, &block) ⇒ Object
if the method is an invalid sub-command or if the command fails you will get a Packer::Binary::Command::CommandFailure exception
This method maps Packer::Binary method calls to Packer sub-commands
Ex. to run packer build test.json -machine-readable
:
Packer::Binary.build('test.json -machine-readable')
41 42 43 44 45 46 47 |
# File 'lib/packer/binary.rb', line 41 def method_missing(method, *args, &block) if method.to_s =~ /(\w+)/ Command.run("#{method.to_s.downcase} #{args}") else super end end |
.Push ⇒ Object
Use #method_missing dynamic method handling for binary sub-commands
67 |
# File 'lib/packer/binary.rb', line 67 def Push; end |
.respond_to_missing?(method) ⇒ Boolean
49 50 51 |
# File 'lib/packer/binary.rb', line 49 def respond_to_missing?(method, *) method =~ /(\w+)/ || super end |
.Validate ⇒ Object
Use #method_missing dynamic method handling for binary sub-commands
71 |
# File 'lib/packer/binary.rb', line 71 def Validate; end |
.Version ⇒ Object
Use #method_missing dynamic method handling for binary sub-commands
75 |
# File 'lib/packer/binary.rb', line 75 def Version; end |