Sha256: ded8d0204ce78438791f6764e82dfa751b843bdc9127dd5c80998e55376c38b7

Contents?: true

Size: 1.03 KB

Versions: 6

Compression:

Stored size: 1.03 KB

Contents

class AppCreator
  def self.get_config url
    response = RestClient.post url, :plan => 'test', :heroku_id => 123, :ssl_version => 'SSLv3'
    json = JSON.parse response

    trackman_url = json['config']['TRACKMAN_URL'].gsub('https', 'http')

    [[:server_url, trackman_url], [:site, "#{trackman_url}/assets"]]
  end

  def self.create
    user = ENV['HEROKU_USERNAME']
    pass = ENV['HEROKU_PASSWORD']
    server = ENV['TRACKMAN_SERVER_URL']
    
    @@config = get_config "http://#{user}:#{pass}@#{server}/heroku/resources"

    Trackman::Assets::Persistence::Remote::ClassMethods.module_eval do
      #singleton = class << self; self; end
      @@config.each do |k, v|   
        alias_method "old_#{k}", k
        define_method(k, lambda { v })
      end
    end

    @@config
  end

  def self.reset
    RemoteAsset.all.each { |a| a.delete }

    Trackman::Assets::Persistence::Remote::ClassMethods.module_eval do
      #singleton = class << self; self; end
      @@config.each do |k,v|
        alias_method k, "old_#{k}"
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
trackman-0.6.18 spec/helpers/app_creator.rb
trackman-0.6.17 spec/helpers/app_creator.rb
trackman-0.6.16 spec/helpers/app_creator.rb
trackman-0.6.15 spec/helpers/app_creator.rb
trackman-0.6.14 spec/helpers/app_creator.rb
trackman-0.6.13 spec/helpers/app_creator.rb