desktop 1.2.0 → 1.3.0.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +5 -0
- data/desktop.gemspec +9 -9
- data/lib/desktop/cli.rb +2 -36
- data/lib/desktop/osx/database.rb +17 -2
- data/lib/desktop/osx/osx.rb +6 -55
- data/lib/desktop/version.rb +1 -1
- data/test/desktop/cli_test.rb +3 -9
- data/test/desktop/osx/database_test.rb +30 -3
- data/test/desktop/osx/osx_test.rb +2 -22
- metadata +23 -23
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: fd0ae66003e3f0c240521ae352379b38c4e164a9
         | 
| 4 | 
            +
              data.tar.gz: aa6f4250cc10f900dd0d60f9465f02d064b48a7a
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 0bdce2e34359a5d97478424b64366723cfdcddc73f2a93c36c8d9131153acde0393a3673f8262c5cff0c25d452740cd6d276055fda556c8ae438eb64a5fd09e1
         | 
| 7 | 
            +
              data.tar.gz: d1399592272f691604cdbdc2fafcd0a98821c0bdfe1473be8a2f254a3d4ea0e096724d1ac3508bfea113a7518073215b2ab0c8f492b4bb163e24208c801fd6fb
         | 
    
        data/Rakefile
    CHANGED
    
    
    
        data/desktop.gemspec
    CHANGED
    
    | @@ -18,14 +18,14 @@ Gem::Specification.new do |spec| | |
| 18 18 | 
             
              spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
         | 
| 19 19 | 
             
              spec.require_paths = ["lib"]
         | 
| 20 20 |  | 
| 21 | 
            -
              spec.add_dependency "faraday",  "~> 0.9"
         | 
| 22 | 
            -
              spec.add_dependency "sqlite3",  "~> 1.3"
         | 
| 23 | 
            -
              spec.add_dependency "thor",     "~> 0.19"
         | 
| 21 | 
            +
              spec.add_dependency "faraday",  "~> 0.9.1"
         | 
| 22 | 
            +
              spec.add_dependency "sqlite3",  "~> 1.3.10"
         | 
| 23 | 
            +
              spec.add_dependency "thor",     "~> 0.19.1"
         | 
| 24 24 |  | 
| 25 | 
            -
              spec.add_development_dependency "bundler",  "~> 1. | 
| 26 | 
            -
              spec.add_development_dependency "minitest", "~> 5. | 
| 27 | 
            -
              spec.add_development_dependency "pry",      "~> 0.10. | 
| 28 | 
            -
              spec.add_development_dependency "rake",     "~> 10. | 
| 29 | 
            -
              spec.add_development_dependency "vcr",      "~> 2.9"
         | 
| 30 | 
            -
              spec.add_development_dependency "webmock",  "~> 1. | 
| 25 | 
            +
              spec.add_development_dependency "bundler",  "~> 1.10.6"
         | 
| 26 | 
            +
              spec.add_development_dependency "minitest", "~> 5.8.1"
         | 
| 27 | 
            +
              spec.add_development_dependency "pry",      "~> 0.10.2"
         | 
| 28 | 
            +
              spec.add_development_dependency "rake",     "~> 10.4.2"
         | 
| 29 | 
            +
              spec.add_development_dependency "vcr",      "~> 2.9.3"
         | 
| 30 | 
            +
              spec.add_development_dependency "webmock",  "~> 1.21.0"
         | 
| 31 31 | 
             
            end
         | 
    
        data/lib/desktop/cli.rb
    CHANGED
    
    | @@ -15,22 +15,14 @@ module Desktop | |
| 15 15 | 
             
                  > $ desktop set http://url.to/image.jpg
         | 
| 16 16 | 
             
                LONGDESC
         | 
| 17 17 | 
             
                option :desktop_image_path, :hide => true
         | 
| 18 | 
            -
                option :cached_image_path, :hide => true
         | 
| 19 18 | 
             
                option :skip_reload, :type => :boolean, :hide => true
         | 
| 20 19 | 
             
                option :skip_database, :type => :boolean, :hide => true
         | 
