Sha256: 96ac9584839da6abca2ec2ae199975f42cf4a824f6ebcea193c6b1e7b579f32d

Contents?: true

Size: 756 Bytes

Versions: 2

Compression:

Stored size: 756 Bytes

Contents

namespace :ourkudos do
    namespace :config do 
      namespace :generate => :environment  do 
        
        config = {:base_uri => "http://ourkudos.com",
                  :api_key  => "your api key"
          }
        
        write(File.join(Rails.root,'config', 'ourkudos.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

2 entries across 2 versions & 1 rubygems

Version Path
ourkudos-0.0.10 lib/tasks/ourkudos.rake
ourkudos-0.0.9 lib/tasks/ourkudos.rake