desktop 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3de2a50f1f1510ad2cb1fd5fe695ba1698221cae
4
- data.tar.gz: f4515e4418728f240c2a73c01bc638b03d5fa7f5
3
+ metadata.gz: c4f400e39b6089ea0778e12d40d0812da8d63878
4
+ data.tar.gz: 09bee821d3197e6859a31ffb44927de974175485
5
5
  SHA512:
6
- metadata.gz: b7cb135b3c2c2769f52a056c9d24863303cf6c8c578c10c9944dfb3ee839c753256b38d3bf137eda9cd404b11f5bfda593df2d89fcf146b004cdba8d020ee9d7
7
- data.tar.gz: a3e7f4f5b6cc5375d3b8030b355d64c6c546810b3f0b4acf39a724f453de2922a24c8edd701d3c822c6e2e42719fc805375c8dd6e588acbfb5a375062fd59181
6
+ metadata.gz: 1a4ce36b5eaa21c360eec8744b37b91b07d22de9e95068a001be9c84035a9825916f35138ebea9d73e373bb535f0fdc5493c2286d1f2cde33bd390e091688b69
7
+ data.tar.gz: f0c0816b2497eaccca98f6506772d8efea7fd22b71ecc03241c99d0c6e1a1a74c5eaaa273410806789b00e1b6f8bbda52b2455ed30813a85a352036f652f2c5a
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ before_install:
3
+ - gem update bundler
4
+ rvm:
5
+ - 2.1.1
6
+ - 2.0.0
7
+ - 1.9.3
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ##v1.1.2
4
+ *2014-10-17*
5
+
6
+ - [Yosemite compatibility](https://github.com/chrishunt/desktop/pull/18)
7
+ - [Update gem dependencies](https://github.com/chrishunt/desktop/pull/16)
8
+
3
9
  ##v1.1.1
4
10
  *2014-06-06*
5
11
 
data/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Desktop
2
2
 
3
+ [![](http://img.shields.io/travis/chrishunt/desktop.svg?style=flat)](https://travis-ci.org/chrishunt/desktop)
4
+ [![](http://img.shields.io/codeclimate/github/chrishunt/desktop.svg?style=flat)](https://codeclimate.com/github/chrishunt/desktop)
5
+ [![](http://img.shields.io/gem/v/desktop.svg?style=flat)](http://rubygems.org/gems/desktop)
6
+
3
7
  ### A decent way to change your desktop image.
4
8
 
5
9
  Since the introduction of
@@ -22,10 +22,10 @@ Gem::Specification.new do |spec|
22
22
  spec.add_dependency "sqlite3", "~> 1.3"
23
23
  spec.add_dependency "thor", "~> 0.19"
24
24
 
25
- spec.add_development_dependency "bundler", "~> 1.6"
26
- spec.add_development_dependency "minitest", "~> 5.3"
27
- spec.add_development_dependency "pry", "~> 0.9.12"
25
+ spec.add_development_dependency "bundler", "~> 1.7.1"
26
+ spec.add_development_dependency "minitest", "~> 5.4"
27
+ spec.add_development_dependency "pry", "~> 0.10.1"
28
28
  spec.add_development_dependency "rake", "~> 10.3"
29
29
  spec.add_development_dependency "vcr", "~> 2.9"
30
- spec.add_development_dependency "webmock", "~> 1.8"
30
+ spec.add_development_dependency "webmock", "~> 1.18"
31
31
  end
@@ -14,10 +14,11 @@ module Desktop
14
14
 
15
15
  > $ desktop set http://url.to/image.jpg
16
16
  LONGDESC
17
- option :default_image_path, :hide => true
17
+ option :desktop_image_path, :hide => true
18
18
  option :skip_reload, :type => :boolean, :hide => true
19
+ option :skip_database, :type => :boolean, :hide => true
19
20
  def set(path, already_failed = false)
20
- osx = OSX.new(options[:default_image_path], options[:skip_reload])
21
+ osx = OSX.new(options)
21
22
  image = HTTP.uri?(path) ? WebImage.new(path) : LocalImage.new(path)
22
23
 
23
24
  begin
@@ -2,7 +2,7 @@ require 'desktop/osx/database'
2
2
 
3
3
  module Desktop
4
4
  class OSX
5
- attr_reader :desktop_image_path, :skip_reload
5
+ attr_reader :desktop_image_path, :skip_reload, :skip_database
6
6
  class DesktopImagePermissionsError < StandardError; end
7
7
  class DesktopImageMissingError < StandardError; end
8
8
 
@@ -22,14 +22,18 @@ module Desktop
22
22
  self.new.chmod_command
23
23
  end
24
24
 
25
- def initialize(desktop_image_path = nil, skip_reload = false)
26
- @skip_reload = skip_reload
27
- @desktop_image_path = desktop_image_path || default_desktop_image_path
25
+ def initialize(options = nil)
26
+ options ||= {}
27
+ @skip_reload = options[:skip_reload]
28
+ @skip_database = options[:skip_database]
29
+ @desktop_image_path = \
30
+ options[:desktop_image_path] || default_desktop_image_path
28
31
  end
29
32
 
30
33
  def desktop_image=(image)
31
34
  write_default_desktop image
32
- clear_custom_desktop_image
35
+ clear_custom_desktop_image unless skip_database
36
+ touch_desktop_image
33
37
  reload_desktop unless skip_reload
34
38
  rescue Errno::EACCES => e
35
39
  raise DesktopImagePermissionsError.new(e)
@@ -42,11 +46,15 @@ module Desktop
42
46
  end
43
47
 
44
48
  def chown_command
45
- "sudo chown root:staff #{desktop_image_path}"
49
+ [' -h ', ' '].map do |option|
50
+ "sudo chown#{option}$('whoami'):staff #{desktop_image_path}"
51
+ end.join(" && ")
46
52
  end
47
53
 
48
54
  def chmod_command
49
- "sudo chmod 664 #{desktop_image_path}"
55
+ [' -h ', ' '].map do |option|
56
+ "sudo chmod#{option}664 #{desktop_image_path}"
57
+ end.join(" && ")
50
58
  end
51
59
 
52
60
  private
@@ -63,6 +71,12 @@ module Desktop
63
71
  db.close
64
72
  end
65
73
 
74
+ def touch_desktop_image
75
+ unless system("touch -h #{desktop_image_path} 2>/dev/null")
76
+ raise Errno::EACCES
77
+ end
78
+ end
79
+
66
80
  def reload_desktop
67
81
  system 'killall Dock'
68
82
  end
@@ -1,3 +1,3 @@
1
1
  module Desktop
2
- VERSION = '1.1.1'
2
+ VERSION = '1.1.2'
3
3
  end
@@ -13,8 +13,9 @@ module Desktop
13
13
  image.rewind
14
14
 
15
15
  defaults = [
16
- "--default-image-path=#{desktop.path}",
17
- "--skip-reload"
16
+ "--desktop-image-path=#{desktop.path}",
17
+ "--skip-reload",
18
+ "--skip-database"
18
19
  ]
19
20
 
20
21
  yield desktop, image, defaults
@@ -7,7 +7,12 @@ module Desktop
7
7
  def osx
8
8
  desktop = Tempfile.new(%w[desktop .jpg])
9
9
  image = Tempfile.new(%w[image .jpg])
10
- osx = OSX.new(desktop.path, true)
10
+
11
+ osx = OSX.new(
12
+ :desktop_image_path => desktop.path,
13
+ :skip_reload => true,
14
+ :skip_database => true
15
+ )
11
16
 
12
17
  yield osx, desktop, image
13
18
  ensure
metadata CHANGED
@@ -1,141 +1,141 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: desktop
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Hunt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-06 00:00:00.000000000 Z
11
+ date: 2014-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.9'
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
26
  version: '0.9'
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
33
  version: '1.3'
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
40
  version: '1.3'
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
47
  version: '0.19'
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
54
  version: '0.19'
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.6'
61
+ version: 1.7.1
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.6'
68
+ version: 1.7.1
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: '5.3'
75
+ version: '5.4'
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: '5.3'
82
+ version: '5.4'
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.9.12
89
+ version: 0.10.1
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.9.12
96
+ version: 0.10.1
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
103
  version: '10.3'
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
110
  version: '10.3'
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
117
  version: '2.9'
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
124
  version: '2.9'
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: '1.8'
131
+ version: '1.18'
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: '1.8'
138
+ version: '1.18'
139
139
  description: A decent way to change your desktop image
140
140
  email:
141
141
  - c@chrishunt.co
@@ -144,7 +144,8 @@ executables:
144
144
  extensions: []
145
145
  extra_rdoc_files: []
146
146
  files:
147
- - .gitignore
147
+ - ".gitignore"
148
+ - ".travis.yml"
148
149
  - CHANGELOG.md
149
150
  - CONTRIBUTING.md
150
151
  - Gemfile
@@ -184,17 +185,17 @@ require_paths:
184
185
  - lib
185
186
  required_ruby_version: !ruby/object:Gem::Requirement
186
187
  requirements:
187
- - - '>='
188
+ - - ">="
188
189
  - !ruby/object:Gem::Version
189
190
  version: '0'
190
191
  required_rubygems_version: !ruby/object:Gem::Requirement
191
192
  requirements:
192
- - - '>='
193
+ - - ">="
193
194
  - !ruby/object:Gem::Version
194
195
  version: '0'
195
196
  requirements: []
196
197
  rubyforge_project:
197
- rubygems_version: 2.0.3
198
+ rubygems_version: 2.2.2
198
199
  signing_key:
199
200
  specification_version: 4
200
201
  summary: A decent way to change your desktop image