Pratt 1.6.2 → 1.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/.gitignore +2 -0
  2. data/Pratt.gemspec +38 -12
  3. data/README.html +85 -0
  4. data/README.txt +6 -3
  5. data/TODO +6 -3
  6. data/VERSION +1 -1
  7. data/config.rb +3 -17
  8. data/db/zips.csv.zip +0 -0
  9. data/lib/models.rb +8 -0
  10. data/lib/pratt.rb +58 -293
  11. data/lib/pratt.rb.orig +626 -0
  12. data/lib/pratt/core_ext.rb +6 -0
  13. data/lib/pratt/{array.rb → core_ext/array.rb} +5 -0
  14. data/lib/pratt/core_ext/float.rb +28 -0
  15. data/lib/pratt/core_ext/nil.rb +5 -0
  16. data/lib/pratt/core_ext/numeric.rb +9 -0
  17. data/lib/pratt/{string.rb → core_ext/string.rb} +13 -0
  18. data/lib/pratt/core_ext/time.rb +20 -0
  19. data/lib/pratt/dialogs.rb +81 -0
  20. data/lib/pratt/formatting.rb +24 -0
  21. data/lib/pratt/project_actions.rb +25 -0
  22. data/lib/pratt/reports.rb +127 -0
  23. data/models/app.rb +1 -2
  24. data/models/customer.rb +22 -0
  25. data/models/invoice.rb +28 -0
  26. data/models/invoice_whence.rb +18 -0
  27. data/models/payment.rb +1 -1
  28. data/models/pratt.rb +0 -9
  29. data/models/project.rb +16 -22
  30. data/models/whence.rb +10 -1
  31. data/models/zip.rb +27 -0
  32. data/spec/fixtures/graph.expectation +0 -5
  33. data/spec/fixtures/proportions.expectation +4 -0
  34. data/spec/float_spec.rb +24 -0
  35. data/spec/numeric_spec.rb +30 -0
  36. data/spec/pratt_spec.rb +5 -4
  37. data/spec/project_spec.rb +8 -2
  38. data/spec/spec.opts +1 -1
  39. data/spec/spec_helper.rb +31 -1
  40. data/spec/string_ext_spec.rb +33 -0
  41. data/views/current.eruby +5 -0
  42. data/views/general-invoice.eruby +538 -0
  43. data/views/graph.eruby +2 -7
  44. data/views/invoice.eruby +3 -3
  45. data/views/main.rb +8 -6
  46. data/views/proportions.eruby +4 -0
  47. data/views/raw.eruby +1 -1
  48. metadata +86 -33
  49. data/lib/pratt/time.rb +0 -12
  50. data/views/env.rb +0 -22
@@ -3,19 +3,14 @@ Project detail
3
3
  by <%= scale.red %> from
4
4
  <%= when_to.send("beginning_of_#{scale}").strftime(Pratt::FMT).blue %> to <%= when_to.send("end_of_#{scale}").strftime(Pratt::FMT).blue %>
5
5
  <% end %>
6
- <%= padded_to_max('') << ' ' << 'dys'.underline << ' '*5 << 'hrs'.underline << ' '*5 << 'min'.underline << ' '*3 << 'total'.underline %>
6
+ <%= ' '.with_label('') << 'dys'.underline << ' '*5 << 'hrs'.underline << ' '*5 << 'min'.underline << ' '*3 << 'total'.underline %>
7
7
  <%= ( '-'.or '·')*67 %>
8
8
 
9
9
  <% @projects.each do |proj| %>
10
10
  <% hour_spent = proj.time_spent(scale, when_to) %>
11
11
  <% if show_all or ( !show_all and hour_spent != 0.0 ) %>
12
- <%= padded_to_max(proj.name) %><%= ('|'.or '⋮') %> <%= Pratt.fmt_i(hour_spent / 24, 'day', :cyan) %> <%= Pratt.fmt_i(hour_spent % 24, 'hour', :yellow) %> <%= Pratt.fmt_i((60*(hour_spent - hour_spent.to_i)), 'min', :green) %> <%= "%0.2f".blue% hour_spent %>
12
+ <%= ('|'.or '⋮').with_label(proj.name) %> <%= (hour_spent / 24).format_integer.cyan %> day <%= (hour_spent % 24).format_integer.yellow %> hour <%= (60*(hour_spent - hour_spent.to_i)).format_integer.green %> min <%= hour_spent.pretty_print.blue %>
13
13
  <% end %>
14
14
  <% end %>
15
15
 
16
16
  <%= ( '-'.or '·' )*67 %>
