flickrage 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 63154293a5393fb80da37c10f2bfac47cd7dea14
4
- data.tar.gz: b82e875fcc2d07a4c91503c47c928ca89a666528
3
+ metadata.gz: e9ee1a397bd1661afccb8def2e52abca69b50eec
4
+ data.tar.gz: 763e29b08d260383ca77c1b6ed45c9884bc44dfb
5
5
  SHA512:
6
- metadata.gz: 3316be1ff039166fabf82dc672f7648a1bb80db5472f72e8118cbc458e26a2f5b7eb65d892872fe07532147357c739057bbec8c043baee75b86bb97c74098af3
7
- data.tar.gz: b064a54c72a8bcbc0e220a1a14e8c3936f4a3b01076b791f7d9ce1849ff505c5c2bbba71d643ebac052162064a64b3a674da795f5530dca9464afba262a4e697
6
+ metadata.gz: 59850dd2bd9e17027df0c114328830fe78f97f965077c71af40747864844f3b8ff308244f114a707af5cfc7c6506f68b112b7487046e344f4597cd6a90fb945d
7
+ data.tar.gz: c4208d19727f769550235a01c9f8f637a08785b39be5dad142d56011b8c99eeabb688a85e38da4eb746233e59d9aebf6ec78b0adf99b77f9550dcc1acfe05b20
data/lib/flickrage/cli.rb CHANGED
@@ -147,7 +147,7 @@ module Flickrage
147
147
  type: :string,
148
148
  required: true,
149
149
  aliases: %w(-o),
150
- banner: './some.png'
150
+ banner: './some'
151
151
  def clean
152
152
  cleanup
153
153
  end
@@ -174,7 +174,7 @@ module Flickrage
174
174
  end
175
175
 
176
176
  def cleanup
177
- return logger.debug('Output directory not exists, cleanup skipped') unless cleanup?
177
+ return logger.info('Output directory not exists, cleanup skipped') unless cleanup?
178
178
  FileUtils.rm_rf("#{options['output']}/.", secure: true)
179
179
  end
180
180
 
@@ -223,8 +223,7 @@ module Flickrage
223
223
  logger.debug 'Checking Flickr Key\'s.'
224
224
 
225
225
  return if Flickrage.api_keys?
226
- logger.error Flickrage::NoKeysError.new('You must provide Flickr API credentials via --flickr-api-key, --flickr-shared-secret via options. or have it in the environment')
227
- exit
226
+ raise Flickrage::NoKeysError, 'You must provide Flickr API credentials via --flickr-api-key, --flickr-shared-secret via options. or have it in the environment'
228
227
  end
229
228
  end
230
229
  end
@@ -19,7 +19,7 @@ module Flickrage
19
19
 
20
20
  private
21
21
 
22
- def download_file(uri, path, limit = 10)
22
+ def download_file(uri, path, limit = Flickrage.config.download_timeout)
23
23
  raise Flickrage::DownloadError, 'Redirect limit arrived' if limit.zero?
24
24
 
25
25
  Net::HTTP.start(uri.host, uri.port,
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Flickrage
3
- VERSION = '0.1.4'
3
+ VERSION = '0.1.5'
4
4
  end
@@ -28,8 +28,7 @@ module Flickrage
28
28
  private
29
29
 
30
30
  def service
31
- return @service unless @service.nil?
32
- @service = Service::Composer.new(opts['file_name'],
31
+ @service ||= Service::Composer.new(opts['file_name'],
33
32
  Flickrage.config.width,
34
33
  Flickrage.config.height)
35
34
  end
@@ -55,8 +55,7 @@ module Flickrage
55
55
  private
56
56
 
57
57
  def service
58
- return @service unless @service.nil?
59
- @service = Service::Resizer.new(Flickrage.config.width, Flickrage.config.height)
58
+ @service ||= Service::Resizer.new(Flickrage.config.width, Flickrage.config.height)
60
59
  end
61
60
 
62
61
  def init_crop_value(name)
@@ -4,8 +4,6 @@ module Flickrage
4
4
  class Search < Base
5
5
  include Flickrage::Helpers::Dict
6
6
 
7
- SYSTEM_TIMEOUT = 20
8
-
9
7
  def call
10
8
  keywords = opts['keywords'] || %w()
11
9
 
@@ -53,7 +51,7 @@ module Flickrage
53
51
  end
54
52
 
55
53
  def timeout?
56
- (Time.now.to_i - time) > SYSTEM_TIMEOUT
54
+ (Time.now.to_i - time) > Flickrage.config.search_timeout
57
55
  end
58
56
 
59
57
  def service
data/lib/flickrage.rb CHANGED
@@ -31,6 +31,9 @@ module Flickrage
31
31
  setting :pool_size, 5
32
32
  setting :pool
33
33
 
34
+ setting :search_timeout, 30
35
+ setting :download_timeout, 10
36
+
34
37
  setting :grid, 2
35
38
  setting :max, 10
36
39
  setting :output
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flickrage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Merkulov