Sha256: becefee28a896606f71e525e4c381a8bc15a0092415a6d1654f5c19f3219fc4c

Contents?: true

Size: 1.16 KB

Versions: 6

Compression:

Stored size: 1.16 KB

Contents

require 'fig/logging'
require 'fig/statement'

module Fig; end

# Specifies that files from a package should be copied into the current
# directory when an environment variable has its value changed.
class Fig::Statement::Retrieve < Fig::Statement
  attr_reader   :var, :path

  def initialize(line_column, source_description, var, path)
    super(line_column, source_description)

    @var = var
    @path = path

    # Yeah, it's not cross-platform, but File doesn't have an #absolute? method
    # and this is better than nothing.
    if path =~ %r< ^ / >x
      Fig::Logging.warn(
        %Q<The retrieve path "#{path}"#{position_string()} looks like it is intended to be absolute; retrieve paths are always treated as relative.>
      )
    end
  end

  def loaded_but_not_referenced?()
    return added_to_environment? && ! referenced?
  end

  def added_to_environment?()
    return @added_to_environment
  end

  def added_to_environment(yea_or_nay)
    @added_to_environment = yea_or_nay
  end

  def referenced?()
    return @referenced
  end

  def referenced(yea_or_nay)
    @referenced = yea_or_nay
  end

  def unparse(indent)
    "#{indent}retrieve #{var}->#{path}"
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fig-0.1.73 lib/fig/statement/retrieve.rb
fig-0.1.71 lib/fig/statement/retrieve.rb
fig-0.1.69 lib/fig/statement/retrieve.rb
fig-0.1.67 lib/fig/statement/retrieve.rb
fig-0.1.65 lib/fig/statement/retrieve.rb
fig-0.1.64 lib/fig/statement/retrieve.rb