verkilo 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/verkilo/book.rb +1 -1
- data/lib/verkilo/cli.rb +46 -20
- data/lib/verkilo/log.rb +2 -2
- data/lib/verkilo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a804a5fee54435a3809b04e8eeb73bd58f33258
|
4
|
+
data.tar.gz: 7e4a2b03cec74905dc2c7db48572ad00ccce33b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c90f8c77c7c957630df796fe6b5f811a242491f0b45a0b13fb43602e9fa72f6def30dfd6b2824ac6943d9e600012c2cce77a9056d3927bd1eb6a25484d3f16f1
|
7
|
+
data.tar.gz: 81b1d192a9f4ea2ef9845e7c9c546f59709e533ff3923cc7b32e2ae2e2f49228d42bf8840284bbcab0af1c9dd95535831597ceca00fdfc8d29df1dbdd40568c1
|
data/Gemfile.lock
CHANGED
data/lib/verkilo/book.rb
CHANGED
@@ -117,7 +117,7 @@ module Verkilo
|
|
117
117
|
csl = (@csl.nil?) ? "" : " --csl #{csl}"
|
118
118
|
|
119
119
|
cmd = "pandoc -o #{fname} #{flags(action)} #{src}"
|
120
|
-
puts "
|
120
|
+
puts "%#{10}s .. %-11s => %s %s" % [@title, action, fname, `#{cmd}`]
|
121
121
|
end
|
122
122
|
end
|
123
123
|
end
|
data/lib/verkilo/cli.rb
CHANGED
@@ -3,11 +3,21 @@ require 'verkilo/version'
|
|
3
3
|
module Verkilo
|
4
4
|
class CLI < Thor
|
5
5
|
desc "compile", "Convert Markdown files in book directory into PDF, EPUB, HTML & DOCX"
|
6
|
+
long_desc <<-LONGDESC
|
7
|
+
`verkilo compile` converts Markdown files in .book
|
8
|
+
\x5 directories into PDF, ePUB, HTML & Word Doc.
|
9
|
+
\x5 The compiled files will be put in the build
|
10
|
+
\x5 directory in the root directory.
|
11
|
+
|
12
|
+
See the Verkilo website (https://verkilo.com) for details
|
13
|
+
|
14
|
+
> $ verkilo compile
|
15
|
+
LONGDESC
|
6
16
|
map %w(-c --compile) => :compile
|
7
|
-
def compile
|
8
|
-
|
17
|
+
def compile
|
18
|
+
is_verkilo_project!
|
9
19
|
shelf = Verkilo::Shelf.new(root_dir)
|
10
|
-
|
20
|
+
say "Compiling #{shelf}"
|
11
21
|
shelf.books.each do |book|
|
12
22
|
fork do
|
13
23
|
book.compile
|
@@ -15,47 +25,63 @@ module Verkilo
|
|
15
25
|
end
|
16
26
|
Process.waitall
|
17
27
|
end
|
18
|
-
desc "proof", "Convert Markdown files in book directory into PDF, EPUB, HTML & DOCX"
|
19
|
-
map %w(-p --proof) => :proof
|
20
|
-
def proof(root_dir=".")
|
21
|
-
puts "Proofing #{root_dir}"
|
22
|
-
end
|
23
28
|
|
24
29
|
desc "merge", "Converts MS Word composite file back into Markdown files."
|
25
30
|
map %w(-m --merge) => :merge
|
26
|
-
def merge
|
27
|
-
|
31
|
+
def merge
|
32
|
+
is_verkilo_project!
|
33
|
+
say "Merging #{root_dir}"
|
28
34
|
end
|
29
35
|
|
30
36
|
desc "wordcount", "Wordcount the books in the repository and write to YAML file."
|
31
37
|
map %w(-w --wordcount) => :wordcount
|
32
|
-
|
38
|
+
method_option :offset
|
39
|
+
long_desc <<-LONGDESC
|
40
|
+
`verkilo wordcount` will count all the words
|
41
|
+
\x5 in Markdown files in .book directories. The
|
42
|
+
\x5 result will be added to a wordcount log YAML
|
43
|
+
\x5 file inside the project's Verkilo configuration
|
44
|
+
\x5 directory.
|
45
|
+
|
46
|
+
You can optionally specify a second parameter,
|
47
|
+
\x5 which will offset the date based on timezone.
|
48
|
+
\x5 This is helpful when you are running this via
|
49
|
+
\x5 a server or CI platform that uses a different
|
50
|
+
\x5 timezone from your own.
|
51
|
+
|
52
|
+
See the Verkilo website (https://verkilo.com) for details
|
53
|
+
|
54
|
+
> $ verkilo wordcount --offset=-08:00
|
55
|
+
LONGDESC
|
56
|
+
def wordcount
|
57
|
+
is_verkilo_project!
|
58
|
+
offset = options["offset"] || nil
|
33
59
|
shelf = Verkilo::Shelf.new(root_dir)
|
34
|
-
wc_log = Verkilo::Log.new('wordcount',root_dir)
|
60
|
+
wc_log = Verkilo::Log.new('wordcount',root_dir, offset)
|
35
61
|
wc_log.data = shelf.wordcount
|
36
62
|
wc_log.write
|
37
63
|
|
38
|
-
|
64
|
+
say "Wordcount for #{shelf}: #{shelf.wordcount.to_yaml}Written to #{wc_log.filename}"
|
39
65
|
end
|
40
66
|
desc "version", "Prints the Verkilo's version information"
|
41
67
|
map %w(-v --version) => :version
|
42
68
|
def version
|
43
|
-
say "Verkilo
|
69
|
+
say "Verkilo v#{Verkilo::VERSION}"
|
44
70
|
end
|
45
71
|
|
46
72
|
private
|
47
|
-
# def config
|
48
|
-
# YAML.load_file(config_path).with_indifferent_access
|
49
|
-
# end
|
50
73
|
def config_path
|
51
|
-
root_dir.join(".verkilo
|
74
|
+
root_dir.join(".verkilo")
|
52
75
|
end
|
53
76
|
def root_dir
|
54
77
|
@root ||= Pathname.new(Dir.pwd)
|
55
78
|
end
|
56
|
-
def
|
79
|
+
def is_verkilo_project!
|
80
|
+
say "Verkilo v#{Verkilo::VERSION}"
|
57
81
|
unless File.exist?(config_path)
|
58
|
-
|
82
|
+
say "You must run this command within a Verkilo directory."
|
83
|
+
say "See the Verkilo website (https://verkilo.com) for details"
|
84
|
+
exit 1
|
59
85
|
end
|
60
86
|
end
|
61
87
|
end
|
data/lib/verkilo/log.rb
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
require 'yaml'
|
3
3
|
module Verkilo
|
4
4
|
class Log
|
5
|
-
def initialize(type, root_dir)
|
5
|
+
def initialize(type, root_dir, offset)
|
6
6
|
@type = type
|
7
7
|
@root_dir = root_dir
|
8
8
|
@data = YAML.load(read_file)
|
9
|
-
@today = Time.now.strftime("%F")
|
9
|
+
@today = Time.now.getlocal(offset).strftime("%F")
|
10
10
|
end
|
11
11
|
def data=(h)
|
12
12
|
@data = @data.merge({@today => h})
|
data/lib/verkilo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: verkilo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben W
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|