| 21 | 
            -
                def set(path | 
| 20 | 
            +
                def set(path)
         | 
| 22 21 | 
             
                  osx = OSX.new(options)
         | 
| 23 22 | 
             
                  image = HTTP.uri?(path) ? WebImage.new(path) : LocalImage.new(path)
         | 
| 24 23 |  | 
| 25 24 | 
             
                  begin
         | 
| 26 25 | 
             
                    osx.desktop_image = image
         | 
| 27 | 
            -
                  rescue OSX::DesktopImagePermissionsError => e
         | 
| 28 | 
            -
                    fail_with_permissions_error if already_failed
         | 
| 29 | 
            -
             | 
| 30 | 
            -
                    print_permissions_message
         | 
| 31 | 
            -
                    osx.update_desktop_image_permissions
         | 
| 32 | 
            -
                    puts
         | 
| 33 | 
            -
                    set path, true
         | 
| 34 26 | 
             
                  rescue OSX::DesktopImageMissingError
         | 
| 35 27 | 
             
                    fail_with_missing_image_error image
         | 
| 36 28 | 
             
                  end
         | 
| @@ -43,41 +35,15 @@ module Desktop | |
| 43 35 |  | 
| 44 36 | 
             
                private
         | 
| 45 37 |  | 
| 46 | 
            -
                def fail_with_permissions_error
         | 
| 47 | 
            -
                  print "Sorry, but I was unable to change your desktop image. "
         | 
| 48 | 
            -
                  puts  "The permissions are still incorrect."
         | 
| 49 | 
            -
                  puts
         | 
| 50 | 
            -
                  puts  "Did you type your password incorrectly?"
         | 
| 51 | 
            -
                  puts
         | 
| 52 | 
            -
                  print_issues_message
         | 
| 53 | 
            -
                  abort
         | 
| 54 | 
            -
                end
         | 
| 55 | 
            -
             | 
| 56 38 | 
             
                def fail_with_missing_image_error(image)
         | 
| 57 39 | 
             
                  puts "Sorry, but it looks like the image you provided does not exist:"
         | 
| 58 40 | 
             
                  puts
         | 
| 59 41 | 
             
                  puts image.path
         | 
| 60 42 | 
             
                  puts
         | 
| 61 | 
            -
                  print_issues_message
         | 
| 62 | 
            -
                  abort
         | 
| 63 | 
            -
                end
         | 
| 64 | 
            -
             | 
| 65 | 
            -
                def print_permissions_message
         | 
| 66 | 
            -
                  print "It looks like this is the first time you've tried to change "
         | 
| 67 | 
            -
                  puts  "your desktop."
         | 
| 68 | 
            -
                  puts
         | 
| 69 | 
            -
                  print "We need to make your desktop image writable before we can "
         | 
| 70 | 
            -
                  puts  "change it. This only needs to be done once."
         | 
| 71 | 
            -
                  puts
         | 
| 72 | 
            -
                  puts  "$ #{OSX.chown_command}"
         | 
| 73 | 
            -
                  puts  "$ #{OSX.chmod_command}"
         | 
| 74 | 
            -
                  puts
         | 
| 75 | 
            -
                end
         | 
| 76 | 
            -
             | 
| 77 | 
            -
                def print_issues_message
         | 
| 78 43 | 
             
                  puts "Please create an issue if you think this is my fault:"
         | 
| 79 44 | 
             
                  puts
         | 
| 80 45 | 
             
                  puts "https://github.com/chrishunt/desktop/issues/new"
         | 
| 46 | 
            +
                  abort
         | 
| 81 47 | 
             
                end
         | 
| 82 48 | 
             
              end
         | 
| 83 49 | 
             
            end
         | 
    
        data/lib/desktop/osx/database.rb
    CHANGED
    
    | @@ -10,7 +10,13 @@ module Desktop | |
| 10 10 | 
             
                  end
         | 
| 11 11 |  | 
| 12 12 | 
             
                  def clear_desktop_image
         | 
| 13 | 
            -
                     | 
| 13 | 
            +
                    clear if data?
         | 
| 14 | 
            +
                  end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                  def set_desktop_image(desktop_image_path)
         | 
| 17 | 
            +
                    create unless data?
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                    ([desktop_image_path] * 100).each { |path| insert(path) }
         | 
| 14 20 | 
             
                  end
         | 
| 15 21 |  | 
| 16 22 | 
             
                  def close
         | 
| @@ -25,11 +31,20 @@ module Desktop | |
| 25 31 | 
             
                    ).any?
         | 
