Sha256: 0c66c9daa471166686adc7d1fc199b9537a62bb65bf3ee173601712e361980af

Contents?: true

Size: 522 Bytes

Versions: 40

Compression:

Stored size: 522 Bytes

Contents

require "foreman"

class Foreman::Env

  attr_reader :entries

  def initialize(filename)
    @entries = File.read(filename).split("\n").inject({}) do |ax, line|
      if line =~ /\A([A-Za-z_0-9]+)=(.*)\z/
        key = $1
        case val = $2
          when /\A'(.*)'\z/ then ax[key] = $1
          when /\A"(.*)"\z/ then ax[key] = $1.gsub(/\\(.)/, '\1')
          else ax[key] = val
        end
      end
      ax
    end
  end

  def entries
    @entries.each do |key, value|
      yield key, value
    end
  end

end

Version data entries

40 entries across 40 versions & 2 rubygems

Version Path
foreman-capistrano-0.53.4 lib/foreman/env.rb
foreman-capistrano-0.53.3 lib/foreman/env.rb
foreman-capistrano-0.53.2 lib/foreman/env.rb
foreman-capistrano-0.53.1 lib/foreman/env.rb
foreman-capistrano-0.53.0 lib/foreman/env.rb
foreman-capistrano-0.52.6 lib/foreman/env.rb
foreman-capistrano-0.52.5 lib/foreman/env.rb
foreman-capistrano-0.52.4 lib/foreman/env.rb
foreman-capistrano-0.52.3 lib/foreman/env.rb
foreman-capistrano-0.52.2 lib/foreman/env.rb
foreman-capistrano-0.52.1 lib/foreman/env.rb
foreman-capistrano-0.52.0 lib/foreman/env.rb
foreman-capistrano-0.51.5 lib/foreman/env.rb
foreman-capistrano-0.51.4 lib/foreman/env.rb
foreman-capistrano-0.51.3 lib/foreman/env.rb
foreman-0.57.0-java lib/foreman/env.rb
foreman-0.57.0 lib/foreman/env.rb
foreman-capistrano-0.51.2 lib/foreman/env.rb
foreman-0.56.0 lib/foreman/env.rb
foreman-0.55.0 lib/foreman/env.rb