class Easycompile::Easycompile

Public Class Methods

[](i) click to toggle source
#

Easycompile[]

#
# File lib/easycompile/easycompile/easycompile.rb, line 72
def self.[](i)
  new(i)
end
new( i = nil, run_already = true ) { || ... } click to toggle source
#

initialize

We can use more advanced compile instructions such as:

Easycompile::Easycompile.new(i, extract_to: EXTRACT_TO)

The first argument is the name of the program in question.

#
Calls superclass method Easycompile::Base::new
# File lib/easycompile/easycompile/easycompile.rb, line 25
def initialize(
    i           = nil,
    run_already = true,
    &block
  )
  set_prefix '/usr' # This is the default prefix anyway.
  super(i, :dont_run_yet)
  if run_already.is_a? Hash
    set_hash(run_already) # Here the prefix can be overruled.
    run_already = true
  end
  if i.is_a? Array
    i = i.first
  end
  if i.end_with? '.yml'
    i = return_yaml_file(i)
    set_original_input(i)
  end
  # ======================================================================= #
  # === Handle blocks next
  # ======================================================================= #
  if block_given?
    yielded = yield
    # ===================================================================== #
    # === Handle Hashes next
    # ===================================================================== #
    if yielded.is_a? Hash
      # =================================================================== #
      # === { :prefix => :appdir }
      #
      # This is the default entry point for programs that are compiled
      # via an AppDir prefix.
      # =================================================================== #
      if yielded.has_key? :prefix
        set_prefix(
          yielded[:prefix]
        )
      end
    end
  end
  set_original_input(i)
  run if run_already # Call the parent method.
end