klipbook 2.1.3 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +9 -0
  3. data/.ruby-version +1 -1
  4. data/.travis.yml +1 -1
  5. data/CHANGELOG.txt +11 -0
  6. data/Gemfile +2 -15
  7. data/Gemfile.lock +73 -113
  8. data/LICENSE.txt +18 -17
  9. data/README.md +63 -69
  10. data/Rakefile +3 -30
  11. data/bin/klipbook +3 -221
  12. data/klipbook.gemspec +32 -118
  13. data/lib/klipbook/cli.rb +69 -0
  14. data/lib/klipbook/commands/command.rb +39 -0
  15. data/lib/klipbook/commands/export.rb +50 -0
  16. data/lib/klipbook/commands/exporters/exporter.rb +49 -0
  17. data/lib/klipbook/{tohtml → commands/exporters}/html_book_summary.erb +1 -1
  18. data/lib/klipbook/commands/exporters/html_exporter.rb +25 -0
  19. data/lib/klipbook/commands/exporters/json_exporter.rb +17 -0
  20. data/lib/klipbook/commands/exporters/markdown_book_summary.erb +12 -0
  21. data/lib/klipbook/commands/exporters/markdown_exporter.rb +19 -0
  22. data/lib/klipbook/commands/list.rb +17 -0
  23. data/lib/klipbook/config.rb +18 -10
  24. data/lib/klipbook/logger.rb +15 -0
  25. data/lib/klipbook/sources/amazon_site/book_scraper.rb +0 -2
  26. data/lib/klipbook/sources/book.rb +36 -21
  27. data/lib/klipbook/sources/clipping.rb +10 -8
  28. data/lib/klipbook/sources/kindle_device/entry.rb +8 -6
  29. data/lib/klipbook/sources/kindle_device/entry_parser.rb +66 -64
  30. data/lib/klipbook/sources/kindle_device/file.rb +45 -43
  31. data/lib/klipbook/sources/kindle_device/file_parser.rb +23 -21
  32. data/lib/klipbook/sources/source.rb +30 -0
  33. data/lib/klipbook/version.rb +1 -1
  34. data/lib/klipbook.rb +11 -11
  35. metadata +56 -113
  36. data/.document +0 -5
  37. data/.yardopts +0 -1
  38. data/Guardfile +0 -19
  39. data/features/fixtures/clippings-for-three-books.txt +0 -105
  40. data/features/list.feature +0 -31
  41. data/features/step_definitions/list_steps.rb +0 -15
  42. data/features/step_definitions/tohtml_steps.rb +0 -61
  43. data/features/step_definitions/tojson_steps.rb +0 -17
  44. data/features/support/env.rb +0 -16
  45. data/features/tohtml.feature +0 -51
  46. data/features/tojson.feature +0 -11
  47. data/lib/klipbook/colours.rb +0 -16
  48. data/lib/klipbook/commands/list_books.rb +0 -19
  49. data/lib/klipbook/commands/tohtml.rb +0 -17
  50. data/lib/klipbook/commands/tojson.rb +0 -18
  51. data/lib/klipbook/sources/invalid_source_error.rb +0 -12
  52. data/lib/klipbook/tohtml/html_printer.rb +0 -39
  53. data/lib/klipbook/tojson/book_file.rb +0 -58
  54. data/spec/lib/klipbook/commands/list_books_spec.rb +0 -43
  55. data/spec/lib/klipbook/commands/tohtml_spec.rb +0 -36
  56. data/spec/lib/klipbook/sources/book_spec.rb +0 -33
  57. data/spec/lib/klipbook/sources/kindle_device/entry_parser_spec.rb +0 -339
  58. data/spec/lib/klipbook/sources/kindle_device/file_parser_spec.rb +0 -68
  59. data/spec/lib/klipbook/sources/kindle_device/file_spec.rb +0 -163
  60. data/spec/lib/klipbook/tohtml/html_printer_spec.rb +0 -88
  61. data/spec/lib/klipbook/tojson/book_file_spec.rb +0 -76
  62. data/spec/spec_helper.rb +0 -7
