class Manoku::Application

Public Instance Methods

add_key(key) click to toggle source
# File lib/manoku/application.rb, line 24
def add_key(key)
  @_heroku = nil
  FileUtils.rm(key_file) if File.exists?(key_file)
  File.open(key_file, "w") { |file| file << key }
end
deploy() click to toggle source
# File lib/manoku/application.rb, line 31
def deploy
  Dir["#{appsdir}/*.json"].each do |path|
    name = File.basename(path, '.json')
    json = JSON.parse(File.read(path))
    heroku.config_var.update(name, json)
    puts "Updated #{name} configuration."
  end
end
download(app) click to toggle source
# File lib/manoku/application.rb, line 41
def download(app)
  File.open("#{appsdir}/#{app}.json", "w") do |file|
    file << JSON.pretty_generate(heroku.config_var.info(app)).to_s
  end
end
init(base=nil) click to toggle source
# File lib/manoku/application.rb, line 13
def init(base=nil)
  base = workdir unless base
  Git.init(base)
  Dir.mkdir(appsdir)
  FileUtils.touch("#{appsdir}/.gitkeep")
  File.open("#{base}/.gitignore", "w") do |file|
    file << "apps/*.json"
  end
end
new(name) click to toggle source
# File lib/manoku/application.rb, line 6
def new(name)
  basedir = "#{workdir}/#{name.downcase.gsub(' ', '-')}"
  Dir.mkdir(basedir)
  init(basedir)
end

Private Instance Methods

appsdir() click to toggle source
# File lib/manoku/application.rb, line 53
def appsdir
  "#{workdir}/apps"
end
heroku() click to toggle source
# File lib/manoku/application.rb, line 61
def heroku
  @_heroku ||= PlatformAPI.connect_oauth(heroku_key)
end
heroku_key() click to toggle source
# File lib/manoku/application.rb, line 65
def heroku_key
  File.read(key_file)
end
key_file() click to toggle source
# File lib/manoku/application.rb, line 57
def key_file
  "#{Dir.home}/.manoku"
end
workdir() click to toggle source
# File lib/manoku/application.rb, line 49
def workdir
  Dir.pwd
end