Class: Defmastership::App

Inherits:
Object
  • Object
show all
Extended by:
GLI::App
Defined in:
lib/defmastership/app.rb

Overview

The start of everything !

Class Method Summary collapse

Class Method Details

.configure_export_flags(command) ⇒ Object

Helper method



27
28
29
30
31
32
# File 'lib/defmastership/app.rb', line 27

def self.configure_export_flags(command)
  command.flag(%i[separator sep s], default_value: ',', desc: 'CSV separator')
  command.flag(%i[output-file o], desc: 'CSV output filename')
  command.flag(%i[format f], desc: 'Output format', default_value: 'csv')
  command.switch(%i[no-fail], desc: 'Exit success even in case of wrong explicit checksum')
end

.configure_modify_changes_summary_flag(command) ⇒ Object

Helper method



114
115
116
# File 'lib/defmastership/app.rb', line 114

def self.configure_modify_changes_summary_flag(command)
  command.flag(%i[changes-summary s], desc: 'generates a change summary in a CSV file')
end

.configure_modify_flags(command) ⇒ Object

Helper method



88
89
90
91
92
# File 'lib/defmastership/app.rb', line 88

def self.configure_modify_flags(command)
  configure_modify_modifications_flag(command)
  configure_modify_modifications_file_flag(command)
  configure_modify_changes_summary_flag(command)
end

.configure_modify_modifications_file_flag(command) ⇒ Object

Helper method



105
106
107
108
109
110
111
# File 'lib/defmastership/app.rb', line 105

def self.configure_modify_modifications_file_flag(command)
  command.flag(
    %i[modifications-file mf],
    default_value: 'modifications.yml',
    desc: 'modifications description file'
  )
end

.configure_modify_modifications_flag(command) ⇒ Object

Helper method



95
96
97
98
99
100
101
102
# File 'lib/defmastership/app.rb', line 95

def self.configure_modify_modifications_flag(command)
  command.flag(
    %i[modifications mod m],
    must_match: /(?:[\w-]+)(?:,[\w-]+)*/,
    default_value: 'all',
    desc: 'comma separated list of modifications to apply'
  )
end

.do_the_export(my_doc, options, first_adoc_file) ⇒ Object

Helper method



35
36
37
38
39
40
41
# File 'lib/defmastership/app.rb', line 35

def self.do_the_export(my_doc, options, first_adoc_file)
  format = options.fetch('format')
  formatter = create_formatter(my_doc, format, options)
  output_file = determine_output_file(options, first_adoc_file, format)

  formatter.export_to(output_file)
end