rtt 0.0.0.12 → 0.0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/db/rtt.sqlite3 +0 -0
- data/lib/rtt.rb +1 -1
- data/lib/rtt/cmd_line_parser.rb +2 -1
- data/lib/rtt/interactive_configurator.rb +27 -21
- data/lib/rtt/report_generator.rb +12 -6
- data/rtt.gemspec +1 -1
- metadata +3 -3
data/Rakefile
CHANGED
@@ -3,7 +3,7 @@ require 'echoe'
|
|
3
3
|
|
4
4
|
# PACKAGING ============================================================
|
5
5
|
|
6
|
-
Echoe.new('rtt', '0.0.0.
|
6
|
+
Echoe.new('rtt', '0.0.0.13') do |p|
|
7
7
|
p.description = 'RTT is a tool for tracking time'
|
8
8
|
p.url = 'http://github.com/marklazz/rtt'
|
9
9
|
p.author = 'Marcelo Giorgi'
|
data/db/rtt.sqlite3
CHANGED
Binary file
|
data/lib/rtt.rb
CHANGED
@@ -72,7 +72,7 @@ module Rtt
|
|
72
72
|
say 'Task List'
|
73
73
|
say '========='
|
74
74
|
query(options).each do |task|
|
75
|
-
say "
|
75
|
+
say "Task: #{task.name} || Client: #{task.client.name} || Project: #{task.project.name} || User: #{task.user.nickname} || Elapsed time: #{task.duration} #{'[ACTIVE]' if task.active} \n"
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
data/lib/rtt/cmd_line_parser.rb
CHANGED
@@ -134,7 +134,8 @@ module Rtt
|
|
134
134
|
when SetUserCommand
|
135
135
|
set_user(cmd.name)
|
136
136
|
when DeleteCommand
|
137
|
-
|
137
|
+
name = cmd.name
|
138
|
+
options = name.present? ? env_filters.merge!(:name => name) : env_filters
|
138
139
|
delete(options)
|
139
140
|
when ConfigureCommand
|
140
141
|
case cmd.name.downcase
|
@@ -92,28 +92,34 @@ module Rtt
|
|
92
92
|
def configure_task(name = nil, conditions = {})
|
93
93
|
conditions.merge!(name.blank? ? { :active => true } : { :name => name })
|
94
94
|
task = name.blank? ? Task.first(conditions) : Task.first_or_create(conditions)
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
95
|
+
if task.present?
|
96
|
+
say "Modify the task information (with name: #{task.name})"
|
97
|
+
say "================================"
|
98
|
+
name = unless agree_or_enter('Want to keep current name')
|
99
|
+
ask("Name:") { |q| q.validate = /^\w+$/ }
|
100
|
+
else
|
101
|
+
task.name
|
102
|
+
end
|
103
|
+
rate = ask_or_default('rate', "Rate:", (task.rate if task.present?), /^[\d]+(\.[\d]+){0,1}$/)
|
104
|
+
task.rate = rate.to_f
|
105
|
+
task.name = name
|
106
|
+
date= ask_or_default('Date', "Date [Format: DD-MM-YYYY]:", (task.date.strftime("%d-%m-%Y") if task.present? && task.date.present?), /^\d{2,2}-\d{2,2}-\d{4,4}$/)
|
107
|
+
task.date = Date.parse(date) if date.present? && task.date != date
|
108
|
+
task.start_at = date
|
109
|
+
task.end_at = date
|
110
|
+
duration = ask_or_default('duration', "Duration:", (task.duration if task.present?), /^(\d{1,2})[hH]{1,2}(\d{1,2})[mM]{1,2}$/)
|
111
|
+
task.duration=(duration) if duration.present?
|
112
|
+
project_name = ask_or_default('project', 'Project name:', (task.project.name if task.present? && task.project.present?), /^\w+$/)
|
113
|
+
task.project=(build_project_if_not_exists(project_name)) if task.project.blank? || project_name != task.project.name
|
114
|
+
user_name = ask_or_default('user', 'User nickname:', (task.user.nickname if task.present? && task.user.present?), /^\w+$/)
|
115
|
+
task.user=(build_user_if_not_exists(user_name)) if task.user.blank? || user_name != task.user.nickname
|
116
|
+
task.save
|
117
|
+
task
|
118
|
+
else
|
119
|
+
name.blank? ?
|
120
|
+
say("There is no active task to configure. Please add the name of task, to this command, to modify it.") :
|
121
|
+
say("There is no task with that name. Please check the available tasks with 'rtt list'.")
|
101
122
|
end
|
102
|
-
rate = ask_or_default('rate', "Rate:", (task.rate if task.present?), /^[\d]+(\.[\d]+){0,1}$/)
|
103
|
-
task.rate = rate.to_f
|
104
|
-
task.name = name
|
105
|
-
date= ask_or_default('Date', "Date [Format: DD-MM-YYYY]:", (task.date.strftime("%d-%m-%Y") if task.present? && task.date.present?), /^\d{2,2}-\d{2,2}-\d{4,4}$/)
|
106
|
-
task.date = Date.parse(date) if date.present? && task.date != date
|
107
|
-
task.start_at = date
|
108
|
-
task.end_at = date
|
109
|
-
duration = ask_or_default('duration', "Duration:", (task.duration if task.present?), /^(\d{1,2})[hH]{1,2}(\d{1,2})[mM]{1,2}$/)
|
110
|
-
task.duration=(duration) if duration.present?
|
111
|
-
project_name = ask_or_default('project', 'Project name:', (task.project.name if task.present? && task.project.present?), /^\w+$/)
|
112
|
-
task.project=(build_project_if_not_exists(project_name)) if task.project.blank? || project_name != task.project.name
|
113
|
-
user_name = ask_or_default('user', 'User nickname:', (task.user.nickname if task.present? && task.user.present?), /^\w+$/)
|
114
|
-
task.user=(build_user_if_not_exists(user_name)) if task.user.blank? || user_name != task.user.nickname
|
115
|
-
task.save
|
116
|
-
task
|
117
123
|
end
|
118
124
|
|
119
125
|
private
|
data/lib/rtt/report_generator.rb
CHANGED
@@ -18,12 +18,14 @@ module Rtt
|
|
18
18
|
}
|
19
19
|
|
20
20
|
def column_widths(fixed_fields)
|
21
|
-
case fixed_fields
|
22
|
-
when
|
23
|
-
{ 0 =>
|
24
|
-
when
|
21
|
+
case fixed_fields
|
22
|
+
when ['Date', 'Client', 'Project']
|
23
|
+
{ 0 => 430, 1 => 50, 2 => 60 } # total = 540 px
|
24
|
+
when ['Client', 'Project']
|
25
|
+
{ 0 => 360, 1 => 60, 2 => 60, 3 => 60 }
|
26
|
+
when ['Project', '']
|
25
27
|
{ 0 => 80, 1 => 290, 2 => 60, 3 => 50, 4 => 60 }
|
26
|
-
|
28
|
+
when []
|
27
29
|
{ 0 => 80, 1 => 80, 2 => 210, 3 => 60, 4 => 50, 5 => 60 }
|
28
30
|
end
|
29
31
|
end
|
@@ -82,6 +84,7 @@ module Rtt
|
|
82
84
|
def has_default_value?(field)
|
83
85
|
task = self.data[:rows].first
|
84
86
|
return true if task.nil?
|
87
|
+
return false if !(field == 'Client' || field == 'Project' || field == 'User')
|
85
88
|
(REPORT_FIELD_OUTPUT[field].call(task) if task.present?) == eval("Rtt::#{field}::DEFAULT_NAME")
|
86
89
|
end
|
87
90
|
|
@@ -156,6 +159,7 @@ module Rtt
|
|
156
159
|
:right_margin => 1.cm, # units
|
157
160
|
:top_margin => 0.1.dm, # work
|
158
161
|
:bottom_margin => 0.01.m, # well
|
162
|
+
:bottom_padding => 0.04.m,
|
159
163
|
:page_size => 'A4') do
|
160
164
|
|
161
165
|
report_generator.fill_user_information(self) if report_generator.custom_user_is_defined?
|
@@ -195,8 +199,10 @@ module Rtt
|
|
195
199
|
text "Total costs: $#{sprintf('%.1f', total_amount)}"
|
196
200
|
move_down 10
|
197
201
|
|
198
|
-
|
202
|
+
font_size 14
|
203
|
+
number_pages "Page <page> / <total>", [bounds.right - 80, -10]
|
199
204
|
say "Report saved at #{output_path}"
|
205
|
+
|
200
206
|
render_file output_path
|
201
207
|
end
|
202
208
|
rescue LoadError
|
data/rtt.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rtt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 85
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
9
|
- 0
|
10
|
-
-
|
11
|
-
version: 0.0.0.
|
10
|
+
- 13
|
11
|
+
version: 0.0.0.13
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Marcelo Giorgi
|