| 26 32 | 
             
                  end
         | 
| 27 33 |  | 
| 28 | 
            -
                  def  | 
| 34 | 
            +
                  def insert(data)
         | 
| 35 | 
            +
                    connection.execute 'INSERT INTO data (value) VALUES (?)', data
         | 
| 36 | 
            +
                  end
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                  def clear
         | 
| 29 39 | 
             
                    connection.execute 'DELETE FROM data'
         | 
| 30 40 | 
             
                    connection.execute 'VACUUM data'
         | 
| 31 41 | 
             
                  end
         | 
| 32 42 |  | 
| 43 | 
            +
                  def create
         | 
| 44 | 
            +
                    connection.execute 'CREATE TABLE data (value)'
         | 
| 45 | 
            +
                    connection.execute 'CREATE INDEX data_index ON data (value)'
         | 
| 46 | 
            +
                  end
         | 
| 47 | 
            +
             | 
| 33 48 | 
             
                  def default_connection
         | 
| 34 49 | 
             
                    SQLite3::Database.new path
         | 
| 35 50 | 
             
                  end
         | 
    
        data/lib/desktop/osx/osx.rb
    CHANGED
    
    | @@ -2,102 +2,53 @@ require 'desktop/osx/database' | |
| 2 2 |  | 
| 3 3 | 
             
            module Desktop
         | 
| 4 4 | 
             
              class OSX
         | 
| 5 | 
            -
                class DesktopImagePermissionsError < StandardError; end
         | 
| 6 5 | 
             
                class DesktopImageMissingError < StandardError; end
         | 
| 7 6 |  | 
| 8 7 | 
             
                def self.desktop_image=(image)
         | 
| 9 8 | 
             
                  self.new.desktop_image = image
         | 
| 10 9 | 
             
                end
         | 
| 11 10 |  | 
| 12 | 
            -
                def self.update_desktop_image_permissions
         | 
| 13 | 
            -
                  self.new.update_desktop_image_permissions
         | 
| 14 | 
            -
                end
         | 
| 15 | 
            -
             | 
| 16 | 
            -
                def self.chown_command
         | 
| 17 | 
            -
                  self.new.chown_command
         | 
| 18 | 
            -
                end
         | 
| 19 | 
            -
             | 
| 20 | 
            -
                def self.chmod_command
         | 
| 21 | 
            -
                  self.new.chmod_command
         | 
| 22 | 
            -
                end
         | 
| 23 | 
            -
             | 
| 24 11 | 
             
                def initialize(options = nil)
         | 
| 25 12 | 
             
                  options ||= {}
         | 
| 26 13 | 
             
                  @skip_reload = options[:skip_reload]
         | 
| 27 14 | 
             
                  @skip_database = options[:skip_database]
         | 
| 28 15 | 
             
                  @desktop_image_path = \
         | 
| 29 16 | 
             
                    options[:desktop_image_path] || default_desktop_image_path
         | 
| 30 | 
            -
                  @cached_image_path = \
         | 
| 31 | 
            -
                    options[:cached_image_path] || default_cached_image_path
         | 
| 32 17 | 
             
                end
         | 
| 33 18 |  | 
| 34 19 | 
             
                def desktop_image=(image)
         | 
| 35 | 
            -
                   | 
| 36 | 
            -
                   | 
| 37 | 
            -
                  touch_desktop_image
         | 
| 38 | 
            -
                  remove_cached_image
         | 
| 20 | 
            +
                  write_desktop image
         | 
| 21 | 
            +
                  save_image_path_in_database unless skip_database
         | 
| 39 22 | 
             
                  reload_desktop unless skip_reload
         | 
| 40 | 
            -
                rescue Errno::EACCES => e
         | 
| 41 | 
            -
                  raise DesktopImagePermissionsError.new(e)
         | 
| 42 23 | 
             
                rescue Errno::ENOENT => e
         | 
| 43 24 | 
             
                  raise DesktopImageMissingError.new(e)
         | 
| 44 25 | 
             
                end
         | 
| 45 26 |  | 
| 46 | 
            -
                def update_desktop_image_permissions
         | 
