53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/work/md/date_file.rb', line 53
def self.create_if_not_exist(some_date)
t = Work::Md::Config.translations
file = date_to_file_locations(some_date)
return file[:name] if ::File.exist?(file[:path])
::FileUtils
.mkdir_p(file[:dir])
::File.open(
file[:path],
'w+'
) do |f|
f.puts("# #{some_date.strftime('%d/%m/%Y')} - #{Work::Md::Config.title} \n\n")
f.puts("### #{t[:tasks]}:\n\n")
f.puts("- [ ]\n\n")
f.puts("---\n\n")
f.puts("### #{t[:meetings]}:\n\n")
f.puts("- [ ]\n\n")
f.puts("---\n\n")
f.puts("### #{t[:interruptions]}:\n\n")
f.puts("---\n\n")
f.puts("### #{t[:difficulties]}:\n\n")
f.puts("---\n\n")
f.puts("### #{t[:observations]}:\n\n")
f.puts("---\n\n")
f.puts("### #{t[:pomodoros]}:\n\n")
f.puts("0\n\n")
end
file[:name]
end
|