module Milkode::Dbdir
Public Instance Methods
dbdir?(path = '.')
click to toggle source
# File lib/milkode/common/dbdir.rb, line 54 def dbdir?(path = '.') FileTest.exist? yaml_path(path) end
default_dir()
click to toggle source
# File lib/milkode/common/dbdir.rb, line 30 def default_dir path = @@milkode_db_dir if (File.exist? path) File.read path elsif (ENV['MILKODE_DEFAULT_DIR']) File.expand_path ENV['MILKODE_DEFAULT_DIR'] else File.expand_path '~/.milkode' end end
expand_groonga_path(path = '.')
click to toggle source
# File lib/milkode/common/dbdir.rb, line 46 def expand_groonga_path(path = '.') File.expand_path groonga_path(path) end
groonga_path(path = '.')
click to toggle source
# File lib/milkode/common/dbdir.rb, line 42 def groonga_path(path = '.') (Pathname.new(path) + 'db/milkode.db').to_s end
milkode_db_dir()
click to toggle source
# File lib/milkode/common/dbdir.rb, line 15 def milkode_db_dir @@milkode_db_dir end
select_dbdir()
click to toggle source
# File lib/milkode/common/dbdir.rb, line 58 def select_dbdir if (Dbdir.dbdir?('.') || !Dbdir.dbdir?(Dbdir.default_dir)) '.' else Dbdir.default_dir end end
set_milkode_db_dir(dir)
click to toggle source
# File lib/milkode/common/dbdir.rb, line 19 def set_milkode_db_dir(dir) @@milkode_db_dir = dir end
tmp_milkode_db_dir(path) { || ... }
click to toggle source
# File lib/milkode/common/dbdir.rb, line 23 def tmp_milkode_db_dir(path) old_path = Dbdir.milkode_db_dir Dbdir.set_milkode_db_dir path yield Dbdir.set_milkode_db_dir old_path end
yaml_path(path = '.')
click to toggle source
# File lib/milkode/common/dbdir.rb, line 50 def yaml_path(path = '.') (Pathname.new(path) + 'milkode.yaml').to_s end