Sha256: 86f88d1c2e3ef9685b82614e3275c1e8ac8c0f48dd6bef8ac3b32afda3c2a9f5

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

module Hobo
  class << self
    attr_accessor :project_path

    def config_path
      File.join(ENV['HOME'], '.hobo')
    end

    def seed_cache_path
      File.join(config_path, 'seeds')
    end

    def project_path
      return @project_path unless @project_path.nil?
      dir = Dir.pwd
      while File.split(dir)[1] != File.split(dir)[0]
        match = [
          File.exists?(File.join(dir, 'Hobofile')),
          File.exists?(File.join(dir, 'tools', 'hobo')),
          File.exists?(File.join(dir, 'tools', 'vagrant', 'Vagrantfile'))
        ] - [false]

        return @project_path = dir if match.length > 0

        dir = File.split(dir)[0]
      end
      return @project_path = nil
    end

    def project_bin_path
      return nil if !project_path
      File.join(project_path, 'bin')
    end

    def hobofile_path
      return nil if !project_path
      File.join(project_path, 'Hobofile')
    end

    def project_config_file
      return nil if !project_path
      File.join(project_path, 'tools', 'hobo', 'storage.yaml')
    end

    def user_config_file
      File.join(config_path, 'config.rb')
    end

    def user_hobofile_path
      File.join(config_path, 'Hobofile')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hobo-inviqa-0.0.3 lib/hobo/paths.rb