class Fig::Statement::Retrieve
Specifies that files from a package should be copied into the current directory when an environment variable has its value changed.
Constants
- TOKENIZING_SUBEXPRESSION_MATCHER
Attributes
tokenized_path[R]
variable[R]
Public Class Methods
new(line_column, source_description, variable, tokenized_path)
click to toggle source
Calls superclass method
Fig::Statement::new
# File lib/fig/statement/retrieve.rb, line 20 def initialize(line_column, source_description, variable, tokenized_path) super(line_column, source_description) @variable = variable @tokenized_path = tokenized_path path = tokenized_path.to_escaped_string # 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::OperatingSystem.windows? && path =~ %r< ^ [a-z] : >xi ) 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
tokenize_path(path, &error_block)
click to toggle source
# File lib/fig/statement/retrieve.rb, line 12 def self.tokenize_path(path, &error_block) tokenizer = Fig::StringTokenizer.new TOKENIZING_SUBEXPRESSION_MATCHER, '\\[' return tokenizer.tokenize path, &error_block end
Public Instance Methods
added_to_environment(yea_or_nay)
click to toggle source
# File lib/fig/statement/retrieve.rb, line 51 def added_to_environment(yea_or_nay) @added_to_environment = yea_or_nay end
added_to_environment?()
click to toggle source
# File lib/fig/statement/retrieve.rb, line 47 def added_to_environment?() return @added_to_environment end
deparse_as_version(deparser)
click to toggle source
# File lib/fig/statement/retrieve.rb, line 63 def deparse_as_version(deparser) return deparser.retrieve(self) end
loaded_but_not_referenced?()
click to toggle source
# File lib/fig/statement/retrieve.rb, line 43 def loaded_but_not_referenced?() return added_to_environment? && ! referenced? end
minimum_grammar_for_emitting_input()
click to toggle source
# File lib/fig/statement/retrieve.rb, line 67 def minimum_grammar_for_emitting_input() return minimum_grammar() end
minimum_grammar_for_publishing()
click to toggle source
# File lib/fig/statement/retrieve.rb, line 71 def minimum_grammar_for_publishing() return minimum_grammar() end
referenced(yea_or_nay)
click to toggle source
# File lib/fig/statement/retrieve.rb, line 59 def referenced(yea_or_nay) @referenced = yea_or_nay end
referenced?()
click to toggle source
# File lib/fig/statement/retrieve.rb, line 55 def referenced?() return @referenced end
statement_type()
click to toggle source
# File lib/fig/statement/retrieve.rb, line 39 def statement_type() return 'retrieve' end
Private Instance Methods
minimum_grammar()
click to toggle source
# File lib/fig/statement/retrieve.rb, line 77 def minimum_grammar() path = tokenized_path.to_escaped_string if path =~ /\s/ return [1, 'contains whitespace'] end # Can't have octothorpes anywhere in v0 due to comment stripping via # regex. if path =~ /#/ return [1, 'contains a comment ("#") character'] end if path =~ %r< ' >x return [1, %Q<contains a single quote character>] end if path =~ %r< " >x return [1, %Q<contains a double quote character>] end if path =~ %r< ( [^a-zA-Z0-9_/.\[\]-] ) >x return [1, %Q<contains a "#{$1}" character>] end return [0] end