kdbook 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/kdbook +7 -3
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 953248a531c5184914edef4ed665f37160eced15
4
- data.tar.gz: ebb466d1e47220ab50b8bbcdaf3edd4f0c8553dd
3
+ metadata.gz: 6e1ab219d01f9ba5acf4277a9daff2113ff82a9c
4
+ data.tar.gz: 524f911fabf8ddbdf1c69dcc7cfe3dea53a486fc
5
5
  SHA512:
6
- metadata.gz: 834ed0a1fd12100469774d5b06790e658eef54f033af14b82e98e38f1524d4227f92c960ead6cbdbd120e993e0b411e868d06021c2b0c53b989742ddd880eee9
7
- data.tar.gz: 434249305b0073cd77e1b82a423c3b8919c08abdd591dea550d8c196a510bddbbd4168a1cff97dd29998c479faf49af3e97e085dde0b3bc492081a1da403cdbe
6
+ metadata.gz: 0d9a0fdcc6532ad7b1e1d542d63cbad014af8d7b905f03c009db75bc92290c60f0caa159f7e315846cdbd32696578951f58991dd71256bb77e78a6c3ed4ffe67
7
+ data.tar.gz: ca39e1574fe204f85a7d5d7dc5ec9b22be7593b9d808a1c957d21fae920ff50b8db98c8a07fa376f79a97df342d2d45bece082123130b8df8f1b39ce3bc6c208
data/bin/kdbook CHANGED
@@ -6,7 +6,7 @@ require 'colorize'
6
6
  require 'kramdown'
7
7
  require 'recursive-open-struct'
8
8
 
9
- VERSION = '0.0.4'
9
+ VERSION = '0.0.5'
10
10
 
11
11
  class KdbookBin < Thor
12
12
  class_option :'config-file', type: :string, aliases: 'f', default: 'kdbook.yml'
@@ -19,8 +19,8 @@ class KdbookBin < Thor
19
19
  def wordcount
20
20
  file_list(options).each do |inp|
21
21
  if inp.wordcount
22
- wc, file = %x(wc -w #{inp.input}).chomp.split
23
- output = "Wordcount of #{file} is #{add_commas(wc)}"
22
+ wc = rm_non_words(read_file(inp.input)).split(' ').length
23
+ output = "Wordcount of #{inp.input} is #{add_commas(wc)}"
24
24
  if inp.wordcount.is_a?(RecursiveOpenStruct) && inp.wordcount.min
25
25
  output = "#{output}. #{percentify(wc, inp.wordcount.min)}% " \
26
26
  "of goal #{inp.wordcount.min}"
@@ -157,6 +157,10 @@ class KdbookBin < Thor
157
157
  input.gsub(/\/--.*?--\//m, "")
158
158
  end
159
159
 
160
+ def rm_non_words(input)
161
+ input.split("\n").select { |line| !(line =~ /^\s*#/) }.join("\n")
162
+ end
163
+
160
164
  def read_file(file)
161
165
  rm_hidden_comments(File.read(file))
162
166
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kdbook
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Porter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-12 00:00:00.000000000 Z
11
+ date: 2016-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  version: '0'
123
123
  requirements: []
124
124
  rubyforge_project:
125
- rubygems_version: 2.2.5
125
+ rubygems_version: 2.4.8
126
126
  signing_key:
127
127
  specification_version: 4
128
128
  summary: book writing in markdown made easy