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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f132dad97344e2d4aa75b9ebdb0e10be4e983e8e
4
- data.tar.gz: f38310d3b68338bc0f4f2b033ec4da4e5ba7388b
3
+ metadata.gz: 307a672f1458f7fc37543aaa4157b70bc247086d
4
+ data.tar.gz: 8c1586619868e3517043d4ec610165dd22802ef9
5
5
  SHA512:
6
- metadata.gz: d9febc14521644a805b71423c7bd7a07964575ea3a5f4bc0631e087ef51c062a5729851ad39eac0c24285dc904f1690af0fdc6b9e82784dd5361a42dc5744c8e
7
- data.tar.gz: 3ad42a80ada1ebd515e1fd8d20839276f43f43902376075466d092f6f0bedd47dbd8329d8e44529e22822842363cc85737b5521450f2c7934b4b0152c341deef
6
+ metadata.gz: f67d8ceefa6a239fb61c3df9319c5ab5aceb85474a4edb0520975ded47f3c7f5d33a38287c854dd57345e459c239c5bc5aa2554939268a9031ca86924313a84b
7
+ data.tar.gz: 195d8294a0d2fdbf8b6f176f6314b0f478eacac11c768c9965bdec4134e2afa088416722c904c4cf35ff2a2a5eab15010d63853c4cff4558bdf9e53b00b036f3
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /vendor/
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.1.2
1
+ 2.3.1
data/.travis.yml CHANGED
@@ -1,3 +1,3 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.0.0
3
+ - 2.3.1
data/CHANGELOG.txt CHANGED
@@ -1,3 +1,14 @@
1
+ == 3.0.0 / 2016-09-18
2
+
3
+ * Feature Changes
4
+
5
+ * Added markdown as an export format.
6
+
7
+ * Breaking changes
8
+
9
+ * Changed command flags to make things more consistent.
10
+ * Changed JSON export to export into individual files rather than a single file. Again for consistency with other export formats.
11
+
1
12
  == 2.1.3 / 2014-07-25
2
13
 
3
14
  * Minor changes
data/Gemfile CHANGED
@@ -1,16 +1,3 @@
1
- source 'http://rubygems.org'
1
+ source 'https://rubygems.org'
2
2
 
3
- gem 'slop', '~> 3.6'
4
- gem 'mechanize', '~> 2.7'
5
-
6
- group :development do
7
- gem 'rspec', '~> 3.0'
8
- gem 'jeweler', '~> 1.8'
9
- gem 'pry-byebug', '~> 1.3'
10
- gem 'cucumber', '~> 1.3'
11
- gem 'aruba', '~> 0.6'
12
- gem 'guard'
13
- gem 'guard-rspec', '~> 4.3'
14
- gem 'guard-cucumber', '~> 1.4'
15
- gem 'terminal-notifier-guard', '~> 1.5'
16
- end
3
+ gemspec
data/Gemfile.lock CHANGED
@@ -1,149 +1,109 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ klipbook (3.0.0)
5
+ commander
6
+ mechanize
7
+
1
8
  GEM
2
- remote: http://rubygems.org/
9
+ remote: https://rubygems.org/
3
10
  specs:
4
- addressable (2.3.6)
5
- aruba (0.6.0)
6
- childprocess (>= 0.3.6)
7
- cucumber (>= 1.1.1)
8
- rspec-expectations (>= 2.7.0)
11
+ aruba (0.14.2)
12
+ childprocess (~> 0.5.6)
13
+ contracts (~> 0.9)
14
+ cucumber (>= 1.3.19)
15
+ ffi (~> 1.9.10)
16
+ rspec-expectations (>= 2.99)
17
+ thor (~> 0.19)
9
18
  builder (3.2.2)
