klipbook 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.txt +6 -0
- data/README.md +1 -1
- data/bin/klipbook +5 -4
- data/features/support/env.rb +4 -0
- data/klipbook.gemspec +10 -10
- data/lib/klipbook/commands/{pretty_print.rb → tohtml.rb} +2 -2
- data/lib/klipbook/commands/{collate.rb → tojson.rb} +1 -1
- data/lib/klipbook/{pretty_print → tohtml}/html_book_summary.erb +0 -0
- data/lib/klipbook/{pretty_print → tohtml}/html_printer.rb +1 -1
- data/lib/klipbook/{collate → tojson}/book_file.rb +1 -1
- data/lib/klipbook/version.rb +1 -1
- data/lib/klipbook.rb +4 -4
- data/spec/lib/klipbook/commands/{pretty_print_spec.rb → tohtml_spec.rb} +2 -2
- data/spec/lib/klipbook/{pretty_print → tohtml}/html_printer_spec.rb +2 -2
- data/spec/lib/klipbook/{collate → tojson}/book_file_spec.rb +3 -3
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3037bf853bd7bf7df5dbf9eaf706b5e2b2aca40
|
4
|
+
data.tar.gz: 17882844c725d1f2464b3320294252823b04d830
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b994c3ada7655bfacde42017cc9e94072912bb89c72dde3b7be1f1171fe22cbf6dcee61a28d99b536ade0e6308dfb292f4476601e414bf61f886311e34045f9
|
7
|
+
data.tar.gz: d7e099518000d5bdf4e95f9efff094aa92b15f959540f1adb1f690c6223a1a5e04c28543569dec54bdc0bae9beb72c151ec1de48504dd737c23826b2e725f9e3
|
data/CHANGELOG.txt
CHANGED
data/README.md
CHANGED
@@ -110,7 +110,7 @@ them into a single JSON file.
|
|
110
110
|
$ klipbook tojson -i "My Clippings.txt" -o books.json
|
111
111
|
```
|
112
112
|
|
113
|
-
You can rerun
|
113
|
+
You can rerun tojson on an existing JSON file to add new books. By default existing
|
114
114
|
books in the JSON file will not be overwritten. This can be changed with the `--force`
|
115
115
|
flag.
|
116
116
|
|
data/bin/klipbook
CHANGED
@@ -72,7 +72,7 @@ rescue
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def book_file(file_path)
|
75
|
-
Klipbook::
|
75
|
+
Klipbook::ToJson::BookFile.from_json(raw_json_from_file(file_path))
|
76
76
|
end
|
77
77
|
|
78
78
|
#########
|
@@ -147,11 +147,12 @@ end
|
|
147
147
|
|
148
148
|
opts = Slop.parse(help: true) do
|
149
149
|
banner "Usage: klipbook <command> [options]\n\n" +
|
150
|
-
"Klipbook
|
150
|
+
"Klipbook writes the clippings you've saved on your Kindle into JSON or pretty html.\n\n" +
|
151
151
|
CONFIG_HELP + "\n"
|
152
152
|
|
153
153
|
on :v, :version, "Print the version." do
|
154
154
|
puts "Klipbook version #{Klipbook::VERSION}"
|
155
|
+
exit 0
|
155
156
|
end
|
156
157
|
|
157
158
|
command "list" do
|
@@ -189,7 +190,7 @@ opts = Slop.parse(help: true) do
|
|
189
190
|
|
190
191
|
books = fetch_books(opts)
|
191
192
|
|
192
|
-
Klipbook::Commands::
|
193
|
+
Klipbook::Commands::ToJson.new(books, book_file(outfile_path)).call(outfile_path, opts[:force])
|
193
194
|
end
|
194
195
|
end
|
195
196
|
|
@@ -211,7 +212,7 @@ opts = Slop.parse(help: true) do
|
|
211
212
|
|
212
213
|
outdir_path = ensure_outdir(opts)
|
213
214
|
|
214
|
-
Klipbook::Commands::
|
215
|
+
Klipbook::Commands::ToHtml.new(books).call(outdir_path, opts[:force])
|
215
216
|
end
|
216
217
|
end
|
217
218
|
|
data/features/support/env.rb
CHANGED
data/klipbook.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "klipbook"
|
8
|
-
s.version = "2.1.
|
8
|
+
s.version = "2.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ray Grasso"]
|
12
|
-
s.date = "2013-12-
|
12
|
+
s.date = "2013-12-12"
|
13
13
|
s.description = "Process your Kindle clippings file to generate a nicely formatted compilation of the clippings of the books you've read"
|
14
14
|
s.email = "ray.grasso@gmail.com"
|
15
15
|
s.executables = ["klipbook"]
|
@@ -41,13 +41,10 @@ Gem::Specification.new do |s|
|
|
41
41
|
"features/tojson.feature",
|
42
42
|
"klipbook.gemspec",
|
43
43
|
"lib/klipbook.rb",
|
44
|
-
"lib/klipbook/collate/book_file.rb",
|
45
|
-
"lib/klipbook/commands/collate.rb",
|
46
44
|
"lib/klipbook/commands/list_books.rb",
|
47
|
-
"lib/klipbook/commands/
|
45
|
+
"lib/klipbook/commands/tohtml.rb",
|
46
|
+
"lib/klipbook/commands/tojson.rb",
|
48
47
|
"lib/klipbook/config.rb",
|
49
|
-
"lib/klipbook/pretty_print/html_book_summary.erb",
|
50
|
-
"lib/klipbook/pretty_print/html_printer.rb",
|
51
48
|
"lib/klipbook/sources/amazon_site/book_scraper.rb",
|
52
49
|
"lib/klipbook/sources/amazon_site/site_scraper.rb",
|
53
50
|
"lib/klipbook/sources/book.rb",
|
@@ -57,17 +54,20 @@ Gem::Specification.new do |s|
|
|
57
54
|
"lib/klipbook/sources/kindle_device/entry_parser.rb",
|
58
55
|
"lib/klipbook/sources/kindle_device/file.rb",
|
59
56
|
"lib/klipbook/sources/kindle_device/file_parser.rb",
|
57
|
+
"lib/klipbook/tohtml/html_book_summary.erb",
|
58
|
+
"lib/klipbook/tohtml/html_printer.rb",
|
59
|
+
"lib/klipbook/tojson/book_file.rb",
|
60
60
|
"lib/klipbook/util/blank.rb",
|
61
61
|
"lib/klipbook/util/struct_to_json.rb",
|
62
62
|
"lib/klipbook/version.rb",
|
63
|
-
"spec/lib/klipbook/collate/book_file_spec.rb",
|
64
63
|
"spec/lib/klipbook/commands/list_books_spec.rb",
|
65
|
-
"spec/lib/klipbook/commands/
|
66
|
-
"spec/lib/klipbook/pretty_print/html_printer_spec.rb",
|
64
|
+
"spec/lib/klipbook/commands/tohtml_spec.rb",
|
67
65
|
"spec/lib/klipbook/sources/book_spec.rb",
|
68
66
|
"spec/lib/klipbook/sources/kindle_device/entry_parser_spec.rb",
|
69
67
|
"spec/lib/klipbook/sources/kindle_device/file_parser_spec.rb",
|
70
68
|
"spec/lib/klipbook/sources/kindle_device/file_spec.rb",
|
69
|
+
"spec/lib/klipbook/tohtml/html_printer_spec.rb",
|
70
|
+
"spec/lib/klipbook/tojson/book_file_spec.rb",
|
71
71
|
"spec/spec_helper.rb",
|
72
72
|
"spec/support/rspec2.rb",
|
73
73
|
"spec/support/with_rr.rb"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Klipbook::Commands
|
2
|
-
class
|
3
|
-
def initialize(books, pretty_printer=Klipbook::
|
2
|
+
class ToHtml
|
3
|
+
def initialize(books, pretty_printer=Klipbook::ToHtml::HtmlPrinter.new)
|
4
4
|
@books = books
|
5
5
|
@pretty_printer = pretty_printer
|
6
6
|
end
|
File without changes
|
data/lib/klipbook/version.rb
CHANGED
data/lib/klipbook.rb
CHANGED
@@ -3,9 +3,9 @@ require 'klipbook/util/blank'
|
|
3
3
|
require 'klipbook/util/struct_to_json'
|
4
4
|
require 'klipbook/version'
|
5
5
|
|
6
|
-
require 'klipbook/commands/
|
6
|
+
require 'klipbook/commands/tojson'
|
7
7
|
require 'klipbook/commands/list_books'
|
8
|
-
require 'klipbook/commands/
|
8
|
+
require 'klipbook/commands/tohtml'
|
9
9
|
|
10
10
|
require 'klipbook/sources/book'
|
11
11
|
require 'klipbook/sources/clipping'
|
@@ -21,5 +21,5 @@ require 'klipbook/sources/amazon_site/book_scraper'
|
|
21
21
|
|
22
22
|
require 'klipbook/config'
|
23
23
|
|
24
|
-
require 'klipbook/
|
25
|
-
require 'klipbook/
|
24
|
+
require 'klipbook/tohtml/html_printer'
|
25
|
+
require 'klipbook/tojson/book_file'
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe Klipbook::Commands::
|
3
|
+
describe Klipbook::Commands::ToHtml do
|
4
4
|
|
5
|
-
let (:it) { Klipbook::Commands::
|
5
|
+
let (:it) { Klipbook::Commands::ToHtml.new(books, pretty_printer) }
|
6
6
|
|
7
7
|
let (:pretty_printer) do
|
8
8
|
Object.new.tap do |fake_printer|
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
# This is more of an integration test but what the heck
|
4
4
|
# it can live in here for now
|
5
5
|
|
6
|
-
describe Klipbook::
|
6
|
+
describe Klipbook::ToHtml::HtmlPrinter do
|
7
7
|
|
8
8
|
before(:all) do
|
9
9
|
@output_dir = Dir.mktmpdir
|
@@ -29,7 +29,7 @@ describe Klipbook::PrettyPrint::HtmlPrinter do
|
|
29
29
|
|
30
30
|
describe '#print_to_file' do
|
31
31
|
|
32
|
-
subject { Klipbook::
|
32
|
+
subject { Klipbook::ToHtml::HtmlPrinter.new(message_stream).print_to_file(book, @output_dir, force) }
|
33
33
|
|
34
34
|
let(:force) { false }
|
35
35
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe Klipbook::
|
3
|
+
describe Klipbook::ToJson::BookFile do
|
4
4
|
|
5
5
|
describe '.from_json' do
|
6
6
|
|
7
|
-
subject { Klipbook::
|
7
|
+
subject { Klipbook::ToJson::BookFile.from_json(json) }
|
8
8
|
|
9
9
|
context 'with empty json' do
|
10
10
|
|
@@ -32,7 +32,7 @@ describe Klipbook::Collate::BookFile do
|
|
32
32
|
b.author = "Author two"
|
33
33
|
end
|
34
34
|
]
|
35
|
-
Klipbook::
|
35
|
+
Klipbook::ToJson::BookFile.new(books)
|
36
36
|
end
|
37
37
|
|
38
38
|
it "adds any books that don't already exist" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: klipbook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ray Grasso
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slop
|
@@ -225,13 +225,10 @@ files:
|
|
225
225
|
- features/tojson.feature
|
226
226
|
- klipbook.gemspec
|
227
227
|
- lib/klipbook.rb
|
228
|
-
- lib/klipbook/collate/book_file.rb
|
229
|
-
- lib/klipbook/commands/collate.rb
|
230
228
|
- lib/klipbook/commands/list_books.rb
|
231
|
-
- lib/klipbook/commands/
|
229
|
+
- lib/klipbook/commands/tohtml.rb
|
230
|
+
- lib/klipbook/commands/tojson.rb
|
232
231
|
- lib/klipbook/config.rb
|
233
|
-
- lib/klipbook/pretty_print/html_book_summary.erb
|
234
|
-
- lib/klipbook/pretty_print/html_printer.rb
|
235
232
|
- lib/klipbook/sources/amazon_site/book_scraper.rb
|
236
233
|
- lib/klipbook/sources/amazon_site/site_scraper.rb
|
237
234
|
- lib/klipbook/sources/book.rb
|
@@ -241,17 +238,20 @@ files:
|
|
241
238
|
- lib/klipbook/sources/kindle_device/entry_parser.rb
|
242
239
|
- lib/klipbook/sources/kindle_device/file.rb
|
243
240
|
- lib/klipbook/sources/kindle_device/file_parser.rb
|
241
|
+
- lib/klipbook/tohtml/html_book_summary.erb
|
242
|
+
- lib/klipbook/tohtml/html_printer.rb
|
243
|
+
- lib/klipbook/tojson/book_file.rb
|
244
244
|
- lib/klipbook/util/blank.rb
|
245
245
|
- lib/klipbook/util/struct_to_json.rb
|
246
246
|
- lib/klipbook/version.rb
|
247
|
-
- spec/lib/klipbook/collate/book_file_spec.rb
|
248
247
|
- spec/lib/klipbook/commands/list_books_spec.rb
|
249
|
-
- spec/lib/klipbook/commands/
|
250
|
-
- spec/lib/klipbook/pretty_print/html_printer_spec.rb
|
248
|
+
- spec/lib/klipbook/commands/tohtml_spec.rb
|
251
249
|
- spec/lib/klipbook/sources/book_spec.rb
|
252
250
|
- spec/lib/klipbook/sources/kindle_device/entry_parser_spec.rb
|
253
251
|
- spec/lib/klipbook/sources/kindle_device/file_parser_spec.rb
|
254
252
|
- spec/lib/klipbook/sources/kindle_device/file_spec.rb
|
253
|
+
- spec/lib/klipbook/tohtml/html_printer_spec.rb
|
254
|
+
- spec/lib/klipbook/tojson/book_file_spec.rb
|
255
255
|
- spec/spec_helper.rb
|
256
256
|
- spec/support/rspec2.rb
|
257
257
|
- spec/support/with_rr.rb
|