Sha256: 77d71381a66f2b4d79bc32047bf5cbd55a39ecfe1b5756a2e14eefbc3f4d5a58

Contents?: true

Size: 667 Bytes

Versions: 5

Compression:

Stored size: 667 Bytes

Contents

# -*- coding: utf-8 -*-
#
# @file 
# @brief
# @author ongaeshi
# @date   2011/03/08

require 'fileutils'

module CodeStock
  DEFAULT_PATH = '~/.codestock'
  
  def db_default_dir
    if (ENV['CODESTOCK_DEFAULT_DIR'])
      File.expand_path ENV['CODESTOCK_DEFAULT_DIR']
    else
      File.expand_path DEFAULT_PATH
    end
  end

  def dbdir?(path = '.')
    FileTest.exist? db_yaml_path(path)
  end

  def db_groonga_path(path = '.')
    (Pathname.new(path) + 'db/grendb.db').to_s
  end

  def db_expand_groonga_path(path = '.')
    File.expand_path db_groonga_path(path)
  end

  def db_yaml_path(path = '.')
    (Pathname.new(path) + 'grendb.yaml').to_s
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
codestock-0.1.4 lib/common/dbdir.rb
codestock-0.1.3 lib/common/dbdir.rb
codestock-0.1.2 lib/common/dbdir.rb
codestock-0.1.1 lib/common/dbdir.rb
codestock-0.1.0 lib/common/dbdir.rb