Sha256: 2c03474460d832ce5f8491cc860598b6648977874e9c7e94996246cdf5a85da7

Contents?: true

Size: 736 Bytes

Versions: 1

Compression:

Stored size: 736 Bytes

Contents

require 'rake'
namespace :ourkudos do
    namespace :config do 
      task :generate => :environment  do
        
        config = {:base_uri => "http://ourkudos.com",
                  :api_key  => "your api key"
          }

        file_path = File.join(Rails.root,'config', 'ourkudos.yml')

        puts "Generating config file to #{file_path}. \nPlease update it with correct api key"

        File.open(file_path, 'w') do |f|
          method = config.respond_to?(:ya2yaml) ? :ya2yaml : :to_yaml
          string = config.deep_stringify_keys.send(method)
          f.write string.gsub("!ruby/symbol ", ":").gsub("---","").split("\n").map(&:rstrip).join("\n").strip
        end  
        
        
      end
    end
    
    
end  

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ourkudos-0.0.29 lib/ourkudos/tasks/ourkudos.rb