Class: Heroku::Command::Bundles

Inherits:
BaseWithApp show all
Defined in:
lib/heroku/commands/bundles.rb

Instance Attribute Summary

Attributes inherited from BaseWithApp

#app

Attributes inherited from Base

#args, #autodetected_app

Instance Method Summary collapse

Methods inherited from BaseWithApp

#initialize

Methods inherited from Base

#app_urls, #ask, #display, #error, #escape, #extract_app, #extract_app_in_dir, #extract_option, #format_date, #git_remotes, #git_url, #heroku, #initialize, #shell, #web_url

Methods included from Helpers

#home_directory, #running_on_a_mac?, #running_on_windows?

Constructor Details

This class inherits a constructor from Heroku::Command::BaseWithApp

Instance Method Details

#animateObject



41
42
43
44
45
46
47
48
49
# File 'lib/heroku/commands/bundles.rb', line 41

def animate
	bundle = args.shift.strip.downcase rescue ""
	if bundle.length == 0
		display "Usage: heroku bundle:animate <bundle>"
	else
		name = heroku.create(nil, :origin_bundle_app => app, :origin_bundle => bundle)
		display "Animated #{app} #{bundle} into #{app_urls(name)}"
	end
end

#captureObject



16
17
18
19
20
21
# File 'lib/heroku/commands/bundles.rb', line 16

def capture
	bundle = args.shift.strip.downcase rescue nil

	bundle = heroku.bundle_capture(app, bundle)
	display "Began capturing bundle #{bundle} from #{app}"
end

#destroyObject



23
24
25
26
27
28
29
30
31
# File 'lib/heroku/commands/bundles.rb', line 23

def destroy
	bundle = args.first.strip.downcase rescue nil
	unless bundle
		display "Usage: heroku bundle:destroy <bundle>"
	else
		heroku.bundle_destroy(app, bundle)
		display "Destroyed bundle #{bundle} from #{app}"
	end
end

#downloadObject



33
34
35
36
37
38
39
# File 'lib/heroku/commands/bundles.rb', line 33

def download
	fname = "#{app}.tar.gz"
	bundle = args.shift.strip.downcase rescue nil
	url = heroku.bundle_url(app, bundle)
	File.open(fname, "wb") { |f| f.write RestClient.get(url) }
	display "Downloaded #{File.stat(fname).size} byte bundle #{fname}"
end

#listObject Also known as: index



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/heroku/commands/bundles.rb', line 3

def list
	list = heroku.bundles(app)
	if list.size > 0
		list.each do |bundle|
			space  = ' ' * [(18 - bundle[:name].size),1].max
			display "#{bundle[:name]}" + space + "#{bundle[:state]} #{bundle[:created_at].strftime("%m/%d/%Y %H:%M")}"
		end
	else
		display "#{app} has no bundles."
	end
end