4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/smalruby_editor.rb', line 4
def create_home_directory(home_dir = nil)
if home_dir.blank?
home_dir = Pathname(ENV['SMALRUBY_EDITOR_HOME'] || '~/.smalruby-editor').expand_path
end
%w(log db config tmp/cache tmp/pids tmp/sessions tmp/sockets).map { |s|
home_dir.join(s)
}.each do |dir|
FileUtils.mkdir_p(dir)
end
database_yml_path = home_dir.join('config', 'database.yml')
db_path = home_dir.join('db', 'standalone.sqlite3')
if !File.exist?(database_yml_path)
File.open(database_yml_path, 'w') do |f|
f.write("standalone:\nadapter: sqlite3\ndatabase: \#{db_path}\npool: 5\ntimeout: 5000\n EOS\n end\n end\n\n home_dir\nend\n")
|