Sha256: 2a1a0e0f0540272e68daf04803b37a8f1a2430beeea9734a067184870a293171

Contents?: true

Size: 723 Bytes

Versions: 31

Compression:

Stored size: 723 Bytes

Contents

# == TagManager::YAML
#
# A TagManager driver that reads tags from a YAML file.
class AutomateIt::TagManager::YAML < AutomateIt::TagManager::Struct
  depends_on :nothing

  def suitability(method, *args) # :nodoc:
    return 5
  end

  # Options:
  # * :file -- File to read tags from. The file is preprocessed with ERB and
  #   must produce YAML content.
  def setup(opts={})
    if filename = opts.delete(:file)
      contents = _read(filename)
      output = HelpfulERB.new(contents, filename).result

      text = AutomateIt::TagManager::TagParser.normalize(output)
      opts[:struct] = ::YAML::load(text)
    end
    super(opts)
  end

  def _read(filename)
    return File.read(filename)
  end
  private :_read
end

Version data entries

31 entries across 31 versions & 2 rubygems

Version Path
automate-it-0.9.2 lib/automateit/tag_manager/yaml.rb
automate-it-0.9.1 lib/automateit/tag_manager/yaml.rb
automate-it-0.9.0 lib/automateit/tag_manager/yaml.rb
automateit-0.71003 lib/automateit/tag_manager/yaml.rb
automateit-0.70923 lib/automateit/tag_manager/yaml.rb
automateit-0.70928 lib/automateit/tag_manager/yaml.rb
automateit-0.70930 lib/automateit/tag_manager/yaml.rb
automateit-0.71021 lib/automateit/tag_manager/yaml.rb
automateit-0.71030 lib/automateit/tag_manager/yaml.rb
automateit-0.71031.1 lib/automateit/tag_manager/yaml.rb
automateit-0.71031.2 lib/automateit/tag_manager/yaml.rb
automateit-0.71017 lib/automateit/tag_manager/yaml.rb
automateit-0.71012 lib/automateit/tag_manager/yaml.rb
automateit-0.71006 lib/automateit/tag_manager/yaml.rb
automateit-0.71101.2 lib/automateit/tag_manager/yaml.rb
automateit-0.71101 lib/automateit/tag_manager/yaml.rb
automateit-0.71103 lib/automateit/tag_manager/yaml.rb
automateit-0.71101.1 lib/automateit/tag_manager/yaml.rb
automateit-0.71031 lib/automateit/tag_manager/yaml.rb
automateit-0.71102 lib/automateit/tag_manager/yaml.rb