Pratt 1.5.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (283) hide show
  1. data/.exrc +61 -0
  2. data/.gitignore +4 -0
  3. data/History.txt +6 -0
  4. data/Manifest.txt +46 -0
  5. data/Pratt.gemspec +351 -0
  6. data/README.txt +66 -0
  7. data/Rakefile +85 -0
  8. data/TODO +54 -0
  9. data/VERSION +1 -0
  10. data/bin/pratt.rb +13 -0
  11. data/config.rb +34 -0
  12. data/lib/pratt.rb +527 -0
  13. data/lib/pratt/array.rb +11 -0
  14. data/lib/pratt/string.rb +18 -0
  15. data/models/app.rb +40 -0
  16. data/models/customer.rb +24 -0
  17. data/models/payment.rb +22 -0
  18. data/models/pratt.rb +19 -0
  19. data/models/project.rb +82 -0
  20. data/models/whence.rb +70 -0
  21. data/pkgs/tile-0.8.2.tar.gz +0 -0
  22. data/pkgs/tile-0.8.2/ANNOUNCE.txt +95 -0
  23. data/pkgs/tile-0.8.2/ChangeLog +4651 -0
  24. data/pkgs/tile-0.8.2/Makefile +250 -0
  25. data/pkgs/tile-0.8.2/Makefile.in +250 -0
  26. data/pkgs/tile-0.8.2/README.txt +86 -0
  27. data/pkgs/tile-0.8.2/aclocal.m4 +2 -0
  28. data/pkgs/tile-0.8.2/altTheme.o +0 -0
  29. data/pkgs/tile-0.8.2/blink.o +0 -0
  30. data/pkgs/tile-0.8.2/button.o +0 -0
  31. data/pkgs/tile-0.8.2/cache.o +0 -0
  32. data/pkgs/tile-0.8.2/clamTheme.o +0 -0
  33. data/pkgs/tile-0.8.2/classicTheme.o +0 -0
  34. data/pkgs/tile-0.8.2/config.log +1330 -0
  35. data/pkgs/tile-0.8.2/config.status +795 -0
  36. data/pkgs/tile-0.8.2/configure +15248 -0
  37. data/pkgs/tile-0.8.2/configure.in +89 -0
  38. data/pkgs/tile-0.8.2/demos/autocomplete.tcl +59 -0
  39. data/pkgs/tile-0.8.2/demos/demo.tcl +870 -0
  40. data/pkgs/tile-0.8.2/demos/dirbrowser.tcl +167 -0
  41. data/pkgs/tile-0.8.2/demos/dlgtest.tcl +97 -0
  42. data/pkgs/tile-0.8.2/demos/iconlib.tcl +110 -0
  43. data/pkgs/tile-0.8.2/demos/repeater.tcl +117 -0
  44. data/pkgs/tile-0.8.2/demos/toolbutton.tcl +101 -0
  45. data/pkgs/tile-0.8.2/doc/Geometry.3 +230 -0
  46. data/pkgs/tile-0.8.2/doc/INDEX.MAP +153 -0
  47. data/pkgs/tile-0.8.2/doc/Makefile +36 -0
  48. data/pkgs/tile-0.8.2/doc/TILE.XML +45 -0
  49. data/pkgs/tile-0.8.2/doc/Theme.3 +34 -0
  50. data/pkgs/tile-0.8.2/doc/button.n +75 -0
  51. data/pkgs/tile-0.8.2/doc/checkbutton.n +61 -0
  52. data/pkgs/tile-0.8.2/doc/combobox.n +98 -0
  53. data/pkgs/tile-0.8.2/doc/converting.txt +97 -0
  54. data/pkgs/tile-0.8.2/doc/dialog.n +122 -0
  55. data/pkgs/tile-0.8.2/doc/entry.n +438 -0
  56. data/pkgs/tile-0.8.2/doc/frame.n +43 -0
  57. data/pkgs/tile-0.8.2/doc/html/Geometry.html +304 -0
  58. data/pkgs/tile-0.8.2/doc/html/Theme.html +48 -0
  59. data/pkgs/tile-0.8.2/doc/html/button.html +120 -0
  60. data/pkgs/tile-0.8.2/doc/html/category-index.html +18 -0
  61. data/pkgs/tile-0.8.2/doc/html/checkbutton.html +94 -0
  62. data/pkgs/tile-0.8.2/doc/html/combobox.html +164 -0
  63. data/pkgs/tile-0.8.2/doc/html/converting.txt +97 -0
  64. data/pkgs/tile-0.8.2/doc/html/dialog.html +159 -0
  65. data/pkgs/tile-0.8.2/doc/html/entry.html +613 -0
  66. data/pkgs/tile-0.8.2/doc/html/frame.html +76 -0
  67. data/pkgs/tile-0.8.2/doc/html/image.html +100 -0
  68. data/pkgs/tile-0.8.2/doc/html/index.html +25 -0
  69. data/pkgs/tile-0.8.2/doc/html/keyword-index.html +228 -0
  70. data/pkgs/tile-0.8.2/doc/html/label.html +133 -0
  71. data/pkgs/tile-0.8.2/doc/html/labelframe.html +91 -0
  72. data/pkgs/tile-0.8.2/doc/html/manpage.css +212 -0
  73. data/pkgs/tile-0.8.2/doc/html/menubutton.html +63 -0
  74. data/pkgs/tile-0.8.2/doc/html/notebook.html +280 -0
  75. data/pkgs/tile-0.8.2/doc/html/paned.html +149 -0
  76. data/pkgs/tile-0.8.2/doc/html/progressbar.html +138 -0
  77. data/pkgs/tile-0.8.2/doc/html/radiobutton.html +89 -0
  78. data/pkgs/tile-0.8.2/doc/html/scrollbar.html +221 -0
  79. data/pkgs/tile-0.8.2/doc/html/separator.html +48 -0
  80. data/pkgs/tile-0.8.2/doc/html/sizegrip.html +62 -0
  81. data/pkgs/tile-0.8.2/doc/html/style.html +172 -0
  82. data/pkgs/tile-0.8.2/doc/html/tile-intro.html +164 -0
  83. data/pkgs/tile-0.8.2/doc/html/treeview.html +634 -0
  84. data/pkgs/tile-0.8.2/doc/html/widget.html +342 -0
  85. data/pkgs/tile-0.8.2/doc/image.n +81 -0
  86. data/pkgs/tile-0.8.2/doc/internals.txt +409 -0
  87. data/pkgs/tile-0.8.2/doc/label.n +75 -0
  88. data/pkgs/tile-0.8.2/doc/labelframe.n +64 -0
  89. data/pkgs/tile-0.8.2/doc/man.macros +239 -0
  90. data/pkgs/tile-0.8.2/doc/menubutton.n +41 -0
  91. data/pkgs/tile-0.8.2/doc/notebook.n +188 -0
  92. data/pkgs/tile-0.8.2/doc/paned.n +95 -0
  93. data/pkgs/tile-0.8.2/doc/progressbar.n +79 -0
  94. data/pkgs/tile-0.8.2/doc/radiobutton.n +57 -0
  95. data/pkgs/tile-0.8.2/doc/scrollbar.n +160 -0
  96. data/pkgs/tile-0.8.2/doc/separator.n +30 -0
  97. data/pkgs/tile-0.8.2/doc/sizegrip.n +53 -0
  98. data/pkgs/tile-0.8.2/doc/style.n +119 -0
  99. data/pkgs/tile-0.8.2/doc/tile-intro.n +165 -0
  100. data/pkgs/tile-0.8.2/doc/tmml.options +4 -0
  101. data/pkgs/tile-0.8.2/doc/treeview.n +415 -0
  102. data/pkgs/tile-0.8.2/doc/widget.n +227 -0
  103. data/pkgs/tile-0.8.2/doc/xml/Geometry.tmml +379 -0
  104. data/pkgs/tile-0.8.2/doc/xml/INDEX.MAP +153 -0
  105. data/pkgs/tile-0.8.2/doc/xml/Theme.tmml +63 -0
  106. data/pkgs/tile-0.8.2/doc/xml/button.tmml +134 -0
  107. data/pkgs/tile-0.8.2/doc/xml/checkbutton.tmml +119 -0
  108. data/pkgs/tile-0.8.2/doc/xml/combobox.tmml +184 -0
  109. data/pkgs/tile-0.8.2/doc/xml/dialog.tmml +195 -0
  110. data/pkgs/tile-0.8.2/doc/xml/entry.tmml +630 -0
  111. data/pkgs/tile-0.8.2/doc/xml/frame.tmml +98 -0
  112. data/pkgs/tile-0.8.2/doc/xml/image.tmml +101 -0
  113. data/pkgs/tile-0.8.2/doc/xml/label.tmml +154 -0
  114. data/pkgs/tile-0.8.2/doc/xml/labelframe.tmml +116 -0
  115. data/pkgs/tile-0.8.2/doc/xml/menubutton.tmml +80 -0
  116. data/pkgs/tile-0.8.2/doc/xml/notebook.tmml +306 -0
  117. data/pkgs/tile-0.8.2/doc/xml/paned.tmml +154 -0
  118. data/pkgs/tile-0.8.2/doc/xml/progressbar.tmml +151 -0
  119. data/pkgs/tile-0.8.2/doc/xml/radiobutton.tmml +109 -0
  120. data/pkgs/tile-0.8.2/doc/xml/scrollbar.tmml +233 -0
  121. data/pkgs/tile-0.8.2/doc/xml/separator.tmml +59 -0
  122. data/pkgs/tile-0.8.2/doc/xml/sizegrip.tmml +82 -0
  123. data/pkgs/tile-0.8.2/doc/xml/style.tmml +171 -0
  124. data/pkgs/tile-0.8.2/doc/xml/tile-intro.tmml +192 -0
  125. data/pkgs/tile-0.8.2/doc/xml/treeview.tmml +604 -0
  126. data/pkgs/tile-0.8.2/doc/xml/widget.tmml +372 -0
  127. data/pkgs/tile-0.8.2/entry.o +0 -0
  128. data/pkgs/tile-0.8.2/frame.o +0 -0
  129. data/pkgs/tile-0.8.2/generic/Makefile.in +221 -0
  130. data/pkgs/tile-0.8.2/generic/TODO +493 -0
  131. data/pkgs/tile-0.8.2/generic/altTheme.c +1172 -0
  132. data/pkgs/tile-0.8.2/generic/blink.c +168 -0
  133. data/pkgs/tile-0.8.2/generic/button.c +858 -0
  134. data/pkgs/tile-0.8.2/generic/cache.c +354 -0
  135. data/pkgs/tile-0.8.2/generic/clamTheme.c +974 -0
  136. data/pkgs/tile-0.8.2/generic/classicTheme.c +518 -0
  137. data/pkgs/tile-0.8.2/generic/configure +10334 -0
  138. data/pkgs/tile-0.8.2/generic/configure.in +100 -0
  139. data/pkgs/tile-0.8.2/generic/entry.c +1922 -0
  140. data/pkgs/tile-0.8.2/generic/frame.c +648 -0
  141. data/pkgs/tile-0.8.2/generic/gunk.h +44 -0
  142. data/pkgs/tile-0.8.2/generic/image.c +416 -0
  143. data/pkgs/tile-0.8.2/generic/label.c +663 -0
  144. data/pkgs/tile-0.8.2/generic/layout.c +1215 -0
  145. data/pkgs/tile-0.8.2/generic/manager.c +554 -0
  146. data/pkgs/tile-0.8.2/generic/manager.h +91 -0
  147. data/pkgs/tile-0.8.2/generic/notebook.c +1380 -0
  148. data/pkgs/tile-0.8.2/generic/paned.c +958 -0
  149. data/pkgs/tile-0.8.2/generic/pkgIndex.tcl.in +7 -0
  150. data/pkgs/tile-0.8.2/generic/progress.c +549 -0
  151. data/pkgs/tile-0.8.2/generic/scale.c +526 -0
  152. data/pkgs/tile-0.8.2/generic/scroll.c +253 -0
  153. data/pkgs/tile-0.8.2/generic/scrollbar.c +346 -0
  154. data/pkgs/tile-0.8.2/generic/separator.c +132 -0
  155. data/pkgs/tile-0.8.2/generic/square.c +306 -0
  156. data/pkgs/tile-0.8.2/generic/tagset.c +147 -0
  157. data/pkgs/tile-0.8.2/generic/tile.c +296 -0
  158. data/pkgs/tile-0.8.2/generic/tkElements.c +1280 -0
  159. data/pkgs/tile-0.8.2/generic/tkTheme.c +1708 -0
  160. data/pkgs/tile-0.8.2/generic/tkTheme.h +419 -0
  161. data/pkgs/tile-0.8.2/generic/tkThemeInt.h +45 -0
  162. data/pkgs/tile-0.8.2/generic/tkstate.c +268 -0
  163. data/pkgs/tile-0.8.2/generic/trace.c +145 -0
  164. data/pkgs/tile-0.8.2/generic/track.c +174 -0
  165. data/pkgs/tile-0.8.2/generic/treeview.c +3211 -0
  166. data/pkgs/tile-0.8.2/generic/ttk.decls +154 -0
  167. data/pkgs/tile-0.8.2/generic/ttkDecls.h +340 -0
  168. data/pkgs/tile-0.8.2/generic/ttkStubInit.c +61 -0
  169. data/pkgs/tile-0.8.2/generic/ttkStubLib.c +70 -0
  170. data/pkgs/tile-0.8.2/generic/widget.c +785 -0
  171. data/pkgs/tile-0.8.2/generic/widget.h +263 -0
  172. data/pkgs/tile-0.8.2/image.o +0 -0
  173. data/pkgs/tile-0.8.2/label.o +0 -0
  174. data/pkgs/tile-0.8.2/layout.o +0 -0
  175. data/pkgs/tile-0.8.2/library/altTheme.tcl +101 -0
  176. data/pkgs/tile-0.8.2/library/aquaTheme.tcl +62 -0
  177. data/pkgs/tile-0.8.2/library/button.tcl +85 -0
  178. data/pkgs/tile-0.8.2/library/clamTheme.tcl +139 -0
  179. data/pkgs/tile-0.8.2/library/classicTheme.tcl +108 -0
  180. data/pkgs/tile-0.8.2/library/combobox.tcl +439 -0
  181. data/pkgs/tile-0.8.2/library/cursors.tcl +36 -0
  182. data/pkgs/tile-0.8.2/library/defaults.tcl +118 -0
  183. data/pkgs/tile-0.8.2/library/dialog.tcl +274 -0
  184. data/pkgs/tile-0.8.2/library/entry.tcl +580 -0
  185. data/pkgs/tile-0.8.2/library/fonts.tcl +153 -0
  186. data/pkgs/tile-0.8.2/library/icons.tcl +105 -0
  187. data/pkgs/tile-0.8.2/library/keynav.tcl +192 -0
  188. data/pkgs/tile-0.8.2/library/menubutton.tcl +171 -0
  189. data/pkgs/tile-0.8.2/library/notebook.tcl +193 -0
  190. data/pkgs/tile-0.8.2/library/paned.tcl +87 -0
  191. data/pkgs/tile-0.8.2/library/progress.tcl +51 -0
  192. data/pkgs/tile-0.8.2/library/scale.tcl +54 -0
  193. data/pkgs/tile-0.8.2/library/scrollbar.tcl +125 -0
  194. data/pkgs/tile-0.8.2/library/sizegrip.tcl +77 -0
  195. data/pkgs/tile-0.8.2/library/tile.tcl +211 -0
  196. data/pkgs/tile-0.8.2/library/treeview.tcl +382 -0
  197. data/pkgs/tile-0.8.2/library/utils.tcl +254 -0
  198. data/pkgs/tile-0.8.2/library/winTheme.tcl +77 -0
  199. data/pkgs/tile-0.8.2/library/xpTheme.tcl +63 -0
  200. data/pkgs/tile-0.8.2/libtile0.8.2.so +0 -0
  201. data/pkgs/tile-0.8.2/libttkstub.a +0 -0
  202. data/pkgs/tile-0.8.2/license.terms +24 -0
  203. data/pkgs/tile-0.8.2/macosx/aquaTheme.c +1076 -0
  204. data/pkgs/tile-0.8.2/manager.o +0 -0
  205. data/pkgs/tile-0.8.2/notebook.o +0 -0
  206. data/pkgs/tile-0.8.2/paned.o +0 -0
  207. data/pkgs/tile-0.8.2/pkgIndex.tcl +3 -0
  208. data/pkgs/tile-0.8.2/progress.o +0 -0
  209. data/pkgs/tile-0.8.2/scale.o +0 -0
  210. data/pkgs/tile-0.8.2/scroll.o +0 -0
  211. data/pkgs/tile-0.8.2/scrollbar.o +0 -0
  212. data/pkgs/tile-0.8.2/separator.o +0 -0
  213. data/pkgs/tile-0.8.2/tagset.o +0 -0
  214. data/pkgs/tile-0.8.2/tclconfig/install-sh +119 -0
  215. data/pkgs/tile-0.8.2/tclconfig/tcl.m4 +4069 -0
  216. data/pkgs/tile-0.8.2/tclconfig/teax.m4 +109 -0
  217. data/pkgs/tile-0.8.2/tests/all.tcl +18 -0
  218. data/pkgs/tile-0.8.2/tests/bwidget.test +103 -0
  219. data/pkgs/tile-0.8.2/tests/cbtest.tcl +125 -0
  220. data/pkgs/tile-0.8.2/tests/combobox.test +51 -0
  221. data/pkgs/tile-0.8.2/tests/compound.tcl +92 -0
  222. data/pkgs/tile-0.8.2/tests/entry.test +285 -0
  223. data/pkgs/tile-0.8.2/tests/entrytest.tcl +78 -0
  224. data/pkgs/tile-0.8.2/tests/image.test +94 -0
  225. data/pkgs/tile-0.8.2/tests/labelframe.tcl +41 -0
  226. data/pkgs/tile-0.8.2/tests/labelframe.test +137 -0
  227. data/pkgs/tile-0.8.2/tests/layout.test +33 -0
  228. data/pkgs/tile-0.8.2/tests/misc.test +35 -0
  229. data/pkgs/tile-0.8.2/tests/nbtest.tcl +66 -0
  230. data/pkgs/tile-0.8.2/tests/notebook.test +500 -0
  231. data/pkgs/tile-0.8.2/tests/paned.test +298 -0
  232. data/pkgs/tile-0.8.2/tests/progress.test +92 -0
  233. data/pkgs/tile-0.8.2/tests/pwtest.tcl +90 -0
  234. data/pkgs/tile-0.8.2/tests/sbtest.tcl +79 -0
  235. data/pkgs/tile-0.8.2/tests/scrollbar.test +77 -0
  236. data/pkgs/tile-0.8.2/tests/sgtest.tcl +52 -0
  237. data/pkgs/tile-0.8.2/tests/testutils.tcl +20 -0
  238. data/pkgs/tile-0.8.2/tests/tile.test +674 -0
  239. data/pkgs/tile-0.8.2/tests/treetags.test +78 -0
  240. data/pkgs/tile-0.8.2/tests/treeview.test +563 -0
  241. data/pkgs/tile-0.8.2/tests/tvtest.tcl +332 -0
  242. data/pkgs/tile-0.8.2/tests/validate.test +278 -0
  243. data/pkgs/tile-0.8.2/tile.o +0 -0
  244. data/pkgs/tile-0.8.2/tkElements.o +0 -0
  245. data/pkgs/tile-0.8.2/tkTheme.o +0 -0
  246. data/pkgs/tile-0.8.2/tkstate.o +0 -0
  247. data/pkgs/tile-0.8.2/tools/genStubs.tcl +861 -0
  248. data/pkgs/tile-0.8.2/trace.o +0 -0
  249. data/pkgs/tile-0.8.2/track.o +0 -0
  250. data/pkgs/tile-0.8.2/treeview.o +0 -0
  251. data/pkgs/tile-0.8.2/ttkStubInit.o +0 -0
  252. data/pkgs/tile-0.8.2/ttkStubLib.o +0 -0
  253. data/pkgs/tile-0.8.2/widget.o +0 -0
  254. data/pkgs/tile-0.8.2/win/Tile.dsp +261 -0
  255. data/pkgs/tile-0.8.2/win/makefile.vc +527 -0
  256. data/pkgs/tile-0.8.2/win/monitor.c +164 -0
  257. data/pkgs/tile-0.8.2/win/nmakehlp.c +483 -0
  258. data/pkgs/tile-0.8.2/win/rules.vc +512 -0
  259. data/pkgs/tile-0.8.2/win/tile.rc +40 -0
  260. data/pkgs/tile-0.8.2/win/winTheme.c +734 -0
  261. data/pkgs/tile-0.8.2/win/xpTheme.c +1029 -0
  262. data/spec/app_spec.rb +48 -0
  263. data/spec/customer_spec.rb +31 -0
  264. data/spec/fixtures/graph.expectation +18 -0
  265. data/spec/payment_spec.rb +19 -0
  266. data/spec/pratt_spec.rb +148 -0
  267. data/spec/project_spec.rb +163 -0
  268. data/spec/rcov.opts +0 -0
  269. data/spec/spec.opts +1 -0
  270. data/spec/spec_helper.rb +21 -0
  271. data/spec/whence_spec.rb +54 -0
  272. data/tasks/pratt.rb +84 -0
  273. data/templates/model.eruby +12 -0
  274. data/templates/spec.eruby +8 -0
  275. data/views/env.rb +22 -0
  276. data/views/graph.eruby +20 -0
  277. data/views/invoice.eruby +148 -0
  278. data/views/main.rb +92 -0
  279. data/views/pid.eruby +3 -0
  280. data/views/pop.rb +94 -0
  281. data/views/pop2.rb +75 -0
  282. data/views/raw.eruby +11 -0
  283. metadata +390 -0
