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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd2f5eb4f0d596951567629d7a89ceb2f56b5f1c
4
- data.tar.gz: 4ca518363f9fc626596f09203a649025091aeeff
3
+ metadata.gz: 8a804a5fee54435a3809b04e8eeb73bd58f33258
4
+ data.tar.gz: 7e4a2b03cec74905dc2c7db48572ad00ccce33b3
5
5
  SHA512:
6
- metadata.gz: e7ba6ae387a4007f28f08c6862dc456b8eb95bea7acd30629b83e986a41c6fd0fbd265119430ef780d24b7bd8d8c8db20edee70058c05f5e3d60a8ba67314949
7
- data.tar.gz: 3aa465a383910a850d8aeccc02ac682b8e84a9ff37f721345a6daacb87248001c3775f1f0311087281c7d15c3a4793a4dd278e43755e0bb6695a2343ff57e8b2
6
+ metadata.gz: c90f8c77c7c957630df796fe6b5f811a242491f0b45a0b13fb43602e9fa72f6def30dfd6b2824ac6943d9e600012c2cce77a9056d3927bd1eb6a25484d3f16f1
7
+ data.tar.gz: 81b1d192a9f4ea2ef9845e7c9c546f59709e533ff3923cc7b32e2ae2e2f49228d42bf8840284bbcab0af1c9dd95535831597ceca00fdfc8d29df1dbdd40568c1
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- verkilo (0.1.1)
4
+ verkilo (0.1.3)
5
5
  thor (~> 0)
6
6
 
7
7
  GEM
@@ -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 "%15s .. %11s => %s %s" % [@title, action, fname, `#{cmd}`]
120
+ puts "%#{10}s .. %-11s => %s %s" % [@title, action, fname, `#{cmd}`]
121
121
  end
122
122
  end
123
123
  end
@@ -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(root_dir=".")
8
- say "Verkilo v#{Verkilo::VERSION}"
17
+ def compile
18
+ is_verkilo_project!
9
19
  shelf = Verkilo::Shelf.new(root_dir)
10
- puts "Compiling #{shelf}"
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(root_dir=".")
27
- puts "Merging #{root_dir}"
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
- def wordcount(root_dir=".")
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
- puts "Wordcount for #{shelf}: #{shelf.wordcount.to_yaml}Written to #{wc_log.filename}"
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 version #{Verkilo::VERSION}"
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/defaults.yml")
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 inside_ebook!
79
+ def is_verkilo_project!
80
+ say "Verkilo v#{Verkilo::VERSION}"
57
81
  unless File.exist?(config_path)
58
- raise Error, "You have to run this command from inside a Verkilo directory."
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
@@ -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})
@@ -1,3 +1,3 @@
1
1
  module Verkilo
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
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.2
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-24 00:00:00.000000000 Z
11
+ date: 2020-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler