desktop 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +13 -0
- data/img/simple-desktops.jpg +0 -0
- data/img/vladstudio.jpg +0 -0
- data/lib/desktop.rb +2 -1
- data/lib/desktop/osx/database.rb +42 -0
- data/lib/desktop/{osx.rb → osx/osx.rb} +3 -8
- data/lib/desktop/version.rb +1 -1
- data/test/desktop/osx/database_test.rb +38 -0
- data/test/desktop/{osx_test.rb → osx/osx_test.rb} +1 -1
- metadata +10 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3de2a50f1f1510ad2cb1fd5fe695ba1698221cae
|
4
|
+
data.tar.gz: f4515e4418728f240c2a73c01bc638b03d5fa7f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7cb135b3c2c2769f52a056c9d24863303cf6c8c578c10c9944dfb3ee839c753256b38d3bf137eda9cd404b11f5bfda593df2d89fcf146b004cdba8d020ee9d7
|
7
|
+
data.tar.gz: a3e7f4f5b6cc5375d3b8030b355d64c6c546810b3f0b4acf39a724f453de2922a24c8edd701d3c822c6e2e42719fc805375c8dd6e588acbfb5a375062fd59181
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -73,6 +73,19 @@ And use the same CLI interface that you already know:
|
|
73
73
|
Desktop::CLI.start %w[set path/to/image.jpg]
|
74
74
|
```
|
75
75
|
|
76
|
+
## Where can I get desktops?
|
77
|
+
|
78
|
+
[**Simple Desktops**](http://simpledesktops.com) - A collection of wallpapers
|
79
|
+
curated by [Tom Watson](http://tmwtsn.com) designed to make your computer
|
80
|
+
beautiful without distraction.
|
81
|
+
|
82
|
+
[![](img/simple-desktops.jpg)](http://simpledesktops.com)
|
83
|
+
|
84
|
+
[**Vladstudio**](http://www.vladstudio.com/wallpapers) - The project of Russian
|
85
|
+
digital artist [Vlad Gerasimov](http://www.vladstudio.com/blog). He creates
|
86
|
+
wallpapers for computers and mobile devices.
|
87
|
+
|
88
|
+
[![](img/vladstudio.jpg)](http://www.vladstudio.com/wallpapers)
|
76
89
|
|
77
90
|
## Contributing
|
78
91
|
Please see the [Contributing
|
Binary file
|
data/img/vladstudio.jpg
ADDED
Binary file
|
data/lib/desktop.rb
CHANGED
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'sqlite3'
|
2
|
+
|
3
|
+
module Desktop
|
4
|
+
class OSX
|
5
|
+
class Database
|
6
|
+
attr_reader :connection
|
7
|
+
|
8
|
+
def initialize(connection = nil)
|
9
|
+
@connection = connection || default_connection
|
10
|
+
end
|
11
|
+
|
12
|
+
def clear_desktop_image
|
13
|
+
clear_data if data?
|
14
|
+
end
|
15
|
+
|
16
|
+
def close
|
17
|
+
connection.close
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def data?
|
23
|
+
connection.execute(
|
24
|
+
"SELECT name FROM sqlite_master WHERE type='table' AND name='data'"
|
25
|
+
).any?
|
26
|
+
end
|
27
|
+
|
28
|
+
def clear_data
|
29
|
+
connection.execute 'DELETE FROM data'
|
30
|
+
connection.execute 'VACUUM data'
|
31
|
+
end
|
32
|
+
|
33
|
+
def default_connection
|
34
|
+
SQLite3::Database.new path
|
35
|
+
end
|
36
|
+
|
37
|
+
def path
|
38
|
+
File.expand_path '~/Library/Application Support/Dock/desktoppicture.db'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'desktop/osx/database'
|
2
2
|
|
3
3
|
module Desktop
|
4
4
|
class OSX
|
@@ -58,9 +58,8 @@ module Desktop
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def clear_custom_desktop_image
|
61
|
-
db =
|
62
|
-
db.
|
63
|
-
db.execute 'VACUUM data'
|
61
|
+
db = Database.new
|
62
|
+
db.clear_desktop_image
|
64
63
|
db.close
|
65
64
|
end
|
66
65
|
|
@@ -71,9 +70,5 @@ module Desktop
|
|
71
70
|
def default_desktop_image_path
|
72
71
|
'/System/Library/CoreServices/DefaultDesktop.jpg'
|
73
72
|
end
|
74
|
-
|
75
|
-
def desktop_image_db_path
|
76
|
-
File.expand_path '~/Library/Application Support/Dock/desktoppicture.db'
|
77
|
-
end
|
78
73
|
end
|
79
74
|
end
|
data/lib/desktop/version.rb
CHANGED
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'desktop/osx/database'
|
3
|
+
|
4
|
+
module Desktop
|
5
|
+
describe OSX::Database do
|
6
|
+
def with_connection
|
7
|
+
connection = SQLite3::Database.new ':memory:'
|
8
|
+
yield connection
|
9
|
+
ensure
|
10
|
+
connection.close
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '#clear_desktop_image' do
|
14
|
+
it 'clears contents of data table' do
|
15
|
+
with_connection do |connection|
|
16
|
+
connection.execute("CREATE TABLE data (FileName STRING)")
|
17
|
+
connection.execute("INSERT INTO data VALUES ('mydesktop.png')")
|
18
|
+
|
19
|
+
refute_empty connection.execute("SELECT * FROM data")
|
20
|
+
|
21
|
+
OSX::Database.new(connection).clear_desktop_image
|
22
|
+
|
23
|
+
assert_empty connection.execute("SELECT * FROM data")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'does not blow up if data table does not exist' do
|
28
|
+
with_connection do |connection|
|
29
|
+
assert_empty connection.execute(
|
30
|
+
"SELECT name FROM sqlite_master WHERE type='table' AND name='data'"
|
31
|
+
)
|
32
|
+
|
33
|
+
OSX::Database.new(connection).clear_desktop_image
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
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.1.
|
4
|
+
version: 1.1.1
|
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-
|
11
|
+
date: 2014-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -154,19 +154,23 @@ files:
|
|
154
154
|
- bin/desktop
|
155
155
|
- desktop.gemspec
|
156
156
|
- img/example.gif
|
157
|
+
- img/simple-desktops.jpg
|
158
|
+
- img/vladstudio.jpg
|
157
159
|
- lib/desktop.rb
|
158
160
|
- lib/desktop/cli.rb
|
159
161
|
- lib/desktop/http.rb
|
160
162
|
- lib/desktop/image.rb
|
161
163
|
- lib/desktop/local_image.rb
|
162
|
-
- lib/desktop/osx.rb
|
164
|
+
- lib/desktop/osx/database.rb
|
165
|
+
- lib/desktop/osx/osx.rb
|
163
166
|
- lib/desktop/version.rb
|
164
167
|
- lib/desktop/web_image.rb
|
165
168
|
- test/desktop/cli_test.rb
|
166
169
|
- test/desktop/http_test.rb
|
167
170
|
- test/desktop/image_test.rb
|
168
171
|
- test/desktop/local_image_test.rb
|
169
|
-
- test/desktop/
|
172
|
+
- test/desktop/osx/database_test.rb
|
173
|
+
- test/desktop/osx/osx_test.rb
|
170
174
|
- test/desktop/web_image_test.rb
|
171
175
|
- test/fixtures/web_image_data.yml
|
172
176
|
- test/test_helper.rb
|
@@ -199,7 +203,8 @@ test_files:
|
|
199
203
|
- test/desktop/http_test.rb
|
200
204
|
- test/desktop/image_test.rb
|
201
205
|
- test/desktop/local_image_test.rb
|
202
|
-
- test/desktop/
|
206
|
+
- test/desktop/osx/database_test.rb
|
207
|
+
- test/desktop/osx/osx_test.rb
|
203
208
|
- test/desktop/web_image_test.rb
|
204
209
|
- test/fixtures/web_image_data.yml
|
205
210
|
- test/test_helper.rb
|