pinpress 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83ccc8144066f655e2b17a30f05ce1f9e0d3802a
4
- data.tar.gz: bacd08125f3c4f14638598c40436605680966614
3
+ metadata.gz: abf02d81f7239b623f70a4f4e047a765fb6603f2
4
+ data.tar.gz: 7c79e907be640f042376328614bee97aac71e3fc
5
5
  SHA512:
6
- metadata.gz: c0cad134fa4ee12431114767df32c935e2a936e642b1984d0d122201d8f9e2581346cdb6c7b18a50b846e4708e9f7fe4b2f8bd98135f0ab7bca59f045bc06802
7
- data.tar.gz: 6551a7cb8d75cd7310110d1fe72c2a177c142a7bb01650c117f1e2483be6c25bd52ee25d4909b6effa3c83172ff65d9b35f210d9c79c1019ee06ed7beb9ec14d
6
+ metadata.gz: c14f1e6b344374440bb047e12e5f325da73f86fd7434c9e05c0bbd8b54d2bfa67f2aa82f873107ce224d0281b84712b29d68c4623685feb1a6b8e643a57fcd58
7
+ data.tar.gz: 3461ad458562a329b1234641d5b567c624367aacc704c7c13774f12aab85dcc930a337b2ed81cd545a213271c15ebfed029c19e035fa935e31c2e58d03d3a854
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1
4
+ - 2.0.0
5
+ - 1.9.3
data/Gemfile CHANGED
@@ -1,5 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'simplecov', :require => false, :group => :test
4
-
5
3
  gemspec
data/HISTORY.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 1.2.3 (2014-05-04)
2
+
3
+ * Fixed a bug where error management failed
4
+ * Updated documentation
5
+
1
6
  # 1.2.2 (2014-04-29)
2
7
 
3
8
  * Fixed a bug in which the configuration wouldn't update as expected
@@ -37,4 +42,4 @@
37
42
 
38
43
  # 1.0.0 (2014-04-16)
39
44
 
40
- * Initial release
45
+ * Initial release
data/README.md CHANGED
@@ -1,18 +1,26 @@
1
1
  PinPress
2
2
  ========
