sum 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (228) hide show
  1. data/README.markdown +10 -12
  2. data/Rakefile +6 -7
  3. data/config/externals.yml +3 -3
  4. data/config/schedule.rb +0 -1
  5. data/features/step_definitions/when.rb +3 -3
  6. data/features/support/env.rb +9 -10
  7. data/gemspec.rb +13 -14
  8. data/lib/sum.rb +8 -8
  9. data/lib/sum/helper/cron.rb +1 -1
  10. data/lib/sum/model/user.rb +3 -3
  11. data/vendor/fetcher/MIT-LICENSE +20 -0
  12. data/vendor/fetcher/README.rdoc +94 -0
  13. data/vendor/fetcher/Rakefile +30 -0
  14. data/vendor/fetcher/fetcher.gemspec +27 -0
  15. data/vendor/fetcher/gemspec.rb +17 -0
  16. data/vendor/fetcher/init.rb +0 -0
  17. data/vendor/fetcher/lib/fetcher.rb +23 -0
  18. data/vendor/fetcher/lib/fetcher/base.rb +63 -0
  19. data/vendor/fetcher/lib/fetcher/imap.rb +79 -0
  20. data/vendor/fetcher/lib/fetcher/pop.rb +50 -0
  21. data/vendor/fetcher/lib/vendor/plain_imap.rb +21 -0
  22. data/vendor/fetcher/lib/vendor/secure_pop.rb +125 -0
  23. data/vendor/fetcher/test/fetcher_test.rb +74 -0
  24. metadata +40 -241
  25. data/sum.gemspec +0 -69
  26. data/vendor/webrat/History.txt +0 -358
  27. data/vendor/webrat/MIT-LICENSE.txt +0 -19
  28. data/vendor/webrat/README.rdoc +0 -85
  29. data/vendor/webrat/Rakefile +0 -200
  30. data/vendor/webrat/install.rb +0 -1
  31. data/vendor/webrat/lib/webrat.rb +0 -31
  32. data/vendor/webrat/lib/webrat/core.rb +0 -14
  33. data/vendor/webrat/lib/webrat/core/configuration.rb +0 -102
  34. data/vendor/webrat/lib/webrat/core/elements/area.rb +0 -31
  35. data/vendor/webrat/lib/webrat/core/elements/element.rb +0 -33
  36. data/vendor/webrat/lib/webrat/core/elements/field.rb +0 -409
  37. data/vendor/webrat/lib/webrat/core/elements/form.rb +0 -103
  38. data/vendor/webrat/lib/webrat/core/elements/label.rb +0 -31
  39. data/vendor/webrat/lib/webrat/core/elements/link.rb +0 -93
  40. data/vendor/webrat/lib/webrat/core/elements/select_option.rb +0 -35
  41. data/vendor/webrat/lib/webrat/core/locators.rb +0 -20
  42. data/vendor/webrat/lib/webrat/core/locators/area_locator.rb +0 -38
  43. data/vendor/webrat/lib/webrat/core/locators/button_locator.rb +0 -54
  44. data/vendor/webrat/lib/webrat/core/locators/field_by_id_locator.rb +0 -37
  45. data/vendor/webrat/lib/webrat/core/locators/field_labeled_locator.rb +0 -56
  46. data/vendor/webrat/lib/webrat/core/locators/field_locator.rb +0 -25
  47. data/vendor/webrat/lib/webrat/core/locators/field_named_locator.rb +0 -41
  48. data/vendor/webrat/lib/webrat/core/locators/form_locator.rb +0 -19
  49. data/vendor/webrat/lib/webrat/core/locators/label_locator.rb +0 -34
  50. data/vendor/webrat/lib/webrat/core/locators/link_locator.rb +0 -74
  51. data/vendor/webrat/lib/webrat/core/locators/locator.rb +0 -20
  52. data/vendor/webrat/lib/webrat/core/locators/select_option_locator.rb +0 -59
  53. data/vendor/webrat/lib/webrat/core/logging.rb +0 -24
  54. data/vendor/webrat/lib/webrat/core/matchers.rb +0 -4
  55. data/vendor/webrat/lib/webrat/core/matchers/have_content.rb +0 -73
  56. data/vendor/webrat/lib/webrat/core/matchers/have_selector.rb +0 -74
  57. data/vendor/webrat/lib/webrat/core/matchers/have_tag.rb +0 -21
  58. data/vendor/webrat/lib/webrat/core/matchers/have_xpath.rb +0 -147
  59. data/vendor/webrat/lib/webrat/core/methods.rb +0 -63
  60. data/vendor/webrat/lib/webrat/core/mime.rb +0 -29
  61. data/vendor/webrat/lib/webrat/core/save_and_open_page.rb +0 -48
  62. data/vendor/webrat/lib/webrat/core/scope.rb +0 -350
  63. data/vendor/webrat/lib/webrat/core/session.rb +0 -299
  64. data/vendor/webrat/lib/webrat/core/xml.rb +0 -115
  65. data/vendor/webrat/lib/webrat/core/xml/hpricot.rb +0 -19
  66. data/vendor/webrat/lib/webrat/core/xml/nokogiri.rb +0 -76
  67. data/vendor/webrat/lib/webrat/core/xml/rexml.rb +0 -24
  68. data/vendor/webrat/lib/webrat/core_extensions/blank.rb +0 -58
  69. data/vendor/webrat/lib/webrat/core_extensions/deprecate.rb +0 -8
  70. data/vendor/webrat/lib/webrat/core_extensions/detect_mapped.rb +0 -12
  71. data/vendor/webrat/lib/webrat/core_extensions/meta_class.rb +0 -6
  72. data/vendor/webrat/lib/webrat/core_extensions/nil_to_param.rb +0 -5
  73. data/vendor/webrat/lib/webrat/core_extensions/tcp_socket.rb +0 -27
  74. data/vendor/webrat/lib/webrat/mechanize.rb +0 -74
  75. data/vendor/webrat/lib/webrat/merb.rb +0 -9
  76. data/vendor/webrat/lib/webrat/merb_multipart_support.rb +0 -27
  77. data/vendor/webrat/lib/webrat/merb_session.rb +0 -82
  78. data/vendor/webrat/lib/webrat/rack.rb +0 -25
  79. data/vendor/webrat/lib/webrat/rails.rb +0 -106
  80. data/vendor/webrat/lib/webrat/rspec-rails.rb +0 -10
  81. data/vendor/webrat/lib/webrat/selenium.rb +0 -81
  82. data/vendor/webrat/lib/webrat/selenium/application_server_factory.rb +0 -40
  83. data/vendor/webrat/lib/webrat/selenium/application_servers.rb +0 -5
  84. data/vendor/webrat/lib/webrat/selenium/application_servers/base.rb +0 -46
  85. data/vendor/webrat/lib/webrat/selenium/application_servers/external.rb +0 -26
  86. data/vendor/webrat/lib/webrat/selenium/application_servers/merb.rb +0 -50
  87. data/vendor/webrat/lib/webrat/selenium/application_servers/rails.rb +0 -44
  88. data/vendor/webrat/lib/webrat/selenium/application_servers/sinatra.rb +0 -37
  89. data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/button.js +0 -19
  90. data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/label.js +0 -16
  91. data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/webrat.js +0 -5
  92. data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/webratlink.js +0 -12
  93. data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/webratlinkwithin.js +0 -15
  94. data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/webratselectwithoption.js +0 -5
  95. data/vendor/webrat/lib/webrat/selenium/matchers.rb +0 -4
  96. data/vendor/webrat/lib/webrat/selenium/matchers/have_content.rb +0 -66
  97. data/vendor/webrat/lib/webrat/selenium/matchers/have_selector.rb +0 -49
  98. data/vendor/webrat/lib/webrat/selenium/matchers/have_tag.rb +0 -72
  99. data/vendor/webrat/lib/webrat/selenium/matchers/have_xpath.rb +0 -45
  100. data/vendor/webrat/lib/webrat/selenium/selenium_extensions.js +0 -6
  101. data/vendor/webrat/lib/webrat/selenium/selenium_rc_server.rb +0 -84
  102. data/vendor/webrat/lib/webrat/selenium/selenium_session.rb +0 -248
  103. data/vendor/webrat/lib/webrat/selenium/silence_stream.rb +0 -18
  104. data/vendor/webrat/lib/webrat/sinatra.rb +0 -11
  105. data/vendor/webrat/spec/fakes/test_session.rb +0 -34
  106. data/vendor/webrat/spec/integration/merb/Rakefile +0 -35
  107. data/vendor/webrat/spec/integration/merb/app/controllers/application.rb +0 -2
  108. data/vendor/webrat/spec/integration/merb/app/controllers/exceptions.rb +0 -13
  109. data/vendor/webrat/spec/integration/merb/app/controllers/testing.rb +0 -27
  110. data/vendor/webrat/spec/integration/merb/app/views/exceptions/not_acceptable.html.erb +0 -63
  111. data/vendor/webrat/spec/integration/merb/app/views/exceptions/not_found.html.erb +0 -47
  112. data/vendor/webrat/spec/integration/merb/app/views/layout/application.html.erb +0 -12
  113. data/vendor/webrat/spec/integration/merb/app/views/testing/show_form.html.erb +0 -27
  114. data/vendor/webrat/spec/integration/merb/app/views/testing/upload.html.erb +0 -9
  115. data/vendor/webrat/spec/integration/merb/config/environments/development.rb +0 -15
  116. data/vendor/webrat/spec/integration/merb/config/environments/rake.rb +0 -11
  117. data/vendor/webrat/spec/integration/merb/config/environments/test.rb +0 -14
  118. data/vendor/webrat/spec/integration/merb/config/init.rb +0 -25
  119. data/vendor/webrat/spec/integration/merb/config/rack.rb +0 -11
  120. data/vendor/webrat/spec/integration/merb/config/router.rb +0 -34
  121. data/vendor/webrat/spec/integration/merb/spec/spec.opts +0 -1
  122. data/vendor/webrat/spec/integration/merb/spec/spec_helper.rb +0 -24
  123. data/vendor/webrat/spec/integration/merb/spec/webrat_spec.rb +0 -39
  124. data/vendor/webrat/spec/integration/merb/tasks/merb.thor/app_script.rb +0 -31
  125. data/vendor/webrat/spec/integration/merb/tasks/merb.thor/common.rb +0 -64
  126. data/vendor/webrat/spec/integration/merb/tasks/merb.thor/gem_ext.rb +0 -124
  127. data/vendor/webrat/spec/integration/merb/tasks/merb.thor/main.thor +0 -150
  128. data/vendor/webrat/spec/integration/merb/tasks/merb.thor/ops.rb +0 -93
  129. data/vendor/webrat/spec/integration/merb/tasks/merb.thor/utils.rb +0 -40
  130. data/vendor/webrat/spec/integration/rack/Rakefile +0 -5
  131. data/vendor/webrat/spec/integration/rack/app.rb +0 -73
  132. data/vendor/webrat/spec/integration/rack/test/helper.rb +0 -20
  133. data/vendor/webrat/spec/integration/rack/test/webrat_rack_test.rb +0 -62
  134. data/vendor/webrat/spec/integration/rails/Rakefile +0 -30
  135. data/vendor/webrat/spec/integration/rails/app/controllers/application.rb +0 -15
  136. data/vendor/webrat/spec/integration/rails/app/controllers/buttons_controller.rb +0 -7
  137. data/vendor/webrat/spec/integration/rails/app/controllers/fields_controller.rb +0 -4
  138. data/vendor/webrat/spec/integration/rails/app/controllers/links_controller.rb +0 -7
  139. data/vendor/webrat/spec/integration/rails/app/controllers/webrat_controller.rb +0 -43
  140. data/vendor/webrat/spec/integration/rails/app/helpers/buttons_helper.rb +0 -2
  141. data/vendor/webrat/spec/integration/rails/app/helpers/fields_helper.rb +0 -2
  142. data/vendor/webrat/spec/integration/rails/app/helpers/links_helper.rb +0 -2
  143. data/vendor/webrat/spec/integration/rails/app/views/buttons/show.html.erb +0 -11
  144. data/vendor/webrat/spec/integration/rails/app/views/fields/show.html.erb +0 -9
  145. data/vendor/webrat/spec/integration/rails/app/views/links/show.html.erb +0 -5
  146. data/vendor/webrat/spec/integration/rails/app/views/webrat/before_redirect_form.html.erb +0 -4
  147. data/vendor/webrat/spec/integration/rails/app/views/webrat/buttons.html.erb +0 -11
  148. data/vendor/webrat/spec/integration/rails/app/views/webrat/form.html.erb +0 -28
  149. data/vendor/webrat/spec/integration/rails/config/boot.rb +0 -109
  150. data/vendor/webrat/spec/integration/rails/config/environment.rb +0 -12
  151. data/vendor/webrat/spec/integration/rails/config/environments/development.rb +0 -17
  152. data/vendor/webrat/spec/integration/rails/config/environments/selenium.rb +0 -22
  153. data/vendor/webrat/spec/integration/rails/config/environments/test.rb +0 -22
  154. data/vendor/webrat/spec/integration/rails/config/initializers/inflections.rb +0 -10
  155. data/vendor/webrat/spec/integration/rails/config/initializers/mime_types.rb +0 -5
  156. data/vendor/webrat/spec/integration/rails/config/initializers/new_rails_defaults.rb +0 -17
  157. data/vendor/webrat/spec/integration/rails/config/locales/en.yml +0 -5
  158. data/vendor/webrat/spec/integration/rails/config/routes.rb +0 -18
  159. data/vendor/webrat/spec/integration/rails/public/404.html +0 -30
  160. data/vendor/webrat/spec/integration/rails/public/422.html +0 -30
  161. data/vendor/webrat/spec/integration/rails/public/500.html +0 -33
  162. data/vendor/webrat/spec/integration/rails/script/about +0 -4
  163. data/vendor/webrat/spec/integration/rails/script/console +0 -3
  164. data/vendor/webrat/spec/integration/rails/script/dbconsole +0 -3
  165. data/vendor/webrat/spec/integration/rails/script/destroy +0 -3
  166. data/vendor/webrat/spec/integration/rails/script/generate +0 -3
  167. data/vendor/webrat/spec/integration/rails/script/performance/benchmarker +0 -3
  168. data/vendor/webrat/spec/integration/rails/script/performance/profiler +0 -3
  169. data/vendor/webrat/spec/integration/rails/script/performance/request +0 -3
  170. data/vendor/webrat/spec/integration/rails/script/plugin +0 -3
  171. data/vendor/webrat/spec/integration/rails/script/process/inspector +0 -3
  172. data/vendor/webrat/spec/integration/rails/script/process/reaper +0 -3
  173. data/vendor/webrat/spec/integration/rails/script/process/spawner +0 -3
  174. data/vendor/webrat/spec/integration/rails/script/runner +0 -3
  175. data/vendor/webrat/spec/integration/rails/script/server +0 -3
  176. data/vendor/webrat/spec/integration/rails/test/integration/button_click_test.rb +0 -80
  177. data/vendor/webrat/spec/integration/rails/test/integration/fill_in_test.rb +0 -24
  178. data/vendor/webrat/spec/integration/rails/test/integration/link_click_test.rb +0 -27
  179. data/vendor/webrat/spec/integration/rails/test/integration/webrat_test.rb +0 -97
  180. data/vendor/webrat/spec/integration/rails/test/test_helper.rb +0 -25
  181. data/vendor/webrat/spec/integration/sinatra/Rakefile +0 -5
  182. data/vendor/webrat/spec/integration/sinatra/classic_app.rb +0 -64
  183. data/vendor/webrat/spec/integration/sinatra/modular_app.rb +0 -16
  184. data/vendor/webrat/spec/integration/sinatra/test/classic_app_test.rb +0 -37
  185. data/vendor/webrat/spec/integration/sinatra/test/modular_app_test.rb +0 -18
  186. data/vendor/webrat/spec/integration/sinatra/test/test_helper.rb +0 -16
  187. data/vendor/webrat/spec/private/core/configuration_spec.rb +0 -116
  188. data/vendor/webrat/spec/private/core/field_spec.rb +0 -85
  189. data/vendor/webrat/spec/private/core/link_spec.rb +0 -24
  190. data/vendor/webrat/spec/private/core/logging_spec.rb +0 -10
  191. data/vendor/webrat/spec/private/core/session_spec.rb +0 -195
  192. data/vendor/webrat/spec/private/mechanize/mechanize_session_spec.rb +0 -81
  193. data/vendor/webrat/spec/private/merb/attaches_file_spec.rb +0 -93
  194. data/vendor/webrat/spec/private/merb/merb_session_spec.rb +0 -61
  195. data/vendor/webrat/spec/private/nokogiri_spec.rb +0 -77
  196. data/vendor/webrat/spec/private/rails/attaches_file_spec.rb +0 -81
  197. data/vendor/webrat/spec/private/rails/rails_session_spec.rb +0 -112
  198. data/vendor/webrat/spec/private/selenium/application_servers/rails_spec.rb +0 -26
  199. data/vendor/webrat/spec/public/basic_auth_spec.rb +0 -24
  200. data/vendor/webrat/spec/public/check_spec.rb +0 -191
  201. data/vendor/webrat/spec/public/choose_spec.rb +0 -118
  202. data/vendor/webrat/spec/public/click_area_spec.rb +0 -106
  203. data/vendor/webrat/spec/public/click_button_spec.rb +0 -496
  204. data/vendor/webrat/spec/public/click_link_spec.rb +0 -511
  205. data/vendor/webrat/spec/public/fill_in_spec.rb +0 -209
  206. data/vendor/webrat/spec/public/locators/field_by_xpath_spec.rb +0 -19
  207. data/vendor/webrat/spec/public/locators/field_labeled_spec.rb +0 -172
  208. data/vendor/webrat/spec/public/locators/field_with_id_spec.rb +0 -16
  209. data/vendor/webrat/spec/public/matchers/contain_spec.rb +0 -114
  210. data/vendor/webrat/spec/public/matchers/have_selector_spec.rb +0 -142
  211. data/vendor/webrat/spec/public/matchers/have_tag_spec.rb +0 -39
  212. data/vendor/webrat/spec/public/matchers/have_xpath_spec.rb +0 -136
  213. data/vendor/webrat/spec/public/reload_spec.rb +0 -10
  214. data/vendor/webrat/spec/public/save_and_open_spec.rb +0 -70
  215. data/vendor/webrat/spec/public/select_date_spec.rb +0 -112
  216. data/vendor/webrat/spec/public/select_datetime_spec.rb +0 -137
  217. data/vendor/webrat/spec/public/select_spec.rb +0 -249
  218. data/vendor/webrat/spec/public/select_time_spec.rb +0 -100
  219. data/vendor/webrat/spec/public/selenium/application_server_factory_spec.rb +0 -49
  220. data/vendor/webrat/spec/public/selenium/application_servers/external_spec.rb +0 -12
  221. data/vendor/webrat/spec/public/selenium/selenium_session_spec.rb +0 -37
  222. data/vendor/webrat/spec/public/set_hidden_field_spec.rb +0 -5
  223. data/vendor/webrat/spec/public/submit_form_spec.rb +0 -5
  224. data/vendor/webrat/spec/public/visit_spec.rb +0 -58
  225. data/vendor/webrat/spec/public/within_spec.rb +0 -177
  226. data/vendor/webrat/spec/rcov.opts +0 -1
  227. data/vendor/webrat/spec/spec.opts +0 -2
  228. data/vendor/webrat/spec/spec_helper.rb +0 -50
