Class: Deliver::Deliverfile::Deliverfile

Inherits:
Object
  • Object
show all
Includes:
DSL
Defined in:
lib/deliver/deliverfile/deliverfile.rb,
lib/deliver/deliverfile/dsl.rb

Overview

Deliverfile represents a Deliverfile created by a user of this library

Defined Under Namespace

Modules: DSL

Constant Summary collapse

FILE_NAME =
"Deliverfile"

Constants included from DSL

DSL::INVALID_IPA_FILE_GIVEN, DSL::MISSING_APP_IDENTIFIER_MESSAGE, DSL::MISSING_VALUE_ERROR_MESSAGE, DSL::MISSING_VERSION_NUMBER_MESSAGE, DSL::SPECIFY_LANGUAGE_FOR_VALUE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DSL

#beta_ipa, #default_language, #email, #hide_transporter_output, #ipa, #method_missing, validate_ipa!, #version

Constructor Details

#initialize(deliver_data, path = nil) ⇒ Deliverfile

Loads the Deliverfile from the given path

Parameters:

  • deliver_data (Deliver::Deliverer)

    The deliverer which handles the results of running this deliverfile

  • path (String) (defaults to: nil)

    (optional) to the file itself. This must also include the filename itself.



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/deliver/deliverfile/deliverfile.rb', line 20

def initialize(deliver_data, path = nil)
  path ||= "./#{FILE_NAME}"
  raise "#{FILE_NAME} not found at path '#{File.expand_path(path)}'".red unless File.exists?(path.to_s)

  self.path = path
  @deliver_data = deliver_data

  content = File.read(path)

  eval(content) # this is okay in this case

  @deliver_data.finished_executing_deliver_file
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Deliver::Deliverfile::Deliverfile::DSL

Instance Attribute Details

#pathObject

The path to the used Deliverfile.



13
14
15
# File 'lib/deliver/deliverfile/deliverfile.rb', line 13

def path
  @path
end