Skip to content

Commit

Permalink
First
Browse files Browse the repository at this point in the history
  • Loading branch information
foxyblocks committed Sep 5, 2011
1 parent cb916e8 commit 3489754
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 0 deletions.
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions info.plist
Original file line number Diff line number Diff line change
@@ -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>
45 changes: 45 additions & 0 deletions install_dmg.rb
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions kudos.plist
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit 3489754

Please sign in to comment.