lib/controllers/generate.rb in evertils-0.3.4 vs lib/controllers/generate.rb in evertils-0.3.5
- old
+ new
@@ -15,18 +15,10 @@
@methods_require_internet.push(:daily, :weekly, :monthly, :mts)
OptionParser.new do |opt|
opt.banner = "#{Evertils::PACKAGE_NAME} generate timeframe [...-flags]"
- opt.on("-f", "--force", "Force execution") do
- @force = true
- end
-
- opt.on("-s", "--start=START", "Specify a date for the note") do |date|
- @start = DateTime.parse(date)
- end
-
opt.on("-n", "--name=NAME", "A name to pass to the script (not all commands support this flag)") do |name|
@name = name
end
end.parse!
@@ -48,21 +40,18 @@
title = @format.date_templates[NOTEBOOK_WEEKLY]
body = @format.template_contents(NOTEBOOK_WEEKLY)
body += to_enml($config.custom_sections[NOTEBOOK_WEEKLY]) unless $config.custom_sections.nil?
parent_notebook = NOTEBOOK_WEEKLY
- if !@force
- if !Date.today.monday?
- Notify.error("Sorry, you can only create new weekly logs on Mondays", {})
- end
- end
-
note = @model.create_note(title: title, body: body, parent_notebook: parent_notebook)
- tag_manager = Evertils::Common::Manager::Tag.instance
- week_tag = tag_manager.find("week-#{DateTime.now.cweek + 1}")
- note.tag(week_tag.prop(:name))
+ # BUG: inability to tag notes lies somewhere in evertils-common,
+ # specifically in how note.tag works
+ # As this is non-functional, lets not run it - commented out for now
+ # tag_manager = Evertils::Common::Manager::Tag.instance
+ # week_tag = tag_manager.find_or_create("week-#{Date.today.cweek}")
+ # note.tag(week_tag.prop(:name))
end
# generate monthly notes
def monthly
title = @format.date_templates[NOTEBOOK_MONTHLY]
@@ -70,13 +59,16 @@
body += to_enml($config.custom_sections[NOTEBOOK_MONTHLY]) unless $config.custom_sections.nil?
parent_notebook = NOTEBOOK_MONTHLY
note = @model.create_note(title: title, body: body, parent_notebook: parent_notebook)
- tag_manager = Evertils::Common::Manager::Tag.instance
- month_tag = tag_manager.find("month-#{DateTime.now.strftime('%-m')}")
- note.tag(month_tag.prop(:name))
+ # BUG: inability to tag notes lies somewhere in evertils-common,
+ # specifically in how note.tag works
+ # As this is non-functional, lets not run it - commented out for now
+ # tag_manager = Evertils::Common::Manager::Tag.instance
+ # month_tag = tag_manager.find_or_create("month-#{Date.today.month}")
+ # note.tag(month_tag.prop(:name))
end
# generate monthly task summary templates
def mts
Notify.error("Name argument is required", {}) if @name.nil?
@@ -87,15 +79,16 @@
parent_notebook = NOTEBOOK_MTS
# create the note from template
mts_note = @model.create_note(title: title, body: body, parent_notebook: parent_notebook)
- # tag it
- # TODO: maybe move this out of controller?
- tag_manager = Evertils::Common::Manager::Tag.instance
- month_tag = tag_manager.find("month-#{DateTime.now.strftime('%-m')}")
- mts_note.tag(month_tag.prop(:name))
+ # BUG: inability to tag notes lies somewhere in evertils-common,
+ # specifically in how note.tag works
+ # As this is non-functional, lets not run it - commented out for now
+ # tag_manager = Evertils::Common::Manager::Tag.instance
+ # month_tag = tag_manager.find_or_create("month-#{Date.today.month}")
+ # mts_note.tag(month_tag.prop(:name))
# TODO: commented out until support for multiple tags is added
# client_tag = tag_manager.find_or_create(@name)
# mts_note.tag(client_tag.prop(:name))
end
@@ -111,12 +104,14 @@
end
# creates the notes required to start the day
# - priority queue
# - daily
+ # - weekly (if today is Monday)
def morning
pq
daily
+ weekly if Date.today.monday?
end
private
#