class MxxRu::Util::Mode::OptionParser

Option parser for common Mxx_ru options.

Since v.1.4.0

Attributes

is_brief_desc[R]
is_brief_desc_disabled[R]
is_clean[R]
is_dry_run[R]
is_keep_tmps[R]
is_rebuild[R]
is_show_cmd[R]
is_show_tmps[R]

Public Class Methods

new() click to toggle source
# File lib/mxx_ru/util.rb, line 86
def initialize
  @is_brief_desc = false
  @is_brief_desc_disabled = false
  @is_clean = false
  @is_dry_run = false
  @is_keep_tmps = false
  @is_rebuild = false
  @is_show_cmd = false
  @is_show_tmps = false
end

Public Instance Methods

prepare( parser ) click to toggle source
# File lib/mxx_ru/util.rb, line 97
def prepare( parser )
  parser.separator ''
  parser.separator 'Common Mxx_ru options:'

  parser.on( MXXARG_CLEAN, 'Clean up project' ) do
    @is_clean = true
    check_clean_and_rebuild_correctness
  end

  parser.on( MXXARG_REBUILD,
      'Clean up and then build project again' ) do
    @is_rebuild = true
    check_clean_and_rebuild_correctness
  end

  parser.on( MXXARG_SHOW_CMD,
      'Show commands during build process' ) do
    @is_show_cmd = true
  end

  parser.on( MXXARG_KEEP_TMPS,
      'Keep temporary files after build finihed' ) do
    @is_keep_tmps = true
  end

  parser.on( MXXARG_SHOW_TMPS,
      'Show content of temporary files during build process' ) do
    @is_show_tmps = true
  end

  parser.on( MXXARG_BRIEF_DESC,
      'Enable displaying short description of build steps' ) do
    @is_brief_desc = true
  end

  parser.on( MXXARG_BRIEF_DESC_DISABLED,
      'Disable displaying short description of build steps' ) do
    @is_brief_desc_disabled = true
  end

  parser.on( MXXARG_DRY_RUN,
      'Build imitation mode, no actual actions perfomed' ) do
    @is_dry_run = true
  end
end

Private Instance Methods

check_clean_and_rebuild_correctness() click to toggle source

Throws exception if –mxx-clean and –mxx-rebuild specified at the same time.

# File lib/mxx_ru/util.rb, line 146
def check_clean_and_rebuild_correctness
  raise CleanAndRebuildUsedTogetherEx.new if @is_clean && @is_rebuild
end