flickrage 0.1.1 → 0.1.2
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 +4 -4
- data/lib/flickrage/cli.rb +9 -6
- data/lib/flickrage/pipeline.rb +1 -1
- data/lib/flickrage/version.rb +1 -1
- data/lib/flickrage/worker/base.rb +6 -1
- data/lib/flickrage/worker/download.rb +11 -7
- data/lib/flickrage.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79e1e5010a8973cdb15ce3cb3aa4aed0c57b2f55
|
4
|
+
data.tar.gz: d91a251a0c0ba6ec7953e28366a5fa38c49fcfe3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69b1337687d72f9e5e3ba06d0fa56741986ab0d12e8a4758786b59f7037712aa1a028f75020f5e65023afe0629ce0ec6e2643d056fdb18c30c5d9071cd3962f5
|
7
|
+
data.tar.gz: 85b9cd46ccf7b32c33468fb4486c888c46bd414d5bd766871396fd7d01eb54da859c3a7fc435eb3412b0aeac6c8d43980acc4f482649e767d77bc1675497cb93
|
data/lib/flickrage/cli.rb
CHANGED
@@ -135,8 +135,8 @@ module Flickrage
|
|
135
135
|
init_flickraw
|
136
136
|
|
137
137
|
pipeline.run
|
138
|
-
rescue Flickrage::NoKeysError, Flickrage::SearchError, Flickrage::DownloadError,
|
139
|
-
Flickrage::NumberError, Flickrage::PathError => e
|
138
|
+
rescue Flickrage::NoKeysError, Flickrage::SearchError, Flickrage::DownloadError, Flickrage::CollageError,
|
139
|
+
Flickrage::ResizeError, Flickrage::NumberError, Flickrage::PathError => e
|
140
140
|
error_simple(e)
|
141
141
|
rescue => e
|
142
142
|
error_with_backtrace(e)
|
@@ -160,12 +160,12 @@ module Flickrage
|
|
160
160
|
no_commands do
|
161
161
|
def error_simple(e)
|
162
162
|
logger.error e.message
|
163
|
-
raise e
|
163
|
+
raise e if Flickrage.config.verbose
|
164
164
|
end
|
165
165
|
|
166
166
|
def error_with_backtrace(e)
|
167
167
|
logger.error e.message
|
168
|
-
backtrace(e) if
|
168
|
+
backtrace(e) if Flickrage.config.verbose
|
169
169
|
raise e
|
170
170
|
end
|
171
171
|
|
@@ -174,11 +174,14 @@ module Flickrage
|
|
174
174
|
end
|
175
175
|
|
176
176
|
def cleanup
|
177
|
-
return unless
|
178
|
-
return unless Dir.exist?(options['output'])
|
177
|
+
return logger.debug('Output directory not exists, cleanup skipped') unless cleanup?
|
179
178
|
FileUtils.rm_rf("#{options['output']}/.", secure: true)
|
180
179
|
end
|
181
180
|
|
181
|
+
def cleanup?
|
182
|
+
options['output'] && Dir.exist?(options['output'])
|
183
|
+
end
|
184
|
+
|
182
185
|
def setup_config
|
183
186
|
Flickrage.configure do |config|
|
184
187
|
config.logger = ::Logger.new(options['log']) if options['log']
|
data/lib/flickrage/pipeline.rb
CHANGED
@@ -32,7 +32,7 @@ module Flickrage
|
|
32
32
|
|
33
33
|
speaker.add_padding
|
34
34
|
|
35
|
-
raise CollageError, 'Try again later...' unless valid_list?(list)
|
35
|
+
raise Flickrage::CollageError, 'Try again later...' unless valid_list?(list)
|
36
36
|
|
37
37
|
logger.warn("Congrats! You can find composed collage at #{list.collage_path}")
|
38
38
|
|
data/lib/flickrage/version.rb
CHANGED
@@ -37,7 +37,12 @@ module Flickrage
|
|
37
37
|
def increment_error_counter(error, value)
|
38
38
|
@opts[:ask_error_counter] += 1
|
39
39
|
|
40
|
-
|
40
|
+
return unless opts[:ask_error_counter] >= MAX_ASK_ERRORS
|
41
|
+
return yield if block_given?
|
42
|
+
raise error, value
|
43
|
+
rescue SystemCallError => e
|
44
|
+
logger.error(e.message)
|
45
|
+
raise error, value
|
41
46
|
end
|
42
47
|
|
43
48
|
def reset_error_counter
|
@@ -58,17 +58,21 @@ module Flickrage
|
|
58
58
|
def init_output
|
59
59
|
return if validate_output
|
60
60
|
|
61
|
-
output = speaker.ask('Please enter
|
61
|
+
output = speaker.ask('Please enter existing path of the output directory:',
|
62
62
|
path: true)
|
63
63
|
|
64
|
-
|
65
|
-
|
66
|
-
return init_output
|
67
|
-
end
|
64
|
+
if valid_output?(output)
|
65
|
+
reset_error_counter
|
68
66
|
|
69
|
-
|
67
|
+
Flickrage.config.output = output
|
68
|
+
end
|
70
69
|
|
71
|
-
Flickrage
|
70
|
+
increment_error_counter(Flickrage::PathError, output) do
|
71
|
+
raise Flickrage::PathError, output unless speaker.yes?("Do you want create path, #{output}?")
|
72
|
+
FileUtils.mkdir_p(output)
|
73
|
+
Flickrage.config.output = output
|
74
|
+
end
|
75
|
+
init_output
|
72
76
|
end
|
73
77
|
|
74
78
|
def validate_output
|
data/lib/flickrage.rb
CHANGED
@@ -31,7 +31,7 @@ module Flickrage
|
|
31
31
|
setting :pool_size, 5
|
32
32
|
setting :pool
|
33
33
|
|
34
|
-
setting :grid,
|
34
|
+
setting :grid, 2
|
35
35
|
setting :max, 10
|
36
36
|
setting :output
|
37
37
|
|
@@ -172,7 +172,7 @@ module Flickrage
|
|
172
172
|
end
|
173
173
|
end
|
174
174
|
|
175
|
-
#
|
175
|
+
# Something wrong with the process?
|
176
176
|
#
|
177
177
|
class CollageError < BaseError
|
178
178
|
def initialize(*args)
|