10
- byebug (2.7.0)
11
- columnize (~> 0.3)
12
- debugger-linecache (~> 1.2)
13
- celluloid (0.15.2)
14
- timers (~> 1.1.0)
15
- childprocess (0.5.3)
19
+ byebug (9.0.5)
20
+ childprocess (0.5.9)
16
21
  ffi (~> 1.0, >= 1.0.11)
17
- coderay (1.1.0)
18
- columnize (0.8.9)
19
- cucumber (1.3.15)
22
+ coderay (1.1.1)
23
+ commander (4.4.0)
24
+ highline (~> 1.7.2)
25
+ contracts (0.14.0)
26
+ cucumber (2.4.0)
20
27
  builder (>= 2.1.2)
28
+ cucumber-core (~> 1.5.0)
29
+ cucumber-wire (~> 0.0.1)
21
30
  diff-lcs (>= 1.1.3)
22
- gherkin (~> 2.12)
31
+ gherkin (~> 4.0)
23
32
  multi_json (>= 1.7.5, < 2.0)
24
- multi_test (>= 0.1.1)
25
- debugger-linecache (1.2.0)
33
+ multi_test (>= 0.1.2)
34
+ cucumber-core (1.5.0)
35
+ gherkin (~> 4.0)
36
+ cucumber-wire (0.0.1)
26
37
  diff-lcs (1.2.5)
27
- domain_name (0.5.19)
38
+ domain_name (0.5.20160826)
28
39
  unf (>= 0.0.5, < 1.0.0)
29
- faraday (0.8.9)
30
- multipart-post (~> 1.2.0)
31
- ffi (1.9.3)
32
- formatador (0.2.5)
33
- gherkin (2.12.2)
34
- multi_json (~> 1.3)
35
- git (1.2.7)
36
- github_api (0.10.1)
37
- addressable
38
- faraday (~> 0.8.1)
39
- hashie (>= 1.2)
40
- multi_json (~> 1.4)
41
- nokogiri (~> 1.5.2)
42
- oauth2
43
- guard (2.6.1)
44
- formatador (>= 0.2.4)
45
- listen (~> 2.7)
46
- lumberjack (~> 1.0)
47
- pry (>= 0.9.12)
48
- thor (>= 0.18.1)
49
- guard-cucumber (1.4.1)
50
- cucumber (>= 1.2.0)
51
- guard (>= 1.1.0)
52
- guard-rspec (4.3.1)
53
- guard (~> 2.1)
54
- rspec (>= 2.14, < 4.0)
55
- hashie (3.2.0)
56
- highline (1.6.21)
40
+ ffi (1.9.14)
41
+ gherkin (4.0.0)
42
+ highline (1.7.8)
57
43
  http-cookie (1.0.2)
58
44
  domain_name (~> 0.5)
59
- jeweler (1.8.8)
60
- builder
61
- bundler (~> 1.0)
62
- git (>= 1.2.5)
63
- github_api (= 0.10.1)
64
- highline (>= 1.6.15)
65
- nokogiri (= 1.5.10)
66
- rake
67
- rdoc
68
- json (1.8.1)
69
- jwt (1.0.0)
70
- listen (2.7.9)
71
- celluloid (>= 0.15.2)
72
- rb-fsevent (>= 0.9.3)
73
- rb-inotify (>= 0.9)
74
- lumberjack (1.0.9)
75
- mechanize (2.7.3)
45
+ mechanize (2.7.5)
76
46
  domain_name (~> 0.5, >= 0.5.1)
77
47
  http-cookie (~> 1.0)
78
- mime-types (~> 2.0)
48
+ mime-types (>= 1.17.2)
79
49
  net-http-digest_auth (~> 1.1, >= 1.1.1)
80
50
  net-http-persistent (~> 2.5, >= 2.5.2)
81
- nokogiri (~> 1.4)
51
+ nokogiri (~> 1.6)
82
52
  ntlm-http (~> 0.1, >= 0.1.1)
83
53
  webrobots (>= 0.0.9, < 0.2)
