Class: Transpec::DynamicAnalyzer
- Inherits:
-
Object
- Object
- Transpec::DynamicAnalyzer
- Defined in:
- lib/transpec/dynamic_analyzer.rb,
lib/transpec/dynamic_analyzer/rewriter.rb,
lib/transpec/dynamic_analyzer/node_util.rb,
lib/transpec/dynamic_analyzer/runtime_data.rb
Defined Under Namespace
Modules: NodeUtil Classes: AnalysisError, Rewriter, RuntimeData
Constant Summary collapse
- ANALYSIS_MODULE =
'Transpec'
- ANALYSIS_METHOD =
'analyze'
- RUNTIME_DATA_ERROR_MESSAGE_KEY =
:error_message
- HELPER_TEMPLATE_FILE =
'transpec_analysis_helper.rb.erb'
- RESULT_FILE =
'transpec_analysis_result.json'
Instance Attribute Summary collapse
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#rspec_command ⇒ Object
readonly
Returns the value of attribute rspec_command.
-
#silent ⇒ Object
(also: #silent?)
readonly
Returns the value of attribute silent.
Instance Method Summary collapse
- #analyze(paths = []) ⇒ Object
- #default_rspec_command ⇒ Object
-
#initialize(options = {}) ⇒ DynamicAnalyzer
constructor
A new instance of DynamicAnalyzer.
Constructor Details
#initialize(options = {}) ⇒ DynamicAnalyzer
Returns a new instance of DynamicAnalyzer.
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/transpec/dynamic_analyzer.rb', line 24 def initialize( = {}) @project = [:project] || Project.new @rspec_command = [:rspec_command] || default_rspec_command @silent = [:silent] || false if block_given? in_copied_project do yield self end end end |
Instance Attribute Details
#project ⇒ Object (readonly)
Returns the value of attribute project.
21 22 23 |
# File 'lib/transpec/dynamic_analyzer.rb', line 21 def project @project end |
#rspec_command ⇒ Object (readonly)
Returns the value of attribute rspec_command.
21 22 23 |
# File 'lib/transpec/dynamic_analyzer.rb', line 21 def rspec_command @rspec_command end |
#silent ⇒ Object (readonly) Also known as: silent?
Returns the value of attribute silent.
21 22 23 |
# File 'lib/transpec/dynamic_analyzer.rb', line 21 def silent @silent end |
Instance Method Details
#analyze(paths = []) ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/transpec/dynamic_analyzer.rb', line 44 def analyze(paths = []) in_copied_project do rewrite_specs(paths) put_analysis_helper modify_dot_rspec run_rspec(paths) load_analysis_result end end |
#default_rspec_command ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/transpec/dynamic_analyzer.rb', line 36 def default_rspec_command if project.require_bundler? 'bundle exec rspec' else 'rspec' end end |