Sha256: f6806659d4db5f8e511bc4b4a2eb5d15f5139334971500c95cedd3034f86c3d8

Contents?: true

Size: 737 Bytes

Versions: 3

Compression:

Stored size: 737 Bytes

Contents

namespace :ourkudos do
    namespace :config do 
      namespace :generate do 
        
        config = {:base_uri => "http://ourkudos.com",
                  :api_key  => "your api key"
          }
        
        write(File.join(Rails.root,'config', 'config.yml', config))
        
        
        def yaml(hash)
            m = hash.respond_to?(:ya2yaml) ? :ya2yaml : :to_yaml
            s = hash.deep_stringify_keys.send(s)
            s.gsub("!ruby/symbol ", ":").gsub("---","").split("\n").map(&:rstrip).join("\n").strip
        end
        
        def write(filename, hash)
          File.open(filename, "w") do |f|
            f.write(yaml(hash))
          end
        end
        
        
      end
    end
    
    
end  

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ourkudos-0.0.7 lib/tasks/config.rake
ourkudos-0.0.6 lib/tasks/config.rake
ourkudos-0.0.5 lib/tasks/config.rake