84
54
  method_source (0.8.2)
85
- mime-types (2.3)
86
- multi_json (1.10.1)
87
- multi_test (0.1.1)
88
- multi_xml (0.5.5)
89
- multipart-post (1.2.0)
55
+ mime-types (3.1)
56
+ mime-types-data (~> 3.2015)
57
+ mime-types-data (3.2016.0521)
58
+ mini_portile2 (2.1.0)
59
+ multi_json (1.12.1)
60
+ multi_test (0.1.2)
90
61
  net-http-digest_auth (1.4)
91
62
  net-http-persistent (2.9.4)
92
- nokogiri (1.5.10)
63
+ nokogiri (1.6.8)
64
+ mini_portile2 (~> 2.1.0)
65
+ pkg-config (~> 1.1.7)
93
66
  ntlm-http (0.1.1)
94
- oauth2 (1.0.0)
95
- faraday (>= 0.8, < 0.10)
96
- jwt (~> 1.0)
97
- multi_json (~> 1.3)
98
- multi_xml (~> 0.5)
99
- rack (~> 1.2)
100
- pry (0.10.0)
67
+ pkg-config (1.1.7)
68
+ pry (0.10.4)
101
69
  coderay (~> 1.1.0)
102
70
  method_source (~> 0.8.1)
103
71
  slop (~> 3.4)
104
- pry-byebug (1.3.3)
105
- byebug (~> 2.7)
72
+ pry-byebug (3.4.0)
73
+ byebug (~> 9.0)
106
74
  pry (~> 0.10)
107
- rack (1.5.2)
108
75
  rake (10.3.2)
109
- rb-fsevent (0.9.4)
110
- rb-inotify (0.9.5)
111
- ffi (>= 0.5.0)
112
- rdoc (4.1.1)
113
- json (~> 1.4)
114
- rspec (3.0.0)
115
- rspec-core (~> 3.0.0)
116
- rspec-expectations (~> 3.0.0)
117
- rspec-mocks (~> 3.0.0)
118
- rspec-core (3.0.3)
119
- rspec-support (~> 3.0.0)
120
- rspec-expectations (3.0.3)
76
+ rspec (3.5.0)
77
+ rspec-core (~> 3.5.0)
78
+ rspec-expectations (~> 3.5.0)
79
+ rspec-mocks (~> 3.5.0)
80
+ rspec-core (3.5.3)
81
+ rspec-support (~> 3.5.0)
82
+ rspec-expectations (3.5.0)
121
83
  diff-lcs (>= 1.2.0, < 2.0)
122
- rspec-support (~> 3.0.0)
123
- rspec-mocks (3.0.3)
124
- rspec-support (~> 3.0.0)
125
- rspec-support (3.0.3)
84
+ rspec-support (~> 3.5.0)
85
+ rspec-mocks (3.5.0)
86
+ diff-lcs (>= 1.2.0, < 2.0)
87
+ rspec-support (~> 3.5.0)
88
+ rspec-support (3.5.0)
126
89
  slop (3.6.0)
127
- terminal-notifier-guard (1.5.3)
128
90
  thor (0.19.1)
129
- timers (1.1.0)
130
91
  unf (0.1.4)
131
92
  unf_ext
132
- unf_ext (0.0.6)
133
- webrobots (0.1.1)
93
+ unf_ext (0.0.7.2)
94
+ webrobots (0.1.2)
134
95
 
135
96
  PLATFORMS
136
97
  ruby
137
98
 
138
99
  DEPENDENCIES
