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 +4 -4
- data/.travis.yml +7 -0
- data/CHANGELOG.md +6 -0
- data/README.md +4 -0
- data/desktop.gemspec +4 -4
- data/lib/desktop/cli.rb +3 -2
- data/lib/desktop/osx/osx.rb +21 -7
- data/lib/desktop/version.rb +1 -1
- data/test/desktop/cli_test.rb +3 -2
- data/test/desktop/osx/osx_test.rb +6 -1
- metadata +33 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4f400e39b6089ea0778e12d40d0812da8d63878
|
4
|
+
data.tar.gz: 09bee821d3197e6859a31ffb44927de974175485
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a4ce36b5eaa21c360eec8744b37b91b07d22de9e95068a001be9c84035a9825916f35138ebea9d73e373bb535f0fdc5493c2286d1f2cde33bd390e091688b69
|
7
|
+
data.tar.gz: f0c0816b2497eaccca98f6506772d8efea7fd22b71ecc03241c99d0c6e1a1a74c5eaaa273410806789b00e1b6f8bbda52b2455ed30813a85a352036f652f2c5a
|
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
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
|
data/desktop.gemspec
CHANGED
@@ -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.
|
26
|
-
spec.add_development_dependency "minitest", "~> 5.
|
27
|
-
spec.add_development_dependency "pry", "~> 0.
|
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.
|
30
|
+
spec.add_development_dependency "webmock", "~> 1.18"
|
31
31
|
end
|
data/lib/desktop/cli.rb
CHANGED
@@ -14,10 +14,11 @@ module Desktop
|
|
14
14
|
|
15
15
|
> $ desktop set http://url.to/image.jpg
|
16
16
|
LONGDESC
|
17
|
-
option :
|
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
|
21
|
+
osx = OSX.new(options)
|
21
22
|
image = HTTP.uri?(path) ? WebImage.new(path) : LocalImage.new(path)
|
22
23
|
|
23
24
|
begin
|
data/lib/desktop/osx/osx.rb
CHANGED
@@ -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(
|
26
|
-
|
27
|
-
@
|
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
|
-
|
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
|
-
|
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
|
data/lib/desktop/version.rb
CHANGED
data/test/desktop/cli_test.rb
CHANGED
@@ -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
|
-
|
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.
|
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-
|
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:
|
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:
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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
|