metadata CHANGED
@@ -1,115 +1,73 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: klipbook
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.3
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ray Grasso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-25 00:00:00.000000000 Z
11
+ date: 2016-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: slop
14
+ name: commander
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '3.6'
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '3.6'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mechanize
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '2.7'
33
+ version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '2.7'
41
- - !ruby/object:Gem::Dependency
42
- name: rspec
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '3.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '3.0'
55
- - !ruby/object:Gem::Dependency
56
- name: jeweler
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '1.8'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '1.8'
69
- - !ruby/object:Gem::Dependency
70
- name: pry-byebug
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '1.3'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
38
+ - - ">="
81
39
  - !ruby/object:Gem::Version
82
- version: '1.3'
40
+ version: '0'
83
41
  - !ruby/object:Gem::Dependency
84
- name: cucumber
42
+ name: bundler
85
43
  requirement: !ruby/object:Gem::Requirement
86
44
  requirements:
87
- - - "~>"
45
+ - - ">="
88
46
  - !ruby/object:Gem::Version
89
- version: '1.3'
47
+ version: '0'
90
48
  type: :development
91
49
  prerelease: false
92
50
  version_requirements: !ruby/object:Gem::Requirement
93
51
  requirements:
94
- - - "~>"
52
+ - - ">="
95
53
  - !ruby/object:Gem::Version
96
- version: '1.3'
54
+ version: '0'
97
55
  - !ruby/object:Gem::Dependency
98
- name: aruba
56
+ name: rake
99
57
  requirement: !ruby/object:Gem::Requirement
100
58
  requirements:
101
- - - "~>"
59
+ - - ">="
102
60
  - !ruby/object:Gem::Version
103
- version: '0.6'
61
+ version: '0'
104
62
  type: :development
105
63
  prerelease: false
106
64
  version_requirements: !ruby/object:Gem::Requirement
107
65
  requirements:
108
- - - "~>"
66
+ - - ">="
109
67
  - !ruby/object:Gem::Version
110
- version: '0.6'
68
+ version: '0'
111
69
  - !ruby/object:Gem::Dependency
112
- name: guard
70
+ name: rspec
113
71
  requirement: !ruby/object:Gem::Requirement
114
72
  requirements:
115
73
  - - ">="
@@ -123,114 +81,99 @@ dependencies:
123
81
  - !ruby/object:Gem::Version
124
82
  version: '0'
125
83
  - !ruby/object:Gem::Dependency
126
- name: guard-rspec
84
+ name: pry-byebug
127
85
  requirement: !ruby/object:Gem::Requirement
128
86
  requirements:
129
- - - "~>"
87
+ - - ">="
130
88
  - !ruby/object:Gem::Version
131
- version: '4.3'
89
+ version: '0'
132
90
  type: :development
133
91
  prerelease: false
134
92
  version_requirements: !ruby/object:Gem::Requirement
135
93
  requirements:
136
- - - "~>"
94
+ - - ">="
137
95
  - !ruby/object:Gem::Version
138
- version: '4.3'
96
+ version: '0'
139
97
  - !ruby/object:Gem::Dependency
140
- name: guard-cucumber
98
+ name: cucumber
141
99
  requirement: !ruby/object:Gem::Requirement
142
100
  requirements:
143
- - - "~>"
101
+ - - ">="
144
102
  - !ruby/object:Gem::Version
145
- version: '1.4'
103
+ version: '0'
146
104
  type: :development
147
105
  prerelease: false
148
106
  version_requirements: !ruby/object:Gem::Requirement
149
107
  requirements:
150
- - - "~>"
108
+ - - ">="
151
109
  - !ruby/object:Gem::Version
152
- version: '1.4'
110
+ version: '0'
153
111
  - !ruby/object:Gem::Dependency
154
- name: terminal-notifier-guard
112
+ name: aruba
155
113
  requirement: !ruby/object:Gem::Requirement
156
114
  requirements:
157
- - - "~>"
115
+ - - ">="
158
116
  - !ruby/object:Gem::Version
159
- version: '1.5'
117
+ version: '0'
160
118
  type: :development
161
119
  prerelease: false
162
120
  version_requirements: !ruby/object:Gem::Requirement
163
121
  requirements:
