module DataFiles
Public Class Methods
prepare(data_path)
click to toggle source
# File lib/hikiutils.rb, line 364 def self.prepare(data_path) create_file_if_not_exists(data_path) end
Private Class Methods
create_data_file(data_path)
click to toggle source
# File lib/hikiutils.rb, line 373 def self.create_data_file(data_path) print "make #{data_path}\n" init_data_file(data_path) end
create_file_if_not_exists(data_path)
click to toggle source
# File lib/hikiutils.rb, line 368 def self.create_file_if_not_exists(data_path) return if File::exists?(data_path) create_data_file(data_path) end
init_data_file(data_path)
click to toggle source
initialize source file by dummy data
# File lib/hikiutils.rb, line 379 def self.init_data_file(data_path) @src = {:target => 0, :editor_command => 'open -a mi', :srcs=>[{:nick_name => 'hoge', :local_dir => 'hogehoge', :local_uri => 'http://localhost/~hoge', :global_dir => 'hoge@global_host:/hoge', :global_uri => 'http://hoge'}]} file = File.open(data_path,'w') YAML.dump(@src,file) file.close end