surely 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OThkMzg1NjA2NzUyNWM2MTNhYzMxZTEzYmNiNjc2NGVjMmQ1ZTVkZg==
4
+ ZGNiNjlkY2UzZmE3NDNlNGI0YzNjMDU2YTY4ZDVhMTY1MDc1ZWE1Yw==
5
5
  data.tar.gz: !binary |-
6
- YjMwYjg0MjA5ZTQ3ZmY0OGY5ZWE0NTQ5ZDZiMDFhMmFjN2M4MjUxNg==
6
+ NzdkM2MzNmZlZDAwMjhjZWY5MWRhNDc1Yzc5NjA4MWRiNWU4ZDRlMg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZGIwMDZiZjBmMDU3Nzk2OTE1ODY2ZDZmMDIyNjBmNDEyNjI3NWMzZjVmYjVj
10
- YjA3Zjg5NDYyNWY0MmJiN2UxMzBhMmI4N2Y0ZDg2MWQxODc1NjI3MDc0YTli
11
- NzhiYzQwODcyMzU1NGZhYTI0NmRjY2FiNTAwYWU0MDY4NTBiZTU=
9
+ NTI1ODI3NGRiZTAzZjNkZWI4OGRjODk1YjZhZDZjNWY3NDFlNzI4N2MzOTg0
10
+ MTk1NmY0OTk3MzQwYjZmNGE1NWM2NzAyOTQwNzY0N2M0NGEzYjhiN2RlMzdi
11
+ NGVkMDgwOWYwNTdlNGE2Zjk3YjFkY2Y1OWI3OGE0YzU5MzE3NjE=
12
12
  data.tar.gz: !binary |-
13
- NGFmZGRmMTRjZDYzNzJhNWE1OWY5NTU5YjY4NzdkYjJhYTcxMjA1ZDIyNTM0
14
- ZjdmMTUxMjA3ZTM4ZGIyMDM0YjU0Y2E1ZmM3YjFmMjFjNzIzZWIzOTQ2NDY4
15
- ZDU3ODgyZjY5MGQxNjQ2MzAyZDVjZTBkMTU0YjM4MTVmNzk3NDY=
13
+ ZWE2ZTk0NjJiN2ZmOWQ4NTg2OTg0OTJkNzlkMDUyYWJjZjc1YmY2ZTQ4YTJh
14
+ MGMyMDc5ZjNiMGY5YTkzNTIwM2MxY2NmNmExYzA3ZjdhNTg1MTY0ZmYzMTA2
15
+ NTY0OTVjYzc2MTVjYzQxNGQxMTQwOWEwNGEyYjJmYjMyYjQ5OTE=
data/lib/surely/daemon.rb CHANGED
@@ -9,7 +9,7 @@ module Surely
9
9
  puts "Listening to changes on #{directory}..."
10
10
 
11
11
  listener = Listen.to(directory)
12
- listener.filter(/\.png$/)
12
+ listener.filter(/\.(png|jpg|jpeg|gif)$/)
13
13
  listener.change(&@uploader.callback)
14
14
  listener.start!
15
15
  ensure
@@ -15,7 +15,7 @@ module Surely
15
15
  end
16
16
 
17
17
  def upload_file(file)
18
- file = Faraday::UploadIO.new(file, 'image/png')
18
+ file = Faraday::UploadIO.new(file, "image/#{file.split(/\./).last}")
19
19
 
20
20
  response = @imgur.post '/3/image' do |r|
21
21
  r.headers['Authorization'] = "Bearer #{@access_token}"
@@ -67,11 +67,11 @@ module Surely
67
67
  def callback
68
68
  @callback ||= lambda do |modified, added, removed|
69
69
  if added.any?
70
- puts 'Uploading...'
70
+ print 'Uploading... '
71
71
  refresh_token!
72
72
 
73
73
  if uploaded_file = upload_file(File.join(@directory, added.first))
74
- puts "Done uploading #{uploaded_file['link']}"
74
+ puts "done! #{uploaded_file['link']}"
75
75
  system "say -v 'Fred' 'Uploaded'"
76
76
  system "echo #{uploaded_file['link']} | pbcopy"
77
77
  end
@@ -1,3 +1,3 @@
1
1
  module Surely
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  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.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rémi Prévost