| 47 | 
            -
                  system(chown_command) && system(chmod_command)
         | 
| 48 | 
            -
                end
         | 
| 49 | 
            -
             | 
| 50 | 
            -
                def chown_command
         | 
| 51 | 
            -
                  [' -h ', ' '].map do |option|
         | 
| 52 | 
            -
                    "sudo chown#{option}$('whoami'):staff #{desktop_image_path}"
         | 
| 53 | 
            -
                  end.join(" && ")
         | 
| 54 | 
            -
                end
         | 
| 55 | 
            -
             | 
| 56 | 
            -
                def chmod_command
         | 
| 57 | 
            -
                  [' -h ', ' '].map do |option|
         | 
| 58 | 
            -
                    "sudo chmod#{option}664 #{desktop_image_path}"
         | 
| 59 | 
            -
                  end.join(" && ")
         | 
| 60 | 
            -
                end
         | 
| 61 | 
            -
             | 
| 62 27 | 
             
                private
         | 
| 63 28 |  | 
| 64 29 | 
             
                attr_reader :desktop_image_path,
         | 
| 65 | 
            -
                            :cached_image_path,
         | 
| 66 30 | 
             
                            :skip_reload,
         | 
| 67 31 | 
             
                            :skip_database
         | 
| 68 32 |  | 
| 69 | 
            -
                def  | 
| 33 | 
            +
                def write_desktop(image)
         | 
| 70 34 | 
             
                  File.open(desktop_image_path, 'w') do |desktop|
         | 
| 71 35 | 
             
                    desktop.write image.data
         | 
| 72 36 | 
             
                  end
         | 
| 73 37 | 
             
                end
         | 
| 74 38 |  | 
| 75 | 
            -
                def  | 
| 39 | 
            +
                def save_image_path_in_database
         | 
| 76 40 | 
             
                  db = Database.new
         | 
| 77 41 | 
             
                  db.clear_desktop_image
         | 
| 42 | 
            +
                  db.set_desktop_image desktop_image_path
         | 
| 78 43 | 
             
                  db.close
         | 
| 79 44 | 
             
                end
         | 
| 80 45 |  | 
| 81 | 
            -
                def touch_desktop_image
         | 
| 82 | 
            -
                  unless system("touch -h #{desktop_image_path} 2>/dev/null")
         | 
| 83 | 
            -
                    raise Errno::EACCES
         | 
| 84 | 
            -
                  end
         | 
| 85 | 
            -
                end
         | 
| 86 | 
            -
             | 
| 87 | 
            -
                def remove_cached_image
         | 
| 88 | 
            -
                  system "rm #{cached_image_path} 2>/dev/null"
         | 
| 89 | 
            -
                end
         | 
| 90 | 
            -
             | 
| 91 46 | 
             
                def reload_desktop
         | 
| 92 47 | 
             
                  system 'killall Dock'
         | 
| 93 48 | 
             
                end
         | 
| 94 49 |  | 
| 95 | 
            -
                def default_cached_image_path
         | 
| 96 | 
            -
                  '/Library/Caches/com.apple.desktop.admin.png'
         | 
| 97 | 
            -
                end
         | 
| 98 | 
            -
             | 
| 99 50 | 
             
                def default_desktop_image_path
         | 
| 100 | 
            -
                   | 
| 51 | 
            +
                  File.expand_path "~/Library/Application Support/desktop-gem-wallpaper.jpg"
         | 
| 101 52 | 
             
                end
         | 
| 102 53 | 
             
              end
         | 
| 103 54 | 
             
            end
         | 
    
        data/lib/desktop/version.rb
    CHANGED
    
    
    
        data/test/desktop/cli_test.rb
    CHANGED
    
    | @@ -8,37 +8,31 @@ module Desktop | |
| 8 8 | 
             
                  desktop.write 'Default content'
         | 
| 9 9 | 
             
                  desktop.rewind
         | 
| 10 10 |  | 
| 11 | 
            -
                  cached = Tempfile.new(%w[cached .jpg])
         | 
| 12 | 
            -
                  cached.write 'Cached content'
         | 
| 13 | 
            -
                  cached.rewind
         | 
| 14 | 
            -
             | 
| 15 11 | 
             
                  image = Tempfile.new(%w[image .jpg])
         | 
