Class: MxxRu::Util::Mode::OptionParser

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/mxx_ru/util.rb

Overview

Option parser for common Mxx_ru options.

Since v.1.4.0

Defined Under Namespace

Classes: CleanAndRebuildUsedTogetherEx

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeOptionParser

Returns a new instance of OptionParser.



86
87
88
89
90
91
92
93
94
95
# 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

Instance Attribute Details

#is_brief_descObject (readonly)

Returns the value of attribute is_brief_desc.



77
78
79
# File 'lib/mxx_ru/util.rb', line 77

def is_brief_desc
  @is_brief_desc
end

#is_brief_desc_disabledObject (readonly)

Returns the value of attribute is_brief_desc_disabled.



78
79
80
# File 'lib/mxx_ru/util.rb', line 78

def is_brief_desc_disabled
  @is_brief_desc_disabled
end

#is_cleanObject (readonly)

Returns the value of attribute is_clean.



79
80
81
# File 'lib/mxx_ru/util.rb', line 79

def is_clean
  @is_clean
end

#is_dry_runObject (readonly)

Returns the value of attribute is_dry_run.



80
81
82
# File 'lib/mxx_ru/util.rb', line 80

def is_dry_run
  @is_dry_run
end

#is_keep_tmpsObject (readonly)

Returns the value of attribute is_keep_tmps.



81
82
83
# File 'lib/mxx_ru/util.rb', line 81

def is_keep_tmps
  @is_keep_tmps
end

#is_rebuildObject (readonly)

Returns the value of attribute is_rebuild.



82
83
84
# File 'lib/mxx_ru/util.rb', line 82

def is_rebuild
  @is_rebuild
end

#is_show_cmdObject (readonly)

Returns the value of attribute is_show_cmd.



83
84
85
# File 'lib/mxx_ru/util.rb', line 83

def is_show_cmd
  @is_show_cmd
end

#is_show_tmpsObject (readonly)

Returns the value of attribute is_show_tmps.



84
85
86
# File 'lib/mxx_ru/util.rb', line 84

def is_show_tmps
  @is_show_tmps
end

Instance Method Details

#prepare(parser) ⇒ Object



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# 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