pinpress 1.4.2 → 1.5.0
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/HISTORY.md +6 -0
- data/bin/pinpress +30 -28
- data/lib/pinpress.rb +12 -5
- data/lib/pinpress/constants.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb9834c1b4b146171b5dd3775335edc642590a30
|
4
|
+
data.tar.gz: 43363332876a9e29eec3a8fee3ca921a0bad00c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dad5319aac8cef3d99bb986beb9eb3dac341acb97ab019ae5a812cd36a935135a6a6a10eb1b648bf0148213059416fd783ed3055de1788b2c23d961de3ad3a9c
|
7
|
+
data.tar.gz: 37711b8fc8f9db2968133dff075424eb0ddf6c1a1398692e9d5a041c739e41425ebda9f070645e9d29d309296815910f0e90989f41acf369d29631e2436ae64f
|
data/HISTORY.md
CHANGED
data/bin/pinpress
CHANGED
@@ -148,7 +148,7 @@ command :pins do |c|
|
|
148
148
|
opts = {}
|
149
149
|
opts.merge!(todt: Chronic.parse(options[:e])) if options[:e]
|
150
150
|
opts.merge!(fromdt: Chronic.parse(options[:s])) if options[:s]
|
151
|
-
opts.merge!(PinPress.merge_common_options(options))
|
151
|
+
opts.merge!(PinPress.merge_common_options(options, template_name, PinPress::Template::TYPE_PIN))
|
152
152
|
|
153
153
|
# Request pin data from Pinboard and output the return data.
|
154
154
|
output = PinPress.pin_yield(template, opts)
|
@@ -168,24 +168,25 @@ command :pins do |c|
|
|
168
168
|
# and/or the presence of a default template.
|
169
169
|
template_name, template = PinPress.init_template(options[:m], PinPress::Template::TYPE_PIN)
|
170
170
|
|
171
|
+
opts = {}
|
172
|
+
|
171
173
|
last_run_date = configuration.pin_templates.find { |t| t.keys[0] == template_name.to_sym }.values[0].last_run
|
172
174
|
if last_run_date
|
173
175
|
# Set one option: the start date. Set it to the last-run date + 1.
|
174
|
-
opts = {}
|
175
176
|
opts.merge!(fromdt: DateTime.parse(last_run_date) + 1)
|
176
|
-
|
177
|
+
end
|
177
178
|
|
178
|
-
|
179
|
-
|
180
|
-
puts output if output
|
179
|
+
# Set our common options.
|
180
|
+
opts.merge!(PinPress.merge_common_options(options, template_name, PinPress::Template::TYPE_PIN))
|
181
181
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
182
|
+
# Request pin data from Pinboard and output the return data.
|
183
|
+
output = PinPress.pin_yield(template, opts)
|
184
|
+
puts output if output
|
185
|
+
|
186
|
+
# Save the last-run date to the configuration file.
|
187
|
+
configuration.pin_templates.find { |t| t.keys[0] == template_name.to_sym}.values[0].last_run = Time.now.utc.iso8601
|
188
|
+
configuration.save
|
189
|
+
end
|
189
190
|
end
|
190
191
|
end
|
191
192
|
|
@@ -214,7 +215,7 @@ command :tags do |c|
|
|
214
215
|
opts = {}
|
215
216
|
opts.merge!(todt: Chronic.parse(options[:e])) if options[:e]
|
216
217
|
opts.merge!(fromdt: Chronic.parse(options[:s])) if options[:s]
|
217
|
-
opts.merge!(PinPress.merge_common_options(options))
|
218
|
+
opts.merge!(PinPress.merge_common_options(options, template_name, PinPress::Template::TYPE_PIN))
|
218
219
|
|
219
220
|
# Request tag data from Pinboard and output the return data.
|
220
221
|
output = PinPress.tag_yield(template, opts)
|
@@ -233,27 +234,28 @@ command :tags do |c|
|
|
233
234
|
# and/or the presence of a default template.
|
234
235
|
template_name, template = PinPress.init_template(options[:m], PinPress::Template::TYPE_TAG)
|
235
236
|
|
237
|
+
opts = {}
|
238
|
+
|
236
239
|
last_run_date = configuration.tag_templates.find { |t| t.keys[0] == template_name.to_sym }.values[0].last_run
|
237
240
|
if last_run_date
|
238
241
|
PinPress.verbose = global_options[:v]
|
239
242
|
|
240
243
|
# Set one option: the start date. Set it to the last-run date + 1.
|
241
|
-
opts = {}
|
242
244
|
opts.merge!(fromdt: DateTime.parse(last_run_date) + 1)
|
243
|
-
opts.merge!(PinPress.merge_common_options(options))
|
244
|
-
|
245
|
-
# Request tag data from Pinboard and output the return data.
|
246
|
-
output = PinPress.tag_yield(template, opts)
|
247
|
-
puts output if output
|
248
|
-
|
249
|
-
# Save the last-run date to the configuration file.
|
250
|
-
t_config = configuration.tag_templates.find { |t| t.keys[0] == template_name.to_sym}.values[0]
|
251
|
-
t_config.last_run = Time.now.utc.iso8601
|
252
|
-
configuration.save
|
253
|
-
else
|
254
|
-
messenger.warn("`pinpress tags` hasn't been run before.")
|
255
245
|
end
|
256
|
-
|
246
|
+
|
247
|
+
# Set our common options.
|
248
|
+
opts.merge!(PinPress.merge_common_options(options, template_name, PinPress::Template::TYPE_PIN))
|
249
|
+
|
250
|
+
# Request tag data from Pinboard and output the return data.
|
251
|
+
output = PinPress.tag_yield(template, opts)
|
252
|
+
puts output if output
|
253
|
+
|
254
|
+
# Save the last-run date to the configuration file.
|
255
|
+
t_config = configuration.tag_templates.find { |t| t.keys[0] == template_name.to_sym}.values[0]
|
256
|
+
t_config.last_run = Time.now.utc.iso8601
|
257
|
+
configuration.save
|
258
|
+
end
|
257
259
|
end
|
258
260
|
end
|
259
261
|
|
data/lib/pinpress.rb
CHANGED
@@ -159,18 +159,25 @@ module PinPress
|
|
159
159
|
# and tag requests.
|
160
160
|
# @param [Hash] options
|
161
161
|
# @return [Hash]
|
162
|
-
def merge_common_options(options)
|
162
|
+
def merge_common_options(options, template_name, template_type)
|
163
|
+
case template_type
|
164
|
+
when PinPress::Template::TYPE_PIN
|
165
|
+
section = configuration.pin_templates.find { |t| t.keys[0] == template_name.to_sym}.values[0]
|
166
|
+
when PinPress::Template::TYPE_TAG
|
167
|
+
section = configuration.tag_templates.find { |t| t.keys[0] == template_name.to_sym}.values[0]
|
168
|
+
end
|
169
|
+
|
163
170
|
opts = {}
|
164
171
|
if options[:n]
|
165
172
|
opts.merge!(results: options[:n])
|
166
|
-
elsif
|
167
|
-
opts.merge!(results:
|
173
|
+
elsif section.default_num_results
|
174
|
+
opts.merge!(results: section.default_num_results)
|
168
175
|
end
|
169
176
|
|
170
177
|
if options[:t]
|
171
178
|
opts.merge!(tag: options[:t])
|
172
|
-
elsif
|
173
|
-
opts.merge!(tag:
|
179
|
+
elsif section.default_tags
|
180
|
+
opts.merge!(tag: section.default_tags.join(','))
|
174
181
|
end
|
175
182
|
opts
|
176
183
|
end
|
data/lib/pinpress/constants.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pinpress
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Bach
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aruba
|