17
-
18
- <%= padded_to_max('Total') %> <%= ("%0.2f"%@scaled_total).underline %> hrs
19
- <%= Pratt.percent(Project.primary.name, @primary.to_f, @scaled_total, :green) %>
20
- <%= Pratt.percent(Project.off.name, @off_total.to_f, @scaled_total, :yellow) %>
21
- <%= Pratt.percent('Other', @rest_total.to_f, @scaled_total, :red) %>
@@ -101,13 +101,13 @@
101
101
  <P><%= project.name %></P>
102
102
  </TD>
103
103
  <TD WIDTH=96>
104
- <P ALIGN=RIGHT><%= project.time_spent(scale, when_to) %></P>
104
+ <P ALIGN=RIGHT><%= project.time_spent(scale, when_to).pretty_print %></P>
105
105
  </TD>
106
106
  <TD WIDTH=96>
107
107
  <P ALIGN=RIGHT><%= project.payment.pretty_print %></P>
108
108
  </TD>
109
109
  <TD WIDTH=97>
110
- <P ALIGN=RIGHT><FONT SIZE=2><%= project.amount(scale, when_to) %></FONT></P>
110
+ <P ALIGN=RIGHT><FONT SIZE=2><%= project.amount(scale, when_to).pretty_print %></FONT></P>
111
111
  </TD>
112
112
  </TR>
113
113
  <% end %>
@@ -120,7 +120,7 @@
120
120
  <P ALIGN=RIGHT><FONT SIZE=1 STYLE="font-size: 8pt">TOTAL</FONT></P>
121
121
  </TD>
122
122
  <TD WIDTH=97>
123
- <P ALIGN=RIGHT><FONT SIZE=2><%= @total %></FONT></P>
123
+ <P ALIGN=RIGHT><FONT SIZE=2><%= @total.pretty_print %></FONT></P>
124
124
  </TD>
125
125
  </TR>
126
126
  </TABLE>
@@ -4,6 +4,8 @@ require 'tkextlib/tile'
4
4
  require 'optparse'
5
5
  require 'ostruct'
6
6
 
7
+ include Tk::Tile
8
+
7
9
  opts = OpenStruct.new
8
10
  opts.projects = []
9
11
  opts.current = -1
@@ -31,12 +33,12 @@ opts.current = opts.projects.index(opts.current) if opts.current == -1
31
33
 
32
34
  root = TkRoot.new { title "Pratt Main" }
33
35
 
34
- button_holder = Tk::Tile::Frame.new(root){ padding "5 5 5 5" }
35
- button_holder_top = Tk::Tile::Frame.new(button_holder) { padding "5 5 5 5" }
36
+ button_holder = Frame.new(root){ padding "5 5 5 5" }
37
+ button_holder_top = Frame.new(button_holder) { padding "5 5 5 5" }
36
38
 
37
- project_combo = Tk::Tile::TCombobox.new(button_holder_top)
39
+ project_combo = TCombobox.new(button_holder_top)
38
40
  project_combo.values = opts.projects
39
- project_combo.current = opts.current
41
+ project_combo.current = opts.current || 0
40
42
  project_combo.pack('side' => 'bottom', 'fill' => 'y')
41
43
 
