Sha256: f1604b0cd26ae6b6696e8ab88cfea377cc03e7dac3ea9a73cc2e25b3d3c0ed97

Contents?: true

Size: 1.01 KB

Versions: 44

Compression:

Stored size: 1.01 KB

Contents

require 'deliver/deliverfile/dsl'

module Deliver
  module Deliverfile
    # Deliverfile represents a Deliverfile created by a user of this library
    class Deliverfile

      FILE_NAME = "Deliverfile"

      include Deliver::Deliverfile::Deliverfile::DSL

      # The path to the used Deliverfile.
      attr_accessor :path

      # Loads the Deliverfile from the given path
      # @param deliver_data (Deliver::Deliverer) The deliverer which handles the
      #  results of running this deliverfile
      # @param (String) path (optional) to the file itself. This must also include the
      #  filename itself.
      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
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
deliver-0.13.5 lib/deliver/deliverfile/deliverfile.rb
deliver-0.13.4 lib/deliver/deliverfile/deliverfile.rb
deliver-0.13.3 lib/deliver/deliverfile/deliverfile.rb
deliver-0.13.2 lib/deliver/deliverfile/deliverfile.rb
deliver-0.13.1 lib/deliver/deliverfile/deliverfile.rb
deliver-0.13.0 lib/deliver/deliverfile/deliverfile.rb
deliver-0.12.1 lib/deliver/deliverfile/deliverfile.rb
deliver-0.12.0 lib/deliver/deliverfile/deliverfile.rb
deliver-0.11.5 lib/deliver/deliverfile/deliverfile.rb
deliver-0.11.4 lib/deliver/deliverfile/deliverfile.rb
deliver-0.11.3 lib/deliver/deliverfile/deliverfile.rb
deliver-0.11.2 lib/deliver/deliverfile/deliverfile.rb
deliver-0.11.1 lib/deliver/deliverfile/deliverfile.rb
deliver-0.11.1.beta lib/deliver/deliverfile/deliverfile.rb
deliver-0.11.0 lib/deliver/deliverfile/deliverfile.rb
deliver-0.10.0 lib/deliver/deliverfile/deliverfile.rb
deliver-0.9.4 lib/deliver/deliverfile/deliverfile.rb
deliver-0.9.3 lib/deliver/deliverfile/deliverfile.rb
deliver-0.9.2 lib/deliver/deliverfile/deliverfile.rb
deliver-0.9.1 lib/deliver/deliverfile/deliverfile.rb