Module: CodeStock

Included in:
Database
Defined in:
lib/cdstk/cdstk.rb,
lib/common/dbdir.rb,
lib/cdweb/database.rb,
lib/cdstk/cli_cdstk.rb,
lib/cdweb/cli_cdweb.rb,
lib/cdstk/cdstk_yaml.rb,
lib/cdview/cli_cdview.rb

Defined Under Namespace

Classes: CLI_Cdstk, CLI_Cdview, CLI_Cdweb, Cdstk, CdstkYaml, Database

Constant Summary collapse

DEFAULT_PATH =
'~/.codestock'

Instance Method Summary collapse

Instance Method Details

#db_default_dirObject



13
14
15
16
17
18
19
# File 'lib/common/dbdir.rb', line 13

def db_default_dir
  if (ENV['CODESTOCK_DEFAULT_DIR'])
    File.expand_path ENV['CODESTOCK_DEFAULT_DIR']
  else
    File.expand_path DEFAULT_PATH
  end
end

#db_expand_groonga_path(path = '.') ⇒ Object



29
30
31
# File 'lib/common/dbdir.rb', line 29

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

#db_groonga_path(path = '.') ⇒ Object



25
26
27
# File 'lib/common/dbdir.rb', line 25

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

#db_yaml_path(path = '.') ⇒ Object



33
34
35
# File 'lib/common/dbdir.rb', line 33

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

#dbdir?(path = '.') ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/common/dbdir.rb', line 21

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