pinpress 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile +0 -2
- data/README.md +321 -1
- data/features/2.initialization.feature +6 -6
- data/features/3.templates.feature +4 -4
- data/features/4.pins.feature +1 -1
- data/lib/PinPress.rb +49 -9
- data/lib/PinPress/constants.rb +2 -2
- data/lib/PinPress/templates/pin_template.rb +5 -0
- data/lib/PinPress/templates/tag_template.rb +5 -0
- data/lib/PinPress/templates/template.rb +16 -0
- data/res/sample_config.yaml +1 -1
- metadata +5 -3
- data/results.html +0 -472
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6186a5c36dfb2d7e14e6271b45bb1f9040603385
|
4
|
+
data.tar.gz: 47a8b71dacbd00fde35228da01fb7c057c8e40ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e4685396b55ebf68218ce6c89e6878d8a1723caff9702f2becf7ba1f3467a52cd42849effddd0631d92b58b23b4af6b8e64b50bdfeeaea5228bf1f0f6eb9dc2
|
7
|
+
data.tar.gz: d797d51163782785ca1b88b3c8f2ed831fb4cfc027fd46da2cd23243075bb0b519e02aea588a303d1e8a53be2e728b6a341be4d5fc9c4a6de40ee77ad043af4a
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,324 @@
|
|
1
1
|
PinPress
|
2
2
|
========
|
3
|
+
[![Build Status](https://travis-ci.org/bachya/PinPress.svg?branch=master)](https://travis-ci.org/bachya/PinPress)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/pinpress.svg)](http://badge.fury.io/rb/pinpress)
|
3
5
|
|
4
|
-
|
6
|
+
PinPress is a simple CLI to create templates (HTML, Markdown, or otherwise) of Pinboard pins and tags.
|
7
|
+
|
8
|
+
# Why?
|
9
|
+
|
10
|
+
Every two weeks, I create a "link mash" for my website; this link mash consists of URLs that I find interesting and want to share with my readers. Previously, I would save those interesting URLs to an Evernote note and, every two weeks, manually create my link mash for use in Wordpress. <barf/>
|
11
|
+
|
12
|
+
When I began using [Pinboard](http://pinboard.in "Pinboard") to save interesting links, I knew I needed a better method. This tool is the result: **Pin**board + Word**press**.
|
13
|
+
|
14
|
+
# Prerequisites
|
15
|
+
|
16
|
+
In addition to Git (which, given you being on this site, I'll assume you have), Ruby (v. 1.9.3 or greater) is needed.
|
17
|
+
|
18
|
+
# Installation
|
19
|
+
|
20
|
+
```
|
21
|
+
gem install pinpress
|
22
|
+
```
|
23
|
+
|
24
|
+
# Usage
|
25
|
+
|
26
|
+
Syntax and usage can be accessed by running `pinpress help`:
|
27
|
+
|
28
|
+
```
|
29
|
+
$ pinpress help
|
30
|
+
NAME
|
31
|
+
pinpress - A Pinboard application that allows for the creation of "pin templates" in almost any conceivable format.
|
32
|
+
|
33
|
+
SYNOPSIS
|
34
|
+
pinpress [global options] command [command options] [arguments...]
|
35
|
+
|
36
|
+
VERSION
|
37
|
+
1.0.1
|
38
|
+
|
39
|
+
GLOBAL OPTIONS
|
40
|
+
--help - Show this message
|
41
|
+
--version - Display the program version
|
42
|
+
|
43
|
+
COMMANDS
|
44
|
+
help - Shows a list of commands or help for one command
|
45
|
+
init - Install and initialize dependencies
|
46
|
+
pins - Get posts from Pinboard
|
47
|
+
tags - Get tags from Pinboard
|
48
|
+
templates - Work with templates for pin output
|
49
|
+
```
|
50
|
+
|
51
|
+
Note that each command's options can be revealed by adding the `--help` switch after the command. For example:
|
52
|
+
|
53
|
+
```
|
54
|
+
$ pinpress pins --help
|
55
|
+
NAME
|
56
|
+
pins - Get posts from Pinboard
|
57
|
+
|
58
|
+
SYNOPSIS
|
59
|
+
pinpress [global options] pins [command options]
|
60
|
+
|
61
|
+
COMMAND OPTIONS
|
62
|
+
-e arg - The end date to pull pins to (default: none)
|
63
|
+
-n arg - The number of results to return (default: none)
|
64
|
+
-s arg - The start date to pull pins from (default: none)
|
65
|
+
-t arg - The tags to use (e.g., "ruby,pinboard") (default: none)
|
66
|
+
```
|
67
|
+
|
68
|
+
# Initialization
|
69
|
+
|
70
|
+
```
|
71
|
+
$ pinpress init
|
72
|
+
```
|
73
|
+
|
74
|
+
Initialization will prompt you to enter your Pinboard API token. Once, entered, this (and other pertinent data) will be stored in `~/.pinpress`.
|
75
|
+
|
76
|
+
# Getting Pins
|
77
|
+
|
78
|
+
```
|
79
|
+
$ pinpress pins
|
80
|
+
# => <ul><li><b><a title="Using Drafts for Remote CLI" href="https://gist.github.com/hiilppp/10993803" target="_blank">Using Drafts for Remote CLI</a>.</b> As a text file is added to a directory to which this AppleScript is associated as Folder Action, the content of the received file is executed as shell script and the generated output sent to an iOS device.</li></ul>
|
81
|
+
```
|
82
|
+
|
83
|
+
This simple command will return all pins from the user's account and output them based on the [Pin Template](https://github.com/bachya/PinPress#pin-templates "Pin Templates") provided.
|
84
|
+
|
85
|
+
Pinpress also provides some flags that allow a user to define specific pins to grab:
|
86
|
+
|
87
|
+
* `-s`: the start date to use (uses [Chronic](https://github.com/mojombo/chronic "Chronic"), which allows dates like "last Tuesday")
|
88
|
+
* `-e`: the end date to use (also uses [Chronic](https://github.com/mojombo/chronic "Chronic"))
|
89
|
+
* `-n`: the number of pins to return (e.g., 20)
|
90
|
+
* `-t`: a CSV list of tags to grab (e.g., "tag1,tag2")
|
91
|
+
|
92
|
+
## Getting Pins From a Date Forward
|
93
|
+
|
94
|
+
```
|
95
|
+
$ pinpress pins -s 2014-01-01
|
96
|
+
```
|
97
|
+
|
98
|
+
...returns all pins from January 1, 2014 to the current day.
|
99
|
+
|
100
|
+
## Getting Pins Until a Date
|
101
|
+
|
102
|
+
```
|
103
|
+
$ pinpress pins -e 2014-01-01
|
104
|
+
```
|
105
|
+
|
106
|
+
...returns all pins up to January 1, 2014.
|
107
|
+
|
108
|
+
## Getting Pins Between a Date Range
|
109
|
+
|
110
|
+
```
|
111
|
+
$ pinpress pins -s 2014-01-01 -e 2014-01-31
|
112
|
+
```
|
113
|
+
|
114
|
+
## Getting Tagged Pins
|
115
|
+
|
116
|
+
```
|
117
|
+
$ pinpress pins -t "ruby,cli"
|
118
|
+
```
|
119
|
+
|
120
|
+
...returns all pins tagged "ruby" *and* "cli".
|
121
|
+
|
122
|
+
# Getting Tags
|
123
|
+
|
124
|
+
Pinpress can also work with tags in a Pinboard account:
|
125
|
+
|
126
|
+
```
|
127
|
+
$ pinpress tags
|
128
|
+
# => cli (1),github (1),applescript (1),osx (1),link-mash (1)
|
129
|
+
```
|
130
|
+
|
131
|
+
This simple command will return all tags from the user's account and output them based on the [Tag Template](https://github.com/bachya/PinPress#tag-templates "Tag Templates") provided.
|
132
|
+
|
133
|
+
Pinpress also provides some flags that allow a user to define specific tags to grab:
|
134
|
+
|
135
|
+
* `-s`: the start date to use (uses [Chronic](https://github.com/mojombo/chronic "Chronic"), which allows dates like "last Tuesday")
|
136
|
+
* `-e`: the end date to use (also uses [Chronic](https://github.com/mojombo/chronic "Chronic"))
|
137
|
+
|
138
|
+
## Getting Tags From a Date Forward
|
139
|
+
|
140
|
+
```
|
141
|
+
$ pinpress tags -s 2014-01-01
|
142
|
+
```
|
143
|
+
|
144
|
+
...returns all tags used from January 1, 2014 to the current day. Note that for each tag returned, the data includes both the tag name and the number of times it was used.
|
145
|
+
|
146
|
+
## Getting Tags Until a Date
|
147
|
+
|
148
|
+
```
|
149
|
+
$ pinpress tags -e 2014-01-01
|
150
|
+
```
|
151
|
+
|
152
|
+
...returns all tags used up to January 1, 2014.
|
153
|
+
|
154
|
+
## Getting Tags Between a Date Range
|
155
|
+
|
156
|
+
```
|
157
|
+
$ pinpress tags -s 2014-01-01 -e 2014-01-31
|
158
|
+
```
|
159
|
+
|
160
|
+
# Templates
|
161
|
+
|
162
|
+
The first stop on the PinPress journey is templates. Templates are used to define how data should be output and are defined in `~/.pinpress` and come in two forms: **Pin Templates** and **Tag Templates**.
|
163
|
+
|
164
|
+
## Pin Templates
|
165
|
+
|
166
|
+
Pin Templates define how a pin should be output.
|
167
|
+
|
168
|
+
### Schema
|
169
|
+
|
170
|
+
Pin Templates are placed under the `pin_templates` section of the `~/.pinpress` config file -- as an example:
|
171
|
+
|
172
|
+
```YAML
|
173
|
+
pin_templates:
|
174
|
+
- name: pinpress_default
|
175
|
+
opener: "<ul>"
|
176
|
+
closer: "</ul>"
|
177
|
+
item: "<li><b><a title=\"<%= description %>\" href=\"<%= href %>\" target=\"_blank\"><%=
|
178
|
+
description %></a>.</b> <%= extended %></li>"
|
179
|
+
item_separator: "\n"
|
180
|
+
```
|
181
|
+
|
182
|
+
A Pin Template can have several different sub-keys:
|
183
|
+
|
184
|
+
* `name` (**required**): the name of the template
|
185
|
+
* `opener` (*optional*): the text that should exist above the pins
|
186
|
+
* `closer` (*optional*): the text that should exist above the pins
|
187
|
+
* `item` (**required**): the formatted text that should be output for every pin
|
188
|
+
* `item_separator` (**required**): the text that should exist between each pin ("item")
|
189
|
+
|
190
|
+
### Available Tokens
|
191
|
+
|
192
|
+
Additionally, a Pin Template can make use of several different tokens that are filled by a pin's values:
|
193
|
+
|
194
|
+
* `<%= href %>`: the URL of the pin
|
195
|
+
* `<%= description %>`: the description of the pin
|
196
|
+
* `<%= extended %>`: the pin's longer assocated description
|
197
|
+
* `<%= tag %>`: the CSV list of tags that apply to the pin
|
198
|
+
* `<%= time %>`: the time the pin was added to Pinboard
|
199
|
+
* `<%= replace %>`: the replacement status of the pin
|
200
|
+
* `<%= shared %>`: the privacy status of the pin
|
201
|
+
* `<%= toread %>`: the "to-read" status of the pin
|
202
|
+
|
203
|
+
### Usage
|
204
|
+
|
205
|
+
Pin Templates can be used in two ways: they can either be called dynamically:
|
206
|
+
|
207
|
+
```
|
208
|
+
$ pinpress pins template_name
|
209
|
+
```
|
210
|
+
|
211
|
+
...or a default template can be specified in `~/.pinpress`:
|
212
|
+
|
213
|
+
```
|
214
|
+
---
|
215
|
+
pinpress:
|
216
|
+
config_location: "/Users/abach/.pinpress"
|
217
|
+
default_pin_template: pinpress_default
|
218
|
+
# ... other keys ...
|
219
|
+
pin_templates:
|
220
|
+
- name: pinpress_default
|
221
|
+
opener: "<ul>"
|
222
|
+
closer: "</ul>"
|
223
|
+
item: "<li><b><a title=\"<%= description %>\" href=\"<%= href %>\" target=\"_blank\"><%=
|
224
|
+
description %></a>.</b> <%= extended %></li>"
|
225
|
+
item_separator: "\n"
|
226
|
+
```
|
227
|
+
|
228
|
+
Using this example, here's what's output:
|
229
|
+
|
230
|
+
```
|
231
|
+
$ pinpress pins -s 'yesterday'
|
232
|
+
# => <ul><li><b><a title="Using Drafts for Remote CLI" href="https://gist.github.com/hiilppp/10993803" target="_blank">Using Drafts for Remote CLI</a>.</b> As a text file is added to a directory to which this AppleScript is associated as Folder Action, the content of the received file is executed as shell script and the generated output sent to an iOS device.</li></ul>
|
233
|
+
```
|
234
|
+
|
235
|
+
## Tag Templates
|
236
|
+
|
237
|
+
Tag Templates are exactly like Pin Templates, but are used for tags.
|
238
|
+
|
239
|
+
### Schema
|
240
|
+
|
241
|
+
They, too, are defined in `~/.pinpress`:
|
242
|
+
|
243
|
+
```YAML
|
244
|
+
tag_templates:
|
245
|
+
- name: pinpress_default
|
246
|
+
item: "<%= tag %> (<%= count %>)"
|
247
|
+
item_separator: ","
|
248
|
+
```
|
249
|
+
|
250
|
+
A Pin Template can have several different sub-keys:
|
251
|
+
|
252
|
+
* `name` (**required**): the name of the template
|
253
|
+
* `opener` (*optional*): the text that should exist above the pins
|
254
|
+
* `closer` (*optional*): the text that should exist above the pins
|
255
|
+
* `item` (**required**): the formatted text that should be output for every pin
|
256
|
+
* `item_separator` (**required**): the text that should exist between each pin ("item")
|
257
|
+
|
258
|
+
### Available Tokens
|
259
|
+
|
260
|
+
Additionally, a Pin Template can make use of several different tokens that are filled by a pin's values:
|
261
|
+
|
262
|
+
* `<%= tag %>`: the name of the tag
|
263
|
+
* `<%= count %>`: the number of times the tag has been used in the range
|
264
|
+
|
265
|
+
### Usage
|
266
|
+
|
267
|
+
Pin Templates can be used in two ways: they can either be called dynamically:
|
268
|
+
|
269
|
+
```
|
270
|
+
$ pinpress tags template_name
|
271
|
+
```
|
272
|
+
|
273
|
+
...or a default template can be specified in `~/.pinpress`:
|
274
|
+
|
275
|
+
```
|
276
|
+
---
|
277
|
+
pinpress:
|
278
|
+
config_location: "/Users/abach/.pinpress"
|
279
|
+
default_tag_template: pinpress_default
|
280
|
+
# ... other keys ...
|
281
|
+
pin_templates:
|
282
|
+
# ... other keys ...
|
283
|
+
tag_templates:
|
284
|
+
- name: pinpress_default
|
285
|
+
item: "<%= tag %> (<%= count %>)"
|
286
|
+
item_separator: ","
|
287
|
+
```
|
288
|
+
|
289
|
+
Using this example, here's what's output:
|
290
|
+
|
291
|
+
```
|
292
|
+
$ pinpress tags -s 'yesterday'
|
293
|
+
# => cli (1),github (1),applescript (1),osx (1),link-mash (1)
|
294
|
+
```
|
295
|
+
|
296
|
+
# Known Issues & Future Releases
|
297
|
+
|
298
|
+
Check out the Pinpress roadmap via the [Trello Board](https://trello.com/b/lmuC8TT0/pinpress "Pinpress Trello Board").
|
299
|
+
|
300
|
+
Bugs, issues, and enhancement requests can be submitted on the [Issues Page](https://github.com/bachya/Pinpress/issues "Open Items").
|
301
|
+
|
302
|
+
# Bugs and Feature Requests
|
303
|
+
|
304
|
+
To report bugs with or suggest features/changes for Sifttter Redux, please use the [Issues Page](http://github.com/bachya/PinPress/issues).
|
305
|
+
|
306
|
+
Contributions are welcome and encouraged. To contribute:
|
307
|
+
|
308
|
+
* [Fork Sifttter Redux](http://github.com/bachya/PinPress/fork).
|
309
|
+
* Create a branch for your contribution (`git checkout -b new-feature`).
|
310
|
+
* Commit your changes (`git commit -am 'Added this new feature'`).
|
311
|
+
* Push to the branch (`git push origin new-feature`).
|
312
|
+
* Create a new [Pull Request](http://github.com/bachya/PinPress/compare/).
|
313
|
+
|
314
|
+
# License
|
315
|
+
|
316
|
+
(The MIT License)
|
317
|
+
|
318
|
+
Copyright © 2014 Aaron Bach <bachya1208@gmail.com>
|
319
|
+
|
320
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
321
|
+
|
322
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
323
|
+
|
324
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -16,7 +16,7 @@ Feature: Initialization
|
|
16
16
|
config_location: "/tmp/pp/.pinpress"
|
17
17
|
default_template: pinpress_default
|
18
18
|
log_level: WARN
|
19
|
-
version: 1.0.
|
19
|
+
version: 1.0.1
|
20
20
|
api_token: '12345'
|
21
21
|
templates:
|
22
22
|
- name: pinpress_default
|
@@ -34,7 +34,7 @@ Feature: Initialization
|
|
34
34
|
config_location: "/tmp/pp/.pinpress"
|
35
35
|
default_template: pinpress_default
|
36
36
|
log_level: WARN
|
37
|
-
version: 1.0.
|
37
|
+
version: 1.0.1
|
38
38
|
api_token: '12345'
|
39
39
|
templates:
|
40
40
|
- name: pinpress_default
|
@@ -55,7 +55,7 @@ Feature: Initialization
|
|
55
55
|
config_location: "/tmp/pp/.pinpress"
|
56
56
|
default_template: pinpress_default
|
57
57
|
log_level: WARN
|
58
|
-
version: 1.0.
|
58
|
+
version: 1.0.1
|
59
59
|
api_token: '12345'
|
60
60
|
templates:
|
61
61
|
- name: pinpress_default
|
@@ -76,7 +76,7 @@ Feature: Initialization
|
|
76
76
|
config_location: "/tmp/pp/.pinpress"
|
77
77
|
default_template: pinpress_default
|
78
78
|
log_level: WARN
|
79
|
-
version: 1.0.
|
79
|
+
version: 1.0.1
|
80
80
|
api_token: '12345'
|
81
81
|
templates:
|
82
82
|
- name: pinpress_default
|
@@ -94,7 +94,7 @@ Feature: Initialization
|
|
94
94
|
config_location: "/tmp/pp/.pinpress"
|
95
95
|
default_template: pinpress_default
|
96
96
|
log_level: WARN
|
97
|
-
version: 1.0.
|
97
|
+
version: 1.0.1
|
98
98
|
api_token: '12345'
|
99
99
|
templates:
|
100
100
|
- name: pinpress_default
|
@@ -114,7 +114,7 @@ Feature: Initialization
|
|
114
114
|
config_location: "/tmp/pp/.pinpress"
|
115
115
|
default_template: pinpress_default
|
116
116
|
log_level: WARN
|
117
|
-
version: 1.0.
|
117
|
+
version: 1.0.1
|
118
118
|
api_token: '12345'
|
119
119
|
templates:
|
120
120
|
- name: pinpress_default
|
@@ -10,7 +10,7 @@ Feature: Templates
|
|
10
10
|
config_location: "/tmp/pp/.pinpress"
|
11
11
|
default_template: pinpress_default
|
12
12
|
log_level: WARN
|
13
|
-
version: 1.0.
|
13
|
+
version: 1.0.1
|
14
14
|
api_token: '12345'
|
15
15
|
templates:
|
16
16
|
- name: pinpress_default
|
@@ -38,7 +38,7 @@ Feature: Templates
|
|
38
38
|
config_location: "/tmp/pp/.pinpress"
|
39
39
|
default_template: pinpress_default
|
40
40
|
log_level: WARN
|
41
|
-
version: 1.0.
|
41
|
+
version: 1.0.1
|
42
42
|
api_token: '12345'
|
43
43
|
templates:
|
44
44
|
- name: pinpress_default
|
@@ -66,7 +66,7 @@ Feature: Templates
|
|
66
66
|
config_location: "/tmp/pp/.pinpress"
|
67
67
|
default_template: pinpress_default
|
68
68
|
log_level: WARN
|
69
|
-
version: 1.0.
|
69
|
+
version: 1.0.1
|
70
70
|
api_token: '12345'
|
71
71
|
templates:
|
72
72
|
- name: pinpress_default
|
@@ -102,7 +102,7 @@ Feature: Templates
|
|
102
102
|
config_location: "/tmp/pp/.pinpress"
|
103
103
|
default_template: secondary
|
104
104
|
log_level: WARN
|
105
|
-
version: 1.0.
|
105
|
+
version: 1.0.1
|
106
106
|
api_token: '12345'
|
107
107
|
templates:
|
108
108
|
- name: pinpress_default
|