| 16 12 | 
             
                  image.write 'New content'
         | 
| 17 13 | 
             
                  image.rewind
         | 
| 18 14 |  | 
| 19 15 | 
             
                  defaults = [
         | 
| 20 16 | 
             
                    "--desktop-image-path=#{desktop.path}",
         | 
| 21 | 
            -
                    "--cached-image-path=#{cached.path}",
         | 
| 22 17 | 
             
                    "--skip-reload",
         | 
| 23 18 | 
             
                    "--skip-database"
         | 
| 24 19 | 
             
                  ]
         | 
| 25 20 |  | 
| 26 | 
            -
                  yield desktop,  | 
| 21 | 
            +
                  yield desktop, image, defaults
         | 
| 27 22 | 
             
                ensure
         | 
| 28 23 | 
             
                  desktop.unlink
         | 
| 29 | 
            -
                  cached.unlink
         | 
| 30 24 | 
             
                  image.unlink
         | 
| 31 25 | 
             
                end
         | 
| 32 26 |  | 
| 33 27 | 
             
                it 'sets the desktop when a local image path is provided' do
         | 
| 34 | 
            -
                  with_defaults do |desktop,  | 
| 28 | 
            +
                  with_defaults do |desktop, image, defaults|
         | 
| 35 29 | 
             
                    CLI.start ['set', image.path] + defaults
         | 
| 36 30 | 
             
                    assert_equal File.read(desktop), File.read(image)
         | 
| 37 31 | 
             
                  end
         | 
| 38 32 | 
             
                end
         | 
| 39 33 |  | 
| 40 34 | 
             
                it 'sets the desktop when a web url is provided' do
         | 
| 41 | 
            -
                  with_defaults do |desktop, _,  | 
| 35 | 
            +
                  with_defaults do |desktop, _, defaults|
         | 
| 42 36 | 
             
                    VCR.use_cassette('web_image_data') do
         | 
| 43 37 | 
             
                      CLI.start ['set', 'http://f.cl.ly/image.jpg'] + defaults
         | 
| 44 38 | 
             
                      refute_equal 'Default content', File.read(desktop)
         | 
| @@ -5,14 +5,16 @@ module Desktop | |
| 5 5 | 
             
              describe OSX::Database do
         | 
| 6 6 | 
             
                def with_connection
         | 
| 7 7 | 
             
                  connection = SQLite3::Database.new ':memory:'
         | 
| 8 | 
            -
                   | 
| 8 | 
            +
                  desktop_image = Tempfile.new(%w[desktop .jpg])
         | 
| 9 | 
            +
                  yield connection, desktop_image.path
         | 
| 9 10 | 
             
                ensure
         | 
| 11 | 
            +
                  desktop_image.unlink
         | 
| 10 12 | 
             
                  connection.close
         | 
| 11 13 | 
             
                end
         | 
| 12 14 |  | 
| 13 15 | 
             
                describe '#clear_desktop_image' do
         | 
| 14 16 | 
             
                  it 'clears contents of data table' do
         | 
| 15 | 
            -
                    with_connection do |connection|
         | 
| 17 | 
            +
                    with_connection do |connection, _|
         | 
| 16 18 | 
             
                      connection.execute("CREATE TABLE data (FileName STRING)")
         | 
| 17 19 | 
             
                      connection.execute("INSERT INTO data VALUES ('mydesktop.png')")
         | 
| 18 20 |  | 
| @@ -25,7 +27,7 @@ module Desktop | |
| 25 27 | 
             
                  end
         | 
| 26 28 |  | 
| 27 29 | 
             
                  it 'does not blow up if data table does not exist' do
         | 
| 28 | 
            -
                    with_connection do |connection|
         | 
| 30 | 
            +
                    with_connection do |connection, _|
         | 
| 29 31 | 
             
                      assert_empty connection.execute(
         | 
| 30 32 | 
             
                        "SELECT name FROM sqlite_master WHERE type='table' AND name='data'"
         | 
| 31 33 | 
             
                      )
         | 
| @@ -34,5 +36,30 @@ module Desktop | |
| 34 36 | 
             
                    end
         | 
| 35 37 | 
             
                  end
         | 
| 36 38 | 
             
                end
         | 
