rtt 0.0.0.1 → 0.0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Manifest CHANGED
@@ -4,10 +4,6 @@ README.rdoc
4
4
  Rakefile
5
5
  USAGE.txt
6
6
  bin/rtt
7
- db/rtt.sqlite3
8
- db/test.sqlite3
9
- db/test.sqlite3-journal
10
- init.sh
11
7
  lib/rtt.rb
12
8
  lib/rtt/client.rb
13
9
  lib/rtt/cmd_line_interpreter.rb
@@ -20,9 +16,7 @@ lib/rtt/task.rb
20
16
  lib/rtt/user.rb
21
17
  lib/rtt/user_configurator.rb
22
18
  rtt.gemspec
23
- rtt_report
24
19
  spec/datamapper_spec_helper.rb
25
20
  spec/lib/rtt/task_spec.rb
26
21
  spec/lib/rtt_spec.rb
27
22
  tasks/rtt.rake
28
- todo.txt
data/Rakefile CHANGED
@@ -3,12 +3,12 @@ require 'echoe'
3
3
 
4
4
  # PACKAGING ============================================================
5
5
 
6
- Echoe.new('rtt', '0.0.0.1') do |p|
6
+ Echoe.new('rtt', '0.0.0.2') do |p|
7
7
  p.description = 'RTT is a tool for tracking time'
8
8
  p.url = 'http://www.marklazz.com'
9
9
  p.author = 'Marcelo Giorgi'
10
10
  p.email = 'marklazz.uy@gmail.com'
11
- p.ignore_pattern = [ 'tmp/*', 'script/*' ]
11
+ p.ignore_pattern = [ 'tmp/*', 'script/*', 'db/*', '*.sh' ]
12
12
  p.runtime_dependencies = [ ['highline', ">= 1.5.2"], ['activesupport', '>= 2.3.0'], ['prawn', '>= 0.8.0'], ['dm-core', '>= 1.0.0'], [ 'dm-migrations', '>= 1.0.0'] ]
13
13
  p.development_dependencies = [ 'spec' ]
14
14
  end
@@ -65,6 +65,8 @@ module Rtt
65
65
  command.optional = arguments if arguments.present?
66
66
  Array(command)
67
67
  end
68
+ else
69
+ puts_usage
68
70
  end
69
71
  end
70
72
 
@@ -55,6 +55,14 @@ module Rtt
55
55
  end
56
56
  end
57
57
 
58
+ def full_path(output_path = nil)
59
+ entered_filename = output_path || DEFAULT_FILENAME
60
+ filename, directory, extension = File.basename(entered_filename), File.dirname(entered_filename), File.extname(entered_filename)
61
+ path = directory.present? && directory != '.' && File.exists?(directory) ? directory : ENV['HOME']
62
+ ext = extension.present? ? extension : 'pdf'
63
+ "#{File.join(path, filename)}.#{ext}"
64
+ end
65
+
58
66
  #
59
67
  #
60
68
  def report options = {}
@@ -65,9 +73,10 @@ module Rtt
65
73
  fixed_fields = extract_fixed_fields(options)
66
74
  fixed_fields_and_values = fixed_fields.inject({}) { |hash, key| hash[key] = options[key.downcase.to_sym]; hash }
67
75
  @data = { :fixed_fields => fixed_fields_and_values, :rows => query(options) }
76
+ filename_path = full_path(path)
68
77
  case extension
69
78
  when :pdf
70
- report_to_pdf path
79
+ report_to_pdf filename_path
71
80
  when :csv
72
81
  raise 'CSV format report not implemented yet'
73
82
  report_to_csv path
@@ -142,17 +151,19 @@ module Rtt
142
151
 
143
152
  move_down 50
144
153
 
145
- table data,
146
- :headers => columns,
147
- #:position => :center,
148
- :position => :left,
149
- :border_width => 1,
150
- :row_colors => [ 'fafafa', 'f0f0f0' ],
151
- :font_size => 12,
152
- :padding => 5,
153
- :align => :left
154
- #:width => 535
155
- #:column_widths => { 1=> 50, 2 => 40, 3 => 30}
154
+ if data.present?
155
+ table data,
156
+ :headers => columns,
157
+ #:position => :center,
158
+ :position => :left,
159
+ :border_width => 1,
160
+ :row_colors => [ 'fafafa', 'f0f0f0' ],
161
+ :font_size => 12,
162
+ :padding => 5,
163
+ :align => :left
164
+ #:width => 535
165
+ #:column_widths => { 1=> 50, 2 => 40, 3 => 30}
166
+ end
156
167
 