164
- - - "~>"
122
+ - - ">="
165
123
  - !ruby/object:Gem::Version
166
- version: '1.5'
124
+ version: '0'
167
125
  description: Process your Kindle clippings file to generate a nicely formatted compilation
168
126
  of the clippings of the books you've read
169
- email: ray.grasso@gmail.com
127
+ email:
128
+ - ray.grasso@gmail.com
170
129
  executables:
171
130
  - klipbook
172
131
  extensions: []
173
- extra_rdoc_files:
174
- - LICENSE.txt
175
- - README.md
132
+ extra_rdoc_files: []
176
133
  files:
177
- - ".document"
134
+ - ".gitignore"
178
135
  - ".rspec"
179
136
  - ".ruby-version"
180
137
  - ".travis.yml"
181
- - ".yardopts"
182
138
  - CHANGELOG.txt
183
139
  - Gemfile
184
140
  - Gemfile.lock
185
- - Guardfile
186
141
  - LICENSE.txt
187
142
  - README.md
188
143
  - Rakefile
189
144
  - bin/klipbook
190
145
  - example.png
191
- - features/fixtures/clippings-for-three-books.txt
192
- - features/list.feature
193
- - features/step_definitions/list_steps.rb
194
- - features/step_definitions/tohtml_steps.rb
195
- - features/step_definitions/tojson_steps.rb
196
- - features/support/env.rb
197
- - features/tohtml.feature
198
- - features/tojson.feature
199
146
  - klipbook.gemspec
200
147
  - lib/klipbook.rb
201
- - lib/klipbook/colours.rb
202
- - lib/klipbook/commands/list_books.rb
203
- - lib/klipbook/commands/tohtml.rb
204
- - lib/klipbook/commands/tojson.rb
148
+ - lib/klipbook/cli.rb
149
+ - lib/klipbook/commands/command.rb
150
+ - lib/klipbook/commands/export.rb
151
+ - lib/klipbook/commands/exporters/exporter.rb
152
+ - lib/klipbook/commands/exporters/html_book_summary.erb
153
+ - lib/klipbook/commands/exporters/html_exporter.rb
154
+ - lib/klipbook/commands/exporters/json_exporter.rb
155
+ - lib/klipbook/commands/exporters/markdown_book_summary.erb
156
+ - lib/klipbook/commands/exporters/markdown_exporter.rb
157
+ - lib/klipbook/commands/list.rb
205
158
  - lib/klipbook/config.rb
159
+ - lib/klipbook/logger.rb
206
160
  - lib/klipbook/sources/amazon_site/book_scraper.rb
207
161
  - lib/klipbook/sources/amazon_site/site_scraper.rb
208
162
  - lib/klipbook/sources/book.rb
209
163
  - lib/klipbook/sources/clipping.rb
210
- - lib/klipbook/sources/invalid_source_error.rb
211
164
  - lib/klipbook/sources/kindle_device/entry.rb
212
165
  - lib/klipbook/sources/kindle_device/entry_parser.rb
213
166
  - lib/klipbook/sources/kindle_device/file.rb
214
167
  - lib/klipbook/sources/kindle_device/file_parser.rb
215
- - lib/klipbook/tohtml/html_book_summary.erb
216
- - lib/klipbook/tohtml/html_printer.rb
217
- - lib/klipbook/tojson/book_file.rb
168
+ - lib/klipbook/sources/source.rb
218
169
  - lib/klipbook/util/blank.rb
219
170
  - lib/klipbook/util/struct_to_json.rb
220
171
  - lib/klipbook/version.rb
221
- - spec/lib/klipbook/commands/list_books_spec.rb
222
- - spec/lib/klipbook/commands/tohtml_spec.rb
223
- - spec/lib/klipbook/sources/book_spec.rb
224
- - spec/lib/klipbook/sources/kindle_device/entry_parser_spec.rb
225
- - spec/lib/klipbook/sources/kindle_device/file_parser_spec.rb
226
- - spec/lib/klipbook/sources/kindle_device/file_spec.rb
227
- - spec/lib/klipbook/tohtml/html_printer_spec.rb
228
- - spec/lib/klipbook/tojson/book_file_spec.rb
229
- - spec/spec_helper.rb
230
172
  homepage: https://github.com/grassdog/klipbook
