Class: RubyDetective::Runner
- Inherits:
-
Object
- Object
- RubyDetective::Runner
- Defined in:
- lib/ruby_detective/runner.rb
Instance Attribute Summary collapse
-
#classes ⇒ Object
readonly
Returns the value of attribute classes.
-
#modules ⇒ Object
readonly
Returns the value of attribute modules.
-
#project_path ⇒ Object
readonly
Returns the value of attribute project_path.
Instance Method Summary collapse
-
#initialize(project_path) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
Constructor Details
#initialize(project_path) ⇒ Runner
Returns a new instance of Runner.
7 8 9 10 11 12 13 |
# File 'lib/ruby_detective/runner.rb', line 7 def initialize(project_path) if [nil, "", " "].include? project_path @project_path = "." else @project_path = project_path end end |
Instance Attribute Details
#classes ⇒ Object (readonly)
Returns the value of attribute classes.
5 6 7 |
# File 'lib/ruby_detective/runner.rb', line 5 def classes @classes end |
#modules ⇒ Object (readonly)
Returns the value of attribute modules.
5 6 7 |
# File 'lib/ruby_detective/runner.rb', line 5 def modules @modules end |
#project_path ⇒ Object (readonly)
Returns the value of attribute project_path.
5 6 7 |
# File 'lib/ruby_detective/runner.rb', line 5 def project_path @project_path end |
Instance Method Details
#run ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ruby_detective/runner.rb', line 15 def run puts "Processing files..." Dir.glob("#{project_path}/**/*.rb") do |file_path| AST::FileParser.new(file_path, project_path).parse end puts "Finding dependencies..." SourceRepresentation::DataStore.instance.resolve_dependencies if ENV["ENV"] == "development" puts "Generating output .json file..." json = ::RubyDetective::JSONBuilder.build output_file_path = "ui/src/data.json" File.delete(output_file_path) if File.exist?(output_file_path) File.open(output_file_path, "w") { |file| file << json } else puts "Generating output HTML file..." UIGenerator.generate end puts "Done!" end |