157
168
  move_down 20
158
169
  text "Total: #{total_h}h#{total_m}m"
@@ -165,11 +176,12 @@ module Rtt
165
176
  #}.draw
166
177
  #end
167
178
  number_pages "Page <page> / <total>", [bounds.right - 80, 0]
168
-
169
- render_file(output_path || DEFAULT_FILENAME)
179
+ render_file output_path
170
180
  end
171
181
  rescue LoadError
172
182
  puts "Missing gem: prawn, prawn/layout or prawn/measurement_extensions"
183
+ rescue => e
184
+ puts "[rtt] Error while generating report: #{e.to_s}"
173
185
  end
174
186
 
175
187
  def calculate_fixed_fields_based_on_data
data/rtt.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{rtt}
5
- s.version = "0.0.0.1"
5
+ s.version = "0.0.0.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Marcelo Giorgi"]
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.email = %q{marklazz.uy@gmail.com}
13
13
  s.executables = ["rtt"]
14
14
  s.extra_rdoc_files = ["LICENSE", "README.rdoc", "bin/rtt", "lib/rtt.rb", "lib/rtt/client.rb", "lib/rtt/cmd_line_interpreter.rb", "lib/rtt/hash_extensions.rb", "lib/rtt/project.rb", "lib/rtt/query_builder.rb", "lib/rtt/report_generator.rb", "lib/rtt/storage.rb", "lib/rtt/task.rb", "lib/rtt/user.rb", "lib/rtt/user_configurator.rb", "tasks/rtt.rake"]
