lib/renuo/cli/app/work.rb in renuo-cli-4.5.0 vs lib/renuo/cli/app/work.rb in renuo-cli-4.5.1
- old
+ new
@@ -1,10 +1,10 @@
# frozen_string_literal: true
-require 'fileutils'
-require 'renuo/cli/app/redmine/issue'
-require 'renuo/cli/app/toggl/time_entry'
+require "fileutils"
+require "renuo/cli/app/redmine/issue"
+require "renuo/cli/app/toggl/time_entry"
class Work
ACTIONS = %w[start].freeze
def run(args)
@@ -20,25 +20,25 @@
private
# TODO: I want to implement also the stop action.
def validate_action
- abort('>> No action given. It must be start') unless ACTIONS.include? @action
+ abort(">> No action given. It must be start") unless ACTIONS.include? @action
end
def validate_project_name
- abort('>> No project name given.') unless @project_name
+ abort(">> No project name given.") unless @project_name
end
def validate_ticket_number
- abort('>> No ticket number given.') unless @ticket_number
+ abort(">> No ticket number given.") unless @ticket_number
issue = Redmine::Issue.find(@ticket_number)
open_statuses = Redmine::Issue::STATUSES.values_at(:to_start, :planned, :in_progress, :qa)
return if open_statuses.include?(issue.status.id)
system("open #{issue.html_url}")
- abort('>> Ticket should be in an open status')
+ abort(">> Ticket should be in an open status")
end
def start_feature_branch
project_folder = `autojump #{@project_name}`.strip
system("cd #{project_folder} && git stash && git checkout develop " \
@@ -64,31 +64,31 @@
end
def existing_toggl(current_time_entry)
say("A timer '#{current_time_entry.description}' was already running.")
if current_time_entry.description.to_i == @ticket_number.to_i
- say('I will keep using it')
+ say("I will keep using it")
else
- say('I stopped it and started a new time entry.')
+ say("I stopped it and started a new time entry.")
stop_toggl_time_entry(current_time_entry.id)
create_toggl_time_entry
end
end
def update_toggl_time_entry(time_entry_id)
- say('A timer was already running but without a project assigned. I updated the current time entry.')
+ say("A timer was already running but without a project assigned. I updated the current time entry.")
time_entry = Toggl::TimeEntry.find(time_entry_id)
time_entry.description = @ticket_number.to_s
time_entry.tags = [@project_name.to_s]
- time_entry.created_with = 'curl'
+ time_entry.created_with = "curl"
time_entry.save
end
def create_toggl_time_entry
Toggl::TimeEntry.start(time_entry: { description: @ticket_number.to_s,
tags: [@project_name.to_s],
- created_with: 'curl' })
+ created_with: "curl" })
end
def stop_toggl_time_entry(time_entry_id)
Toggl::TimeEntry.find(time_entry_id).stop
end