Class: Desktop::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/desktop/cli.rb

Instance Method Summary collapse

Instance Method Details

#set(path, already_failed = false) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/desktop/cli.rb', line 19

def set(path, already_failed = false)
  osx = OSX.new(options[:default_image_path], options[:skip_reload])
  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

#versionObject



38
39
40
# File 'lib/desktop/cli.rb', line 38

def version
  puts Desktop::VERSION
end