Class: MxxRu::Cpp::Mode

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

Overview

Class, detecting a mode of MxxRu::Cpp is running

Defined Under Namespace

Classes: OptionParser

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMode

Constructor checks for a special arguments in a command line



113
114
115
116
117
# File 'lib/mxx_ru/cpp/mode.rb', line 113

def initialize
  CmdLineOptionProcessor.instance.parse

  @manual_dry_run_counter = 0
end

Class Method Details

.generate_option_reader(option) ⇒ Object

Method for generation methods like is_clean, is_rebuild, etc.



98
99
100
101
102
103
104
# File 'lib/mxx_ru/cpp/mode.rb', line 98

def Mode.generate_option_reader( option )
  class_eval do
    define_method( option ) do
      OptionParser.instance.send( option )
    end
  end
end

Instance Method Details

#after_subprj_processingObject

It should be executed after build/clean of subprojects. If is_only_one option is set and manual_dry_run_counter is equal to 0, manual dry_run mode is activated.



134
135
136
137
138
139
140
141
# File 'lib/mxx_ru/cpp/mode.rb', line 134

def after_subprj_processing
  if is_only_one
    @manual_dry_run_counter -= 1
    if 0 == @manual_dry_run_counter
      MxxRu::Util::Mode.instance.manual_dry_run( false )
    end
  end
end

#before_subprj_processingObject

It should be executed before build/clean of subprojects. If is_only_one option is set and manual_dry_run_counter is equal to 0, manual dry_run mode is activated.



122
123
124
125
126
127
128
129
# File 'lib/mxx_ru/cpp/mode.rb', line 122

def before_subprj_processing
  if is_only_one
    if 0 == @manual_dry_run_counter
      MxxRu::Util::Mode.instance.manual_dry_run( true )
    end
    @manual_dry_run_counter += 1
  end
end