lib/capistrano/env/config.rb in capistrano-env-0.1.2 vs lib/capistrano/env/config.rb in capistrano-env-0.2.0

- old
+ new

@@ -2,26 +2,35 @@ module Env class Config attr_accessor :formatter def initialize - @formatter = :ruby @values = {} @keys = [] end + def formatter + self.formatter = :ruby unless @formatter + @formatter + end + + def formatter=(value) + warn 'formatter :ruby is deprecated! use :dotenv with dotenv(-rails).gem' if value == :ruby + @formatter = value + end + def add(name_or_regexp, val = nil, &block) if val && name_or_regexp.is_a?(String) @values[name_or_regexp] = val else @keys << [name_or_regexp, block] end end def formatter_class @formatter_class ||= begin - require "capistrano/env/formatter/#{@formatter}_formatter" + require "capistrano/env/formatter/#{formatter}_formatter" Capistrano::Env::Formatter.const_get "#{formatter.capitalize}Formatter" end end def envs @@ -33,10 +42,10 @@ end result.merge(@values) end def capenv_file - "capenv.#{formatter_class.file_ext}" + formatter_class.filename end def capenv_content formatter_class.format(envs) end