Class: Mkmatter::App::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/mkmatter/cli/app.rb

Constant Summary collapse

HILINE =

(see HighLine#new)

HighLine.new($stdin, $stderr, 80)

Instance Method Summary collapse

Instance Method Details

#__debugNilClass

Prints debug info

Returns:

  • (NilClass)

    returns nil



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/mkmatter/cli/app.rb', line 30

def __debug
  report = YAML.safe_load(OS.report)
  rows   = {
      :mkmatter_version => Mkmatter::VERSION,
      :ruby_version     => RbConfig::CONFIG['RUBY_PROGRAM_VERSION'],
  }
  rows.merge! report
  rows.merge!({
                  'ruby bin'      => OS.ruby_bin,
                  :windows        => OS.windows?,
                  :posix          => OS.posix?,
                  :mac            => OS.mac?,
                  'under windows' => OS::Underlying.windows?,
                  'under bsd'     => OS::Underlying.bsd?,
              })
  table       = Terminal::Table.new
  table.title = 'mkmatter Debug Info'
  table.rows  = rows.to_a
  table.align_column(0, :left)

  puts table
end

#__print_infoNilClass

Returns Prints Gem info.

Returns:

  • (NilClass)

    Prints Gem info



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/mkmatter/cli/app.rb', line 57

def __print_info
  format = options[:'info-format']
  rows   = {
      'author(s)':        Mkmatter::GemInfo.authors.join(', '),
      'e-mail':           Mkmatter::GemInfo.email.join(', '),
      'mkmatter version': Mkmatter::VERSION,
      'Ruby version':     RbConfig::CONFIG['RUBY_PROGRAM_VERSION'],
      'Platform':         RbConfig::CONFIG['build_os'],
  }
  case format
    when 'table'
      table                 = Terminal::Table.new
      table.style.alignment = :center
      table.title           = 'mkmatter Info'
      table.rows            = rows.to_a
      table.align_column(0, :left)

      puts table
    when 'yaml'
      puts rows.stringify_keys.to_yaml
    else
      # noop
      # this doesn't get run because of
      # the logic of options and their
      # enum parameter.
  end
end

#__print_versionNilClass

Prints version string

Returns:

  • (NilClass)

    nil



22
23
24
# File 'lib/mkmatter/cli/app.rb', line 22

def __print_version
  puts Mkmatter::VERSION
end