Sha256: 08c969e579443dd390b71297e626f0a53bc5458df8b7e11fdbc47151e2cd8ae8

Contents?: true

Size: 591 Bytes

Versions: 12

Compression:

Stored size: 591 Bytes

Contents

module Timetrap
  module AutoSheets
    #
    # Check the current dir and all parent dirs for .timetrap-sheet
    #
    class NestedDotfiles
      def check_sheet(dir)
        dotfile = File.join(dir, '.timetrap-sheet')
        File.read(dotfile).chomp if File.exist?(dotfile)
      end

      def sheet
        dir = Dir.pwd
        while true do
            sheet = check_sheet dir
            break if nil != sheet
            new_dir = File.expand_path("..", dir)
            break if new_dir == dir
            dir = new_dir
        end
        return sheet
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
timetrap-1.15.4 lib/timetrap/auto_sheets/nested_dotfiles.rb
timetrap-1.15.2 lib/timetrap/auto_sheets/nested_dotfiles.rb
timetrap-1.15.1 lib/timetrap/auto_sheets/nested_dotfiles.rb
timetrap-1.14.3 lib/timetrap/auto_sheets/nested_dotfiles.rb
timetrap-1.15.0 lib/timetrap/auto_sheets/nested_dotfiles.rb
timetrap-1.14.2 lib/timetrap/auto_sheets/nested_dotfiles.rb
timetrap-1.14.1 lib/timetrap/auto_sheets/nested_dotfiles.rb
timetrap-1.14.0 lib/timetrap/auto_sheets/nested_dotfiles.rb
timetrap-1.13.0 lib/timetrap/auto_sheets/nested_dotfiles.rb
timetrap-1.12.0 lib/timetrap/auto_sheets/nested_dotfiles.rb
timetrap-1.11.0 lib/timetrap/auto_sheets/nested_dotfiles.rb
timetrap-1.10.0 lib/timetrap/auto_sheets/nested_dotfiles.rb