Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

First

  • Loading branch information...
commit 34897548309f61b2bb280315d71785ed796b019d 1 parent cb916e8
@wordofchristian authored
View
BIN  icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
36 info.plist
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>action</key>
+ <false/>
+ <key>category</key>
+ <string>SCRIPTS</string>
+ <key>command</key>
+ <string>ruby install_dmg.rb</string>
+ <key>escapequery</key>
+ <true/>
+ <key>escapequerybackquotes</key>
+ <true/>
+ <key>escapequerybrackets</key>
+ <true/>
+ <key>escapequeryquotes</key>
+ <true/>
+ <key>escapequerysemicolons</key>
+ <true/>
+ <key>growloutput</key>
+ <true/>
+ <key>growloutputsticky</key>
+ <false/>
+ <key>keyword</key>
+ <string>dmg</string>
+ <key>logging</key>
+ <false/>
+ <key>silent</key>
+ <true/>
+ <key>subtitle</key>
+ <string>Finds the most recent .dmg file in the downloads folder and automatically installs the app inside of it. Then delets the .dmg file.</string>
+ <key>title</key>
+ <string>Install DMG</string>
+</dict>
+</plist>
View
45 install_dmg.rb
@@ -0,0 +1,45 @@
+ #!/usr/bin/env ruby
+
+ require 'fileutils'
+ require 'pathname'
+ include FileUtils
+
+ #go to downloads directory
+ puts "installing most recent .dmg"
+ cd File.expand_path("~/Downloads/")
+ path = Pathname.new('.')
+
+ #find most recent .dmg file
+ files = path.entries.collect { |file| path+file }.sort { |file1,file2| file1.ctime <=> file2.ctime }
+ files.reject! { |file| ((file.file? and file.to_s.include?(".dmg")) ? false : true) }
+ last_dmg = files.last
+
+ #if there is no .dmg file then reject this.
+ if !last_dmg
+ puts "No DMG files"
+ exit
+ end
+
+ puts "Mounting #{last_dmg}"
+
+ mount_point = Pathname.new "/Volumes/#{last_dmg}"
+
+ result = `hdiutil attach -mountpoint #{mount_point} #{last_dmg}`
+
+ #find any apps in the mounted dmg
+ files = mount_point.entries.collect { |file| mount_point+file }
+ files.reject! { |file| ((file.to_s.include?(".app")) ? false : true) }
+
+ files.each { |app|
+ puts "Copying #{app} to Applications folder"
+ `cp -a #{app} /Applications/`
+ }
+
+ #unmount the .dmg
+ puts "Unmounting #{last_dmg}"
+ result = `hdiutil detach #{mount_point}`
+ puts "Finished installing #{last_dmg}"
+
+
+ #delete the .dmg
+ rm last_dmg
View
10 kudos.plist
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>creator</key>
+ <string>Christian Schlensker</string>
+ <key>website</key>
+ <string>http://cswebartisan.com</string>
+</dict>
+</plist>
Please sign in to comment.
Something went wrong with that request. Please try again.