231
173
  licenses:
232
174
  - MIT
233
- metadata: {}
175
+ metadata:
176
+ allowed_push_host: https://rubygems.org
234
177
  post_install_message:
235
178
  rdoc_options: []
236
179
  require_paths:
@@ -247,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
247
190
  version: '0'
248
191
  requirements: []
249
192
  rubyforge_project:
250
- rubygems_version: 2.2.2
193
+ rubygems_version: 2.5.1
251
194
  signing_key:
252
195
  specification_version: 4
253
196
  summary: Klipbook creates a nice html summary of the clippings you've created on your
data/.document DELETED
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt
data/.yardopts DELETED
@@ -1 +0,0 @@
1
- -m markdown
data/Guardfile DELETED
@@ -1,19 +0,0 @@
1
-
2
- group 'specs' do
3
- guard 'rspec', :cmd => 'bundle exec rspec' do
4
- # Regexp watch patterns are matched with Regexp#match
5
- watch(%r{^spec/.+_spec\.rb$})
6
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
-
8
- watch('spec/spec_helper.rb') { "spec" }
9
- end
10
- end
11
-
12
- group 'cukes' do
13
- guard 'cucumber', :cli => '--tags ~@slow' do
14
- watch(%r{^features/.+\.feature$})
15
- watch(%r{^features/support/.+$}) { 'features' }
16
- watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
17
- end
18
- end
19
-
@@ -1,105 +0,0 @@
1
- Clean Code: A Handbook of Agile Software Craftsmanship (Robert C. Martin)
2
- - Highlight Loc. 4536-37 | Added on Tuesday, August 21, 2012, 09:32 PM
3
-
4
- Concurrency can sometimes improve performance, but only when there is a lot of wait time that can be shared between multiple threads or multiple processors. Neither situation is trivial.
5
- ==========
6
- Clean Code: A Handbook of Agile Software Craftsmanship (Robert C. Martin)
7
- - Note Loc. 4713 | Added on Tuesday, August 21, 2012, 09:43 PM
8
-
9
- Recommendations for developing concurrent systems
10
- ==========
11
- Clean Code: A Handbook of Agile Software Craftsmanship (Robert C. Martin)
12
- - Highlight Loc. 4745-46 | Added on Tuesday, August 21, 2012, 09:45 PM
13
-
14
- Things happen when the system switches between tasks. To encourage task swapping, run with more threads than processors or cores. The more frequently your tasks swap, the more likely you’ll encounter code that is missing a critical section or causes deadlock.
15
- ==========
16
- Instapaper: Long Reads (Instapaper: Long Reads)
17
- - Highlight Loc. 91-93 | Added on Sunday, April 24, 2011, 02:20 PM
18
-
19
- 3. Do not freeze work design into code! Leave as much work design as possible for work teams to determine and modify. If that is not possible, make sure that the people who will live with the new system are involved in the design of their work.
20
- ==========
21
- Instapaper: Long Reads (Instapaper: Long Reads)
22
- - Highlight Loc. 90-91 | Added on Sunday, April 24, 2011, 02:20 PM
23
-
24
- 2. Simplify before you automate. Never automate a work process until the work teams have devised as simple a work process as they possibly can. Automating the right thing is at least as important as automating it right.
25
- ==========
26
- Instapaper: Long Reads (Instapaper: Long Reads)
27
- - Highlight Loc. 150-51 | Added on Sunday, April 24, 2011, 02:25 PM
28
-
29
- Roll-in of progressive change They started off with small teams (4 people in the beginning) so not a big bang approach. 
30
- ==========
31
- Instapaper: Long Reads (Instapaper: Long Reads)
32
- - Highlight Loc. 167-72 | Added on Sunday, April 24, 2011, 02:28 PM
33
-
34
- What is management’s role? The hardest part is working with managers and helping them see their new role.  Their role becomes understanding demand, thinking outside in, engage staff, walk the process, allow staff to experiment with design and evaluate etc.  Previously managers used to be specialists at solving tricky decisions, but now they have to become a specialist in training (moving from ‘disablers’ to ‘enablers).  They now need to create conditions that enable workers to reach their goals.  They need to support and encourage the initiative of the workers.  They need to ensure that the process / initiative is end to end.  Also, building agreement with others outside the process.
35
- ==========
36
- Lean Software Development: An Agile Toolkit (Mary Poppendieck and Tom Poppendieck)
37
- - Highlight Loc. 921-23 | Added on Monday, April 25, 2011, 09:18 AM
38
-
39
- Your objective should be to balance experimentation with deliberation and review. In order to do this, consider how you can generate the most knowledge at the least cost in your circumstances.
40
- ==========
41
- Lean Software Development: An Agile Toolkit (Mary Poppendieck and Tom Poppendieck)
42
- - Highlight Loc. 930-32 | Added on Monday, April 25, 2011, 01:10 PM
43
-
44
- There are many ways to represent the system, from models to prototypes, to incremental deliveries, but the important thing is to select the representation that gathers the most knowledge. Most users relate better to seeing working screens than to a requirements document, so working software tends to generate better knowledge faster.
45
- ==========
46
- Lean Software Development: An Agile Toolkit (Mary Poppendieck and Tom Poppendieck)
47
- - Highlight Loc. 1035-44 | Added on Monday, April 25, 2011, 01:21 PM
48
-
49
- In most cases, increasing feedback, not decreasing it, is the single most effective way to deal with troubled software development projects and environments. Instead of letting defects accumulate, run tests as soon as the code is written. Instead of adding more documentation or detailed planning, try checking out ideas by writing code. Instead of gathering more requirements from users, show them an assortment of potential user screens and get their input. Instead of studying more carefully which tool to use, bring the top three candidates inhouse and test them. Instead of trying to figure out how to convert an entire system in a single massive effort, create a Web front end to the legacy system and try the new idea out.
50
- ==========
51
- Lean Software Development: An Agile Toolkit (Mary Poppendieck and Tom Poppendieck)
52
- - Highlight Loc. 1066-67 | Added on Monday, April 25, 2011, 01:24 PM
53
-
54
- One reason just-in-time flow is so effective is that it requires significantly improved worker-to-worker communication and surfaces quality problems as soon as they occur.
55
- ==========
56
- Lean Software Development: An Agile Toolkit (Mary Poppendieck and Tom Poppendieck)
57
- - Highlight Loc. 1074-77 | Added on Monday, April 25, 2011, 01:28 PM
58
-
59
- An iteration is a useful increment of software that is designed, programmed, tested, integrated, and delivered during a short, fixed timeframe. It is very similar to a prototype in product development except that an iteration produces a working portion of the final product. This software will be improved in future iterations, but it is working, tested, integrated code from the beginning.
60
- ==========
61
- Lean Software Development: An Agile Toolkit (Mary Poppendieck and Tom Poppendieck)
62
- - Highlight Loc. 1180-81 | Added on Monday, April 25, 2011, 02:34 PM
63
-
64
- A Standish Group study found that 45 percent of features in a typical system are never used and 19 percent are rarely used.
65
- ==========
66
- Lean Software Development: An Agile Toolkit (Mary Poppendieck and Tom Poppendieck)
67
- - Highlight Loc. 1359-62 | Added on Tuesday, April 26, 2011, 08:34 AM
68
-
69
- When you have a difficult problem, try this: Develop a set of alternative solutions to a problem, see how well they actually work, and then merge the best features of the solutions or choose one of the alternatives. It might seem wasteful to develop multiple solutions to the same problem, but set-based development can lead to better solutions faster,
70
- ==========
71
- Lean Software Development: An Agile Toolkit (Mary Poppendieck and Tom Poppendieck)
72
- - Bookmark Loc. 1364 | Added on Tuesday, April 26, 2011, 08:36 AM
73
-
74
-
75
- ==========
76
- Lean Software Development: An Agile Toolkit (Mary Poppendieck and Tom Poppendieck)
77
- - Highlight Loc. 1392-93 | Added on Tuesday, April 26, 2011, 08:42 AM
78
-
79
- Set-based development means that you communicate constraints, not solutions.
80
- ==========
81
- Lean Software Development: An Agile Toolkit (Mary Poppendieck and Tom Poppendieck)
82
- - Highlight Loc. 1535-36 | Added on Tuesday, April 26, 2011, 08:59 AM
83
-
84
- This presents us with a new category of waste: waste caused by software that is difficult to change.
85
- ==========
86
- Lean Software Development: An Agile Toolkit (Mary Poppendieck and Tom Poppendieck)
87
- - Highlight Loc. 1586-88 | Added on Tuesday, April 26, 2011, 09:10 AM
88
-
89
- Lean software development emphasizes developing a robust, change-tolerant design, one that accepts the inevitability of change and structures the system so that it can be readily adapted to the most likely kinds of changes.
90
- ==========
91
- Lean Software Development: An Agile Toolkit (Mary Poppendieck and Tom Poppendieck)
92
- - Highlight Loc. 1588-89 | Added on Tuesday, April 26, 2011, 09:11 AM
93
-
94
- The main reason software changes throughout its lifecycle is that the business process in which it is used evolves over time.
95
- ==========
96
- Lean Software Development: An Agile Toolkit (Mary Poppendieck and Tom Poppendieck)
97
- - Highlight Loc. 1627-28 | Added on Tuesday, April 26, 2011, 09:19 AM
98
-
99
- the underlying economic mechanism for controlling complexity in just-in-time systems is minimizing irreversible actions.
100
- ==========
101
- Lean Software Development: An Agile Toolkit (Mary Poppendieck and Tom Poppendieck)
102
- - Highlight Loc. 1722-23 | Added on Tuesday, April 26, 2011, 09:48 AM
103
-
104
- Good design is a discovery process, done through short, repeated exploratory cycles.
105
- ==========
@@ -1,31 +0,0 @@
1
- Feature: klipbook lists the books in a clipping file
2
- As an avid reader and note taker
3
- I want to be shown an indexed list of books
4
- So that I can see which books are available for collation
5
-
6
- Scenario: Empty file
7
- Given I have a clippings file "input.txt" that contains no clippings
8
- When I list "1" books in the file "input.txt"
9
- Then the output should contain "No books available"
10
- And the exit status should be 0
11
-
12
- Scenario: File with one book
13
- Given a file that contains clippings for 3 books called "input.txt"
14
- When I list "5" books in the file "input.txt"
15
- Then the output should contain "[1] Clean Code: A Handbook of Agile Software Craftsmanship by Robert C. Martin"
16
- Then the output should contain "[2] Lean Software Development: An Agile Toolkit by Mary Poppendieck and Tom Poppendieck"
17
- Then the output should contain "[3] Instapaper: Long Reads by Instapaper: Long Reads"
18
- And the exit status should be 0
19
-
20
- Scenario: File with one book
21
- Given a file that contains clippings for 3 books called "input.txt"
22
- When I list "5" books in the file "input.txt"
23
- Then the output should match /\[1\] .+ by .+/
24
- And the exit status should be 0
25
-
26
- @slow
27
- Scenario: Site with one book
28
- When I list "1" books from the kindle site
29
- Then the output should match /\[1\] .+ by .+/
30
- And the exit status should be 0
31
-
@@ -1,15 +0,0 @@
1
-
2
- Given /^I have a clippings file "([^"]*)" that contains no clippings$/ do |input_file|
3
- in_current_dir do
4
- FileUtils.touch(input_file)
5
- end
6
- end
7
-
8
- When /^I list "([^"]*)" books in the file "([^"]*)"$/ do |book_count, input_file|
9
- run_simple(unescape("klipbook list -n #{book_count} -i #{input_file}"), false)
10
- end
11
-
12
- # FIXME This step currently assumes you have site: set up in your klipbookrc
13
- When /^I list "([^"]*)" books from the kindle site$/ do |book_count|
14
- run_simple(unescape("klipbook list -n #{book_count}"), false)
15
- end
@@ -1,61 +0,0 @@
1
- CLIPPING_FILE = File.join(File.dirname(__FILE__), '../fixtures/clippings-for-three-books.txt')
2
-
3
- Given /^a file in "([^"]*)" named "([^"]*)"$/ do |output_dir, file_name|
4
- in_current_dir { FileUtils.touch(File.join(output_dir, file_name)) }
5
- end
6
-
7
- Given /^there is not a directory named "([^"]*)"$/ do |directory_name|
8
- in_current_dir do
9
- FileUtils.rm_f(directory_name)
10
- end
11
- end
12
-
13
- Given /^a file that contains clippings for 3 books called "([^"]*)"$/ do |file_name|
14
- in_current_dir { FileUtils.cp(CLIPPING_FILE, file_name) }
15
- end
16
-
17
- When /^I tohtml clippings for "([^"]*)" books from the file "([^"]*)" to the output directory "([^"]*)"$/ do |book_count, input_file, output_dir|
18
- run_tohtml_file(book_count, output_dir, input_file, false)
19
- end
20
-
21
- When /^I tohtml clippings for "([^"]*)" books from the file "([^"]*)" to the output directory "([^"]*)" forcefully$/ do |book_count, input_file, output_dir|
22
- run_tohtml_file(book_count, output_dir, input_file, true)
23
- end
24
-
25
- Then /^I should find a file in the folder "([^"]*)" named "([^"]*)" that contains "([^"]*)" clippings$/ do |output_folder, file_name, clipping_count|
26
- in_current_dir do
27
- file_path = File.join(output_folder, file_name)
28
- expect(File.exists?(file_path)).to be_truthy
29
- File.open(file_path, 'r') do |f|
30
- expect(f.read).to match(/<footer>\s+#{clipping_count} clippings &bull;/m)
31
- end
32
- end
33
- end
34
-
35
- # FIXME This step currently assumes you have site: set up in your klipbookrc
36
- When /^I tohtml clippings for "([^"]*)" books from the kindle site to the output directory "([^"]*)"$/ do |book_count, output_dir|
37
- run_simple(unescape("klipbook tohtml -n #{book_count} -o #{output_dir}"), false)
38
- end
39
-
40
- Then /^I should find "([^"]*)" html files containing clippings in the directory "([^"]*)"$/ do |file_count, output_dir|
41
- in_current_dir do
42
- files = Dir['output/*.html']
43
- expect(files.size).to eq(file_count.to_i)
44
- files.each do |fname|
45
- File.open(fname, 'r') do |f|
46
- expect(f.read).to match(/<footer>\s+\d+ clippings &bull;/m)
47
- end
48
- end
49
- end
50
- end
51
-
52
- def run_tohtml_file(book_count, output, input, force=false)
53
- force_str = if force
54
- '-f'
55
- else
56
- ''
57
- end
58
-
59
- run_simple(unescape("klipbook tohtml -n #{book_count} #{force_str} -o #{output} -i #{input}"), false)
60
- end
61
-
@@ -1,17 +0,0 @@
1
-
2
- When /^I tojson clippings for "([^"]*)" books from the file "([^"]*)" to the output file "([^"]*)"$/ do |book_count, input_file, output_file|
3
- run_tojson(book_count, output_file, input_file)
4
- end
5
-
6
- Then /^I should find a file called "([^"]*)" that contains "([^"]*)"$/ do |output_file, expected_text|
7
- in_current_dir do
8
- expect(File.exists?(output_file)).to be_truthy
9
- File.open(output_file, 'r') do |f|
10
- expect(f.read).to match(/#{expected_text}/m)
11
- end
12
- end
13
- end
14
-
15
- def run_tojson(book_count, output_file, input_file)
16
- run_simple(unescape("klipbook tojson -n #{book_count} -o #{output_file} -i #{input_file}"), false)
17
- end
@@ -1,16 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler/setup'
3
-
4
- require 'aruba/cucumber'
5
-
6
- $LOAD_PATH << File.expand_path('../../../lib', __FILE__)
7
- require 'klipbook'
8
- require 'fileutils'
9
-
10
- Before do
11
- @aruba_timeout_seconds = 40
12
- end
13
-
14
- Before('@slow') do
15
- @aruba_io_wait_seconds = 40
16
- end
@@ -1,51 +0,0 @@
1
- Feature: klipbook outputs the clippings from a clippings file into a set of HTML files
2
- As an avid reader and note taker
3
- I want to see a pretty html summary for each of the books that I've read
4
- So that I can refer to a nice summary of passages I enjoyed in the book
5
-
6
- Scenario: File with clippings for a book
7
- Given a directory named "output"
8
- And a file that contains clippings for 3 books called "input.txt"
9
- When I tohtml clippings for "3" books from the file "input.txt" to the output directory "output"
10
- Then I should find a file in the folder "output" named "Lean Software Development: An Agile Toolkit by Mary Poppendieck and Tom Poppendieck.html" that contains "13" clippings
11
- Then I should find a file in the folder "output" named "Instapaper: Long Reads by Instapaper: Long Reads.html" that contains "4" clippings
12
- Then I should find a file in the folder "output" named "Clean Code: A Handbook of Agile Software Craftsmanship by Robert C. Martin.html" that contains "3" clippings
13
- And the exit status should be 0
14
-
15
- Scenario: Attempting to write to an existing file
16
- Given a directory named "output"
17
- And a file in "output" named "Clean Code: A Handbook of Agile Software Craftsmanship by Robert C. Martin.html"
18
- And a file that contains clippings for 3 books called "input.txt"
19
- When I tohtml clippings for "3" books from the file "input.txt" to the output directory "output"
20
- Then the output should contain "Skipping Clean Code: A Handbook of Agile Software Craftsmanship by Robert C. Martin.html"
21
- And the exit status should be 0
22
-
23
- Scenario: Force overwrite of an existing file
24
- Given a directory named "output"
25
- And a file in "output" named "Clean Code: A Handbook of Agile Software Craftsmanship by Robert C. Martin.html"
26
- And a file that contains clippings for 3 books called "input.txt"
27
- When I tohtml clippings for "3" books from the file "input.txt" to the output directory "output" forcefully
28
- Then the output should contain "Writing Clean Code: A Handbook of Agile Software Craftsmanship by Robert C. Martin.html"
29
- And the exit status should be 0
30
-
31
- Scenario: Attempt to write with a bad number of books
32
- Given a directory named "output"
33
- And a file that contains clippings for 3 books called "input.txt"
34
- When I tohtml clippings for "notanumber" books from the file "input.txt" to the output directory "output"
35
- Then the output should contain "Error: Specify a number of books greater than 0"
36
- And the exit status should be 127
37
-
38
- Scenario: Attempt to write to a non-existent directory
39
- Given there is not a directory named "output"
40
- And a file that contains clippings for 3 books called "input.txt"
41
- When I tohtml clippings for "3" books from the file "input.txt" to the output directory "output"
42
- Then the output should contain "Error: Outdir does not exist."
43
- And the exit status should be 127
44
-
45
- @slow
46
- Scenario: Site with clippings for a book
47
- Given a directory named "output"
48
- When I tohtml clippings for "1" books from the kindle site to the output directory "output"
49
- Then I should find "1" html files containing clippings in the directory "output"
50
- And the exit status should be 0
51
-
@@ -1,11 +0,0 @@
1
- Feature: klipbook outputs clippings from a clippings file into a JSON file
2
- As an avid reader and note taker
3
- I want to see a single JSON file collating the clippings of the books that I've read
4
- So that I can export them to other tools for my enjoyment
5
-
6
- Scenario: File with clippings for a book
7
- Given a file that contains clippings for 3 books called "input.txt"
8
- When I tojson clippings for "3" books from the file "input.txt" to the output file "books.json"
9
- Then I should find a file called "books.json" that contains "Lean Software Development: An Agile Toolkit"
10
- And the exit status should be 0
11
-
@@ -1,16 +0,0 @@
1
- module Colours
2
- GREEN = "\033[32m"
3
- YELLOW = "\033[33m"
4
-
5
- def self.green(message)
6
- colorize(message, GREEN)
7
- end
8
-
9
- def self.yellow(message)
10
- colorize(message, YELLOW)
11
- end
12
-
13
- def self.colorize(message, color)
14
- "#{color}#{message}\033[0m"
15
- end
16
- end