class Verkilo::CLI
Public Instance Methods
compile()
click to toggle source
# File lib/verkilo/cli.rb, line 17 def compile is_verkilo_project! shelf = Verkilo::Shelf.new(root_dir) say "Compiling #{shelf}" shelf.books.each do |book| fork do book.compile end end Process.waitall end
merge()
click to toggle source
# File lib/verkilo/cli.rb, line 31 def merge is_verkilo_project! say "Merging #{root_dir}" end
version()
click to toggle source
# File lib/verkilo/cli.rb, line 76 def version say "Verkilo v#{Verkilo::VERSION}" end
wordcount()
click to toggle source
# File lib/verkilo/cli.rb, line 59 def wordcount is_verkilo_project! log = options["log"] || false offset = options["offset"] || nil delta = options["delta"] || false shelf = Verkilo::Shelf.new(root_dir) say "Wordcount for #{shelf}: #{shelf.wordcount.to_yaml}" if log wc_log = Verkilo::Log.new('wordcount',root_dir, offset) wc_log.data = shelf.wordcount wc_log.delta! unless delta.nil? wc_log.write say "Written to #{wc_log.filename}" end end
Private Instance Methods
config_path()
click to toggle source
# File lib/verkilo/cli.rb, line 81 def config_path root_dir.join(".verkilo") end
is_verkilo_project!()
click to toggle source
# File lib/verkilo/cli.rb, line 87 def is_verkilo_project! say "Verkilo v#{Verkilo::VERSION}" unless File.exist?(config_path) say "You must run this command within a Verkilo directory." say "See the Verkilo website (https://verkilo.com) for details" exit 1 end end
root_dir()
click to toggle source
# File lib/verkilo/cli.rb, line 84 def root_dir @root ||= Pathname.new(Dir.pwd) end