surely 0.1.2 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.gitignore +2 -0
- data/README.md +3 -3
- data/bin/surely +5 -1
- data/lib/surely/daemon.rb +14 -12
- data/lib/surely/uploader.rb +2 -2
- data/lib/surely/version.rb +1 -1
- data/lib/surely.rb +1 -0
- data/surely.gemspec +6 -5
- metadata +35 -21
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjEwNmU3MmQ5NjBkNDFiMWYxZjg1NGNjZjYwZDE2MTUxZDY3OWVmMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NGZlZWZkM2JhMzlkMjU3N2NmNjNmZDYyNDRkODk0MjRjNmI4YWE3Yg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZTQyYTM0M2U2M2NiMWMyZGZiNjRiMzlmZjYyNTIwMmRlNzRmY2EzNmQ4YWZm
|
10
|
+
NjlhYjI2ZmZiYjQxMmZlNTUwMmE2YWMyY2I4MDMyYTIzZjlhZjBmNTQ0ODQz
|
11
|
+
MTIxZjFiNTdkMWZkMjBiYzViNTQxMWQzMGMyNDYyYTYwYjMwNjE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjRkNzAxZDQxOGM2NmZjZjk4YTc5NzBhOGRkYmFkYWYzMmE1ZTYzMjE1NmZj
|
14
|
+
ZmIxNGU1YjQ3MWIxMzA2ZGNlMjZjZDdhYzU3NTBiMGRjZjFhNDU2MWFkYzFl
|
15
|
+
OWEyNThjYTlkNGVmNTliZGJiNzg2YmYwODNiOWUyZGY0MmVlZWY=
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Surely
|
2
2
|
|
3
|
-
Surely watches your screenshots directory and upload new files to your [imgur](http://imgur.com/) account.
|
3
|
+
Surely is a daemon that watches your screenshots directory and upload new files to your [imgur](http://imgur.com/) account.
|
4
4
|
|
5
5
|
## Usage
|
6
6
|
|
@@ -13,6 +13,6 @@ $ gem install surely
|
|
13
13
|
export IMGUR_CLIENT_ID=…
|
14
14
|
export IMGUR_CLIENT_SECRET=…
|
15
15
|
|
16
|
-
# Start the
|
17
|
-
$ surely
|
16
|
+
# Start the daemon (OS X screenshots directory by default)
|
17
|
+
$ surely start -d
|
18
18
|
```
|
data/bin/surely
CHANGED
data/lib/surely/daemon.rb
CHANGED
@@ -1,20 +1,22 @@
|
|
1
1
|
module Surely
|
2
2
|
class Daemon
|
3
|
-
def initialize(
|
4
|
-
|
5
|
-
|
3
|
+
def initialize(env)
|
4
|
+
@env = env
|
5
|
+
end
|
6
|
+
|
7
|
+
def start
|
8
|
+
directory = @env['SURELY_DIRECTORY'] || `defaults read com.apple.screencapture location`.chomp
|
9
|
+
@uploader = Uploader.new(@env, directory)
|
6
10
|
@uploader.authorize!
|
7
11
|
|
8
|
-
|
9
|
-
|
12
|
+
Raad::Logger.info "Listening to changes on #{directory}..."
|
13
|
+
|
14
|
+
listener = Listen.to(directory)
|
15
|
+
listener.filter(/\.(png|jpg|jpeg|gif)$/)
|
16
|
+
listener.change(&@uploader.callback)
|
17
|
+
listener.start
|
10
18
|
|
11
|
-
|
12
|
-
listener.filter(/\.(png|jpg|jpeg|gif)$/)
|
13
|
-
listener.change(&@uploader.callback)
|
14
|
-
listener.start!
|
15
|
-
ensure
|
16
|
-
exit
|
17
|
-
end
|
19
|
+
sleep(1) while !Raad.stopped?
|
18
20
|
end
|
19
21
|
end
|
20
22
|
end
|
data/lib/surely/uploader.rb
CHANGED
@@ -67,11 +67,11 @@ module Surely
|
|
67
67
|
def callback
|
68
68
|
@callback ||= lambda do |modified, added, removed|
|
69
69
|
if added.any?
|
70
|
-
|
70
|
+
Raad::Logger.info 'Uploading... '
|
71
71
|
refresh_token!
|
72
72
|
|
73
73
|
if uploaded_file = upload_file(File.join(@directory, added.first))
|
74
|
-
|
74
|
+
Raad::Logger.info "Done! Uploaded #{uploaded_file['link']}"
|
75
75
|
system "say -v 'Fred' 'Uploaded'"
|
76
76
|
system "echo #{uploaded_file['link']} | pbcopy"
|
77
77
|
end
|
data/lib/surely/version.rb
CHANGED
data/lib/surely.rb
CHANGED
data/surely.gemspec
CHANGED
@@ -17,10 +17,11 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
18
|
s.require_paths = ["lib"]
|
19
19
|
|
20
|
-
s.add_runtime_dependency "faraday"
|
21
|
-
s.add_runtime_dependency "listen"
|
22
|
-
s.add_runtime_dependency "multi_json"
|
23
|
-
s.add_runtime_dependency "yajl-ruby"
|
20
|
+
s.add_runtime_dependency "faraday", '~> 0.8'
|
21
|
+
s.add_runtime_dependency "listen", '~> 1.0'
|
22
|
+
s.add_runtime_dependency "multi_json", '~> 1.7'
|
23
|
+
s.add_runtime_dependency "yajl-ruby", '~> 1.1'
|
24
|
+
s.add_runtime_dependency "raad", '~> 0.5'
|
24
25
|
|
25
|
-
s.add_development_dependency "rake"
|
26
|
+
s.add_development_dependency "rake", '~> 10.0'
|
26
27
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: surely
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rémi Prévost
|
@@ -14,72 +14,86 @@ dependencies:
|
|
14
14
|
name: faraday
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
19
|
+
version: '0.8'
|
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: '0'
|
26
|
+
version: '0.8'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: listen
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
33
|
+
version: '1.0'
|
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: '0'
|
40
|
+
version: '1.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: multi_json
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '1.7'
|
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: '1.7'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: yajl-ruby
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '1.1'
|
62
62
|
type: :runtime
|
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.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: raad
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.5'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.5'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rake
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- -
|
87
|
+
- - ~>
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
89
|
+
version: '10.0'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- -
|
94
|
+
- - ~>
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
96
|
+
version: '10.0'
|
83
97
|
description: Surely watches your screenshots directory and upload new files to your
|
84
98
|
imgur account.
|
85
99
|
email:
|