Top Level Namespace
Defined Under Namespace
Modules: Roasted
Instance Method Summary collapse
- #bundle(source, options = {}) ⇒ Object
- #download(source, target, options = {}) ⇒ Object
- #download_git(source, target, options = {}) ⇒ Object
- #download_http(source, target, options = {}) ⇒ Object
- #plugin(source, options = {}) ⇒ Object
- #theme(source, options = {}) ⇒ Object
Instance Method Details
#bundle(source, options = {}) ⇒ Object
21 22 23 |
# File 'lib/roasted/provider/app/textmate.rb', line 21 def bundle(source, = {}) download source, "~/Library/Application Support/TextMate/Bundles", end |
#download(source, target, options = {}) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/roasted/provider/app/textmate.rb', line 29 def download(source, target, = {}) type = case source when /^http/ :http when /^git/ :git end self.send("download_#{type}", source, target, ) end |
#download_git(source, target, options = {}) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/roasted/provider/app/textmate.rb', line 61 def download_git(source, target, = {}) target = File.(target) # Prepare target directory FileUtils.mkdir_p target [:name] ||= File.basename(source).gsub(".git", "") Dir.chdir target do system "git clone '#{source}' '#{[:name]}'" end end |
#download_http(source, target, options = {}) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/roasted/provider/app/textmate.rb', line 39 def download_http(source, target, = {}) target = File.(target) # Prepare target directory FileUtils.mkdir_p target tmp = Tempfile.new File.basename(source) system "curl -o '#{tmp.path}' '#{source}'" if [:checksum] checksum = Digest::SHA1.hexdigest(File.read(tmp.path)) raise "Checksum mismatch, expected #{[:checksum]}" if checksum != [:checksum] end case File.extname(source)[1..-1] when "zip" system "ditto -x -k '#{tmp.path}' '#{target}'" else raise "Unknown download type: #{source}" end end |
#plugin(source, options = {}) ⇒ Object
17 18 19 |
# File 'lib/roasted/provider/app/textmate.rb', line 17 def plugin(source, = {}) download source, "~/Library/Application Support/TextMate/PlugIns", end |
#theme(source, options = {}) ⇒ Object
25 26 27 |
# File 'lib/roasted/provider/app/textmate.rb', line 25 def theme(source, = {}) download source, "~/Library/Application Support/TextMate/Themes", end |