class Desktop::CLI
Public Instance Methods
set(path, already_failed = false)
click to toggle source
# File lib/desktop/cli.rb, line 21 def set(path, already_failed = false) osx = OSX.new(options) image = HTTP.uri?(path) ? WebImage.new(path) : LocalImage.new(path) begin osx.desktop_image = image rescue OSX::DesktopImagePermissionsError => e fail_with_permissions_error if already_failed print_permissions_message osx.update_desktop_image_permissions puts set path, true rescue OSX::DesktopImageMissingError fail_with_missing_image_error image end end
version()
click to toggle source
# File lib/desktop/cli.rb, line 40 def version puts Desktop::VERSION end
Private Instance Methods
fail_with_missing_image_error(image)
click to toggle source
# File lib/desktop/cli.rb, line 56 def fail_with_missing_image_error(image) puts "Sorry, but it looks like the image you provided does not exist:" puts puts image.path puts print_issues_message abort end
fail_with_permissions_error()
click to toggle source
# File lib/desktop/cli.rb, line 46 def fail_with_permissions_error print "Sorry, but I was unable to change your desktop image. " puts "The permissions are still incorrect." puts puts "Did you type your password incorrectly?" puts print_issues_message abort end
print_issues_message()
click to toggle source
# File lib/desktop/cli.rb, line 77 def print_issues_message puts "Please create an issue if you think this is my fault:" puts puts "https://github.com/chrishunt/desktop/issues/new" end
print_permissions_message()
click to toggle source
# File lib/desktop/cli.rb, line 65 def print_permissions_message print "It looks like this is the first time you've tried to change " puts "your desktop." puts print "We need to make your desktop image writable before we can " puts "change it. This only needs to be done once." puts puts "$ #{OSX.chown_command}" puts "$ #{OSX.chmod_command}" puts end