sum 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +10 -12
- data/Rakefile +6 -7
- data/config/externals.yml +3 -3
- data/config/schedule.rb +0 -1
- data/features/step_definitions/when.rb +3 -3
- data/features/support/env.rb +9 -10
- data/gemspec.rb +13 -14
- data/lib/sum.rb +8 -8
- data/lib/sum/helper/cron.rb +1 -1
- data/lib/sum/model/user.rb +3 -3
- data/vendor/fetcher/MIT-LICENSE +20 -0
- data/vendor/fetcher/README.rdoc +94 -0
- data/vendor/fetcher/Rakefile +30 -0
- data/vendor/fetcher/fetcher.gemspec +27 -0
- data/vendor/fetcher/gemspec.rb +17 -0
- data/vendor/fetcher/init.rb +0 -0
- data/vendor/fetcher/lib/fetcher.rb +23 -0
- data/vendor/fetcher/lib/fetcher/base.rb +63 -0
- data/vendor/fetcher/lib/fetcher/imap.rb +79 -0
- data/vendor/fetcher/lib/fetcher/pop.rb +50 -0
- data/vendor/fetcher/lib/vendor/plain_imap.rb +21 -0
- data/vendor/fetcher/lib/vendor/secure_pop.rb +125 -0
- data/vendor/fetcher/test/fetcher_test.rb +74 -0
- metadata +40 -241
- data/sum.gemspec +0 -69
- data/vendor/webrat/History.txt +0 -358
- data/vendor/webrat/MIT-LICENSE.txt +0 -19
- data/vendor/webrat/README.rdoc +0 -85
- data/vendor/webrat/Rakefile +0 -200
- data/vendor/webrat/install.rb +0 -1
- data/vendor/webrat/lib/webrat.rb +0 -31
- data/vendor/webrat/lib/webrat/core.rb +0 -14
- data/vendor/webrat/lib/webrat/core/configuration.rb +0 -102
- data/vendor/webrat/lib/webrat/core/elements/area.rb +0 -31
- data/vendor/webrat/lib/webrat/core/elements/element.rb +0 -33
- data/vendor/webrat/lib/webrat/core/elements/field.rb +0 -409
- data/vendor/webrat/lib/webrat/core/elements/form.rb +0 -103
- data/vendor/webrat/lib/webrat/core/elements/label.rb +0 -31
- data/vendor/webrat/lib/webrat/core/elements/link.rb +0 -93
- data/vendor/webrat/lib/webrat/core/elements/select_option.rb +0 -35
- data/vendor/webrat/lib/webrat/core/locators.rb +0 -20
- data/vendor/webrat/lib/webrat/core/locators/area_locator.rb +0 -38
- data/vendor/webrat/lib/webrat/core/locators/button_locator.rb +0 -54
- data/vendor/webrat/lib/webrat/core/locators/field_by_id_locator.rb +0 -37
- data/vendor/webrat/lib/webrat/core/locators/field_labeled_locator.rb +0 -56
- data/vendor/webrat/lib/webrat/core/locators/field_locator.rb +0 -25
- data/vendor/webrat/lib/webrat/core/locators/field_named_locator.rb +0 -41
- data/vendor/webrat/lib/webrat/core/locators/form_locator.rb +0 -19
- data/vendor/webrat/lib/webrat/core/locators/label_locator.rb +0 -34
- data/vendor/webrat/lib/webrat/core/locators/link_locator.rb +0 -74
- data/vendor/webrat/lib/webrat/core/locators/locator.rb +0 -20
- data/vendor/webrat/lib/webrat/core/locators/select_option_locator.rb +0 -59
- data/vendor/webrat/lib/webrat/core/logging.rb +0 -24
- data/vendor/webrat/lib/webrat/core/matchers.rb +0 -4
- data/vendor/webrat/lib/webrat/core/matchers/have_content.rb +0 -73
- data/vendor/webrat/lib/webrat/core/matchers/have_selector.rb +0 -74
- data/vendor/webrat/lib/webrat/core/matchers/have_tag.rb +0 -21
- data/vendor/webrat/lib/webrat/core/matchers/have_xpath.rb +0 -147
- data/vendor/webrat/lib/webrat/core/methods.rb +0 -63
- data/vendor/webrat/lib/webrat/core/mime.rb +0 -29
- data/vendor/webrat/lib/webrat/core/save_and_open_page.rb +0 -48
- data/vendor/webrat/lib/webrat/core/scope.rb +0 -350
- data/vendor/webrat/lib/webrat/core/session.rb +0 -299
- data/vendor/webrat/lib/webrat/core/xml.rb +0 -115
- data/vendor/webrat/lib/webrat/core/xml/hpricot.rb +0 -19
- data/vendor/webrat/lib/webrat/core/xml/nokogiri.rb +0 -76
- data/vendor/webrat/lib/webrat/core/xml/rexml.rb +0 -24
- data/vendor/webrat/lib/webrat/core_extensions/blank.rb +0 -58
- data/vendor/webrat/lib/webrat/core_extensions/deprecate.rb +0 -8
- data/vendor/webrat/lib/webrat/core_extensions/detect_mapped.rb +0 -12
- data/vendor/webrat/lib/webrat/core_extensions/meta_class.rb +0 -6
- data/vendor/webrat/lib/webrat/core_extensions/nil_to_param.rb +0 -5
- data/vendor/webrat/lib/webrat/core_extensions/tcp_socket.rb +0 -27
- data/vendor/webrat/lib/webrat/mechanize.rb +0 -74
- data/vendor/webrat/lib/webrat/merb.rb +0 -9
- data/vendor/webrat/lib/webrat/merb_multipart_support.rb +0 -27
- data/vendor/webrat/lib/webrat/merb_session.rb +0 -82
- data/vendor/webrat/lib/webrat/rack.rb +0 -25
- data/vendor/webrat/lib/webrat/rails.rb +0 -106
- data/vendor/webrat/lib/webrat/rspec-rails.rb +0 -10
- data/vendor/webrat/lib/webrat/selenium.rb +0 -81
- data/vendor/webrat/lib/webrat/selenium/application_server_factory.rb +0 -40
- data/vendor/webrat/lib/webrat/selenium/application_servers.rb +0 -5
- data/vendor/webrat/lib/webrat/selenium/application_servers/base.rb +0 -46
- data/vendor/webrat/lib/webrat/selenium/application_servers/external.rb +0 -26
- data/vendor/webrat/lib/webrat/selenium/application_servers/merb.rb +0 -50
- data/vendor/webrat/lib/webrat/selenium/application_servers/rails.rb +0 -44
- data/vendor/webrat/lib/webrat/selenium/application_servers/sinatra.rb +0 -37
- data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/button.js +0 -19
- data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/label.js +0 -16
- data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/webrat.js +0 -5
- data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/webratlink.js +0 -12
- data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/webratlinkwithin.js +0 -15
- data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/webratselectwithoption.js +0 -5
- data/vendor/webrat/lib/webrat/selenium/matchers.rb +0 -4
- data/vendor/webrat/lib/webrat/selenium/matchers/have_content.rb +0 -66
- data/vendor/webrat/lib/webrat/selenium/matchers/have_selector.rb +0 -49
- data/vendor/webrat/lib/webrat/selenium/matchers/have_tag.rb +0 -72
- data/vendor/webrat/lib/webrat/selenium/matchers/have_xpath.rb +0 -45
- data/vendor/webrat/lib/webrat/selenium/selenium_extensions.js +0 -6
- data/vendor/webrat/lib/webrat/selenium/selenium_rc_server.rb +0 -84
- data/vendor/webrat/lib/webrat/selenium/selenium_session.rb +0 -248
- data/vendor/webrat/lib/webrat/selenium/silence_stream.rb +0 -18
- data/vendor/webrat/lib/webrat/sinatra.rb +0 -11
- data/vendor/webrat/spec/fakes/test_session.rb +0 -34
- data/vendor/webrat/spec/integration/merb/Rakefile +0 -35
- data/vendor/webrat/spec/integration/merb/app/controllers/application.rb +0 -2
- data/vendor/webrat/spec/integration/merb/app/controllers/exceptions.rb +0 -13
- data/vendor/webrat/spec/integration/merb/app/controllers/testing.rb +0 -27
- data/vendor/webrat/spec/integration/merb/app/views/exceptions/not_acceptable.html.erb +0 -63
- data/vendor/webrat/spec/integration/merb/app/views/exceptions/not_found.html.erb +0 -47
- data/vendor/webrat/spec/integration/merb/app/views/layout/application.html.erb +0 -12
- data/vendor/webrat/spec/integration/merb/app/views/testing/show_form.html.erb +0 -27
- data/vendor/webrat/spec/integration/merb/app/views/testing/upload.html.erb +0 -9
- data/vendor/webrat/spec/integration/merb/config/environments/development.rb +0 -15
- data/vendor/webrat/spec/integration/merb/config/environments/rake.rb +0 -11
- data/vendor/webrat/spec/integration/merb/config/environments/test.rb +0 -14
- data/vendor/webrat/spec/integration/merb/config/init.rb +0 -25
- data/vendor/webrat/spec/integration/merb/config/rack.rb +0 -11
- data/vendor/webrat/spec/integration/merb/config/router.rb +0 -34
- data/vendor/webrat/spec/integration/merb/spec/spec.opts +0 -1
- data/vendor/webrat/spec/integration/merb/spec/spec_helper.rb +0 -24
- data/vendor/webrat/spec/integration/merb/spec/webrat_spec.rb +0 -39
- data/vendor/webrat/spec/integration/merb/tasks/merb.thor/app_script.rb +0 -31
- data/vendor/webrat/spec/integration/merb/tasks/merb.thor/common.rb +0 -64
- data/vendor/webrat/spec/integration/merb/tasks/merb.thor/gem_ext.rb +0 -124
- data/vendor/webrat/spec/integration/merb/tasks/merb.thor/main.thor +0 -150
- data/vendor/webrat/spec/integration/merb/tasks/merb.thor/ops.rb +0 -93
- data/vendor/webrat/spec/integration/merb/tasks/merb.thor/utils.rb +0 -40
- data/vendor/webrat/spec/integration/rack/Rakefile +0 -5
- data/vendor/webrat/spec/integration/rack/app.rb +0 -73
- data/vendor/webrat/spec/integration/rack/test/helper.rb +0 -20
- data/vendor/webrat/spec/integration/rack/test/webrat_rack_test.rb +0 -62
- data/vendor/webrat/spec/integration/rails/Rakefile +0 -30
- data/vendor/webrat/spec/integration/rails/app/controllers/application.rb +0 -15
- data/vendor/webrat/spec/integration/rails/app/controllers/buttons_controller.rb +0 -7
- data/vendor/webrat/spec/integration/rails/app/controllers/fields_controller.rb +0 -4
- data/vendor/webrat/spec/integration/rails/app/controllers/links_controller.rb +0 -7
- data/vendor/webrat/spec/integration/rails/app/controllers/webrat_controller.rb +0 -43
- data/vendor/webrat/spec/integration/rails/app/helpers/buttons_helper.rb +0 -2
- data/vendor/webrat/spec/integration/rails/app/helpers/fields_helper.rb +0 -2
- data/vendor/webrat/spec/integration/rails/app/helpers/links_helper.rb +0 -2
- data/vendor/webrat/spec/integration/rails/app/views/buttons/show.html.erb +0 -11
- data/vendor/webrat/spec/integration/rails/app/views/fields/show.html.erb +0 -9
- data/vendor/webrat/spec/integration/rails/app/views/links/show.html.erb +0 -5
- data/vendor/webrat/spec/integration/rails/app/views/webrat/before_redirect_form.html.erb +0 -4
- data/vendor/webrat/spec/integration/rails/app/views/webrat/buttons.html.erb +0 -11
- data/vendor/webrat/spec/integration/rails/app/views/webrat/form.html.erb +0 -28
- data/vendor/webrat/spec/integration/rails/config/boot.rb +0 -109
- data/vendor/webrat/spec/integration/rails/config/environment.rb +0 -12
- data/vendor/webrat/spec/integration/rails/config/environments/development.rb +0 -17
- data/vendor/webrat/spec/integration/rails/config/environments/selenium.rb +0 -22
- data/vendor/webrat/spec/integration/rails/config/environments/test.rb +0 -22
- data/vendor/webrat/spec/integration/rails/config/initializers/inflections.rb +0 -10
- data/vendor/webrat/spec/integration/rails/config/initializers/mime_types.rb +0 -5
- data/vendor/webrat/spec/integration/rails/config/initializers/new_rails_defaults.rb +0 -17
- data/vendor/webrat/spec/integration/rails/config/locales/en.yml +0 -5
- data/vendor/webrat/spec/integration/rails/config/routes.rb +0 -18
- data/vendor/webrat/spec/integration/rails/public/404.html +0 -30
- data/vendor/webrat/spec/integration/rails/public/422.html +0 -30
- data/vendor/webrat/spec/integration/rails/public/500.html +0 -33
- data/vendor/webrat/spec/integration/rails/script/about +0 -4
- data/vendor/webrat/spec/integration/rails/script/console +0 -3
- data/vendor/webrat/spec/integration/rails/script/dbconsole +0 -3
- data/vendor/webrat/spec/integration/rails/script/destroy +0 -3
- data/vendor/webrat/spec/integration/rails/script/generate +0 -3
- data/vendor/webrat/spec/integration/rails/script/performance/benchmarker +0 -3
- data/vendor/webrat/spec/integration/rails/script/performance/profiler +0 -3
- data/vendor/webrat/spec/integration/rails/script/performance/request +0 -3
- data/vendor/webrat/spec/integration/rails/script/plugin +0 -3
- data/vendor/webrat/spec/integration/rails/script/process/inspector +0 -3
- data/vendor/webrat/spec/integration/rails/script/process/reaper +0 -3
- data/vendor/webrat/spec/integration/rails/script/process/spawner +0 -3
- data/vendor/webrat/spec/integration/rails/script/runner +0 -3
- data/vendor/webrat/spec/integration/rails/script/server +0 -3
- data/vendor/webrat/spec/integration/rails/test/integration/button_click_test.rb +0 -80
- data/vendor/webrat/spec/integration/rails/test/integration/fill_in_test.rb +0 -24
- data/vendor/webrat/spec/integration/rails/test/integration/link_click_test.rb +0 -27
- data/vendor/webrat/spec/integration/rails/test/integration/webrat_test.rb +0 -97
- data/vendor/webrat/spec/integration/rails/test/test_helper.rb +0 -25
- data/vendor/webrat/spec/integration/sinatra/Rakefile +0 -5
- data/vendor/webrat/spec/integration/sinatra/classic_app.rb +0 -64
- data/vendor/webrat/spec/integration/sinatra/modular_app.rb +0 -16
- data/vendor/webrat/spec/integration/sinatra/test/classic_app_test.rb +0 -37
- data/vendor/webrat/spec/integration/sinatra/test/modular_app_test.rb +0 -18
- data/vendor/webrat/spec/integration/sinatra/test/test_helper.rb +0 -16
- data/vendor/webrat/spec/private/core/configuration_spec.rb +0 -116
- data/vendor/webrat/spec/private/core/field_spec.rb +0 -85
- data/vendor/webrat/spec/private/core/link_spec.rb +0 -24
- data/vendor/webrat/spec/private/core/logging_spec.rb +0 -10
- data/vendor/webrat/spec/private/core/session_spec.rb +0 -195
- data/vendor/webrat/spec/private/mechanize/mechanize_session_spec.rb +0 -81
- data/vendor/webrat/spec/private/merb/attaches_file_spec.rb +0 -93
- data/vendor/webrat/spec/private/merb/merb_session_spec.rb +0 -61
- data/vendor/webrat/spec/private/nokogiri_spec.rb +0 -77
- data/vendor/webrat/spec/private/rails/attaches_file_spec.rb +0 -81
- data/vendor/webrat/spec/private/rails/rails_session_spec.rb +0 -112
- data/vendor/webrat/spec/private/selenium/application_servers/rails_spec.rb +0 -26
- data/vendor/webrat/spec/public/basic_auth_spec.rb +0 -24
- data/vendor/webrat/spec/public/check_spec.rb +0 -191
- data/vendor/webrat/spec/public/choose_spec.rb +0 -118
- data/vendor/webrat/spec/public/click_area_spec.rb +0 -106
- data/vendor/webrat/spec/public/click_button_spec.rb +0 -496
- data/vendor/webrat/spec/public/click_link_spec.rb +0 -511
- data/vendor/webrat/spec/public/fill_in_spec.rb +0 -209
- data/vendor/webrat/spec/public/locators/field_by_xpath_spec.rb +0 -19
- data/vendor/webrat/spec/public/locators/field_labeled_spec.rb +0 -172
- data/vendor/webrat/spec/public/locators/field_with_id_spec.rb +0 -16
- data/vendor/webrat/spec/public/matchers/contain_spec.rb +0 -114
- data/vendor/webrat/spec/public/matchers/have_selector_spec.rb +0 -142
- data/vendor/webrat/spec/public/matchers/have_tag_spec.rb +0 -39
- data/vendor/webrat/spec/public/matchers/have_xpath_spec.rb +0 -136
- data/vendor/webrat/spec/public/reload_spec.rb +0 -10
- data/vendor/webrat/spec/public/save_and_open_spec.rb +0 -70
- data/vendor/webrat/spec/public/select_date_spec.rb +0 -112
- data/vendor/webrat/spec/public/select_datetime_spec.rb +0 -137
- data/vendor/webrat/spec/public/select_spec.rb +0 -249
- data/vendor/webrat/spec/public/select_time_spec.rb +0 -100
- data/vendor/webrat/spec/public/selenium/application_server_factory_spec.rb +0 -49
- data/vendor/webrat/spec/public/selenium/application_servers/external_spec.rb +0 -12
- data/vendor/webrat/spec/public/selenium/selenium_session_spec.rb +0 -37
- data/vendor/webrat/spec/public/set_hidden_field_spec.rb +0 -5
- data/vendor/webrat/spec/public/submit_form_spec.rb +0 -5
- data/vendor/webrat/spec/public/visit_spec.rb +0 -58
- data/vendor/webrat/spec/public/within_spec.rb +0 -177
- data/vendor/webrat/spec/rcov.opts +0 -1
- data/vendor/webrat/spec/spec.opts +0 -2
- data/vendor/webrat/spec/spec_helper.rb +0 -50
data/README.markdown
CHANGED
@@ -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
|
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
|
-
|
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
|
-
|
68
|
-
|
65
|
+
cucumber
|
66
|
+
spec .
|
69
67
|
</pre>
|
data/Rakefile
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
|
3
3
|
gems = [
|
4
|
-
[ '
|
5
|
-
[ '
|
6
|
-
[ '
|
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
|
-
|
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
|
data/config/externals.yml
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
|
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
|
-
|
7
|
+
fetcher:
|
8
8
|
repo: git@github.com:winton/fetcher.git
|
9
9
|
path: vendor
|
10
|
-
|
10
|
+
secret_key:
|
11
11
|
repo: git@github.com:winton/secret_key.git
|
12
12
|
path: vendor
|
13
13
|
sinatra:
|
data/config/schedule.rb
CHANGED
@@ -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"
|
14
|
-
when "numbers only"
|
15
|
-
when "dollar signs"
|
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
|
data/features/support/env.rb
CHANGED
@@ -5,32 +5,31 @@ $:.unshift "#{$root}/lib"
|
|
5
5
|
require 'sum'
|
6
6
|
|
7
7
|
gems = [
|
8
|
-
[ '
|
9
|
-
[ 'rack-test', '=0.
|
10
|
-
[ 'rspec', '=1.2.
|
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
|
-
|
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
|
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('
|
25
|
-
s.add_dependency('
|
26
|
-
s.add_dependency('
|
27
|
-
s.add_dependency('
|
28
|
-
s.add_dependency('
|
29
|
-
s.add_dependency('
|
30
|
-
s.add_dependency('rack
|
31
|
-
s.add_dependency('
|
32
|
-
s.add_dependency('
|
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('
|
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.
|
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
|
-
[ '
|
5
|
-
[ '
|
6
|
-
[ '
|
7
|
-
[ '
|
8
|
-
[ '
|
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
|
-
|
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
|
|
data/lib/sum/helper/cron.rb
CHANGED
data/lib/sum/model/user.rb
CHANGED
@@ -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
|