Class: GitScribe

Inherits:
Object
  • Object
show all
Includes:
CLI, Check, Generate, Init, Subcommands
Defined in:
lib/git-scribe.rb,
lib/git-scribe/cli.rb,
lib/git-scribe/init.rb,
lib/git-scribe/check.rb,
lib/git-scribe/version.rb,
lib/git-scribe/generate.rb

Defined Under Namespace

Modules: CLI, Check, Generate, Init

Constant Summary collapse

BOOK_FILE =
'book.asc'
OUTPUT_TYPES =
['docbook', 'html', 'pdf', 'epub', 'mobi', 'site']
SCRIBE_ROOT =
File.expand_path(File.join(File.dirname(__FILE__), '..'))
VERSION =
'0.1.1'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CLI

#clean, #error, #help, #l, #parse_options, #r, #run

Methods included from Subcommands

#_check_alias, #add_help_option, #add_subcommand_help, #alias_command, #command, #global_options, #opt_parse, #print_actions

Methods included from Generate

#a2x, #a2x_wss, #do_docbook, #do_epub, #do_html, #do_mobi, #do_pdf, #do_site, #ex, #gather_and_process, #gen, #generate_toc_files, #liquid_template, #prepare_output_dir

Methods included from Check

#check, #check_can_run

Methods included from Init

#init

Constructor Details

#initializeGitScribe

Returns a new instance of GitScribe.



26
27
28
29
30
31
# File 'lib/git-scribe.rb', line 26

def initialize
  @subcommand = nil
  @args = []
  @options = {}
  @config = YAML::parse(File.open(local('.gitscribe'))).transform rescue {}
end

Instance Attribute Details

#argsObject

Returns the value of attribute args.



19
20
21
# File 'lib/git-scribe.rb', line 19

def args
  @args
end

#info(message) ⇒ Object (readonly)

eventually we’ll want to log this or have it retrievable elsehow



58
59
60
# File 'lib/git-scribe.rb', line 58

def info
  @info
end

#optionsObject

Returns the value of attribute options.



19
20
21
# File 'lib/git-scribe.rb', line 19

def options
  @options
end

#subcommandObject

Returns the value of attribute subcommand.



19
20
21
# File 'lib/git-scribe.rb', line 19

def subcommand
  @subcommand
end

Instance Method Details

#base(file) ⇒ Object



43
44
45
# File 'lib/git-scribe.rb', line 43

def base(file)
  File.join(SCRIBE_ROOT, file)
end

#die(message) ⇒ Object

COMMANDS ##



35
36
37
# File 'lib/git-scribe.rb', line 35

def die(message)
  raise message
end

#first_arg(args) ⇒ Object



53
54
55
# File 'lib/git-scribe.rb', line 53

def first_arg(args)
  Array(args).shift
end

#git(subcommand) ⇒ Object

API/DATA HELPER FUNCTIONS #



49
50
51
# File 'lib/git-scribe.rb', line 49

def git(subcommand)
  `git #{subcommand}`.chomp
end

#local(file) ⇒ Object



39
40
41
# File 'lib/git-scribe.rb', line 39

def local(file)
  File.expand_path(File.join(Dir.pwd, file))
end