Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

Commit

Permalink
flycut: oh ugly hack, how I abhor thee!
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Cunnie committed Oct 26, 2012
1 parent f1d0c47 commit e40592d
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions recipes/flycut.rb
@@ -1,21 +1,22 @@
# fixme: This should be re-factored once package.rb has a mechanism
# FIXME: This should be re-factored once package.rb has a mechanism
# for installing pkg files without mounting a dmg
include_recipe "pivotal_workstation::addloginitem"

app_path="/Applications/Flycut.app"

ruby_block "Install Flycut" do
block do
system("cd #{Chef::Config[:file_cache_path]}/ && curl -OL https://github.com/downloads/TermiT/Flycut/flycut1.5.pkg")
system("installer -allowUntrusted -package #{Chef::Config[:file_cache_path]}/flycut1.5.pkg -target /")
system("chown -R #{WS_USER} #{app_path}")
# oh ugly hack, how I abhor thee!
system("su #{WS_USER} -c \"addloginitem #{app_path}\"")
end
not_if {File.exists?("/Applications/Flycut.app")}
end

# start up on login
execute "Start Flycut automatically" do
command "defaults write loginwindow AutoLaunchedApplicationDictionary -array-add '{ \"Path\" = \"/Applications/Flycut.app\"; \"Hide\" = 0; }'"
user WS_USER
not_if {File.exists?(app_path)}
end

ruby_block "test that Flycut install worked" do
block do
raise "Flycut install failed!" if ! File.exists?("/Applications/Flycut.app")
raise "Flycut install failed!" if ! File.exists?(app_path)
end
end

0 comments on commit e40592d

Please sign in to comment.