Class: Github::DownloadsController
- Inherits:
-
SimpleConsole::Controller
- Object
- SimpleConsole::Controller
- Github::DownloadsController
- Includes:
- Hirb::Console
- Defined in:
- lib/github/downloads_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/github/downloads_controller.rb', line 42 def create if params[:file].nil? fail! "* A file must be specified (-f or --file)" end if (url_for_upload = github(:authenticated).create(params[:file], params[:description])) puts "Upload successful! (#{url_for_upload})" else fail! "Upload failed!" end rescue Github::Downloads::UnexpectedResponse => e fail! "Unexpected response (#{e.response})." end |
#default ⇒ Object
27 28 29 30 |
# File 'lib/github/downloads_controller.rb', line 27 def default puts "Valid actions: list, upload, delete" exit 1 end |
#list ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/github/downloads_controller.rb', line 32 def list if (downloads = github(:authenticated).list) table downloads, {:fields => [:name, :description, :download_count]} else puts "Couldn't fetch downloads!" end rescue Github::Downloads::UnexpectedResponse => e fail! "Unexpected response (#{e.response})." end |