42
44
  change = proc {
@@ -58,9 +60,9 @@ start = proc {
58
60
  exit
59
61
  }
60
62
 
61
- Tk::Tile::Label.new(button_holder_top) { text "What will you be working on?" }.pack('side' => 'top', :fill => 'y')
63
+ Label.new(button_holder_top) { text "What will you be working on?" }.pack('side' => 'top', :fill => 'y')
62
64
 
63
- button_holder_bottom = Tk::Tile::Frame.new(button_holder) { padding "5 5 5 5" }
65
+ button_holder_bottom = Frame.new(button_holder) { padding "5 5 5 5" }
64
66
  TkButton.new(button_holder_bottom) do
65
67
  text 'Start'
66
68
  command start
@@ -0,0 +1,4 @@
1
+ <%= @scaled_total.to_f.pretty_print.underline.with_label("Total") %> hrs
2
+ <%= @primary.to_f.percentage( @scaled_total ).green.with_label(Project.primary.name) %>
3
+ <%= @off_total.to_f.percentage( @scaled_total).yellow.with_label(Project.off.name) %>
4
+ <%= @rest_total.to_f.percentage( @scaled_total ).red.with_label('Other') %>
@@ -2,7 +2,7 @@
2
2
  @whences.each do |whence|
3
3
  color = colors[whence.project.id%colors.size]
4
4
  %>
5
- <%= padded_to_max(whence.project.name) %> <%= '|'.or '⌈' %><%= whence.start_at.strftime(Pratt::FMT).send(color) -%>
5
+ <%= ('|'.or '⌈').with_label whence.project.name %><%= whence.start_at.strftime(Pratt::FMT).send(color) -%>
6
6
  <% if whence.end_at -%>
7
7
  <%= '-'.or '­' %> <%= whence.end_at.strftime(Pratt::FMT).send(color) %><%= '|'.or '⌋' %> <%= "%6.2f"% [(whence.end_at-whence.start_at)/60] %> min
8
8
  <% else %>
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Pratt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 6
8
+ - 4
9
+ version: 1.6.4
5
10
  platform: ruby
6
11
  authors:
7
12
  - Scott Noel-Hemming
@@ -9,59 +14,79 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-02-15 00:00:00 -08:00
17
+ date: 2010-05-30 00:00:00 -07:00
13
18
  default_executable: pratt.rb
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: rspec
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 1
29
+ - 2
30
+ - 6
23
31
  version: 1.2.6
24
- version:
32
+ type: :development
33
+ version_requirements: *id001
25
34
  - !ruby/object:Gem::Dependency
26
35
  name: mocha
27
- type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
30
38
  requirements:
31
39
  - - ">="
32
40
  - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ - 9
44
+ - 5
33
45
  version: 0.9.5
34
- version:
46
+ type: :development
47
+ version_requirements: *id002
35
48
  - !ruby/object:Gem::Dependency
36
49
  name: activerecord
37
- type: :runtime
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
40
52
  requirements:
41
53
  - - ">="
42
54
  - !ruby/object:Gem::Version
55
+ segments:
56
+ - 2
57
+ - 1
58
+ - 1
43
59
  version: 2.1.1
44
- version:
60
+ type: :runtime
61
+ version_requirements: *id003
45
62
  - !ruby/object:Gem::Dependency
46
63
  name: sqlite3-ruby
47
- type: :runtime
48
- version_requirement:
49
- version_requirements: !ruby/object:Gem::Requirement
64
+ prerelease: false
65
+ requirement: &id004 !ruby/object:Gem::Requirement
50
66
  requirements:
51
67
  - - ">="
52
68
  - !ruby/object:Gem::Version
69
+ segments:
70
+ - 1
71
+ - 2
72
+ - 4
53
73
  version: 1.2.4
54
- version:
74
+ type: :runtime
75
+ version_requirements: *id004
55
76
  - !ruby/object:Gem::Dependency
56
77
  name: shifty_week
57
- type: :runtime
58
- version_requirement:
59
- version_requirements: !ruby/object:Gem::Requirement
78
+ prerelease: false
79
+ requirement: &id005 !ruby/object:Gem::Requirement
60
80
  requirements:
61
81
  - - ">="
62
82
  - !ruby/object:Gem::Version
83
+ segments:
84
+ - 0
85
+ - 1
86
+ - 0
63
87
  version: 0.1.0
64
- version:
88
+ type: :runtime
89
+ version_requirements: *id005
65
90
  description: "\n\
66
91
  \t Need a way to keep track of your time, but get caught up in work? Or constant interruptions?\n\
67
92
  \t Yeah you know who I'm talking about. Those people from the [abc] department always \"NEEDING xyz FEATURE NOW!!!\".\n\
@@ -78,6 +103,7 @@ executables:
78
103
  extensions: []
79
104
 
80
105
  extra_rdoc_files:
106
+ - README.html
81
107
  - README.txt
82
108
  - TODO
83
109
  files:
@@ -87,6 +113,7 @@ files:
87
113
  - Manifest.txt
88
114
  - Pratt.gemspec
89
115
  - Pratt.mm
116
+ - README.html
90
117
  - README.txt
91
118
  - Rakefile
92
119
  - Session.vim
@@ -95,16 +122,30 @@ files:
95
122
  - bin/pratt.rb
96
123
  - config.rb
97
124
  - db/sqlite_databases_go_here
125
+ - db/zips.csv.zip
126
+ - lib/models.rb
98
127
  - lib/pratt.rb
99
- - lib/pratt/array.rb
100
- - lib/pratt/string.rb
101
- - lib/pratt/time.rb
128
+ - lib/pratt.rb.orig
129
+ - lib/pratt/core_ext.rb
130
+ - lib/pratt/core_ext/array.rb
131
+ - lib/pratt/core_ext/float.rb
132
+ - lib/pratt/core_ext/nil.rb
133
+ - lib/pratt/core_ext/numeric.rb
134
+ - lib/pratt/core_ext/string.rb
135
+ - lib/pratt/core_ext/time.rb
136
+ - lib/pratt/dialogs.rb
137
+ - lib/pratt/formatting.rb
138
+ - lib/pratt/project_actions.rb
139
+ - lib/pratt/reports.rb
102
140
  - models/app.rb
103
141
  - models/customer.rb
142
+ - models/invoice.rb
143
+ - models/invoice_whence.rb
104
144
  - models/payment.rb
105
145
  - models/pratt.rb
106
146
  - models/project.rb
107
147
  - models/whence.rb
148
+ - models/zip.rb
108
149
  - pkgs/tile-0.8.2.tar.gz
109
150
  - pkgs/tile-0.8.2/ANNOUNCE.txt
110
151
  - pkgs/tile-0.8.2/ChangeLog
@@ -349,26 +390,33 @@ files:
349
390
  - pkgs/tktray1.2.tar.gz
350
391
  - pratt.mm
351
392
  - reports/travel.log
393
+ - reports/travel.log.2009
352
394
  - spec/app_spec.rb
353
395
  - spec/customer_spec.rb
354
396
  - spec/fixtures/graph.expectation
397
+ - spec/fixtures/proportions.expectation
398
+ - spec/float_spec.rb
399
+ - spec/numeric_spec.rb
355
400
  - spec/payment_spec.rb
356
401
  - spec/pratt_spec.rb
357
402
  - spec/project_spec.rb
358
403
  - spec/rcov.opts
359
404
  - spec/spec.opts
360
405
  - spec/spec_helper.rb
406
+ - spec/string_ext_spec.rb
361
407
  - spec/whence_spec.rb
362
408
  - tasks/pratt.rb
363
409
  - templates/model.eruby
364
410
  - templates/spec.eruby
365
- - views/env.rb
411
+ - views/current.eruby
412
+ - views/general-invoice.eruby
366
413
  - views/graph.eruby
367
414
  - views/invoice.eruby
368
415
  - views/main.rb
369
416
  - views/pid.eruby
370
417
  - views/pop.rb
371
418
  - views/pop2.rb
419
+ - views/proportions.eruby
372
420
  - views/raw.eruby
373
421
  has_rdoc: true
374
422
  homepage: http://github.com/frogstarr78/pratt
@@ -383,26 +431,31 @@ required_ruby_version: !ruby/object:Gem::Requirement
383
431
  requirements:
384
432
  - - ">="
385
433
  - !ruby/object:Gem::Version
434
+ segments:
435
+ - 0
386
436
  version: "0"
387
- version:
388
437
  required_rubygems_version: !ruby/object:Gem::Requirement
389
438
  requirements:
390
439
  - - ">="
391
440
  - !ruby/object:Gem::Version
441
+ segments:
442
+ - 0
392
443
  version: "0"
393
- version:
394
444
  requirements: []
395
445
 
396
446
  rubyforge_project: Pratt
397
- rubygems_version: 1.3.5
447
+ rubygems_version: 1.3.6
398
448
  signing_key:
399
449
  specification_version: 3
400
450
  summary: Pro/Re-Active Time Tracker. Track time based on what you expect to be working on, with frequent prompts to ensure accuracy.
401
451
  test_files:
402
- - spec/customer_spec.rb
403
- - spec/project_spec.rb
404
- - spec/pratt_spec.rb
452
+ - spec/whence_spec.rb
405
453
  - spec/spec_helper.rb
454
+ - spec/float_spec.rb
455
+ - spec/pratt_spec.rb
456
+ - spec/project_spec.rb
457
+ - spec/numeric_spec.rb
406
458
  - spec/app_spec.rb
407
- - spec/whence_spec.rb
459
+ - spec/string_ext_spec.rb
460
+ - spec/customer_spec.rb
408
461
  - spec/payment_spec.rb
@@ -1,12 +0,0 @@
1
- class Date
2
- def beginning_of_week
3
- (self - wday_offset).beginning_of_day
4
- end
5
-
6
- def end_of_week
7
- (beginning_of_week+6).end_of_day
8
- end
9
- end
10
-
11
- class DateTime < Date
12
- end
@@ -1,22 +0,0 @@
1
- #!/usr/bin/ruby
2
- require 'tk'
3
- require 'tkextlib/tile'
4
- require 'optparse'
5
- require 'ostruct'
6
-
7
- root = TkRoot.new { title "Pratt Reminder" }
8
-
9
- max = ENV.inject(0) {|x,(h,v)| x = h.to_s.length if h.to_s.length > x; x }
10
- ENV.sort.each do |globl, val|
11
- Tk::Tile::Label.new(root) do
12
- text "%#{max}.#{max}s: %0.20s"% [globl, val]
13
- end.pack(:side => 'top', :fill => 'y')
14
- end
15
-
16
- Pratt.constants.each do |cnst|
17
- Tk::Tile::Label.new(root) do
18
- text cnst
19
- end.pack(:side => 'top', :fill => 'y')
20
- end
21
-
22
- Tk.mainloop