| 39 | 
            +
             | 
| 40 | 
            +
                describe '#set_desktop_image' do
         | 
| 41 | 
            +
                  it 'fills the data table with entries for the new desktop image' do
         | 
| 42 | 
            +
                    with_connection do |connection, desktop_image_path|
         | 
| 43 | 
            +
                      connection.execute("CREATE TABLE data (value)")
         | 
| 44 | 
            +
             | 
| 45 | 
            +
                      assert_empty connection.execute("SELECT * FROM data")
         | 
| 46 | 
            +
             | 
| 47 | 
            +
                      OSX::Database.new(connection).set_desktop_image(desktop_image_path)
         | 
| 48 | 
            +
             | 
| 49 | 
            +
                      assert_equal [[desktop_image_path]] * 100,
         | 
| 50 | 
            +
                        connection.execute("SELECT * FROM data")
         | 
| 51 | 
            +
                    end
         | 
| 52 | 
            +
                  end
         | 
| 53 | 
            +
             | 
| 54 | 
            +
                  it 'does not blow up if data table does not exist' do
         | 
| 55 | 
            +
                    with_connection do |connection, desktop_image_path|
         | 
| 56 | 
            +
                      assert_empty connection.execute(
         | 
| 57 | 
            +
                        "SELECT name FROM sqlite_master WHERE type='table' AND name='data'"
         | 
| 58 | 
            +
                      )
         | 
| 59 | 
            +
             | 
| 60 | 
            +
                      OSX::Database.new(connection).set_desktop_image(desktop_image_path)
         | 
| 61 | 
            +
                    end
         | 
| 62 | 
            +
                  end
         | 
| 63 | 
            +
                end
         | 
| 37 64 | 
             
              end
         | 
| 38 65 | 
             
            end
         | 
| @@ -6,43 +6,23 @@ module Desktop | |
| 6 6 | 
             
              describe OSX do
         | 
| 7 7 | 
             
                def osx
         | 
| 8 8 | 
             
                  desktop = Tempfile.new(%w[desktop .jpg])
         | 
| 9 | 
            -
                  cached  = Tempfile.new(%w[cached .jpg])
         | 
| 10 9 | 
             
                  image   = Tempfile.new(%w[image .jpg])
         | 
| 11 10 |  | 
| 12 11 | 
             
                  osx = OSX.new(
         | 
| 13 12 | 
             
                    :desktop_image_path => desktop.path,
         | 
| 14 | 
            -
                    :cached_image_path  => cached.path,
         | 
| 15 13 | 
             
                    :skip_reload        => true,
         | 
| 16 14 | 
             
                    :skip_database      => true
         | 
| 17 15 | 
             
                  )
         | 
| 18 16 |  | 
| 19 | 
            -
                  yield osx, desktop,  | 
| 17 | 
            +
                  yield osx, desktop, image
         | 
| 20 18 | 
             
                ensure
         | 
| 21 19 | 
             
                  desktop.unlink
         | 
| 22 | 
            -
                  cached.unlink
         | 
| 23 20 | 
             
                  image.unlink
         | 
| 24 21 | 
             
                end
         | 
| 25 22 |  | 
| 26 23 | 
             
                describe '#desktop_image=' do
         | 
| 27 | 
            -
                  it 'removes the cached desktop image' do
         | 
| 28 | 
            -
                    osx do |osx, _, cached, image|
         | 
| 29 | 
            -
                      osx.desktop_image = LocalImage.new(image)
         | 
| 30 | 
            -
                      refute File.exists?(cached.path)
         | 
| 31 | 
            -
                    end
         | 
| 32 | 
            -
                  end
         | 
| 33 | 
            -
             | 
| 34 | 
            -
                  it 'raises DesktopImagePermissionsError when desktop is readonly' do
         | 
| 35 | 
            -
                    osx do |osx, desktop, _, image|
         | 
| 36 | 
            -
                      FileUtils.chmod 'a-w', desktop
         | 
| 37 | 
            -
             | 
| 38 | 
            -
                      assert_raises OSX::DesktopImagePermissionsError do
         | 
| 39 | 
            -
                        osx.desktop_image = LocalImage.new(image)
         | 
| 40 | 
            -
                      end
         | 
| 41 | 
            -
                    end
         | 