@@ -3,6 +3,11 @@ Sum
3
3
 
4
4
  A budgeting app built on Sinatra. Use it at [sumapp.com](http://sumapp.com).
5
5
 
6
+ Compatibility
7
+ -------------
8
+
9
+ Sum is actively maintained under Ruby 1.9.1.
10
+
6
11
  The flow
7
12
  --------
8
13
 
@@ -16,8 +21,7 @@ Development setup
16
21
  Install the sum gem for its dependencies:
17
22
 
18
23
  <pre>
19
- gem sources -a http://gems.github.com
20
- sudo gem install winton-sum
24
+ sudo gem install sum --source http://gemcutter.org
21
25
  </pre>
22
26
 
23
27
  Fork the [Sum repository](http://github.com/winton/sum) on [GitHub](http://github.com).
@@ -27,12 +31,6 @@ git clone git@github.com:YOUR_NAME/sum.git
27
31
  cd sum
28
32
  </pre>
29
33
 
30
- Create your database:
31
-
32
- <pre>
33
- mysql -uroot -e "create database sum;"
34
- </pre>
35
-
36
34
  Copy and edit the example config files:
37
35
 
38
36
  <pre>
@@ -41,10 +39,10 @@ cp config/mail.example.yml config/mail.yml
41
39
  mate config/database.yml config/mail.yml
42
40
  </pre>
43
41
 
44
- Migrate the database:
42
+ Create and migrate your database:
45
43
 
46
44
  <pre>
47
- rake db:migrate
45
+ rake db:create db:migrate
48
46
  </pre>
49
47
 
50
48
  Start the application with shotgun:
@@ -64,6 +62,6 @@ Running the test suite
64
62
  Sum uses [Cucumber](http://github.com/aslakhellesoy/cucumber), [Webrat](http://github.com/brynary/webrat), and [email-spec](http://github.com/bmabey/email-spec) for functional tests and [rspec](http://github.com/dchelimsky/rspec) for unit tests:
65
63
 
66
64
  <pre>
67
- rake features
68
- rake spec
65
+ cucumber
66
+ spec .
69
67
  </pre>
data/Rakefile CHANGED
@@ -1,16 +1,16 @@
1
1
  require 'rubygems'
2
2
 
3
3
  gems = [
4
- [ 'cucumber', '=0.3.93' ],
5
- [ 'rspec', '=1.2.8' ],
6
- [ 'winton-active_wrapper', '=0.1.9' ]
4
+ [ 'active_wrapper', '=0.2.2' ],
5
+ [ 'cucumber', '=0.4.4' ],
6
+ [ 'rspec', '=1.2.9' ]
7
7
  ]
8
8
 
9
9
  gems.each do |name, version|
10
- begin
10
+ if File.exists?(path = "#{File.dirname(__FILE__)}/../vendor/#{name}/lib")
11
+ $:.unshift path
12
+ else
11
13
  gem name, version
12
- rescue Exception
13
- $:.unshift "#{File.dirname(__FILE__)}/vendor/#{name}/lib"
14
14
  end
15
15
  end
16
16
 
@@ -50,7 +50,6 @@ Rake::GemPackageTask.new(GEM_SPEC) do |pkg|
50
50
  end
51
51
 
52
52
  Spec::Rake::SpecTask.new do |t|
53
- t.rcov = true
54
53
  t.spec_opts = ["--format", "specdoc", "--colour"]
55
54
  t.spec_files = FileList["spec/**/*_spec.rb"]
56
55
  end
@@ -1,13 +1,13 @@
1
- winton-active_wrapper:
1
+ active_wrapper:
2
2
  repo: git@github.com:winton/active_wrapper.git
3
3
  path: vendor
4
4
  email-spec:
5
5
  repo: git://github.com/bmabey/email-spec.git
6
6
  path: vendor
7
- winton-fetcher:
7
+ fetcher:
8
8
  repo: git@github.com:winton/fetcher.git
9
9
  path: vendor
10
- winton-secret_key:
10
+ secret_key:
11
11
  repo: git@github.com:winton/secret_key.git
12
12
  path: vendor
13
13
  sinatra:
@@ -10,7 +10,6 @@ require 'secret_key'
10
10
  key = SecretKey.new(File.dirname(__FILE__)).read
11
11
 
12
12
  every 1.minute do
13
- puts @environment
14
13
  case @environment
15
14
  when 'development'
16
15
  command "curl http://localhost:#{@port}/cron"
@@ -10,9 +10,9 @@ end
10
10
  When /^I submit a valid form with (.+)$/ do |input|
11
11
  fill_all_with_valid_data
12
12
  values = case input
13
- when "decimals": [ "1000.00", "5000.00", "2000.00" ]
14
- when "numbers only": [ "1000", "5000", "2000" ]
15
- when "dollar signs": [ "$1000.00", "$5000.00", "$2000.00" ]
13
+ when "decimals" then [ "1000.00", "5000.00", "2000.00" ]
14
+ when "numbers only" then [ "1000", "5000", "2000" ]
15
+ when "dollar signs" then [ "$1000.00", "$5000.00", "$2000.00" ]
16
16
  end
17
17
  fill_in "user[savings]", :with => values.pop
18
18
  fill_in "user[income]", :with => values.pop
@@ -5,32 +5,31 @@ $:.unshift "#{$root}/lib"
5
5
  require 'sum'
6
6
 
7
7
  gems = [
8
- [ 'bmabey-email_spec', '=0.2.0' ],
9
- [ 'rack-test', '=0.4.0' ],
10
- [ 'rspec', '=1.2.7' ]
8
+ [ 'email_spec', '=0.3.5' ],
9
+ [ 'rack-test', '=0.5.3' ],
10
+ [ 'rspec', '=1.2.9' ]
11
11
  ]
12
12
 
13
13
  gems.each do |name, version|
14
- begin
14
+ if File.exists?(path = "#{File.dirname(__FILE__)}/../vendor/#{name}/lib")
15
+ $:.unshift path
16
+ else
15
17
  gem name, version
16
- rescue Exception
17
- $:.unshift "#{File.dirname(__FILE__)}/../../vendor/#{name}/lib"
18
18
  end
19
19
  end
20
20
 
21
21
  require 'email_spec'
22
+ require 'email_spec/cucumber'
22
23
  require 'rack/test'
23
24
  require 'spec/mocks'
24
25
  require 'test/unit'
25
- require "#{$root}/vendor/webrat/lib/webrat"
26
+ require 'webrat'
26
27
 
27
28
  World do
28
29
  def app
29
30
  Application
30
31
  end
31
-
32
- include EmailSpec::Helpers
33
- include EmailSpec::Matchers
32
+
34
33
  include Rack::Test::Methods
35
34
  include Test::Unit::Assertions
36
35
  include Webrat::Matchers
data/gemspec.rb CHANGED
@@ -21,25 +21,24 @@ GEM_SPEC = Gem::Specification.new do |s|
21
21
  s.homepage = "http://github.com/winton/#{GEM_NAME}"
22
22
  s.summary = "A simple budgeting app built on Sinatra"
23
23
  # == CONFIGURE ==
24
- s.add_dependency('bmabey-email_spec', '=0.2.0')
25
- s.add_dependency('cucumber', '=0.3.93')
26
- s.add_dependency('haml', '=2.2.2')
27
- s.add_dependency('less', '=0.8.11')
28
- s.add_dependency('javan-whenever', '=0.3.6')
29
- s.add_dependency('rack', '=1.0.0')
30
- s.add_dependency('rack-test', '=0.4.0')
31
- s.add_dependency('rspec', '=1.2.8')
32
- s.add_dependency('shotgun', '=0.3')
24
+ s.add_dependency('active_wrapper', '=0.2.2')
25
+ s.add_dependency('email_spec', '=0.3.5')
26
+ s.add_dependency('cucumber', '=0.4.4')
27
+ s.add_dependency('haml', '=2.2.14')
28
+ s.add_dependency('less', '=1.2.17')
29
+ s.add_dependency('whenever', '=0.4.0')
30
+ s.add_dependency('rack', '=1.0.1')
31
+ s.add_dependency('rack-test', '=0.5.3')
32
+ s.add_dependency('rspec', '=1.2.9')
33
+ s.add_dependency('secret_key', '=0.1.0')
34
+ s.add_dependency('shotgun', '=0.4')
33
35
  s.add_dependency('sinatra', '=0.9.4')
34
- s.add_dependency('winton-active_wrapper', '=0.1.9')
35
- s.add_dependency('winton-externals', '=1.0.2')
36
- s.add_dependency('winton-fetcher', '=0.1.2')
37
- s.add_dependency('winton-secret_key', '=0.1.0')
36
+ s.add_dependency('webrat', '=0.6.0')
38
37
  s.extra_rdoc_files = [ "README.markdown" ]
39
38
  s.files = GEM_FILES.to_a
40
39
  s.has_rdoc = false
41
40
  s.name = GEM_NAME
42
41
  s.platform = Gem::Platform::RUBY
43
42
  s.require_path = "lib"
44
- s.version = "0.1.1"
43
+ s.version = "0.1.2"
45
44
  end
data/lib/sum.rb CHANGED
@@ -1,18 +1,18 @@
1
1
  require 'rubygems'
2
2
 
3
3
  gems = [
4
- [ 'haml', '=2.2.2' ],
5
- [ 'sinatra', '=0.9.4' ],
6
- [ 'winton-active_wrapper', '=0.1.9' ],
7
- [ 'winton-fetcher', '=0.1.2' ],
8
- [ 'winton-secret_key', '=0.1.0' ]
4
+ [ 'active_wrapper', '=0.2.2' ],
5
+ [ 'fetcher', '=0.1.2' ],
6
+ [ 'haml', '=2.2.14' ],
7
+ [ 'secret_key', '=0.1.0' ],
8
+ [ 'sinatra', '=0.9.4' ]
9
9
  ]
10
10
 
11
11
  gems.each do |name, version|
12
- begin
12
+ if File.exists?(path = "#{File.dirname(__FILE__)}/../vendor/#{name}/lib")
13
+ $:.unshift path
14
+ else
13
15
  gem name, version
14
- rescue Exception
15
- $:.unshift "#{File.dirname(__FILE__)}/../vendor/#{name}/lib"
16
16
  end
17
17
  end
18
18
 
@@ -2,7 +2,7 @@ Application.class_eval do
2
2
  helpers do
3
3
 
4
4
  def days(day)
5
- day <= 1 ? "day" : "#{day} days"
5
+ day <= 1 ? "day" : "#{day.to_i} days"
6
6
  end
7
7
 
8
8
  def money(amount)
@@ -118,7 +118,7 @@ class User < ActiveRecord::Base
118
118
 
119
119
  # Days in this fiscal month
120
120
  def days_in_month
121
- self.reset_at.to_date - self.beginning_of_month.to_date
121
+ (self.reset_at.to_date - self.beginning_of_month.to_date).to_i
122
122
  end
123
123
 
124
124
  # Days left in this fiscal month
@@ -138,7 +138,7 @@ class User < ActiveRecord::Base
138
138
 
139
139
  # Days passed in this fiscal month, including today
140
140
  def days_passed_including_today
141
- self.days_passed + 1
141
+ (self.days_passed + 1).to_i
142
142
  end
143
143
 
144
144
  # Reset spent_today
@@ -199,7 +199,7 @@ class User < ActiveRecord::Base
199
199
 
200
200
  # How much the user is spending per day (ideally)
201
201
  def spending_per_day
202
- self.spending_goal / self.days_in_month
202
+ self.spending_goal / self.days_in_month.to_f
203
203
  end
204
204
 
205
205
  # How much the user has spent this month
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2007 Dan Weinand and Slantwise Design, LLC
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,94 @@
1
+ = Fetcher
2
+
3
+ Fetcher is a simple message fetcher perfect for using in a daemon or via cron.
4
+
5
+ It implements the following common pattern:
6
+
7
+ 1. Connect to a server
8
+ 2. Download available messages
9
+ 3. Send each message to another object for further processing
10
+ 4. Remove downloaded messages from the remote server
11
+
12
+ Install using:
13
+
14
+ sudo gem install winton-fetcher
15
+
16
+ == Notice
17
+
18
+ This is a fork of {fetcher}[http://github.com/look/fetcher] by {Luke Francl}[http://github.com/look].
19
+
20
+ Differences:
21
+
22
+ * Gemified
23
+ * Doesn't have generators
24
+ * Fixes a connection exception issue
25
+
26
+ == Usage
27
+
28
+ Create a new fetcher object like the following:
29
+
30
+ @fetcher = Fetcher.create({:type => :pop,
31
+ :receiver => IncomingMailHandler,
32
+ :server => 'mail.example.com',
33
+ :username => 'jim',
34
+ :password => 'test'})
35
+
36
+ The receiver object is expected to have a receive method that takes a message as its only argument
37
+ (e.g., the way <tt>ActionMailer::Base.recieve</tt> works; but you don't <em>have</em> to use ActionMailer.).
38
+
39
+ Call <tt>fetch</tt> to download messages and process them.
40
+
41
+ @fetcher.fetch
42
+
43
+ == Configuration
44
+
45
+ The following options can be passed to the <tt>Fetcher.create</tt> factory method:
46
+
47
+ [<tt>type</tt>] POP or IMAP
48
+ [<tt>server</tt>] The IP address or domain name of the server
49
+ [<tt>port</tt>] The port to connect to (defaults to the standard port for the type of server)
50
+ [<tt>ssl</tt>] Set to any value to use SSL encryption
51
+ [<tt>username</tt>] The username used to connect to the server
52
+ [<tt>password</tt>] The password used to connect to the server
53
+ [<tt>authentication</tt>] The authentication scheme to use (IMAP only). Supports LOGIN, CRAM-MD5, and PASSWORD (defaults to PLAIN)
54
+ [<tt>use_login</tt>] Set to any value to use the LOGIN command instead of AUTHENTICATE. Some servers, like GMail, do not support AUTHENTICATE (IMAP only).
55
+ [<tt>sleep_time</tt>] The number of seconds to sleep between fetches (defaults to 60 seconds; valid only for the generated daemon)
56
+ [<tt>processed_folder</tt>] The name of a folder to move mail to after it has been processed (IMAP only). <b>NOTE:</b> If not specified, mail is deleted.
57
+ [<tt>error_folder</tt>] The name a folder to move mail that causes an error during processing (IMAP only). Defaults to +bogus+.
58
+
59
+ == Running via cron
60
+
61
+ You can also run the Fetcher periodically via cron. It is important to ensure that only one
62
+ instance is running at one time, and for that the {Lockfile gem}[http://codeforpeople.com/lib/ruby/lockfile/] is recommended.
63
+
64
+ Here is an example script to be with <tt>script/runner</tt> via cron:
65
+
66
+ begin
67
+ Lockfile.new('cron_mail_fetcher.lock', :retries => 0) do
68
+ config = YAML.load_file("#{RAILS_ROOT}/config/mail.yml")
69
+ config = config[RAILS_ENV].to_options
70
+
71
+ fetcher = Fetcher.create({:receiver => MailReceiver}.merge(config))
72
+ fetcher.fetch
73
+ end
74
+ rescue Lockfile::MaxTriesLockError => e
75
+ puts "Another fetcher is already running. Exiting."
76
+ end
77
+
78
+ == Extending
79
+
80
+ You can subclass <tt>Fetcher::Base</tt> or one of the protocol-specific classed to override the standard behavior.
81
+
82
+ == Further documentation
83
+
84
+ <shameless-plug>
85
+
86
+ You can read more about how to use the Fetcher in the PeepCode book {Receiving Email with Ruby}[https://peepcode.com/products/mms2r-pdf].
87
+
88
+ </shameless-plug>
89
+
90
+ == Credit & Copyright
91
+
92
+ Created by Dan Weinand and Luke Francl. Development supported by {Slantwise Design}[http://slantwisedesign.com].
93
+
94
+ Licensed under the terms of the MIT License. Be excellent to each other.
@@ -0,0 +1,30 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+ require 'gemspec'
5
+
6
+ desc 'Default: run unit tests.'
7
+ task :default => :test
8
+
9
+ desc "Generate gemspec"
10
+ task :gemspec do
11
+ File.open("#{Dir.pwd}/#{GEM_NAME}.gemspec", 'w') do |f|
12
+ f.write(GEM_SPEC.to_ruby)
13
+ end
14
+ end
15
+
16
+ desc 'Test the fetcher plugin.'
17
+ Rake::TestTask.new(:test) do |t|
18
+ t.libs << 'lib'
19
+ t.pattern = 'test/**/*_test.rb'
20
+ t.verbose = true
21
+ end
22
+
23
+ desc 'Generate documentation for the fetcher plugin.'
24
+ Rake::RDocTask.new(:rdoc) do |rdoc|
25
+ rdoc.rdoc_dir = 'rdoc'
26
+ rdoc.title = 'Fetcher'
27
+ rdoc.options << '--line-numbers' << '--inline-source'
28
+ rdoc.rdoc_files.include('README')
29
+ rdoc.rdoc_files.include('lib/**/*.rb')
30
+ end
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{fetcher}
5
+ s.version = "0.1.2"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Luke Francl"]
9
+ s.date = %q{2009-06-28}
10
+ s.email = %q{look@recursion.org}
11
+ s.extra_rdoc_files = ["README.rdoc"]
12
+ s.files = ["fetcher.gemspec", "gemspec.rb", "init.rb", "lib", "lib/fetcher", "lib/fetcher/base.rb", "lib/fetcher/imap.rb", "lib/fetcher/pop.rb", "lib/fetcher.rb", "lib/vendor", "lib/vendor/plain_imap.rb", "lib/vendor/secure_pop.rb", "MIT-LICENSE", "Rakefile", "README.rdoc", "test", "test/fetcher_test.rb"]
13
+ s.homepage = %q{http://github.com/winton/fetcher}
14
+ s.require_paths = ["lib"]
15
+ s.rubygems_version = %q{1.3.1}
16
+ s.summary = %q{download email from POP3 or IMAP and do stuff with it. gemified fork}
17
+
18
+ if s.respond_to? :specification_version then
19
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
20
+ s.specification_version = 2
21
+
22
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
23
+ else
24
+ end
25
+ else
26
+ end
27
+ end