Skip to content

Commit

Permalink
Merge pull request #18 from chrishunt/yosemite
Browse files Browse the repository at this point in the history
Yosemite compatibility
  • Loading branch information
chrishunt committed Oct 17, 2014
2 parents 7b4f35d + a5334c5 commit 8ad164a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

##v1.1.2
*2014-10-17*

- [Yosemite compatibility](https://github.com/chrishunt/desktop/pull/18)
- [Update gem dependencies](https://github.com/chrishunt/desktop/pull/16)

##v1.1.1
*2014-06-06*

Expand Down
15 changes: 13 additions & 2 deletions lib/desktop/osx/osx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def initialize(options = nil)
def desktop_image=(image)
write_default_desktop image
clear_custom_desktop_image unless skip_database
touch_desktop_image
reload_desktop unless skip_reload
rescue Errno::EACCES => e
raise DesktopImagePermissionsError.new(e)
Expand All @@ -45,11 +46,15 @@ def update_desktop_image_permissions
end

def chown_command
"sudo chown root:staff #{desktop_image_path}"
[' -h ', ' '].map do |option|
"sudo chown#{option}$('whoami'):staff #{desktop_image_path}"
end.join(" && ")
end

def chmod_command
"sudo chmod 664 #{desktop_image_path}"
[' -h ', ' '].map do |option|
"sudo chmod#{option}664 #{desktop_image_path}"
end.join(" && ")
end

private
Expand All @@ -66,6 +71,12 @@ def clear_custom_desktop_image
db.close
end

def touch_desktop_image
unless system("touch -h #{desktop_image_path} 2>/dev/null")
raise Errno::EACCES
end
end

def reload_desktop
system 'killall Dock'
end
Expand Down
2 changes: 1 addition & 1 deletion lib/desktop/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Desktop
VERSION = '1.1.1'
VERSION = '1.1.2'
end

0 comments on commit 8ad164a

Please sign in to comment.