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', 'ebook']
SCRIBE_ROOT =
File.expand_path(File.join(File.dirname(__FILE__), '..'))
VERSION =
'0.1.1.2'

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

#do_docbook, #do_ebook, #do_epub, #do_html, #do_mobi, #do_pdf, #do_site, #gen

Methods included from Check

#check, #check_can_run

Methods included from Init

#init

Constructor Details

#initializeGitScribe

Returns a new instance of GitScribe.



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

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

Instance Attribute Details

#argsObject

Returns the value of attribute args.



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

def args
  @args
end

#info(message) ⇒ Object (readonly)

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



60
61
62
# File 'lib/git-scribe.rb', line 60

def info
  @info
end

#optionsObject

Returns the value of attribute options.



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

def options
  @options
end

#subcommandObject

Returns the value of attribute subcommand.



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

def subcommand
  @subcommand
end

Instance Method Details

#base(file) ⇒ Object



45
46
47
# File 'lib/git-scribe.rb', line 45

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

#die(message) ⇒ Object

COMMANDS ##



37
38
39
# File 'lib/git-scribe.rb', line 37

def die(message)
  raise message
end

#first_arg(args) ⇒ Object



55
56
57
# File 'lib/git-scribe.rb', line 55

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

#git(subcommand) ⇒ Object

API/DATA HELPER FUNCTIONS #



51
52
53
# File 'lib/git-scribe.rb', line 51

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

#local(file) ⇒ Object



41
42
43
# File 'lib/git-scribe.rb', line 41

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