Class: PluginManager

Inherits:
Object show all
Defined in:
lib/ceedling/plugin_manager.rb

Instance Method Summary collapse

Instance Method Details

#load_programmatic_plugins(plugins, system_objects) {|{ :environment => environment }| ... } ⇒ Object

Yields:

  • ({ :environment => environment })


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/ceedling/plugin_manager.rb', line 19

def load_programmatic_plugins(plugins, system_objects)
  environment = []

  plugins.each do |hash|
    # Protect against instantiating object multiple times due to processing config multiple times (option files, etc)
    next if (@plugin_manager_helper.include?( @plugin_objects, hash[:plugin] ) )

    msg = @reportinator.generate_progress( "Instantiating plugin class #{camelize( hash[:plugin] )}" )
    @loginator.log( msg, Verbosity::OBNOXIOUS )

    begin
      @system_wrapper.require_file( "#{hash[:plugin]}.rb" )
      object = @plugin_manager_helper.instantiate_plugin( 
        camelize( hash[:plugin] ),
        system_objects,
        hash[:plugin],
        hash[:root_path]
      )
      @plugin_objects << object
      environment += object.environment

      # Add plugins to hash of all system objects
      system_objects[hash[:plugin].downcase().to_sym()] = object
    rescue 
      @loginator.log( "Exception raised while trying to load plugin: #{hash[:plugin]}", Verbosity::ERRORS, LogLabels::EXCEPTION  )
      raise # Raise again for backtrace, etc.
    end
  end

  yield( { :environment => environment } ) if (environment.size > 0)
end

#plugins_failed?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/ceedling/plugin_manager.rb', line 51

def plugins_failed?
  return (@build_fail_registry.size > 0)
end

#post_buildObject



107
# File 'lib/ceedling/plugin_manager.rb', line 107

def post_build; execute_plugins(:post_build); end

#post_compile_execute(arg_hash) ⇒ Object



88
# File 'lib/ceedling/plugin_manager.rb', line 88

def post_compile_execute(arg_hash); execute_plugins(:post_compile_execute, arg_hash); end

#post_errorObject



108
# File 'lib/ceedling/plugin_manager.rb', line 108

def post_error; execute_plugins(:post_error); end

#post_link_execute(arg_hash) ⇒ Object



91
# File 'lib/ceedling/plugin_manager.rb', line 91

def post_link_execute(arg_hash); execute_plugins(:post_link_execute, arg_hash); end

#post_mock_generate(arg_hash) ⇒ Object



82
# File 'lib/ceedling/plugin_manager.rb', line 82

def post_mock_generate(arg_hash); execute_plugins(:post_mock_generate, arg_hash); end

#post_mock_preprocess(arg_hash) ⇒ Object



76
# File 'lib/ceedling/plugin_manager.rb', line 76

def post_mock_preprocess(arg_hash); execute_plugins(:post_mock_preprocess, arg_hash); end

#post_releaseObject



104
# File 'lib/ceedling/plugin_manager.rb', line 104

def post_release; execute_plugins(:post_release); end

#post_runner_generate(arg_hash) ⇒ Object



85
# File 'lib/ceedling/plugin_manager.rb', line 85

def post_runner_generate(arg_hash); execute_plugins(:post_runner_generate, arg_hash); end

#post_test(test) ⇒ Object



101
# File 'lib/ceedling/plugin_manager.rb', line 101

def post_test(test); execute_plugins(:post_test, test); end

#post_test_fixture_execute(arg_hash) ⇒ Object



94
95
96
97
98
# File 'lib/ceedling/plugin_manager.rb', line 94

def post_test_fixture_execute(arg_hash)
  # Special arbitration: Raw test results are printed or taken over by plugins handling the job
  @loginator.log( arg_hash[:shell_result][:output] ) if @configurator.plugins_display_raw_test_results
  execute_plugins(:post_test_fixture_execute, arg_hash)
end

#post_test_preprocess(arg_hash) ⇒ Object



79
# File 'lib/ceedling/plugin_manager.rb', line 79

def post_test_preprocess(arg_hash); execute_plugins(:post_test_preprocess, arg_hash); end

#pre_buildObject



106
# File 'lib/ceedling/plugin_manager.rb', line 106

def pre_build; execute_plugins(:pre_build); end

#pre_compile_execute(arg_hash) ⇒ Object



87
# File 'lib/ceedling/plugin_manager.rb', line 87

def pre_compile_execute(arg_hash); execute_plugins(:pre_compile_execute, arg_hash); end


90
# File 'lib/ceedling/plugin_manager.rb', line 90

def pre_link_execute(arg_hash); execute_plugins(:pre_link_execute, arg_hash); end

#pre_mock_generate(arg_hash) ⇒ Object



81
# File 'lib/ceedling/plugin_manager.rb', line 81

def pre_mock_generate(arg_hash); execute_plugins(:pre_mock_generate, arg_hash); end

#pre_mock_preprocess(arg_hash) ⇒ Object

execute all plugin methods ####



75
# File 'lib/ceedling/plugin_manager.rb', line 75

def pre_mock_preprocess(arg_hash); execute_plugins(:pre_mock_preprocess, arg_hash); end

#pre_releaseObject



103
# File 'lib/ceedling/plugin_manager.rb', line 103

def pre_release; execute_plugins(:pre_release); end

#pre_runner_generate(arg_hash) ⇒ Object



84
# File 'lib/ceedling/plugin_manager.rb', line 84

def pre_runner_generate(arg_hash); execute_plugins(:pre_runner_generate, arg_hash); end

#pre_test(test) ⇒ Object



100
# File 'lib/ceedling/plugin_manager.rb', line 100

def pre_test(test); execute_plugins(:pre_test, test); end

#pre_test_fixture_execute(arg_hash) ⇒ Object



93
# File 'lib/ceedling/plugin_manager.rb', line 93

def pre_test_fixture_execute(arg_hash); execute_plugins(:pre_test_fixture_execute, arg_hash); end

#pre_test_preprocess(arg_hash) ⇒ Object



78
# File 'lib/ceedling/plugin_manager.rb', line 78

def pre_test_preprocess(arg_hash); execute_plugins(:pre_test_preprocess, arg_hash); end


55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/ceedling/plugin_manager.rb', line 55

def print_plugin_failures
  if (@build_fail_registry.size > 0)
    report = @reportinator.generate_banner('BUILD FAILURE SUMMARY')

    @build_fail_registry.each do |failure|
      report += "#{' - ' if (@build_fail_registry.size > 1)}#{failure}\n"
    end

    report += "\n"

    @loginator.log( report, Verbosity::ERRORS, LogLabels::NONE )
  end
end

#register_build_failure(message) ⇒ Object



69
70
71
# File 'lib/ceedling/plugin_manager.rb', line 69

def register_build_failure(message)
  @build_fail_registry << message if (message and not message.empty?)
end

#setupObject



14
15
16
17
# File 'lib/ceedling/plugin_manager.rb', line 14

def setup
  @build_fail_registry = []
  @plugin_objects = [] # List so we can preserve order
end

#summaryObject



110
# File 'lib/ceedling/plugin_manager.rb', line 110

def summary; execute_plugins(:summary); end