Class: StackCar::DotRc

Inherits:
Object
  • Object
show all
Includes:
Thor::Shell
Defined in:
lib/stack_car/dot_rc.rb

Instance Method Summary collapse

Constructor Details

#initializeDotRc

Returns a new instance of DotRc.



7
8
9
10
11
12
# File 'lib/stack_car/dot_rc.rb', line 7

def initialize
  @file = find_file
  say_status :load, 'not found', :red && return unless @file
  say_status :load, @file
  load(@file)
end

Instance Method Details

#find_fileObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/stack_car/dot_rc.rb', line 14

def find_file
  path = nil
  Pathname(Dir.pwd).ascend do |p|
    if File.directory?(p) && File.exist?(File.join(p, '.stack_car_rc'))
      path = File.join(p, '.stack_car_rc')
      break
    end
  end
  path
end