Class: MxxRu::Util::Mode
- Inherits:
-
Object
- Object
- MxxRu::Util::Mode
- Includes:
- Singleton
- Defined in:
- lib/mxx_ru/util.rb
Overview
Class, which detects MxxRu current mode.
Defined Under Namespace
Classes: OptionParser
Instance Attribute Summary collapse
-
#is_brief_desc ⇒ Object
readonly
Returns the value of attribute is_brief_desc.
Class Method Summary collapse
-
.generate_option_reader(option) ⇒ Object
Method for generation methods like is_clean, is_rebuild, etc.
Instance Method Summary collapse
-
#initialize ⇒ Mode
constructor
Constructor checks for special arguments in command line.
-
#is_dry_run ⇒ Object
Is dry-run mode set? Dry-run mode is set, if –mxx-dry-run command line parameter is set, or if it’s manually set.
-
#manual_dry_run(a_is_manual_dry_run) ⇒ Object
On/Off manual dry-run mode.
-
#try_enable_show_brief ⇒ Object
Try to manually enable ‘show-brief’ mode.
Constructor Details
#initialize ⇒ Mode
Constructor checks for special arguments in command line.
168 169 170 171 172 173 174 175 176 177 |
# File 'lib/mxx_ru/util.rb', line 168 def initialize CmdLineOptionProcessor.instance.parse @is_brief_desc = OptionParser.instance.is_brief_desc @is_brief_desc = false if OptionParser.instance.is_brief_desc_disabled @is_dry_run = OptionParser.instance.is_dry_run @is_manual_dry_run = false end |
Instance Attribute Details
#is_brief_desc ⇒ Object (readonly)
Returns the value of attribute is_brief_desc.
165 166 167 |
# File 'lib/mxx_ru/util.rb', line 165 def is_brief_desc @is_brief_desc end |
Class Method Details
.generate_option_reader(option) ⇒ Object
Method for generation methods like is_clean, is_rebuild, etc.
152 153 154 155 156 157 158 |
# File 'lib/mxx_ru/util.rb', line 152 def Mode.generate_option_reader( option ) class_eval do define_method( option ) do OptionParser.instance.send( option ) end end end |
Instance Method Details
#is_dry_run ⇒ Object
Is dry-run mode set? Dry-run mode is set, if –mxx-dry-run command line parameter is set, or if it’s manually set.
182 183 184 |
# File 'lib/mxx_ru/util.rb', line 182 def is_dry_run return ( @is_dry_run || @is_manual_dry_run ) end |
#manual_dry_run(a_is_manual_dry_run) ⇒ Object
On/Off manual dry-run mode. In some cases it’s efficient to turn it on for some time. For example, it’s used to handle subprojects with –mxx-cpp-1 option set.
190 191 192 |
# File 'lib/mxx_ru/util.rb', line 190 def manual_dry_run( a_is_manual_dry_run ) @is_manual_dry_run = a_is_manual_dry_run end |
#try_enable_show_brief ⇒ Object
Try to manually enable ‘show-brief’ mode. Attempt ignored if ‘–mxx-show-brief-disabled’ was specified.
196 197 198 |
# File 'lib/mxx_ru/util.rb', line 196 def try_enable_show_brief @is_brief_desc = true unless OptionParser.instance.is_brief_desc_disabled end |