@@ -0,0 +1,54 @@
1
+ require 'spec_helper'
2
+
3
+ describe Whence do
4
+
5
+ context "scopes" do
6
+ it "last_unended should return nil if there aren't any unended" do
7
+ Whence.expects(:first).with(:conditions => "end_at IS NULL", :order => "start_at DESC")
8
+ Whence.last_unended
9
+ end
10
+ end
11
+
12
+ context "instances" do
13
+ before :each do
14
+ @whence = Whence.new
15
+ end
16
+
17
+ it "parse a string argument to stop!" do
18
+ when_to = 'yesterday'
19
+ when_to = '2009-10-06 13:48:58'
20
+ expectation = Chronic.parse when_to
21
+
22
+ @whence.expects(:save!)
23
+ @whence.expects(:reload)
24
+ # don't work I'm not sure why
25
+ # @whence.expects(:end_at).with expectation
26
+ # Chronic.expects(:parse).with when_to
27
+
28
+ @whence.stop! when_to
29
+ @whence.end_at.should == expectation
30
+ end
31
+
32
+ it "doesn't parse a non-string thing on stop!" do
33
+ when_to = Chronic.parse 'last week'
34
+ Chronic.expects(:parse).never
35
+ @whence.expects(:save!)
36
+ @whence.expects(:reload)
37
+ @whence.stop! when_to
38
+ @whence.end_at.should == when_to
39
+ end
40
+
41
+ it "should change! to project correctly" do
42
+ project_name = 'proj'
43
+ @whence.expects(:save!)
44
+ @whence.expects(:reload)
45
+ @whence.change! project_name
46
+ @whence.project.name.should == project_name
47
+ end
48
+
49
+ it "should have a special output for start_at.to_s" do
50
+ @whence.start_at = Time.parse('Wed Oct 7 10:57:21 PDT 2009')
51
+ @whence.start_at.to_s.should eql('Wed 07 Oct 2009 10:57:21')
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,84 @@
1
+ # -*- ruby -*-
2
+
3
+ namespace :pratt do
4
+
5
+ task :establish_connection do
6
+ Pratt.connect!( ENV['PRATT_ENV'] || 'development' )
7
+ Pratt.root 'models', '*.rb' do |model|
8
+ require model
9
+ end
10
+ end
11
+
12
+ desc "DB Quick access"
13
+ namespace :db do
14
+
15
+ desc "Show App detail."
16
+ task :app => :establish_connection do
17
+ puts App.last.inspect
18
+ end
19
+
20
+ namespace :schema do
21
+ desc "Run schema file"
22
+ task :run => :establish_connection do
23
+ raise "Missing required file argument" unless ENV.include? 'file'
24
+ schema_change = File.open( ENV['file'] ).read
25
+
26
+ ActiveRecord::Schema.define do
27
+ ActiveRecord::Base.transaction do
28
+ begin
29
+ eval schema_change
30
+ rescue Exception => e
31
+ puts "There was an error:
32
+ #{e.inspect}.
33
+ Rolling back!"
34
+ raise ActiveRecord::Rollback
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+
42
+ namespace :generate do
43
+ desc "Genarate model"
44
+ task :model do
45
+ raise "Missing required klass parameter" unless ENV.include? 'klass'
46
+ klass = ENV['klass'].downcase.singularize
47
+ outfile = File.join(Pratt.root('models'), "#{klass}.rb")
48
+ template = ''
49
+ Pratt.root('templates', 'model.eruby') {|model_gen| template = File.read(model_gen) }
50
+
51
+ eruby = Erubis::Eruby.new(template)
52
+ unless File.exists? outfile
53
+ File.open(outfile, 'w') {|file| file.write eruby.result(:klass => klass) }
54
+ else
55
+ puts "Model '#{klass}' already exists"
56
+ end
57
+
58
+ Rake::Task["generate:spec"].execute
59
+ end
60
+
61
+ desc "Generate spec test"
62
+ task :spec do
63
+ klass = ENV['klass'].downcase.singularize
64
+ raise "Missing required klass parameter" unless ENV.include? 'klass'
65
+
66
+ outpath = File.join(Pratt.root('spec'), "#{klass}_spec.rb")
67
+ inpath = File.join(Pratt.root('templates'), "spec.eruby")
68
+
69
+ if File.exists? outpath
70
+ puts "Spec '#{klass}' already exists"
71
+ else
72
+ File.open outpath, 'w' do |outfile|
73
+ File.open inpath do |infile|
74
+ eruby = Erubis::Eruby.new( infile.read )
75
+ outfile.write eruby.result( :klass => klass )
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
81
+
82
+ end
83
+
84
+ # vim: syntax=Ruby
@@ -0,0 +1,12 @@
1
+ class <%= klass.capitalize.singularize %> < ActiveRecord::Base
2
+
3
+ class << self
4
+ def migrate up = :up
5
+ ActiveRecord::Schema.define do
6
+ create_table :<%= klass.downcase.pluralize %> do |t|
7
+ end if up == :up
8
+ drop_table :<%= klass.downcase.pluralize %> if up == :down
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+ require 'pratt'
3
+
4
+ describe <%= klass.capitalize.singularize %> do
5
+ it "has a test" do
6
+ flunk
7
+ end
8
+ end
@@ -0,0 +1,22 @@
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
@@ -0,0 +1,20 @@
1
+ Project detail
2
+ <% if scale %>
3
+ by <%= scale.red %> from
4
+ <%= when_to.send("beginning_of_#{scale}").strftime(Pratt::FMT).blue %> to <%= when_to.send("end_of_#{scale}").strftime(Pratt::FMT).blue %>
5
+ <% end %>
6
+ <%= padded_to_max(' ') << 'dys'.underline << ' '*5 << 'hrs'.underline << ' '*5 << 'min'.underline %>
7
+ <%= ( '-'.or '·')*60 %>
8
+
9
+ <% @projects.each do |proj| %>
10
+ <% if show_all or ( !show_all and proj.time_spent(scale, when_to) != 0.0 ) %>
11
+ <%= padded_to_max(proj.name) %><%= ('|'.or '⋮') %> <%= Pratt.totals(proj.time_spent(scale, when_to)) %>
12
+ <% end %>
13
+ <% end %>
14
+
15
+ <%= ( '-'.or '·' )*60 %>
16
+
17
+ <%= padded_to_max('Total') %> <%= ("%0.2f"%@scaled_total).underline %> hrs
18
+ <%= Pratt.percent(Project.primary.name, @primary.to_f, @scaled_total, :green) %>
19
+ <%= Pratt.percent(Project.off.name, @off_total.to_f, @scaled_total, :yellow) %>
20
+ <%= Pratt.percent('Other', @rest_total.to_f, @scaled_total, :red) %>
@@ -0,0 +1,148 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
+ <HTML>
3
+ <HEAD>
4
+ <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
5
+ <TITLE></TITLE>
6
+ <META NAME="GENERATOR" CONTENT="OpenOffice.org 3.0 (Linux)">
7
+ <META NAME="AUTHOR" CONTENT=" ">
8
+ <META NAME="CREATED" CONTENT="20090930;9550000">
9
+ <META NAME="CHANGED" CONTENT="20091001;21332000">
10
+ <META NAME="Info 2" CONTENT="">
11
+ <META NAME="Info 3" CONTENT="">
12
+ <META NAME="Info 4" CONTENT="">
13
+ <META NAME="_TemplateID" CONTENT="TC100726791033">
14
+ <STYLE TYPE="text/css">
15
+ <!--
16
+ @page { margin-left: 0.5in; margin-right: 0.5in; margin-top: 0.5in; margin-bottom: 0.51in }
17
+ P { margin-bottom: 0.08in; direction: ltr; color: #000000; text-align: left; widows: 2; orphans: 2 }
18
+ P.western { font-family: "Calibri", sans-serif; font-size: 12pt; so-language: en-US }
19
+ P.cjk { font-family: "Times New Roman", serif; font-size: 12pt; so-language: zxx }
20
+ P.ctl { font-family: "Calibri", sans-serif; font-size: 12pt; so-language: ar-SA }
21
+ -->
22
+ </STYLE>
23
+ </HEAD>
24
+ <BODY LANG="en-US" TEXT="#000000" DIR="LTR">
25
+ <CENTER>
26
+ <TABLE WIDTH=720 BORDER=0 CELLPADDING=5 CELLSPACING=0 STYLE="page-break-before: always">
27
+ <COL WIDTH=351>
28
+ <COL WIDTH=349>
29
+ <TR VALIGN=TOP>
30
+ <TD ROWSPAN=2 WIDTH=351 HEIGHT=43>
31
+ <P STYLE="margin-top: 0.1in; margin-bottom: 0in"><B>QualitySmith LLC</B></P>
32
+ <P STYLE="margin-bottom: 0in"><FONT SIZE=2 STYLE="font-size: 9pt">106 N 2<SUP>nd</SUP> </FONT> </P>
33
+ <P STYLE="margin-bottom: 0in"><FONT SIZE=2 STYLE="font-size: 9pt">Walla Walla, WA 99362</FONT></P>
34
+ <P STYLE="margin-bottom: 0in"><FONT SIZE=2 STYLE="font-size: 9pt">Phone 509-522-0222</FONT></P>
35
+ <P><FONT SIZE=2 STYLE="font-size: 9pt">Fax </FONT> </P>
36
+ </TD>
37
+ <TD WIDTH=349>
38
+ <P ALIGN=RIGHT><FONT COLOR="#7f7f7f"><FONT SIZE=5 STYLE="font-size: 20pt"><B>INVOICE</B></FONT></FONT></P>
39
+ </TD>
40
+ </TR>
41
+ <TR>
42
+ <TD WIDTH=349 VALIGN=BOTTOM>
43
+ <P ALIGN=RIGHT><FONT SIZE=1 STYLE="font-size: 8pt">Date: <%= when_to.send("beginning_of_#{scale}").strftime(Pratt::INVOICE_FMT) %> to <%= when_to.send("end_of_#{scale}").strftime(Pratt::INVOICE_FMT) %></FONT></P>
44
+ </TD>
45
+ </TR>
46
+ </TABLE>
47
+ </CENTER>
48
+ <P CLASS="western" STYLE="margin-bottom: 0in"><BR>
49
+ </P>
50
+ <CENTER>
51
+ <TABLE WIDTH=720 BORDER=0 CELLPADDING=5 CELLSPACING=0>
52
+ <COL WIDTH=350>
53
+ <COL WIDTH=350>
54
+ <TR VALIGN=TOP>
55
+ <TD WIDTH=350 HEIGHT=86>
56
+ <P STYLE="margin-bottom: 0in"><FONT SIZE=1 STYLE="font-size: 8pt"><B>To:</B></FONT></P>
57
+ <P STYLE="margin-bottom: 0in"><FONT SIZE=2 STYLE="font-size: 9pt">Scott Noel-Hemming</FONT></P>
58
+ <P STYLE="margin-bottom: 0in"><FONT SIZE=2 STYLE="font-size: 9pt">Frogstarr78 Software</FONT></P>
59
+ <P STYLE="margin-bottom: 0in"><FONT SIZE=2 STYLE="font-size: 9pt">312 NW 7<SUP>th</SUP> </FONT> </P>
60
+ <P STYLE="margin-bottom: 0in"><FONT SIZE=2 STYLE="font-size: 9pt">Milton-Freewater, OR, 97862</FONT></P>
61
+ <P><FONT SIZE=2 STYLE="font-size: 9pt">509.200.9190</FONT></P>
62
+ </TD>
63
+ <TD WIDTH=350>
64
+ <P><BR>
65
+ </P>
66
+ </TD>
67
+ </TR>
68
+ </TABLE>
69
+ </CENTER>
70
+ <P CLASS="western" STYLE="margin-bottom: 0in"><BR>
71
+ </P>
72
+ <CENTER>
73
+ <TABLE WIDTH=722 BORDER=1 BORDERCOLOR="#000000" CELLPADDING=3 CELLSPACING=0 RULES=ROWS>
74
+ <COLGROUP>
75
+ <COL WIDTH=408>
76
+ <COL WIDTH=96>
77
+ </COLGROUP>
78
+ <COLGROUP>
79
+ <COL WIDTH=96>
80
+ </COLGROUP>
81
+ <COLGROUP>
82
+ <COL WIDTH=97>
83
+ </COLGROUP>
84
+ <TR>
85
+ <TD WIDTH=408 HEIGHT=12>
86
+ <P ALIGN=CENTER><FONT SIZE=1 STYLE="font-size: 8pt"><B>DESCRIPTION</B></FONT></P>
87
+ </TD>
88
+ <TD WIDTH=96>
89
+ <P ALIGN=CENTER><FONT SIZE=1 STYLE="font-size: 8pt"><B>HOURS</B></FONT></P>
90
+ </TD>
91
+ <TD WIDTH=96>
92
+ <P ALIGN=CENTER><FONT SIZE=1 STYLE="font-size: 8pt"><B>RATE</B></FONT></P>
93
+ </TD>
94
+ <TD WIDTH=97>
95
+ <P ALIGN=CENTER><FONT SIZE=1 STYLE="font-size: 8pt"><B>AMOUNT</B></FONT></P>
96
+ </TD>
97
+ </TR>
98
+ <% @projects.each do |project| %>
99
+ <TR>
100
+ <TD WIDTH=408 HEIGHT=13>
101
+ <P><%= project.name %></P>
102
+ </TD>
103
+ <TD WIDTH=96>
104
+ <P ALIGN=RIGHT><%= project.time_spent(scale, when_to) %></P>
105
+ </TD>
106
+ <TD WIDTH=96>
107
+ <P ALIGN=RIGHT><%= project.payment.pretty_print %></P>
108
+ </TD>
109
+ <TD WIDTH=97>
110
+ <P ALIGN=RIGHT><FONT SIZE=2><%= project.amount(scale, when_to) %></FONT></P>
111
+ </TD>
112
+ </TR>
113
+ <% end %>
114
+ <TR>
115
+ <TD WIDTH=408 HEIGHT=13 VALIGN=TOP>
116
+ <P CLASS="western"><BR>
117
+ </P>
118
+ </TD>
119
+ <TD COLSPAN=2 WIDTH=198>
120
+ <P ALIGN=RIGHT><FONT SIZE=1 STYLE="font-size: 8pt">TOTAL</FONT></P>
121
+ </TD>
122
+ <TD WIDTH=97>
123
+ <P ALIGN=RIGHT><FONT SIZE=2><%= @total %></FONT></P>
124
+ </TD>
125
+ </TR>
126
+ </TABLE>
127
+ </CENTER>
128
+ <P CLASS="western" STYLE="margin-bottom: 0in"><BR>
129
+ </P>
130
+ <CENTER>
131
+ <TABLE WIDTH=720 BORDER=0 CELLPADDING=8 CELLSPACING=0>
132
+ <COL WIDTH=704>
133
+ <TR>
134
+ <TD WIDTH=704 HEIGHT=90 VALIGN=TOP>
135
+ <P><FONT SIZE=2 STYLE="font-size: 9pt">Make all checks payable to Frogstarr78 Software</FONT></P>
136
+ </TD>
137
+ </TR>
138
+ <TR>
139
+ <TD WIDTH=704 HEIGHT=13>
140
+ <P ALIGN=CENTER><FONT SIZE=1 STYLE="font-size: 8pt"><B>Thank you for your business!</B></FONT></P>
141
+ </TD>
142
+ </TR>
143
+ </TABLE>
144
+ </CENTER>
145
+ <P CLASS="western" STYLE="margin-bottom: 0in"><BR>
146
+ </P>
147
+ </BODY>
148
+ </HTML>
@@ -0,0 +1,92 @@
1
+ #!/usr/bin/ruby
2
+ require 'tk'
3
+ require 'tkextlib/tile'
4
+ require 'optparse'
5
+ require 'ostruct'
6
+
7
+ opts = OpenStruct.new
8
+ opts.projects = []
9
+ opts.current = -1
10
+ opts.env = :development
11
+
12
+ ARGV.options do |opt|
13
+ opt.on('-e', '--environment ENVIRON', String, "Environment to run under.") do |env|
14
+ opts.env = env
15
+ end
16
+ opt.on('-p x,y,z', "--projects x,y,z", Array, "List of projects to display.") do |projs|
17
+ opts.projects = projs
18
+ end
19
+ opt.on('-c', '--current CURRENT', String, "Set the current task.") do |cur|
20
+ opts.current = opts.projects.index(cur)
21
+ end
22
+ opt.parse!
23
+ end
24
+
25
+ if opts.projects.empty?
26
+ raise 'No Projects' if ARGV.empty?
27
+ opts.projects = ARGV.split(',')
28
+ end
29
+
30
+ opts.current = opts.projects.index(opts.current) if opts.current == -1
31
+
32
+ root = TkRoot.new { title "Pratt Main" }
33
+
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
+
37
+ project_combo = Tk::Tile::TCombobox.new(button_holder_top)
38
+ project_combo.values = opts.projects
39
+ project_combo.current = opts.current
40
+ project_combo.pack('side' => 'bottom', 'fill' => 'y')
41
+
42
+ change = proc {
43
+ Process.detach(
44
+ fork { system("ruby bin/pratt.rb --change '#{project_combo.get}' --begin '#{project_combo.get}' --unlock") }
45
+ )
46
+ exit
47
+ }
48
+ quit = proc {
49
+ Process.detach(
50
+ fork { system("ruby bin/pratt.rb --end '#{project_combo.get}' --unlock --quit") }
51
+ )
52
+ exit
53
+ }
54
+ start = proc {
55
+ Process.detach(
56
+ fork { system("ruby bin/pratt.rb --begin '#{project_combo.get}' --unlock") }
57
+ )
58
+ exit
59
+ }
60
+
61
+ Tk::Tile::Label.new(button_holder_top) { text "What will you be working on?" }.pack('side' => 'top', :fill => 'y')
62
+
63
+ button_holder_bottom = Tk::Tile::Frame.new(button_holder) { padding "5 5 5 5" }
64
+ TkButton.new(button_holder_bottom) do
65
+ text 'Start'
66
+ command start
67
+ underline 0
68
+ end.pack :side => 'left', :fill => 'y'
69
+ root.bind("Alt-s", start)
70
+ #root.bind("Return", start)
71
+
72
+ TkButton.new(button_holder_bottom) do
73
+ text 'Change'
74
+ command change
75
+ underline 0
76
+ end.pack :side => 'left', :fill => 'y'
77
+ root.bind("Alt-c", change)
78
+
79
+ TkButton.new(button_holder_bottom) do
80
+ text 'Quit'
81
+ command quit
82
+ underline 0
83
+ end.pack :side => 'right', :fill => 'y'
84
+ root.bind("Alt-q", quit)
85
+ root.bind("Control-q", quit)
86
+ root.bind("Destroy", quit)
87
+
88
+ button_holder_top.pack( :side => 'top' , :fill => 'y')
89
+ button_holder_bottom.pack(:side => 'bottom', :fill => 'y')
90
+ button_holder.pack( :side => 'top', :fill => 'y')
91
+
92
+ Tk.mainloop