| 42 | 
            -
                  end
         | 
| 43 | 
            -
             | 
| 44 24 | 
             
                  it 'raises DesktopImageMissingError when new image is missing' do
         | 
| 45 | 
            -
                    osx do |osx, _, _ | 
| 25 | 
            +
                    osx do |osx, _, _|
         | 
| 46 26 | 
             
                      assert_raises OSX::DesktopImageMissingError do
         | 
| 47 27 | 
             
                        osx.desktop_image = LocalImage.new('/invalid/image/path.jpg')
         | 
| 48 28 | 
             
                      end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: desktop
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1. | 
| 4 | 
            +
              version: 1.3.0.pre
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Chris Hunt
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2015-10-15 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: faraday
         | 
| @@ -16,126 +16,126 @@ dependencies: | |
| 16 16 | 
             
                requirements:
         | 
| 17 17 | 
             
                - - "~>"
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            -
                    version:  | 
| 19 | 
            +
                    version: 0.9.1
         | 
| 20 20 | 
             
              type: :runtime
         | 
| 21 21 | 
             
              prerelease: false
         | 
| 22 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 23 | 
             
                requirements:
         | 
| 24 24 | 
             
                - - "~>"
         | 
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            -
                    version:  | 
| 26 | 
            +
                    version: 0.9.1
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 28 | 
             
              name: sqlite3
         | 
| 29 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 30 | 
             
                requirements:
         | 
| 31 31 | 
             
                - - "~>"
         | 
| 32 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            -
                    version:  | 
| 33 | 
            +
                    version: 1.3.10
         | 
| 34 34 | 
             
              type: :runtime
         | 
| 35 35 | 
             
              prerelease: false
         | 
| 36 36 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 37 | 
             
                requirements:
         | 
| 38 38 | 
             
                - - "~>"
         | 
| 39 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            -
                    version:  | 
| 40 | 
            +
                    version: 1.3.10
         | 
| 41 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 42 42 | 
             
              name: thor
         | 
| 43 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 44 | 
             
                requirements:
         | 
| 45 45 | 
             
                - - "~>"
         | 
| 46 46 | 
             
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            -
                    version:  | 
| 47 | 
            +
                    version: 0.19.1
         | 
| 48 48 | 
             
              type: :runtime
         | 
| 49 49 | 
             
              prerelease: false
         | 
| 50 50 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 51 | 
             
                requirements:
         | 
| 52 52 | 
             
                - - "~>"
         | 
| 53 53 | 
             
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            -
                    version:  | 
| 54 | 
            +
                    version: 0.19.1
         | 
| 55 55 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 56 56 | 
             
              name: bundler
         | 
| 57 57 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 58 58 | 
             
                requirements:
         | 
| 59 59 | 
             
                - - "~>"
         | 
| 60 60 | 
             
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            -
                    version: 1. | 
| 61 | 
            +
                    version: 1.10.6
         | 
| 62 62 | 
             
              type: :development
         | 
| 63 63 | 
             
              prerelease: false
         | 
| 64 64 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 65 65 | 
             
                requirements:
         | 
| 66 66 | 
             
                - - "~>"
         | 
| 67 67 | 
             
                  - !ruby/object:Gem::Version
         | 
| 68 | 
            -
                    version: 1. | 
| 68 | 
            +
                    version: 1.10.6
         | 
| 69 69 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 70 70 | 
             
              name: minitest
         | 
| 71 71 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 72 72 | 
             
                requirements:
         | 
| 73 73 | 
             
                - - "~>"
         | 
| 74 74 | 
             
                  - !ruby/object:Gem::Version
         | 
| 75 | 
            -
                    version:  | 
| 75 | 
            +
                    version: 5.8.1
         | 
| 76 76 | 
             
              type: :development
         | 
| 77 77 | 
             
              prerelease: false
         | 
| 78 78 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 79 79 | 
             
                requirements:
         | 
| 80 80 | 
             
                - - "~>"
         | 
| 81 81 | 
             
                  - !ruby/object:Gem::Version
         | 
| 82 | 
            -
                    version:  | 
| 82 | 
            +
                    version: 5.8.1
         | 
| 83 83 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 84 84 | 
             
              name: pry
         | 
| 85 85 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 86 86 | 
             
                requirements:
         | 