15
- s.files = ["LICENSE", "Manifest", "README.rdoc", "Rakefile", "USAGE.txt", "bin/rtt", "db/rtt.sqlite3", "db/test.sqlite3", "init.sh", "lib/rtt.rb", "lib/rtt/client.rb", "lib/rtt/cmd_line_interpreter.rb", "lib/rtt/hash_extensions.rb", "lib/rtt/project.rb", "lib/rtt/query_builder.rb", "lib/rtt/report_generator.rb", "lib/rtt/storage.rb", "lib/rtt/task.rb", "lib/rtt/user.rb", "lib/rtt/user_configurator.rb", "rtt.gemspec", "rtt_report", "spec/datamapper_spec_helper.rb", "spec/lib/rtt/task_spec.rb", "spec/lib/rtt_spec.rb", "tasks/rtt.rake", "todo.txt"]
15
+ s.files = ["LICENSE", "Manifest", "README.rdoc", "Rakefile", "USAGE.txt", "bin/rtt", "lib/rtt.rb", "lib/rtt/client.rb", "lib/rtt/cmd_line_interpreter.rb", "lib/rtt/hash_extensions.rb", "lib/rtt/project.rb", "lib/rtt/query_builder.rb", "lib/rtt/report_generator.rb", "lib/rtt/storage.rb", "lib/rtt/task.rb", "lib/rtt/user.rb", "lib/rtt/user_configurator.rb", "rtt.gemspec", "spec/datamapper_spec_helper.rb", "spec/lib/rtt/task_spec.rb", "spec/lib/rtt_spec.rb", "tasks/rtt.rake"]
16
16
  s.homepage = %q{http://www.marklazz.com}
17
17
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Rtt", "--main", "README.rdoc"]
18
18
  s.require_paths = ["lib"]
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: 77
4
+ hash: 75
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
9
  - 0
10
- - 1
11
- version: 0.0.0.1
10
+ - 2
11
+ version: 0.0.0.2
12
12
  platform: ruby
13
13
  authors:
14
14
  - Marcelo Giorgi
@@ -142,9 +142,6 @@ files:
142
142
  - Rakefile
143
143
  - USAGE.txt
144
144
  - bin/rtt
145
- - db/rtt.sqlite3
146
- - db/test.sqlite3
147
- - init.sh
148
145
  - lib/rtt.rb
149
146
  - lib/rtt/client.rb
150
147
  - lib/rtt/cmd_line_interpreter.rb
@@ -157,12 +154,10 @@ files:
157
154
  - lib/rtt/user.rb
158
155
  - lib/rtt/user_configurator.rb
159
156
  - rtt.gemspec
160
- - rtt_report
161
157
  - spec/datamapper_spec_helper.rb
162
158
  - spec/lib/rtt/task_spec.rb
163
159
  - spec/lib/rtt_spec.rb
164
160
  - tasks/rtt.rake
165
- - todo.txt
166
161
  has_rdoc: true
167
162
  homepage: http://www.marklazz.com
168
163
  licenses: []
data/db/rtt.sqlite3 DELETED
Binary file
data/db/test.sqlite3 DELETED
Binary file
data/init.sh DELETED
@@ -1,5 +0,0 @@
1
- #!/bin/sh
2
- rm db/rtt.sqlite3
3
- bin/rtt client 'Emex'
4
- bin/rtt project 'Emex'
5
- bin/rtt user #'marklazz' 'Marcelo' 'Giorgi' 'marklazz' 'marklazz.uy@gmail.com' 'Uruguay' 'Montevideo' 'Palermo 5626/302' '+598 2 6000437' 'www.marklazz.com'
data/rtt_report DELETED
@@ -1,401 +0,0 @@
1
- %PDF-1.3
2
- %����
3
- 1 0 obj
4
- << /Producer (Prawn)
5
- /Creator (Prawn)
6
- >>
7
- endobj
8
- 2 0 obj
9
- << /Type /Pages
10
- /Count 1
11
- /Kids [5 0 R]
12
- >>
13
- endobj
14
- 3 0 obj
15
- << /Pages 2 0 R
16
- /Type /Catalog
17
- >>
18
- endobj
19
- 4 0 obj
20
- << /Length 4667
21
- >>
22
- stream
23
- /DeviceRGB cs
24
- 0.000 0.000 0.000 scn
25
- /DeviceRGB CS
26
- 0.000 0.000 0.000 SCN
27
- q
28
-
29
- BT
30
- 525.166456692913 797.102456692913 Td
31
- /F1.0 12 Tf
32
- [<6d6172> -15 <6b6c617a7a>] TJ
33
- ET
34
-
35
- 0.000 0.000 0.000 scn
36
- 0.000 0.000 0.000 scn
37
- 0.000 0.000 0.000 scn
38
- 0.000 0.000 0.000 scn
39
- 0.000 0.000 0.000 scn
40
- 0.000 0.000 0.000 scn
41
- 0.000 0.000 0.000 scn
42
-
43
- BT
44
- 28.3464566929134 806.858456692913 Td
45
- /F1.0 16 Tf
46
- [<52> 30 <5454205265706f72> -40 <74>] TJ
47
- ET
48
-
49
-
50
- BT
51
- 28.3464566929134 788.362456692913 Td
52
- /F1.0 16 Tf
53
- [<3d3d3d3d3d3d3d3d3d3d>] TJ
54
- ET
55
-
56
-
57
- BT
58
- 28.3464566929134 729.866456692913 Td
59
- /F1.0 16 Tf
60
- [<436c69656e743a> 50 <20456d65> 30 <78>] TJ
61
- ET
62
-
63
-
64
- BT
65
- 28.3464566929134 711.370456692913 Td
66
- /F1.0 16 Tf
67
- [<50726f6a6563743a> 50 <20456d65> 30 <78>] TJ
68
- ET
69
-
70
- 0.980 0.980 0.980 scn
71
- 28.346 631.490 74.000 22.872 re
72
- f
73
- 0.000 0.000 0.000 scn
74
- 1 w
75
- 28.346 654.862 m
76
- 28.346 629.990 l
77
- S
78
- 102.346 654.862 m
79
- 102.346 629.990 l
80
- S
81
- 28.346 654.362 m
82
- 102.346 654.362 l
83
- S
84
- 28.346 630.490 m
85
- 102.346 630.490 l
86
- S
87
- 0.000 0.000 0.000 SCN
88
- 1 w
89
-
90
- BT
91
- 33.3464566929134 638.118456692913 Td
92
- /F1.0 12 Tf
93
- [<4e616d65>] TJ
94
- ET
95
-
96
- 0.000 0.000 0.000 scn
97
- 0.980 0.980 0.980 scn
98
- 102.346 631.490 59.000 22.872 re
99
- f
100
- 0.000 0.000 0.000 scn
101
- 1 w
102
- 102.346 654.862 m
103
- 102.346 629.990 l
104
- S
105
- 161.346 654.862 m
106
- 161.346 629.990 l
107
- S
108
- 102.346 654.362 m
109
- 161.346 654.362 l
110
- S
111
- 102.346 630.490 m
112
- 161.346 630.490 l
113
- S
114
- 0.000 0.000 0.000 SCN
115
- 1 w
116
-
117
- BT
118
- 107.346456692913 638.118456692913 Td
119
- /F1.0 12 Tf
120
- [<44617465>] TJ
121
- ET
122
-
123
- 0.000 0.000 0.000 scn
124
- 0.980 0.980 0.980 scn
125
- 161.346 631.490 56.000 22.872 re
126
- f
127
- 0.000 0.000 0.000 scn
128
- 1 w
129
- 161.346 654.862 m
130
- 161.346 629.990 l
131
- S
132
- 217.346 654.862 m
133
- 217.346 629.990 l
134
- S
135
- 161.346 654.362 m
136
- 217.346 654.362 l
137
- S
138
- 161.346 630.490 m
139
- 217.346 630.490 l
140
- S
141
- 0.000 0.000 0.000 SCN
142
- 1 w
143
-
144
- BT
145
- 166.346456692913 638.118456692913 Td
146
- /F1.0 12 Tf
147
- [<447572> 10 <6174696f6e>] TJ
148
- ET
149
-
150
- 0.000 0.000 0.000 scn
151
- 0.941 0.941 0.941 scn
152
- 28.346 606.118 74.000 24.372 re
153
- f
154
- 0.000 0.000 0.000 scn
155
- 1 w
156
- 28.346 630.990 m
157
- 28.346 606.118 l
158
- S
159
- 102.346 630.990 m
160
- 102.346 606.118 l
161
- S
162
- 0.000 0.000 0.000 SCN
163
- 1 w
164
-
165
- BT
166
- 33.3464566929134 614.246456692913 Td
167
- /F1.0 12 Tf
168
- [<6d6f6e6f6c6f636f>] TJ
169
- ET
170
-
171
- 0.000 0.000 0.000 scn
172
- 0.941 0.941 0.941 scn
173
- 102.346 606.118 59.000 24.372 re
174
- f
175
- 0.000 0.000 0.000 scn
176
- 1 w
177
- 102.346 630.990 m
178
- 102.346 606.118 l
179
- S
180
- 161.346 630.990 m
181
- 161.346 606.118 l
182
- S
183
- 0.000 0.000 0.000 SCN
184
- 1 w
185
-
186
- BT
187
- 107.346456692913 614.246456692913 Td
188
- /F1.0 12 Tf
189
- [<30362d31392d3130>] TJ
190
- ET
191
-
192
- 0.000 0.000 0.000 scn
193
- 0.941 0.941 0.941 scn
194
- 161.346 606.118 56.000 24.372 re
195
- f
196
- 0.000 0.000 0.000 scn
197
- 1 w
198
- 161.346 630.990 m
199
- 161.346 606.118 l
200
- S
201
- 217.346 630.990 m
202
- 217.346 606.118 l
203
- S
204
- 0.000 0.000 0.000 SCN
205
- 1 w
206
-
207
- BT
208
- 166.346456692913 614.246456692913 Td
209
- /F1.0 12 Tf
210
- [<3268316d>] TJ
211
- ET
212
-
213
- 0.000 0.000 0.000 scn
214
- 0.980 0.980 0.980 scn
215
- 28.346 582.246 74.000 24.372 re
216
- f
217
- 0.000 0.000 0.000 scn
218
- 1 w
219
- 28.346 607.118 m
220
- 28.346 582.246 l
221
- S
222
- 102.346 607.118 m
223
- 102.346 582.246 l
224
- S
225
- 0.000 0.000 0.000 SCN
226
- 1 w
227
-
228
- BT
229
- 33.3464566929134 590.374456692913 Td
230
- /F1.0 12 Tf
231
- [<446566> 30 <61756c74207461736b>] TJ
232
- ET
233
-
234
- 0.000 0.000 0.000 scn
235
- 0.980 0.980 0.980 scn
236
- 102.346 582.246 59.000 24.372 re
237
- f
238
- 0.000 0.000 0.000 scn
239
- 1 w
240
- 102.346 607.118 m
241
- 102.346 582.246 l
242
- S
243
- 161.346 607.118 m
244
- 161.346 582.246 l
245
- S
246
- 0.000 0.000 0.000 SCN
247
- 1 w
248
-
249
- BT
250
- 107.346456692913 590.374456692913 Td
251
- /F1.0 12 Tf
252
- [<30362d31392d3130>] TJ
253
- ET
254
-
255
- 0.000 0.000 0.000 scn
256
- 0.980 0.980 0.980 scn
257
- 161.346 582.246 56.000 24.372 re
258
- f
259
- 0.000 0.000 0.000 scn
260
- 1 w
261
- 161.346 607.118 m
262
- 161.346 582.246 l
263
- S
264
- 217.346 607.118 m
265
- 217.346 582.246 l
266
- S
267
- 0.000 0.000 0.000 SCN
268
- 1 w
269
-
270
- BT
271
- 166.346456692913 590.374456692913 Td
272
- /F1.0 12 Tf
273
- [<3068316d>] TJ
274
- ET
275
-
276
- 0.000 0.000 0.000 scn
277
- 0.941 0.941 0.941 scn
278
- 28.346 559.874 74.000 22.872 re
279
- f
280
- 0.000 0.000 0.000 scn
281
- 1 w
282
- 28.346 583.246 m
283
- 28.346 558.374 l
284
- S
285
- 102.346 583.246 m
286
- 102.346 558.374 l
287
- S
288
- 28.346 558.874 m
289
- 102.346 558.874 l
290
- S
291
- 0.000 0.000 0.000 SCN
292
- 1 w
293
-
294
- BT
295
- 33.3464566929134 566.502456692913 Td
296
- /F1.0 12 Tf
297
- [<67> 10 <72> 10 <616e20706f6c6f>] TJ
298
- ET
299
-
300
- 0.000 0.000 0.000 scn
301
- 0.941 0.941 0.941 scn
302
- 102.346 559.874 59.000 22.872 re
303
- f
304
- 0.000 0.000 0.000 scn
305
- 1 w
306
- 102.346 583.246 m
307
- 102.346 558.374 l
308
- S
309
- 161.346 583.246 m
310
- 161.346 558.374 l
311
- S
312
- 102.346 558.874 m
313
- 161.346 558.874 l
314
- S
315
- 0.000 0.000 0.000 SCN
316
- 1 w
317
-
318
- BT
319
- 107.346456692913 566.502456692913 Td
320
- /F1.0 12 Tf
321
- [<30362d31392d3130>] TJ
322
- ET
323
-
324
- 0.000 0.000 0.000 scn
325
- 0.941 0.941 0.941 scn
326
- 161.346 559.874 56.000 22.872 re
327
- f
328
- 0.000 0.000 0.000 scn
329
- 1 w
330
- 161.346 583.246 m
331
- 161.346 558.374 l
332
- S
333
- 217.346 583.246 m
334
- 217.346 558.374 l
335
- S
336
- 161.346 558.874 m
337
- 217.346 558.874 l
338
- S
339
- 0.000 0.000 0.000 SCN
340
- 1 w
341
-
342
- BT
343
- 166.346456692913 566.502456692913 Td
344
- /F1.0 12 Tf
345
- [<2d>] TJ
346
- ET
347
-
348
- 0.000 0.000 0.000 scn
349
-
350
- BT
351
- 28.3464566929134 527.386456692913 Td
352
- /F1.0 16 Tf
353
- [<54> 120 <6f74616c3a> 50 <203268326d>] TJ
354
- ET
355
-
356
-
357
- BT
358
- 486.933543307087 28.3464566929133 Td
359
- /F1.0 16 Tf
360
- [<50> 40 <6167652031202f2031>] TJ
361
- ET
362
-
363
- Q
364
-
365
- endstream
366
- endobj
367
- 5 0 obj
368
- << /Parent 2 0 R
369
- /Type /Page
370
- /MediaBox [0 0 595.28 841.89]
371
- /Resources << /Font << /F1.0 6 0 R
372
- >>
373
- /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
374
- >>
375
- /Contents 4 0 R
376
- >>
377
- endobj
378
- 6 0 obj
379
- << /BaseFont /Helvetica
380
- /Encoding /WinAnsiEncoding
381
- /Subtype /Type1
382
- /Type /Font
383
- >>
384
- endobj
385
- xref
386
- 0 7
387
- 0000000000 65535 f
388
- 0000000015 00000 n
389
- 0000000071 00000 n
390
- 0000000128 00000 n
391
- 0000000177 00000 n
392
- 0000004896 00000 n
393
- 0000005076 00000 n
394
- trailer
395
- << /Size 7
396
- /Root 3 0 R
397
- /Info 1 0 R
398
- >>
399
- startxref
400
- 5173
401
- %%EOF
data/todo.txt DELETED
@@ -1,3 +0,0 @@
1
- 1) Acomodar la firma del user en el pdf
2
- 2) Un script para inicializar el user
3
- 1) Hacer q el current project cambie el client