Class: DarwinInstaller

Inherits:
Object
  • Object
show all
Defined in:
lib/rad/darwin_installer.rb

Class Method Summary collapse

Class Method Details

.install!Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rad/darwin_installer.rb', line 2

def self.install!
  puts "Downloading arduino-0015 for Mac from Arduino.cc"
  File.open("/Applications/arduino-0015.zip", "w") do |file|
    pbar = nil
    file << open("http://arduino.googlecode.com/files/arduino-0015-mac.zip",
    :content_length_proc => lambda {|t|
      if t && 0 < t
        pbar = ProgressBar.new(" Progress", t)
        pbar.file_transfer_mode
      end
    },
    :progress_proc => lambda {|s|
      pbar.set s if pbar
    }).read
    pbar.finish
  end
  puts "Unzipping..."
  `cd /Applications; unzip arduino-0015.zip`
  `rm /Applications/arduino-0015.zip`
  puts "installed Arduino here: /Applications/arduino-0015"
end