Sha256: 2aee6ff7af3524a6441658fbf788e531bfefddee957b907b39491315190adbb8

Contents?: true

Size: 622 Bytes

Versions: 25

Compression:

Stored size: 622 Bytes

Contents

require 'fileutils'
module Recurly
  module ConfigParser
    class << self

      def parse(path = nil)
        path ||= Recurly.settings_path
        settings = {}
        if File.exists?(path)
          settings = YAML.load_file(path) || {}
        else
          puts "\n#{path} file not found. Run rake recurly:setup to create one\n\n"
        end

        settings
      end

      def save(settings = {}, path = nil)
        path ||= Recurly.settings_path
        FileUtils.mkdir_p(File.dirname(path))
        File.open(path, 'w' ) do |out|
          YAML.dump(settings, out)
        end
      end
    end
  end

end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
recurly-0.4.11 lib/recurly/config_parser.rb
recurly-0.4.10 lib/recurly/config_parser.rb
recurly-0.4.8 lib/recurly/config_parser.rb
recurly-0.4.7 lib/recurly/config_parser.rb
recurly-0.4.6 lib/recurly/config_parser.rb
recurly-0.4.5 lib/recurly/config_parser.rb
recurly-0.4.4 lib/recurly/config_parser.rb
recurly-0.4.3 lib/recurly/config_parser.rb
recurly-0.4.2 lib/recurly/config_parser.rb
recurly-0.4.1 lib/recurly/config_parser.rb
recurly-0.4.0 lib/recurly/config_parser.rb
recurly-0.3.4 lib/recurly/config_parser.rb
recurly-0.3.3 lib/recurly/config_parser.rb
recurly-0.3.2 lib/recurly/config_parser.rb
recurly-0.3.1 lib/recurly/config_parser.rb
recurly-0.3.0 lib/recurly/config_parser.rb
recurly-0.2.9 lib/recurly/config_parser.rb
recurly-0.2.8 lib/recurly/config_parser.rb
recurly-0.2.7 lib/recurly/config_parser.rb
recurly-0.2.6 lib/recurly/config_parser.rb