139
- aruba (~> 0.6)
140
- cucumber (~> 1.3)
141
- guard
142
- guard-cucumber (~> 1.4)
143
- guard-rspec (~> 4.3)
144
- jeweler (~> 1.8)
145
- mechanize (~> 2.7)
146
- pry-byebug (~> 1.3)
147
- rspec (~> 3.0)
148
- slop (~> 3.6)
149
- terminal-notifier-guard (~> 1.5)
100
+ aruba
101
+ bundler
102
+ cucumber
103
+ klipbook!
104
+ pry-byebug
105
+ rake
106
+ rspec
107
+
108
+ BUNDLED WITH
109
+ 1.12.4
data/LICENSE.txt CHANGED
@@ -1,20 +1,21 @@
1
- Copyright (c) 2013 Ray Grasso
1
+ The MIT License (MIT)
2
2
 
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
3
+ Copyright (c) 2016 Ray Grasso
10
4
 
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
13
11
 
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -3,118 +3,115 @@
3
3
  [![Build Status](https://travis-ci.org/grassdog/klipbook.png)](https://travis-ci.org/grassdog/klipbook)
4
4
 
5
5
  Klipbook takes the highlights and notes that you've created on your Kindle and
6
- outputs them into nice html or JSON.
6
+ outputs them into nice HTML, Markdown, or JSON.
7
7
 
8
- ## An example of a html clippings file generated by Klipbook
8
+ ## An example of a HTML clippings file generated by Klipbook
9
9
 
10
10
  <img src="https://github.com/grassdog/klipbook/raw/master/example.png" alt="Example
11
11
  of a clippings file" />
12
12
 
13
13
  ## What sources does it support?
14
14
 
15
- Klipbook can take your highlights from a clippings file off a physical Kindle device
16
- or from the [Kindle highlights site](https://kindle.amazon.com/your_highlights)
17
- itself.
15
+ Klipbook can take your highlights from a clippings file off a physical Kindle device or from the [Kindle highlights site](https://kindle.amazon.com/your_highlights) itself.
18
16
 
19
- ## When should I use the file and when should I use the site?
17
+ ### When should I use the file and when should I use the site?
20
18
 
21
- If your books are purchased from Amazon directly then use the site. The site is the
22
- canonical source and will contain all of your notes and highlights from across all of
23
- your Kindle devices and applications. Currently the Amazon highlights site only shows
24
- clippings for books you've purchased on Amazon.
19
+ If your books are purchased from Amazon directly then use the site. The site is the canonical source and will contain all of your notes and highlights from across all of your Kindle devices and applications. Currently the Amazon highlights site only shows clippings for books you've purchased on Amazon.
25
20
 
26
- If your books are personal documents and you've read them on your Kindle device
27
- itself then you should use the file from that device as a source i.e. your Kindle
28
- device only keeps clippings that you made directly on it.
21
+ If your books are personal documents and you've read them on your Kindle device itself then you should use the file from that device as a source i.e. your Kindle device only keeps clippings that you make directly on it.
29
22
 
30
23
  ## How does it work?
31
24
 
32
- Klipbook supports three commands: `list`, `tohtml`, and `tojson`.
25
+ Klipbook supports two commands: `list` and `export`.
33
26
 
34
- ### To HTML
27
+ `list` shows the books in the specified source and `export` exports books to a different format.
35
28
 
36
- `tohtml` retrieves the clippings from your latest annotated books and writes them
37
- out into a pretty html file for each book.
29
+ ## Specifying an Input Source
38
30
 
39
- #### From a file
31
+ Both commands require you to specify the source of your clippings.
40
32
 
41
- Copy your clippings file (called "My Clippings.txt" on a 3rd generation Kindle) from
42
- your Kindle device to your local drive via USB.
33
+ ### Reading from a clippings file
43
34
 
44
- Then write out a list of your clippings via:
35
+ Copy your clippings file (called "My Clippings.txt" on a 3rd generation Kindle) from your Kindle device to your local drive via USB.
36
+
37
+ Then specify the path to your clippings via:
45
38
 
46
39
  ```sh
47
- $ klipbook tohtml -i "My Clippings.txt"
40
+ $ klipbook --from-file "My Clippings.txt"
48
41
  ```
49
42
 
50
- This command will write the collected clippings for the latest annotated book to a
51
- file in the current directory. You can override the output directory with the
52
- `--outdir` switch.
43
+ ### Reading from the highlights site
53
44
 
54
- You can also specify a maximum count of books you'd like collated with the
55
- `--number` switch.
45
+ Specify your Amazon credentials to klipbook and it will scrape the site and output a clippings file.
56
46
 
57
- Klipbook will not overwrite an exiting file by default. You can change this with the
58
- `--force` flag.
47
+ ```sh
48
+ $ klipbook --from-site my-username@blah.com:my-password
49
+ ```
59
50
 
60
- #### From the site
51
+ Note that the scraping requires a network connection (obviously) and can take a while so please be patient.
61
52
 
62
- Specify your Amazon credentials to klipbook and it will scrape the site and
63
- output a clippings file.
53
+ ## List
54
+
55
+ The `list` command lists the books available in the specified source.
64
56
 
65
57
  ```sh
66
- $ klipbook tohtml -c my-username@blah.com:my-password
58
+ $ klipbook list --from-file "My Clippings.txt"
59
+
60
+ Book list:
61
+ [1] The Big Sleep by Raymond Chandler
62
+ [2] How to jump out of a plane without a parachute and survive by Rip Rockjaw
67
63
  ```
68
64
 
69
- The same flags above apply.
65
+ By default it will only list the latest book. This can be overrided with the `--count` switch.
70
66
 
71
- Note that the scraping requires a network connection (obviously) and can take a while
72
- so please be patient.
67
+ ## Export
73
68
 
74
- ### Set up defaults
69
+ `export` reads the clippings from your source and writes them out in the specified format.
75
70
 
76
- If you don't feel like having your Amazon credentials in your shell history you can
77
- set your default source in the klipbook rc file: `~/.klipbookrc`.
71
+ You can specify the directory to export into with the `--output-dir` switch. This defaults to the current directory.
78
72
 
79
- This is simply a YAML file and you can specify default values for the source and the
80
- output directory, e.g.
73
+ You can also specify a maximum number of books you'd like exported with the `--count` switch.
81
74
 
82
- ```sh
83
- $ cat ~/.klipbookrc
75
+ Klipbook will not overwrite an exiting file by default. You can change this with the `--force` flag.
84
76
 
85
- :credentials: my-username@blah.com:my-password
86
- :outdir: /path/to/my/default/output/directory
87
- ```
77
+ ### Export to Html
88
78
 
89
- Command line options override the defaults stored in the rc file.
79
+ You can export clippings into a pretty html file for each book.
80
+
81
+ ```sh
82
+ $ klipbook export ---from-file "My Clippings.txt" --output-format html
83
+ ```
90
84
 
91
- ### List
85
+ ### Export to JSON
92
86
 
93
- The `list` command lists the books available in the specified source.
87
+ You can export clippings into a JSON file for each book.
94
88
 
95
89
  ```sh
96
- $ klipbook list -i "My Clippings.txt"
90
+ $ klipbook export --from-file "My Clippings.txt" --output-format json
91
+ ```
97
92
 
98
- Book list:
99
- [1] The Big Sleep by Raymond Chandler
100
- [2] How to jump out of a plane without a parachute and survive by Rip Rockjaw
93
+ ### Export to Markdown
94
+
95
+ You can export clippings into a markdown file for each book.
96
+
97
+ ```sh
98
+ $ klipbook export --from-file "My Clippings.txt" --output-format markdown
101
99
  ```
102
100
 
103
- By default it will only list the latest book. This can be overrided with the
104
- `--number` switch.
101
+ ## Set defaults
105
102
 
106
- ### To JSON
103
+ If you don't feel like having your Amazon credentials in your shell history you can set your default source in the klipbook rc file: `~/.klipbookrc`.
107
104
 
108
- `tojson` pulls together the clippings from your latest annotated books and combines
109
- them into a single JSON file.
105
+ This is a YAML file and you can specify default values for the source and the output directory (note the use of snake case) e.g.
110
106
 
111
107
  ```sh
112
- $ klipbook tojson -i "My Clippings.txt" -o books.json
108
+ $ cat ~/.klipbookrc
109
+
110
+ :from_site: my-username@blah.com:my-password
111
+ :output_dir: /path/to/my/default/output/directory
113
112
  ```
114
113
 
115
- You can rerun tojson on an existing JSON file to add new books. By default existing
116
- books in the JSON file will not be overwritten. This can be changed with the `--force`
117
- flag.
114
+ Command line options override the defaults stored in the rc file.
118
115
 
119
116
  ## Installation
120
117
 
@@ -126,19 +123,16 @@ $ gem install klipbook
126
123
 
127
124
  ## Supported Devices
128
125
 
129
- Klipbook has been tested on clippings files from 3rd generation Kindles and the
130
- Kindle Touch.
126
+ Klipbook has been tested on clippings files from 3rd generation Kindles and the Kindle Touch.
131
127
 
132
128
  ## Tested platforms
133
129
 
134
- Klipbook has been tested on Mac OSX Mavericks using Ruby 2.1.2.
130
+ Klipbook has been tested on Mac OS X El Capitan using Ruby 2.3.1.
135
131
 
136
132
  ## Contributing to Klipbook
137
133
 
138
- Fork the project on [Github](https://github.com/grassdog/klipbook), add tests for
139
- your changes, and submit a well described pull request.
134
+ Fork the project on [Github](https://github.com/grassdog/klipbook), add tests for your changes, and submit a well described pull request.
140
135
 
141
136
  ## Copyright
142
137
 
143
- Copyright (c) 2014 Ray Grasso. See LICENSE.txt for further details.
144
-
138
+ Copyright (c) 2016 Ray Grasso. See LICENSE.txt for further details.
data/Rakefile CHANGED
@@ -1,40 +1,13 @@
1
1
  # encoding: utf-8
2
2
 
3
- require 'rubygems'
4
- require 'bundler/setup'
5
- require 'rake'
6
- require './lib/klipbook/version.rb'
3
+ require "bundler/gem_tasks"
7
4
 
8
- require 'jeweler'
9
- Jeweler::Tasks.new do |gem|
10
- gem.name = 'klipbook'
11
- gem.homepage = 'https://github.com/grassdog/klipbook'
12
- gem.license = 'MIT'
13
- gem.summary = %Q{Klipbook creates a nice html summary of the clippings you've created on your Kindle.}
14
- gem.description = %Q{Process your Kindle clippings file to generate a nicely formatted compilation of the clippings of the books you've read}
15
- gem.email = 'ray.grasso@gmail.com'
16
- gem.authors = ['Ray Grasso']
17
- gem.version = Klipbook::VERSION
18
- # dependencies defined in Gemfile
19
- end
20
- Jeweler::RubygemsDotOrgTasks.new
21
-
22
- require 'rdoc/task'
23
- Rake::RDocTask.new do |rdoc|
24
- version = Klipbook::VERSION
25
-
26
- rdoc.rdoc_dir = 'rdoc'
27
- rdoc.title = "klipbook #{version}"
28
- rdoc.rdoc_files.include('README*')
29
- rdoc.rdoc_files.include('lib/**/*.rb')
30
- end
31
-
32
- require 'rspec/core/rake_task'
5
+ require "rspec/core/rake_task"
6
+ require 'cucumber/rake/task'
33
7
 
34
8
  desc 'Run specs'
35
9
  RSpec::Core::RakeTask.new(:spec)
36
10
 
37
- require 'cucumber/rake/task'
38
11
  Cucumber::Rake::Task.new(:features) do |t|
39
12
  t.cucumber_opts = '--format pretty --tags ~@slow'
40
13
  end