Class: Shakapacker::Doctor

Inherits:
Object
  • Object
show all
Defined in:
lib/shakapacker/doctor.rb

Defined Under Namespace

Classes: Reporter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = nil, root_path = nil) ⇒ Doctor

Returns a new instance of Doctor.



10
11
12
13
14
15
16
# File 'lib/shakapacker/doctor.rb', line 10

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 = []
  @info = []
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



8
9
10
# File 'lib/shakapacker/doctor.rb', line 8

def config
  @config
end

#infoObject (readonly)

Returns the value of attribute info.



8
9
10
# File 'lib/shakapacker/doctor.rb', line 8

def info
  @info
end

#issuesObject (readonly)

Returns the value of attribute issues.



8
9
10
# File 'lib/shakapacker/doctor.rb', line 8

def issues
  @issues
end

#root_pathObject (readonly)

Returns the value of attribute root_path.



8
9
10
# File 'lib/shakapacker/doctor.rb', line 8

def root_path
  @root_path
end

#warningsObject (readonly)

Returns the value of attribute warnings.



8
9
10
# File 'lib/shakapacker/doctor.rb', line 8

def warnings
  @warnings
end

Instance Method Details

#runObject



18
19
20
21
# File 'lib/shakapacker/doctor.rb', line 18

def run
  perform_checks
  report_results
end

#success?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/shakapacker/doctor.rb', line 23

def success?
  @issues.empty?
end