Class: RemindMe::Runner
- Inherits:
-
Object
- Object
- RemindMe::Runner
- Extended by:
- Parallel::ProcessorCount, BailOut, Utils::Logger, Utils::Versions
- Defined in:
- lib/remind_me/runner.rb
Constant Summary
Constants included from Utils::Versions
Utils::Versions::INSTALLED_GEMS
Class Method Summary collapse
- .all_file_comments(file, parser) ⇒ Object
- .check_reminders(check_path: '.') ⇒ Object
- .collect_reminders(path) ⇒ Object
-
.processor_count ⇒ Object
:nocov:.
-
.relevant_ruby_files(parse_path) ⇒ Object
:nocov:.
-
.silent_parser ⇒ Object
:nocov:.
- .using_old_parallel_gem? ⇒ Boolean
Methods included from BailOut
Methods included from Utils::Logger
colorize, green, log_error, log_info, log_with_rails, rails_being_used?, red
Methods included from Utils::Versions
compare_version_numbers, condition_comparators, gem_installed?, gem_version, invalid_condition_message, valid_condition?, valid_version_string?
Class Method Details
.all_file_comments(file, parser) ⇒ Object
82 83 84 85 86 87 88 |
# File 'lib/remind_me/runner.rb', line 82 def self.all_file_comments(file, parser) parser.reset source = File.read(file).force_encoding(parser.default_encoding) buffer = Parser::Source::Buffer.new(file) buffer.source = source parser.parse_with_comments(buffer).last end |
.check_reminders(check_path: '.') ⇒ Object
38 39 40 |
# File 'lib/remind_me/runner.rb', line 38 def self.check_reminders(check_path: '.') Utils::ResultPrinter.new(collect_reminders(check_path)).print_results end |
.collect_reminders(path) ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/remind_me/runner.rb', line 42 def self.collect_reminders(path) if REMIND_ME_NATIVE_AVAILABLE collect_reminders_native(path) else # :nocov: collect_reminders_ruby(path) # :nocov: end end |
.processor_count ⇒ Object
:nocov:
134 135 136 137 138 139 140 |
# File 'lib/remind_me/runner.rb', line 134 def self.processor_count if using_old_parallel_gem? super else Parallel.processor_count end end |
.relevant_ruby_files(parse_path) ⇒ Object
:nocov:
98 99 100 101 102 103 104 |
# File 'lib/remind_me/runner.rb', line 98 def self.relevant_ruby_files(parse_path) Parallel.flat_map(in_groups(collect_ruby_files(parse_path), processor_count, false)) do |files| files.select do |file| IO.foreach(file).any? { |line| line.include?('REMIND_ME:') } end end end |
.silent_parser ⇒ Object
:nocov:
75 76 77 78 79 80 |
# File 'lib/remind_me/runner.rb', line 75 def self.silent_parser parser = Parser::CurrentRuby.new parser.diagnostics.consumer = ->() {} parser.diagnostics.ignore_warnings = true parser end |
.using_old_parallel_gem? ⇒ Boolean
26 27 28 |
# File 'lib/remind_me/runner.rb', line 26 def self.using_old_parallel_gem? gem_version('parallel') < Gem::Version.new('1.23.0') end |