Class: Shakapacker::Doctor
- Inherits:
-
Object
- Object
- Shakapacker::Doctor
- Defined in:
- lib/shakapacker/doctor.rb
Defined Under Namespace
Classes: Reporter
Constant Summary collapse
- CATEGORY_ACTION_REQUIRED =
Warning categories for better organization
:action_required- CATEGORY_RECOMMENDED =
:recommended- CATEGORY_INFO =
:info
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#info ⇒ Object
readonly
Returns the value of attribute info.
-
#issues ⇒ Object
readonly
Returns the value of attribute issues.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#root_path ⇒ Object
readonly
Returns the value of attribute root_path.
-
#warnings ⇒ Object
readonly
Returns the value of attribute warnings.
Instance Method Summary collapse
-
#initialize(config = nil, root_path = nil, options = {}) ⇒ Doctor
constructor
A new instance of Doctor.
- #run ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(config = nil, root_path = nil, options = {}) ⇒ Doctor
Returns a new instance of Doctor.
15 16 17 18 19 20 21 22 |
# File 'lib/shakapacker/doctor.rb', line 15 def initialize(config = nil, root_path = nil, = {}) @config = config || Shakapacker.config @root_path = root_path || (defined?(Rails) ? Rails.root : Pathname.new(Dir.pwd)) @issues = [] @warnings = [] # Now stores hashes: { category: :symbol, message: "..." } @info = [] = end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
8 9 10 |
# File 'lib/shakapacker/doctor.rb', line 8 def config @config end |
#info ⇒ Object (readonly)
Returns the value of attribute info.
8 9 10 |
# File 'lib/shakapacker/doctor.rb', line 8 def info @info end |
#issues ⇒ Object (readonly)
Returns the value of attribute issues.
8 9 10 |
# File 'lib/shakapacker/doctor.rb', line 8 def issues @issues end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/shakapacker/doctor.rb', line 8 def end |
#root_path ⇒ Object (readonly)
Returns the value of attribute root_path.
8 9 10 |
# File 'lib/shakapacker/doctor.rb', line 8 def root_path @root_path end |
#warnings ⇒ Object (readonly)
Returns the value of attribute warnings.
8 9 10 |
# File 'lib/shakapacker/doctor.rb', line 8 def warnings @warnings end |
Instance Method Details
#run ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/shakapacker/doctor.rb', line 24 def run if [:help] print_help return end perform_checks report_results end |
#success? ⇒ Boolean
34 35 36 |
# File 'lib/shakapacker/doctor.rb', line 34 def success? @issues.empty? end |