3
+ [![Build Status](https://travis-ci.org/bachya/pinpress.svg?branch=master)](https://travis-ci.org/bachya/pinpress)
3
4
  [![Gem Version](https://badge.fury.io/rb/pinpress.svg)](http://badge.fury.io/rb/pinpress)
4
5
 
5
- PinPress is a simple CLI to create templates (HTML, Markdown, or otherwise) of Pinboard pins and tags.
6
+ PinPress is a simple CLI to create templates (HTML, Markdown, or otherwise) of
7
+ Pinboard pins and tags.
6
8
 
7
9
  # Why?
8
10
 
9
- Every week, I create a [link mash for my blog](#link-mash-config-file); 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 week, manually create my link mash for use in Wordpress. `<barf/>`
11
+ Every week, I create a [link mash for my blog](#link-mash-config-file); this
12
+ link mash consists of URLs that I find interesting and want to share with my
13
+ readers. Previously, I would save those interesting URLs to an Evernote note
14
+ and, every week, manually create my link mash for use in Wordpress. `<barf/>`
10
15
 
11
- 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**.
16
+ When I began using [Pinboard](http://pinboard.in "Pinboard") to save
17
+ interesting links, I knew I needed a better method. This tool is the result:
18
+ **Pin** board + Word **press**.
12
19
 
13
20
  # Prerequisites
14
21
 
15
- 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.
22
+ In addition to Git (which, given you being on this site, I'll assume you have),
23
+ Ruby (v. 1.9.3 or greater) is needed.
16
24
 
17
25
  # Installation
18
26
 
@@ -48,7 +56,8 @@ COMMANDS
48
56
  templates - Work with templates for pin output
49
57
  ```
50
58
 
51
- Note that each command's options can be revealed by adding the `--help` switch after the command. For example:
59
+ Note that each command's options can be revealed by adding the `--help` switch
60
+ after the command. For example:
52
61
 
53
62
  ```bash
54
63
  $ pinpress pins --help
@@ -71,7 +80,8 @@ COMMAND OPTIONS
71
80
  $ pinpress init
72
81
  ```
73
82
 
74
- Initialization will prompt you to enter your Pinboard API token. Once, entered, this (and other pertinent data) will be stored in `~/.pinpress`.
83
+ Initialization will prompt you to enter your Pinboard API token. Once, entered,
84
+ this (and other pertinent data) will be stored in `~/.pinpress`.
75
85
 
76
86
  # Getting Pins
77
87
 
@@ -79,9 +89,11 @@ Initialization will prompt you to enter your Pinboard API token. Once, entered,
79
89
  $ pinpress pins
80
90
  ```
81
91
 
82
- This simple command will return all pins from the user's account and output them based on the [Pin Template](#pin-templates "Pin Templates") provided.
92
+ This simple command will return all pins from the user's account and output them
93
+ based on the [Pin Template](#pin-templates "Pin Templates") provided.
83
94
 
84
- Pinpress also provides some flags that allow a user to define specific pins to grab:
95
+ Pinpress also provides some flags that allow a user to define specific pins to
96
+ grab:
85
97
 
86
98
  * `-s`: the start date to use (uses [Chronic](https://github.com/mojombo/chronic "Chronic"), which allows dates like "last Tuesday")
87
99
  * `-e`: the end date to use (also uses [Chronic](https://github.com/mojombo/chronic "Chronic"))
@@ -126,7 +138,9 @@ $ pinpress pins -t "ruby,cli"
126
138
  $ pinpress pins last
127
139
  ```
128
140
 
129
- ...will get all the pins created since you last ran that command (e.g., if you'd last run `pinpress pins` on 2014-01-01, this command would return all pins created from 2014-01-02 onward).
141
+ ...will get all the pins created since you last ran that command (e.g., if you'd
142
+ last run `pinpress pins` on 2014-01-01, this command would return all pins
143
+ created from 2014-01-02 onward).
130
144
 
131
145
  # Getting Tags
132
146
 
@@ -136,9 +150,11 @@ Pinpress can also work with tags in a Pinboard account:
136
150
  $ pinpress tags
137
151
  ```
138
152
 
139
- This simple command will return all tags from the user's account and output them based on the [Tag Template](#tag-templates "Tag Templates") provided.
153
+ This simple command will return all tags from the user's account and output them
154
+ based on the [Tag Template](#tag-templates "Tag Templates") provided.
140
155
 
141
- Pinpress also provides some flags that allow a user to define specific tags to grab:
156
+ Pinpress also provides some flags that allow a user to define specific tags to
157
+ grab:
142
158
 
143
159
  * `-s`: the start date to use (uses [Chronic](https://github.com/mojombo/chronic "Chronic"), which allows dates like "last Tuesday")
144
160
  * `-e`: the end date to use (also uses [Chronic](https://github.com/mojombo/chronic "Chronic"))
@@ -150,7 +166,9 @@ Pinpress also provides some flags that allow a user to define specific tags to g
150
166
  $ pinpress tags -s 2014-01-01
151
167
  ```
152
168
 
153
- ...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.
169
+ ...returns all tags used from January 1, 2014 to the current day. Note that for
170
+ each tag returned, the data includes both the tag name and the number of times
171
+ it was used.
154
172
 
155
173
  ## Getting Tags Until a Date
156
174
 
@@ -172,7 +190,8 @@ $ pinpress tags -s 2014-01-01 -e 2014-01-31
172
190
  $ pinpress tags -t 'tag1,tag2' -s 2014-01-01
173
191
  ```
174
192
 
175
- ...returns all tags that have been used *alongside* `tag1` and `tag2`, starting on Jarnuary 1, 2014.
193
+ ...returns all tags that have been used *alongside* `tag1` and `tag2`, starting
194
+ on Jarnuary 1, 2014.
176
195
 
177
196
  ## Getting Tags Used Since Last Run
178
197
 
@@ -180,11 +199,15 @@ $ pinpress tags -t 'tag1,tag2' -s 2014-01-01
180
199
  $ pinpress tags last
181
200
  ```
182
201
 
183
- ...will get all the tags used since you last ran the command (e.g., if you'd last run `pinpress tags` on 2014-01-01, this command would return all tags used from 2014-01-02 onward).
202
+ ...will get all the tags used since you last ran the command (e.g., if you'd
203
+ last run `pinpress tags` on 2014-01-01, this command would return all tags used
204
+ from 2014-01-02 onward).
184
205
 
185
206
  # Templates
186
207
 
187
- Templates are used to define how data should be output to the terminal and are defined in `~/.pinpress`. They come in two forms: **Pin Templates** and **Tag Templates**.
208
+ Templates are used to define how data should be output to the terminal and are
209
+ defined in `~/.pinpress`. They come in two forms: **Pin Templates** and **Tag
210
+ Templates**.
188
211
 
189
212
  ## Pin Templates
190
213
 
@@ -192,7 +215,8 @@ Pin Templates define how a pin from Pinboard should be output.
192
215
 
193
216
  ### Schema
194
217
 
195
- Pin Templates are placed under the `pin_templates` section of the `~/.pinpress` config file -- as an example:
218
+ Pin Templates are placed under the `pin_templates` section of the `~/.pinpress`
219
+ config file -- as an example:
196
220
 
197
221
  ```yaml
198
222
  pin_templates:
@@ -216,7 +240,8 @@ A Pin Template can have several different sub-keys:
216
240
 
217
241
  ### Available Tokens
218
242
 
219
- Additionally, a Pin Template can make use of several different tokens that are filled by a pin's values:
243
+ Additionally, a Pin Template can make use of several different tokens that are
244
+ filled by a pin's values:
220
245
 
221
246
  * `<%= href %>`: the URL of the pin
222
247
  * `<%= description %>`: the description of the pin
@@ -284,7 +309,8 @@ $ pinpress pins pinpress_default
284
309
  </ul>
285
310
  ```
286
311
 
287
- (Note that the nice indenting is for Github's sake; the actual output will conform to the formatting in `~/.pinpress`.)
312
+ (Note that the nice indenting is for Github's sake; the actual output will
313
+ conform to the formatting in `~/.pinpress`.)
288
314
 
289
315
  ## Tag Templates
290
316
 
@@ -312,7 +338,8 @@ A Tag Template makes use of the same sub-keys as Pin Template:
312
338
  Additionally, like a Pin Template, a Tag Template can make use of a few tokens:
313
339
 
314
340
  * `<%= tag %>`: the name of the tag
315
- * `<%= count %>`: the number of times the tag has been used (depending on the range used)
341
+ * `<%= count %>`: the number of times the tag has been used (depending on the
342
+ range used)
316
343
 
317
344
  ### Usage
318
345
 
@@ -357,7 +384,8 @@ link-mash (15),app (2),ios (3),productivity (1),launch-center-pro (1),drafts (2)
357
384
 
358
385
  # Other Configuration Options
359
386
 
360
- You can place special keys in the `pinpress` section of `~/.pinpress` to automate some actions:
387
+ You can place special keys in the `pinpress` section of `~/.pinpress` to
388
+ automate some actions:
361
389
 
362
390
  ```yaml
363
391
  pinpress:
@@ -388,7 +416,8 @@ Do note:
388
416
 
389
417
  # Link Mash Config File
390
418
 
391
- For your reference, here's my `~/.pinpress` (which is used to generate a [Link Mash on my blog](http://www.bachyaproductions.com/tag/link-mash/ "Bachya Productions Link Mash Archives")):
419
+ For your reference, here's my `~/.pinpress` (which is used to generate a
420
+ [Link Mash on my blog](http://www.bachyaproductions.com/tag/link-mash/ "Bachya Productions Link Mash Archives")):
392
421
 
393
422
  ```yaml
394
423
  ---
@@ -400,7 +429,7 @@ pinpress:
400
429
  ignored_tags: ['buffer']
401
430
  log_level: WARN
402
431
  version: 1.1.1
403
- api_token: bachya:b819312cf9ccee799b87
432
+ api_token: bachya:1234567890987654321
404
433
  last_pins_run: 2014-04-29
405
434
  last_tags_run: 2014-04-29
406
435
  pin_templates:
@@ -434,13 +463,16 @@ tag_templates:
434
463
 
435
464
  # Known Issues & Future Releases
436
465
 
437
- Check out the Pinpress roadmap via the [Trello Board](https://trello.com/b/lmuC8TT0/pinpress "Pinpress Trello Board").
466
+ Check out the Pinpress roadmap via the
467
+ [Trello Board](https://trello.com/b/lmuC8TT0/pinpress "Pinpress Trello Board").
438
468
 
439
- Bugs, issues, and enhancement requests can be submitted on the [Issues Page](https://github.com/bachya/Pinpress/issues "Open Items").
469
+ Bugs, issues, and enhancement requests can be submitted on the
470
+ [Issues Page](https://github.com/bachya/Pinpress/issues "Open Items").
440
471
 
441
472
  # Bugs and Feature Requests
442
473
 
443
- To report bugs with or suggest features/changes for PinPress, please use the [Issues Page](http://github.com/bachya/PinPress/issues).
474
+ To report bugs with or suggest features/changes for PinPress, please use the
475
+ [Issues Page](http://github.com/bachya/PinPress/issues).
444
476
 
445
477
  Contributions are welcome and encouraged. To contribute:
446
478
 
@@ -456,8 +488,20 @@ Contributions are welcome and encouraged. To contribute:
456
488
 
457
489
  Copyright © 2014 Aaron Bach <bachya1208@gmail.com>
458
490
 
459
- 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:
460
-
461
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
462
-
463
- 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.
491
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
492
+ this software and associated documentation files (the 'Software'), to deal in
493
+ the Software without restriction, including without limitation the rights to
494
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
495
+ the Software, and to permit persons to whom the Software is furnished to do so,
496
+ subject to the following conditions:
497
+
498
+ The above copyright notice and this permission notice shall be included in all
499
+ copies or substantial portions of the Software.
500
+
501
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
502
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
503
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
504
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
505
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
506
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
507
+ SOFTWARE.
data/Rakefile CHANGED
@@ -53,4 +53,4 @@ task :build do
53
53
  FileUtils.mv("./pinpress-#{ version }.gem", "pkg")
54
54
  end
55
55
 
56
- task :default => [:features] #:yard, :test, :features
56
+ task :default => [:yard, :test, :features]
data/bin/pinpress CHANGED
@@ -67,7 +67,7 @@ pre do |global, command, options, args|
67
67
 
68
68
  # Compare the two versions and, if needed, update.
69
69
  configuration.compare_version do |c, l|
70
- messenger.debug { "Upgrading from #{ c } to #{ l }" }
70
+ messenger.debug("Upgrading from #{ c } to #{ l }")
71
71
  PinPress.update_config_file
72
72
  exit!(0)
73
73
  end
@@ -85,9 +85,9 @@ post do |global, command, options, args|
85
85
  end
86
86
 
87
87
  on_error do |exception|
88
- # messenger.error(exception.to_s)
89
- # exit!(1)
90
- # true
88
+ messenger.error(exception.to_s)
89
+ exit!(1)
90
+ true
91
91
  end
92
92
 
93
93
  # ======================================================
@@ -5,4 +5,4 @@ Feature: UI
5
5
 
6
6
  Scenario: Display help instructions
7
7
  When I get help for "pinpress"
8
- Then the exit status should be 0
8
+ Then the exit status should be 0
@@ -10,60 +10,36 @@ Feature: Initialization
10
10
  And I type ""
11
11
  And I type "bachya:12345"
12
12
  Then the exit status should be 0
13
- And the following files should exist:
14
- | /tmp/pp/.pinpress |
13
+ And a valid configuration file should exist at "/tmp/pp/.pinpress"
15
14
 
16
15
  Scenario: Reinitialization (refuse)
17
- Given a file located at "/tmp/pp/.pinpress" with the contents:
18
- """
19
- ---
20
- pinpress:
21
- config_location: "/tmp/pp/.pinpress"
22
- default_pin_template: pinpress_default
23
- default_tag_template: pinpress_default
24
- log_level: WARN
25
- version: 1.1.1
26
- api_token: bachya:12345
27
- """
28
- When I run `pinpress init` interactively
29
- And I type ""
30
- Then the exit status should be 0
16
+ Given an existing current configuration file located at "/tmp/pp/.pinpress"
17
+ When I run `pinpress init` interactively
18
+ And I type ""
19
+ Then the exit status should be 0
31
20
 
32
21
  Scenario: Reinitialization (accept)
33
- Given a file located at "/tmp/pp/.pinpress" with the contents:
34
- """
35
- ---
36
- pinpress:
37
- config_location: "/tmp/pp/.pinpress"
38
- default_pin_template: pinpress_default
39
- default_tag_template: pinpress_default
40
- log_level: WARN
41
- version: 1.1.1
42
- api_token: bachya:12345
43
- """
22
+ Given an existing current configuration file located at "/tmp/pp/.pinpress"
44
23
  When I run `pinpress init` interactively
45
24
  And I type "y"
46
25
  And I type ""
47
26
  And I type "bachya:12345"
48
27
  Then the exit status should be 0
49
- And the following files should exist:
50
- | /tmp/pp/.pinpress |
28
+ And a valid configuration file should exist at "/tmp/pp/.pinpress"
51
29
 
52
- Scenario: Reinitialization (from scratch)
53
- Given a file located at "/tmp/pp/.pinpress" with the contents:
54
- """
55
- ---
56
- pinpress:
57
- config_location: "/tmp/pp/.pinpress"
58
- default_pin_template: pinpress_default
59
- default_tag_template: pinpress_default
60
- log_level: WARN
61
- version: 1.1.1
62
- api_token: bachya:12345
63
- """
30
+ Scenario: Reinitialization (accept)
31
+ Given an existing current configuration file located at "/tmp/pp/.pinpress"
64
32
  When I run `pinpress init -s` interactively
65
33
  And I type ""
66
34
  And I type "bachya:12345"
67
35
  Then the exit status should be 0
68
- And the following files should exist:
69
- | /tmp/pp/.pinpress |
36
+ And a valid configuration file should exist at "/tmp/pp/.pinpress"
37
+
38
+ Scenario: Update out-of-date configuration file
39
+ Given an existing old configuration file located at "/tmp/pp/.pinpress"
40
+ When I run `pinpress init` interactively
41
+ And I type ""
42
+ And I type ""
43
+ And I type "bachya:12345"
44
+ Then the exit status should be 0
45
+ And a valid configuration file should exist at "/tmp/pp/.pinpress"
@@ -4,47 +4,19 @@ Feature: Templates
4
4
  templates and choose one.
5
5
 
6
6
  Scenario: List Templates (implicit)
7
- Given a file located at "/tmp/pp/.pinpress" with the contents:
8
- """
9
- ---
10
- pinpress:
11
- config_location: "/tmp/pp/.pinpress"
12
- default_pin_template: pinpress_default
13
- default_tag_template: pinpress_default
14
- log_level: WARN
15
- version: 1.1.1
16
- api_token: bachya:12345
17
- pin_templates:
18
- - name: pinpress_default
19
- tag_templates:
20
- - name: pinpress_default
21
- """
7
+ Given an existing current configuration file located at "/tmp/pp/.pinpress"
22
8
  When I run `pinpress templates` interactively
23
9
  Then the exit status should be 0
24
- And the output should contain:
25
- """
26
- ---> AVAILABLE PIN TEMPLATES:
27
- # 1. pinpress_default
28
- ---> AVAILABLE TAG TEMPLATES:
29
- # 1. pinpress_default
30
- """
10
+ And the output should contain:
11
+ """
12
+ ---> AVAILABLE PIN TEMPLATES:
13
+ # 1. pinpress_default
14
+ ---> AVAILABLE TAG TEMPLATES:
15
+ # 1. pinpress_default
16
+ """
31
17
 
32
18
  Scenario: List Templates (explicit)
33
- Given a file located at "/tmp/pp/.pinpress" with the contents:
34
- """
35
- ---
36
- pinpress:
37
- config_location: "/tmp/pp/.pinpress"
38
- default_pin_template: pinpress_default
39
- default_tag_template: pinpress_default
40
- log_level: WARN
41
- version: 1.1.1
42
- api_token: bachya:12345
43
- pin_templates:
44
- - name: pinpress_default
45
- tag_templates:
46
- - name: pinpress_default
47
- """
19
+ Given an existing current configuration file located at "/tmp/pp/.pinpress"
48
20
  When I run `pinpress templates list` interactively
49
21
  Then the exit status should be 0
50
22
  And the output should contain:
@@ -1,12 +1,37 @@
1
+ def create_config_file(version)
2
+ config = YAML.load_file(File.join(LIB_DIR, '..', 'support/sample_config.yaml'))
3
+ config['pinpress'].merge!('version' => version)
4
+ File.open('/tmp/pp/.pinpress', 'w') { |f| f.write(config.to_yaml) }
5
+ end
6
+
7
+ Given(/^no file located at "(.*?)"$/) do |filepath|
8
+ step %(the file "#{ filepath }" should not exist)
9
+ end
10
+
11
+ Given(/^an existing current configuration file located at "(.*?)"$/) do |filepath|
12
+ create_config_file(PinPress::VERSION)
13
+ end
14
+
15
+ Given(/^an existing old configuration file located at "(.*?)"$/) do |filepath|
16
+ create_config_file('0.0.1')
17
+ end
18
+
1
19
  When /^I get help for "([^"]*)"$/ do |app_name|
2
20
  @app_name = app_name
3
21
  step %(I run `#{app_name} help`)
4
22
  end
5
23
 
6
- Given(/^no file located at "(.*?)"$/) do |filepath|
7
- step %(the file "#{ filepath }" should not exist)
24
+ Then(/^the following files should not be empty:$/) do |table|
25
+ table.cell_matrix.flatten.each do |file|
26
+ expect(File.file?(file.value)).to eq(true)
27
+ expect(File.read(file.value)).not_to be_empty
28
+ end
8
29
  end
9
30
 
10
- Given(/^a file located at "(.*?)" with the contents:$/) do |filepath, contents|
11
- File.open(filepath, 'w') { |f| f.write(contents) }
12
- end
31
+ Then(/^a valid configuration file should exist at "(.*?)"$/) do |filepath|
32
+ expect(File.file?(filepath)).to eq(true)
33
+ stub_data = YAML.load_file(File.join(LIB_DIR, '..', 'support/sample_config.yaml'))
34
+ config_data = YAML.load_file(filepath)
35
+ config_data['pinpress'].delete('version')
36
+ expect(config_data).to eq(stub_data)
37
+ end
@@ -1,12 +1,10 @@
1
- require 'simplecov'
2
1
  require 'aruba/cucumber'
3
- require 'cucumber/rspec/doubles'
2
+ require_relative '../../lib/pinpress/constants'
4
3
 
5
4
  ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
6
5
  LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
7
6
 
8
7
  Before do
9
- # Using "announce" causes massive warnings on 1.9.2
10
8
  @puts = true
11
9
  @original_rubylib = ENV['RUBYLIB']
12
10
  ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
data/lib/pinpress.rb CHANGED
@@ -116,10 +116,10 @@ module PinPress
116
116
  output += PinPress.generate_items(template_type, template, pins, opts)
117
117
  output += template.closer if template.closer
118
118
  end
119
+
119
120
  configuration.save
120
121
  return output
121
122
  rescue StandardError => e
122
- p e.to_s
123
123
  messenger.debug(e.to_s)
124
124
  raise "Pinboard API failed; are you sure you've run " \
125
125
  " `pinpress init` (and that your API key is correct)?"
@@ -173,7 +173,7 @@ module PinPress
173
173
  default_pin_template = {
174
174
  name: 'pinpress_default',
175
175
  opener: '<ul>',
176
- item: '<li><b><a title="<%= description %>" href="<%= href %>" target="_blank"><%= description %></a>.</b><%= extended %></li>',
176
+ item: '<li><b><a title="<%= description %>" href="<%= href %>" target="_blank"><%= description %></a>.</b> <%= extended %></li>',
177
177
  closer: '</ul>'
178
178
  }
179
179
 
@@ -190,9 +190,8 @@ module PinPress
190
190
  pm.ask
191
191
  configuration.ingest_prefs(pm)
192
192
 
193
- messenger.debug {
194
- "Configuration values after pref collection: #{ configuration.data }"
195
- }
193
+ messenger.debug("Configuration values after pref collection: #{ configuration.data }")
194
+
196
195
  configuration.save
197
196
  @initialized = true
198
197
  end
@@ -20,7 +20,7 @@ module PinPress
20
20
  File.dirname(__FILE__),
21
21
  '..',
22
22
  '..',
23
- 'res/preference_prompts.yaml'
23
+ 'support/preference_prompts.yaml'
24
24
  )
25
25
  }
26
26
 
@@ -28,5 +28,5 @@ module PinPress
28
28
  SUMMARY = 'A simple CLI to create HTML templates of Pinboard data.'
29
29
 
30
30
  # The Gem's version
31
- VERSION = '1.2.2'
31
+ VERSION = '1.2.3'
32
32
  end
data/pinpress.gemspec CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
6
6
  spec.email = ["bachya1208@googlemail.com"]
7
7
  spec.summary = PinPress::SUMMARY
8
8
  spec.description = PinPress::DESCRIPTION
9
- spec.homepage = 'http://www.bachyaproductions.com/pinpress-joining-pinboard-wordpress/'
9
+ spec.homepage = 'https://github.com/bachya/pinpress'
10
10
  spec.license = 'MIT'
11
11
 
12
12
  spec.files = `git ls-files -z`.split("\x0")
@@ -17,11 +17,9 @@ Gem::Specification.new do |spec|
17
17
  spec.add_development_dependency('aruba', '0.5.4')
18
18
  spec.add_development_dependency('rake', '10.1.1')
19
19
  spec.add_development_dependency('rdoc', '4.1.1')
20
- spec.add_development_dependency('rspec', '2.14.1')
21
20
  spec.add_development_dependency('yard', '0.8.7.4')
22
21
  spec.add_runtime_dependency('chronic', '0.10.2')
23
- spec.add_runtime_dependency('cliutils', '~> 2.1')
22
+ spec.add_runtime_dependency('cliutils', '~> 2')
24
23
  spec.add_runtime_dependency('gli', '2.9.0')
25
24
  spec.add_runtime_dependency('pinboard', '0.1.1')
26
25
  end
27
-
File without changes
@@ -1,17 +1,15 @@
1
1
  ---
2
2
  pinpress:
3
- config_location: "/tmp/test.config"
3
+ config_location: "/tmp/pp/.pinpress"
4
4
  default_pin_template: pinpress_default
5
5
  default_tag_template: pinpress_default
6
6
  log_level: WARN
7
- version: 1.1.1
8
7
  api_token: bachya:12345
9
8
  pin_templates:
10
9
  - name: pinpress_default
11
10
  opener: "<ul>"
12
- item: "<li><b><a title=\"<%= description %>\" href=\"<%= href %>\" target=\"_blank\"><%=
13
- description %></a>.</b> <%= extended %></li>"
11
+ item: <li><b><a title="<%= description %>" href="<%= href %>" target="_blank"><%= description %></a>.</b> <%= extended %></li>
14
12
  closer: "</ul>"
15
13
  tag_templates:
16
14
  - name: pinpress_default
17
- item: "<%= tag %>,"
15
+ item: "<%= tag %> (<%= count %>),"
data/test/test_helper.rb CHANGED
@@ -1,4 +1,3 @@
1
- require 'simplecov'
2
1
  require 'test/unit'
3
2
 
4
3
  class Test::Unit::TestCase
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.2.2
4
+ version: 1.2.3
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-04-30 00:00:00.000000000 Z
11
+ date: 2014-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aruba
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
54
  version: 4.1.1
55
- - !ruby/object:Gem::Dependency
56
- name: rspec
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - '='
60
- - !ruby/object:Gem::Version
61
- version: 2.14.1
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - '='
67
- - !ruby/object:Gem::Version
68
- version: 2.14.1
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: yard
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +86,14 @@ dependencies:
100
86
  requirements:
101
87
  - - "~>"
102
88
  - !ruby/object:Gem::Version
103
- version: '2.1'
89
+ version: '2'
104
90
  type: :runtime
105
91
  prerelease: false
106
92
  version_requirements: !ruby/object:Gem::Requirement
107
93
  requirements:
108
94
  - - "~>"
109
95
  - !ruby/object:Gem::Version
110
- version: '2.1'
96
+ version: '2'
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: gli
113
99
  requirement: !ruby/object:Gem::Requirement
@@ -147,6 +133,7 @@ extensions: []
147
133
  extra_rdoc_files: []
148
134
  files:
149
135
  - ".gitignore"
136
+ - ".travis.yml"
150
137
  - Gemfile
151
138
  - HISTORY.md
152
139
  - LICENSE
@@ -156,7 +143,6 @@ files:
156
143
  - features/1.ui.feature
157
144
  - features/2.initialization.feature
158
145
  - features/3.templates.feature
159
- - features/4.pins.feature
160
146
  - features/step_definitions/pinpress_steps.rb
161
147
  - features/support/env.rb
162
148
  - lib/pinpress.rb
@@ -165,14 +151,13 @@ files:
165
151
  - lib/pinpress/templates/tag_template.rb
166
152
  - lib/pinpress/templates/template.rb
167
153
  - pinpress.gemspec
168
- - res/preference_prompts.yaml
169
- - res/sample_config.yaml
154
+ - support/preference_prompts.yaml
155
+ - support/sample_config.yaml
170
156
  - test/pin_template_test.rb
171
157
  - test/pinpress_template_test.rb
172
158
  - test/tag_template_test.rb
173
- - test/test_files/configuration.yaml
174
159
  - test/test_helper.rb
175
- homepage: http://www.bachyaproductions.com/pinpress-joining-pinboard-wordpress/
160
+ homepage: https://github.com/bachya/pinpress
176
161
  licenses:
177
162
  - MIT
178
163
  metadata: {}
@@ -200,12 +185,10 @@ test_files:
200
185
  - features/1.ui.feature
201
186
  - features/2.initialization.feature
202
187
  - features/3.templates.feature
203
- - features/4.pins.feature
204
188
  - features/step_definitions/pinpress_steps.rb
205
189
  - features/support/env.rb
206
190
  - test/pin_template_test.rb
207
191
  - test/pinpress_template_test.rb
208
192
  - test/tag_template_test.rb
209
- - test/test_files/configuration.yaml
210
193
  - test/test_helper.rb
211
194
  has_rdoc:
@@ -1,19 +0,0 @@
1
- @active
2
- Feature: Templates
3
- As a user, I should be able get pins from Pinboard
4
- and have them inherit certain templates.
5
-
6
- Scenario: Invalid API Key
7
- Given a file located at "/tmp/pp/.pinpress" with the contents:
8
- """
9
- ---
10
- pinpress:
11
- config_location: "/tmp/pp/.pinpress"
12
- default_pin_template: pinpress_default
13
- default_tag_template: pinpress_default
14
- log_level: WARN
15
- version: 1.1.1
16
- api_token: bachya:12345
17
- """
18
- When I run `pinpress pins` interactively
19
- Then the exit status should be 1
@@ -1,17 +0,0 @@
1
- ---
2
- pinpress:
3
- config_location: "/Users/abach/.pinpress"
4
- default_template: pinpress_default
5
- log_level: WARN
6
- version: 1.0.1
7
- api_token: bachya:b819312cf9ccee799b87
8
- templates:
9
- - name: pinpress_default
10
- opener: "<ul>"
11
- item: "<li><b><a title=\"<%= description %>\" href=\"<%= href %>\" target=\"_blank\"><%=
12
- description %></a>.</b> <%= extended %></li>"
13
- closer: "</ul>"
14
- - name: secondary
15
- opener: "<ul>"
16
- item: "<li>TEST</li>"
17
- closer: "</ul>"