Class: Relyze::Plugin::Analysis
- Defined in:
- C:/Program Files/Relyze/lib/relyze/core/plugin.rb
Overview
An Analysis plugin may run manually when the user invokes it or automatically against a specific model in that models analysis pipeline.
Instance Attribute Summary
Attributes inherited from Base
#autorun_model, #information, #relyze
Instance Method Summary collapse
-
#initialize(_information) ⇒ Analysis
constructor
A new instance of Analysis.
-
#main(commandline = nil, action = nil, block = false) ⇒ Object
The main method is called by the application.
-
#post_code_analyze ⇒ Object
protected
Override this method to hook into the analysis pipeline at the post code analysis stage.
-
#post_structure_analyze ⇒ Object
protected
Override this method to hook into the analysis pipeline at the post structure analysis stage.
-
#pre_code_analyze ⇒ Object
protected
Override this method to hook into the analysis pipeline at the pre code analysis stage.
-
#pre_structure_analyze ⇒ Object
protected
Override this method to hook into the analysis pipeline at the pre structure analysis stage.
-
#run ⇒ Object
Override this method to implement your plugin.
-
#shortcuts ⇒ Hash
Get this plugins keyboard shortcuts, if any.
-
#type ⇒ Object
Get this plugins type.
Methods inherited from Base
#abort_analysis, #authors, #can_run?, #current_model, #description, #get_persistent_value, #guid, #license, #name, #options, #origin, #print_error, #print_exception, #print_message, #print_warning, #references, #remove_task, #require_files, #restart_analysis, #set_persistent_value, #task_status, #version, #version_major, #version_minor
Constructor Details
#initialize(_information) ⇒ Analysis
Returns a new instance of Analysis
477 478 479 |
# File 'C:/Program Files/Relyze/lib/relyze/core/plugin.rb', line 477 def initialize( _information ) super( _information ) end |
Instance Method Details
#main(commandline = nil, action = nil, block = false) ⇒ Object
The main method is called by the application. The plugins functionality is implemented via the #run method.
525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 |
# File 'C:/Program Files/Relyze/lib/relyze/core/plugin.rb', line 525 def main( commandline=nil, action=nil, block=false ) if( not commandline.nil? ) args = ::Shellwords.split( commandline ) args.each do | arg | opt_val = arg.partition( '=' ) @information[:options][ opt_val[0] ] = opt_val[2].empty? ? nil : opt_val[2] end end if( self.can_run?( action ) ) do_run = lambda do begin if( action.nil? ) self.run elsif( action.class == ::Symbol and self.respond_to?( action, false ) ) self.send( action ) end rescue ::Relyze::AbortException print_warning( "Plugin '#{self.name}' aborting." ) result = nil rescue ::Relyze::RestartException print_warning( "Plugin '#{self.name}' forcing restart." ) result = nil rescue ::Exception => e print_exception( e ) end self.remove_task end if( block ) do_run.call else @relyze.add_plugin_thread( self, ::Thread.new do do_run.call @relyze.remove_plugin_thread( ::Thread.current ) end ) end else self.remove_task return false end return true end |
#post_code_analyze ⇒ Object (protected)
Override this method to hook into the analysis pipeline at the post code analysis stage.
593 594 595 |
# File 'C:/Program Files/Relyze/lib/relyze/core/plugin.rb', line 593 def post_code_analyze return false end |
#post_structure_analyze ⇒ Object (protected)
Override this method to hook into the analysis pipeline at the post structure analysis stage.
583 584 585 |
# File 'C:/Program Files/Relyze/lib/relyze/core/plugin.rb', line 583 def post_structure_analyze return false end |
#pre_code_analyze ⇒ Object (protected)
Override this method to hook into the analysis pipeline at the pre code analysis stage.
588 589 590 |
# File 'C:/Program Files/Relyze/lib/relyze/core/plugin.rb', line 588 def pre_code_analyze return false end |
#pre_structure_analyze ⇒ Object (protected)
Override this method to hook into the analysis pipeline at the pre structure analysis stage.
578 579 580 |
# File 'C:/Program Files/Relyze/lib/relyze/core/plugin.rb', line 578 def pre_structure_analyze return false end |
#run ⇒ Object
Override this method to implement your plugin.
519 520 521 |
# File 'C:/Program Files/Relyze/lib/relyze/core/plugin.rb', line 519 def run return false end |
#shortcuts ⇒ Hash
Get this plugins keyboard shortcuts, if any. Shortcuts are registered during plugin initialization via the :shortcuts key in the plugins information hash. The :shortcuts value is a hash of shortcuts. Each key is a symbol for the shortcut name which corresponds to a method that is called when the shortcut is invoked. Each value is a string describing the keyboard shortcut value used to trigger the shortcut. While a default keyboard shortcut value must be given, the user can configure keyboard shortcuts via the application options in the GUI.
514 515 516 |
# File 'C:/Program Files/Relyze/lib/relyze/core/plugin.rb', line 514 def shortcuts return @information[:shortcuts] || {} end |
#type ⇒ Object
Get this plugins type.
482 483 484 |
# File 'C:/Program Files/Relyze/lib/relyze/core/plugin.rb', line 482 def type return :analysis end |