| 87 87 | 
             
                - - "~>"
         | 
| 88 88 | 
             
                  - !ruby/object:Gem::Version
         | 
| 89 | 
            -
                    version: 0.10. | 
| 89 | 
            +
                    version: 0.10.2
         | 
| 90 90 | 
             
              type: :development
         | 
| 91 91 | 
             
              prerelease: false
         | 
| 92 92 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 93 93 | 
             
                requirements:
         | 
| 94 94 | 
             
                - - "~>"
         | 
| 95 95 | 
             
                  - !ruby/object:Gem::Version
         | 
| 96 | 
            -
                    version: 0.10. | 
| 96 | 
            +
                    version: 0.10.2
         | 
| 97 97 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 98 98 | 
             
              name: rake
         | 
| 99 99 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 100 100 | 
             
                requirements:
         | 
| 101 101 | 
             
                - - "~>"
         | 
| 102 102 | 
             
                  - !ruby/object:Gem::Version
         | 
| 103 | 
            -
                    version:  | 
| 103 | 
            +
                    version: 10.4.2
         | 
| 104 104 | 
             
              type: :development
         | 
| 105 105 | 
             
              prerelease: false
         | 
| 106 106 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 107 107 | 
             
                requirements:
         | 
| 108 108 | 
             
                - - "~>"
         | 
| 109 109 | 
             
                  - !ruby/object:Gem::Version
         | 
| 110 | 
            -
                    version:  | 
| 110 | 
            +
                    version: 10.4.2
         | 
| 111 111 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 112 112 | 
             
              name: vcr
         | 
| 113 113 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 114 114 | 
             
                requirements:
         | 
| 115 115 | 
             
                - - "~>"
         | 
| 116 116 | 
             
                  - !ruby/object:Gem::Version
         | 
| 117 | 
            -
                    version:  | 
| 117 | 
            +
                    version: 2.9.3
         | 
| 118 118 | 
             
              type: :development
         | 
| 119 119 | 
             
              prerelease: false
         | 
| 120 120 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 121 121 | 
             
                requirements:
         | 
| 122 122 | 
             
                - - "~>"
         | 
| 123 123 | 
             
                  - !ruby/object:Gem::Version
         | 
| 124 | 
            -
                    version:  | 
| 124 | 
            +
                    version: 2.9.3
         | 
| 125 125 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 126 126 | 
             
              name: webmock
         | 
| 127 127 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 128 128 | 
             
                requirements:
         | 
| 129 129 | 
             
                - - "~>"
         | 
| 130 130 | 
             
                  - !ruby/object:Gem::Version
         | 
| 131 | 
            -
                    version:  | 
| 131 | 
            +
                    version: 1.21.0
         | 
| 132 132 | 
             
              type: :development
         | 
| 133 133 | 
             
              prerelease: false
         | 
| 134 134 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 135 135 | 
             
                requirements:
         | 
| 136 136 | 
             
                - - "~>"
         | 
| 137 137 | 
             
                  - !ruby/object:Gem::Version
         | 
| 138 | 
            -
                    version:  | 
| 138 | 
            +
                    version: 1.21.0
         | 
| 139 139 | 
             
            description: A decent way to change your desktop image
         | 
| 140 140 | 
             
            email:
         | 
| 141 141 | 
             
            - c@chrishunt.co
         | 
| @@ -190,12 +190,12 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 190 190 | 
             
                  version: '0'
         | 
| 191 191 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 192 192 | 
             
              requirements:
         | 
| 193 | 
            -
              - - " | 
| 193 | 
            +
              - - ">"
         | 
| 194 194 | 
             
                - !ruby/object:Gem::Version
         | 
| 195 | 
            -
                  version:  | 
| 195 | 
            +
                  version: 1.3.1
         | 
| 196 196 | 
             
            requirements: []
         | 
| 197 197 | 
             
            rubyforge_project: 
         | 
| 198 | 
            -
            rubygems_version: 2.2. | 
| 198 | 
            +
            rubygems_version: 2.2.3
         | 
| 199 199 | 
             
            signing_key: 
         | 
| 200 200 | 
             
            specification_version: 4
         | 
| 201 201 | 
             
            summary: A decent way to change your desktop image
         |