Class: Manoku::Application
- Inherits:
-
Thor
- Object
- Thor
- Manoku::Application
- Defined in:
- lib/manoku/application.rb
Instance Method Summary collapse
- #add_key(key) ⇒ Object
- #deploy ⇒ Object
- #download(app) ⇒ Object
- #init(base = nil) ⇒ Object
- #new(name) ⇒ Object
Instance Method Details
#add_key(key) ⇒ Object
24 25 26 27 28 |
# 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 ⇒ Object
31 32 33 34 35 36 37 38 |
# 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) ⇒ Object
41 42 43 44 45 |
# 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) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# 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) ⇒ Object
6 7 8 9 10 |
# File 'lib/manoku/application.rb', line 6 def new(name) basedir = "#{workdir}/#{name.downcase.gsub(' ', '-')}" Dir.mkdir(basedir) init(basedir) end |