Module: ScrnShots::CLI
- Defined in:
- lib/scrnshots.rb
Class Method Summary collapse
Class Method Details
.download(username, directory) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/scrnshots.rb', line 42 def self.download(username, directory) FileUtils.mkdir_p(directory) unless File.exists?(directory) puts "Starting to download screenshots. This may take a while..." ScrnShots.new(username).all do |path| print(".") STDOUT.flush filename = File.basename(path) File.open(File.join(directory, filename), 'w+') do |f| open(path){|image| f << image.read } end end end |
.print_banner_and_exit ⇒ Object
56 57 58 59 |
# File 'lib/scrnshots.rb', line 56 def self. puts "Usage: $ scrnshots USERNAME DIR" exit(1) end |
.run(args) ⇒ Object
37 38 39 40 |
# File 'lib/scrnshots.rb', line 37 def self.run(args) unless args[0] && args[1] download(args[0], args[1]) end |