Class: Fig::Statement::Retrieve

Inherits:
Fig::Statement show all
Defined in:
lib/fig/statement/retrieve.rb

Overview

Specifies that files from a package should be copied into the current directory when an environment variable has its value changed.

Constant Summary

Constants inherited from Fig::Statement

ENVIRONMENT_VARIABLE_NAME_REGEX

Instance Attribute Summary collapse

Attributes inherited from Fig::Statement

#column, #line, #source_description

Instance Method Summary collapse

Methods inherited from Fig::Statement

#is_asset?, position_description, #position_string, #urls, #walk_statements

Constructor Details

#initialize(line_column, source_description, var, path) ⇒ Retrieve

Returns a new instance of Retrieve.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/fig/statement/retrieve.rb', line 11

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

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



9
10
11
# File 'lib/fig/statement/retrieve.rb', line 9

def path
  @path
end

#varObject (readonly)

Returns the value of attribute var.



9
10
11
# File 'lib/fig/statement/retrieve.rb', line 9

def var
  @var
end

Instance Method Details

#added_to_environment(yea_or_nay) ⇒ Object



34
35
36
# File 'lib/fig/statement/retrieve.rb', line 34

def added_to_environment(yea_or_nay)
  @added_to_environment = yea_or_nay
end

#added_to_environment?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/fig/statement/retrieve.rb', line 30

def added_to_environment?()
  return @added_to_environment
end

#loaded_but_not_referenced?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/fig/statement/retrieve.rb', line 26

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

#referenced(yea_or_nay) ⇒ Object



42
43
44
# File 'lib/fig/statement/retrieve.rb', line 42

def referenced(yea_or_nay)
  @referenced = yea_or_nay
end

#referenced?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/fig/statement/retrieve.rb', line 38

def referenced?()
  return @referenced
end

#unparse(indent) ⇒ Object



46
47
48
# File 'lib/fig/statement/retrieve.rb', line 46

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