module Speculations::CLI
Public Instance Methods
run(args)
click to toggle source
# File lib/speculations/cli.rb, line 4 def run args loop do case args.first when "-h", "--help" _usage when "-v", "--version" _version else return _compile_and_maybe_run args end end end
Private Instance Methods
_compile_and_maybe_run(args)
click to toggle source
# File lib/speculations/cli.rb, line 19 def _compile_and_maybe_run args require_relative "../speculations" args = Dir.glob(["*.md", "speculations/**/*.md"]) if args.empty? args.each do |input_file| Speculations.compile(input_file) end end
_usage()
click to toggle source
# File lib/speculations/cli.rb, line 27 def _usage puts <<-EOF usage: #{$0} [options] [filenames] options: -h | --help display this exit with -1 -v | --version display version of the speculate_about gem exit with -2 filenames (default to all markdown files in the project directory and its speculations subdirectories) recreate outdated speculations in `spec/speculations/` EOF exit -1 end
_version()
click to toggle source
# File lib/speculations/cli.rb, line 43 def _version require_relative 'version' puts VERSION exit -2 end