moneyrail 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. data/.gitignore +5 -0
  2. data/.gitmodules +6 -0
  3. data/Changelog +21 -0
  4. data/README +1 -0
  5. data/Rakefile +32 -0
  6. data/VERSION +1 -0
  7. data/app/controllers/accounts_controller.rb +99 -0
  8. data/app/controllers/application_controller.rb +10 -0
  9. data/app/controllers/categories_controller.rb +99 -0
  10. data/app/controllers/home_controller.rb +31 -0
  11. data/app/controllers/items_controller.rb +105 -0
  12. data/app/controllers/logs_controller.rb +20 -0
  13. data/app/helpers/accounts_helper.rb +2 -0
  14. data/app/helpers/application_helper.rb +3 -0
  15. data/app/helpers/categories_helper.rb +2 -0
  16. data/app/helpers/home_helper.rb +2 -0
  17. data/app/helpers/items_helper.rb +2 -0
  18. data/app/helpers/logs_helper.rb +42 -0
  19. data/app/models/account.rb +12 -0
  20. data/app/models/category.rb +26 -0
  21. data/app/models/expense.rb +2 -0
  22. data/app/models/income.rb +2 -0
  23. data/app/models/item.rb +31 -0
  24. data/app/models/move.rb +37 -0
  25. data/app/models/simple_item.rb +27 -0
  26. data/app/views/accounts/edit.html.erb +16 -0
  27. data/app/views/accounts/index.html.erb +24 -0
  28. data/app/views/accounts/new.html.erb +15 -0
  29. data/app/views/accounts/show.html.erb +8 -0
  30. data/app/views/categories/edit.html.erb +20 -0
  31. data/app/views/categories/index.html.erb +26 -0
  32. data/app/views/categories/new.html.erb +19 -0
  33. data/app/views/categories/show.html.erb +13 -0
  34. data/app/views/home/index.html.erb +15 -0
  35. data/app/views/items/edit.html.erb +45 -0
  36. data/app/views/items/index.html.erb +38 -0
  37. data/app/views/items/new.html.erb +40 -0
  38. data/app/views/items/show.html.erb +3 -0
  39. data/app/views/layouts/application.html.erb +37 -0
  40. data/app/views/logs/view.html.erb +120 -0
  41. data/config/boot.rb +110 -0
  42. data/config/database.yml +25 -0
  43. data/config/environment.rb +41 -0
  44. data/config/environments/cucumber.rb +21 -0
  45. data/config/environments/development.rb +17 -0
  46. data/config/environments/production.rb +28 -0
  47. data/config/environments/test.rb +28 -0
  48. data/config/initializers/backtrace_silencers.rb +7 -0
  49. data/config/initializers/inflections.rb +10 -0
  50. data/config/initializers/mime_types.rb +5 -0
  51. data/config/initializers/new_rails_defaults.rb +19 -0
  52. data/config/initializers/session_store.rb +15 -0
  53. data/config/locales/en.yml +5 -0
  54. data/config/routes.rb +80 -0
  55. data/db/migrate/20090802070406_create_accounts.rb +14 -0
  56. data/db/migrate/20090802073601_create_categories.rb +15 -0
  57. data/db/migrate/20090804065900_create_items.rb +26 -0
  58. data/db/production.sqlite3 +0 -0
  59. data/doc/README_FOR_APP +2 -0
  60. data/features/step_definitions/webrat_steps.rb +129 -0
  61. data/features/support/env.rb +37 -0
  62. data/features/support/paths.rb +27 -0
  63. data/lib/tasks/cucumber.rake +20 -0
  64. data/lib/tasks/rspec.rake +182 -0
  65. data/main.rb +5 -0
  66. data/moneyrail.gemspec +170 -0
  67. data/public/404.html +30 -0
  68. data/public/422.html +30 -0
  69. data/public/500.html +30 -0
  70. data/public/favicon.ico +0 -0
  71. data/public/images/rails.png +0 -0
  72. data/public/javascripts/application.js +2 -0
  73. data/public/javascripts/controls.js +963 -0
  74. data/public/javascripts/dragdrop.js +973 -0
  75. data/public/javascripts/editor.js +188 -0
  76. data/public/javascripts/effects.js +1128 -0
  77. data/public/javascripts/jquery-ui.js +160 -0
  78. data/public/javascripts/jquery.js +32 -0
  79. data/public/javascripts/prototype.js +4320 -0
  80. data/public/robots.txt +5 -0
  81. data/public/stylesheets/editor.less +67 -0
  82. data/public/stylesheets/scaffold.css +54 -0
  83. data/script/about +4 -0
  84. data/script/autospec +6 -0
  85. data/script/console +3 -0
  86. data/script/cucumber +8 -0
  87. data/script/dbconsole +3 -0
  88. data/script/destroy +3 -0
  89. data/script/generate +3 -0
  90. data/script/performance/benchmarker +3 -0
  91. data/script/performance/profiler +3 -0
  92. data/script/plugin +3 -0
  93. data/script/runner +3 -0
  94. data/script/server +3 -0
  95. data/script/spec +10 -0
  96. data/script/spec_server +9 -0
  97. data/spec/_fixtures/accounts.yml +5 -0
  98. data/spec/_fixtures/categories.yml +19 -0
  99. data/spec/_fixtures/incomes.yml +7 -0
  100. data/spec/_fixtures/items.yml +7 -0
  101. data/spec/fixtures/accounts.yml +11 -0
  102. data/spec/fixtures/categories.yml +24 -0
  103. data/spec/fixtures/items.yml +82 -0
  104. data/spec/helpers/accounts_helper_spec.rb +11 -0
  105. data/spec/helpers/categories_helper_spec.rb +11 -0
  106. data/spec/helpers/items_helper_spec.rb +11 -0
  107. data/spec/models/account_spec.rb +13 -0
  108. data/spec/models/category_spec.rb +9 -0
  109. data/spec/models/income_spec.rb +9 -0
  110. data/spec/models/item_spec.rb +13 -0
  111. data/spec/rcov.opts +2 -0
  112. data/spec/spec.opts +4 -0
  113. data/spec/spec_helper.rb +51 -0
  114. data/vendor/plugins/acts_as_list/README +23 -0
  115. data/vendor/plugins/acts_as_list/init.rb +3 -0
  116. data/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb +256 -0
  117. data/vendor/plugins/acts_as_list/test/list_test.rb +332 -0
  118. data/vendor/plugins/less/LICENCE +20 -0
  119. data/vendor/plugins/less/README +52 -0
  120. data/vendor/plugins/less/init.rb +19 -0
  121. data/vendor/plugins/less/lib/less_for_rails.rb +37 -0
  122. data/vendor/plugins/less/test/less_for_rails_test.rb +15 -0
  123. metadata +202 -0
data/public/robots.txt ADDED
@@ -0,0 +1,5 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
+ #
3
+ # To ban all spiders from the entire site uncomment the next two lines:
4
+ # User-Agent: *
5
+ # Disallow: /
@@ -0,0 +1,67 @@
1
+ @cell_width: 70px;
2
+
3
+ table.editor {
4
+ border-collapse: collapse;
5
+
6
+ * {
7
+ margin: 0px;
8
+ padding: 0px;
9
+ }
10
+
11
+ td, th {
12
+ border: 1px solid black;
13
+ }
14
+
15
+ // table head
16
+
17
+ th.inserts{
18
+ width: 1.5em;
19
+ }
20
+
21
+ th.date {
22
+ min-width: @cell_width;
23
+ width: @cell_width;
24
+ }
25
+
26
+ th.category {
27
+ min-width: @cell_width * 2;
28
+ width: @cell_width * 2;
29
+ }
30
+
31
+ // row
32
+
33
+ tr.even {
34
+ }
35
+ tr.odd, tr.odd input {
36
+ background: #f9f9ff;
37
+ }
38
+
39
+ // cell
40
+
41
+ td.title, td.amount {
42
+ min-width: @cell_width;
43
+ width: @cell_width;
44
+
45
+ input {
46
+ width: 90%;
47
+ border: none;
48
+ font-size: 100%;
49
+ padding-left: 3px;
50
+ }
51
+ }
52
+
53
+ td.title {
54
+ padding-left: 3px;
55
+ }
56
+
57
+ td.amount div, td.amount input {
58
+ text-align: right;
59
+ padding-right: 3px;
60
+ }
61
+ }
62
+
63
+ .pushable {
64
+ color: blue;
65
+ // text-decoration: underline;
66
+ cursor: pointer;
67
+ }
@@ -0,0 +1,54 @@
1
+ body { background-color: #fff; color: #333; }
2
+
3
+ body, p, ol, ul, td {
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px;
7
+ }
8
+
9
+ pre {
10
+ background-color: #eee;
11
+ padding: 10px;
12
+ font-size: 11px;
13
+ }
14
+
15
+ a { color: #000; }
16
+ a:visited { color: #666; }
17
+ a:hover { color: #fff; background-color:#000; }
18
+
19
+ .fieldWithErrors {
20
+ padding: 2px;
21
+ background-color: red;
22
+ display: table;
23
+ }
24
+
25
+ #errorExplanation {
26
+ width: 400px;
27
+ border: 2px solid red;
28
+ padding: 7px;
29
+ padding-bottom: 12px;
30
+ margin-bottom: 20px;
31
+ background-color: #f0f0f0;
32
+ }
33
+
34
+ #errorExplanation h2 {
35
+ text-align: left;
36
+ font-weight: bold;
37
+ padding: 5px 5px 5px 15px;
38
+ font-size: 12px;
39
+ margin: -7px;
40
+ background-color: #c00;
41
+ color: #fff;
42
+ }
43
+
44
+ #errorExplanation p {
45
+ color: #333;
46
+ margin-bottom: 0;
47
+ padding: 5px;
48
+ }
49
+
50
+ #errorExplanation ul li {
51
+ font-size: 12px;
52
+ list-style: square;
53
+ }
54
+
data/script/about ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info"
4
+ require 'commands/about'
data/script/autospec ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
3
+ ENV['RSPEC'] = 'true' # allows autotest to discover rspec
4
+ ENV['AUTOTEST'] = 'true' # allows autotest to run w/ color on linux
5
+ system((RUBY_PLATFORM =~ /mswin|mingw/ ? 'autotest.bat' : 'autotest'), *ARGV) ||
6
+ $stderr.puts("Unable to find autotest. Please install ZenTest or fix your PATH")
data/script/console ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/console'
data/script/cucumber ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ begin
3
+ load File.expand_path(File.dirname(__FILE__) + "/../vendor/plugins/cucumber/bin/cucumber")
4
+ rescue LoadError => e
5
+ raise unless e.to_s =~ /cucumber/
6
+ require "rubygems"
7
+ load File.join(Gem.bindir, "cucumber")
8
+ end
data/script/dbconsole ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/dbconsole'
data/script/destroy ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/destroy'
data/script/generate ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/generate'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/performance/benchmarker'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/performance/profiler'
data/script/plugin ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/plugin'
data/script/runner ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/runner'
data/script/server ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/server'
data/script/spec ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ if ARGV.any? {|arg| %w[--drb -X --generate-options -G --help -h --version -v].include?(arg)}
3
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
4
+ else
5
+ gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
6
+ ENV["RAILS_ENV"] ||= 'test'
7
+ require File.expand_path(File.dirname(__FILE__) + "/../config/environment") unless defined?(RAILS_ROOT)
8
+ end
9
+ require 'spec/autorun'
10
+ exit ::Spec::Runner::CommandLine.run
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
3
+
4
+ puts "Loading Rails environment"
5
+ ENV["RAILS_ENV"] ||= 'test'
6
+ require File.expand_path(File.dirname(__FILE__) + "/../config/environment") unless defined?(RAILS_ROOT)
7
+
8
+ require 'optparse'
9
+ require 'spec/rails/spec_server'
@@ -0,0 +1,5 @@
1
+ wallet:
2
+ name: Wallet
3
+
4
+ bank:
5
+ name: Bank
@@ -0,0 +1,19 @@
1
+ food_expense:
2
+ name: Food expense
3
+ kind: Expense
4
+
5
+ life_expense:
6
+ name: Life expense
7
+ kind: Expense
8
+
9
+ salary:
10
+ name: Sarary
11
+ kind: Income
12
+
13
+ special:
14
+ name: Special
15
+ kind: Income
16
+
17
+ withdraw:
18
+ name: Withdraw
19
+ kind: Move
@@ -0,0 +1,7 @@
1
+ august_sarary:
2
+ title: Sarary of August
3
+ account: bank
4
+ category: salary
5
+ amount: 1000
6
+ index_of_day: 0
7
+ date: 2009-08-25
@@ -0,0 +1,7 @@
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+
3
+ # one:
4
+ # column: value
5
+ #
6
+ # two:
7
+ # column: value
@@ -0,0 +1,11 @@
1
+ wallet:
2
+ name: サイフ
3
+ position: 0
4
+
5
+ bank:
6
+ name: 銀行
7
+ position: 1
8
+
9
+ credit_card:
10
+ name: クレジットカード
11
+ position: 2
@@ -0,0 +1,24 @@
1
+ food_expense:
2
+ name: 食費
3
+ kind: Expense
4
+ position: 0
5
+
6
+ life_expense:
7
+ name: 生活費
8
+ kind: Expense
9
+ position: 1
10
+
11
+ salary:
12
+ name: 給料
13
+ kind: Income
14
+ position: 0
15
+
16
+ special:
17
+ name: 臨時収入
18
+ kind: Income
19
+ position: 1
20
+
21
+ withdraw:
22
+ name: 引き出し
23
+ kind: Move
24
+ position: 2
@@ -0,0 +1,82 @@
1
+ juice:
2
+ type: Expense
3
+ title: ジュース
4
+ account: wallet
5
+ category: food_expense
6
+ amount: 120
7
+ position: 0
8
+ date: 2009-08-01
9
+
10
+ juice7:
11
+ type: Expense
12
+ title: ジュース
13
+ account: wallet
14
+ category: food_expense
15
+ amount: 170
16
+ position: 0
17
+ date: 2009-07-01
18
+
19
+ juice9:
20
+ type: Expense
21
+ title: ジュース
22
+ account: wallet
23
+ category: food_expense
24
+ amount: 190
25
+ position: 0
26
+ date: 2009-09-01
27
+
28
+ dinner:
29
+ type: Expense
30
+ title: 夕飯
31
+ account: wallet
32
+ category: food_expense
33
+ amount: 1000
34
+ position: 1
35
+ date: 2009-08-01
36
+
37
+ dinner2:
38
+ type: Expense
39
+ title: 夕飯
40
+ account: wallet
41
+ category: food_expense
42
+ amount: 700
43
+ position: 0
44
+ date: 2009-08-02
45
+
46
+ dentist:
47
+ type: Expense
48
+ title: 歯医者
49
+ account: wallet
50
+ category: life_expense
51
+ amount: 1230
52
+ position: 0
53
+ date: 2009-08-01
54
+
55
+ august_sarary:
56
+ type: Income
57
+ title: 給料
58
+ account: wallet
59
+ category: salary
60
+ amount: 1000000
61
+ position: 0
62
+ date: 2009-08-02
63
+
64
+ sending:
65
+ type: Move
66
+ title: 振り込み
67
+ account_from: wallet
68
+ account_to: bank
69
+ category: withdraw
70
+ amount: 10000
71
+ position: 0
72
+ date: 2009-08-02
73
+
74
+ withdrawal:
75
+ type: Move
76
+ title: 引き出し
77
+ account_from: bank
78
+ account_to: wallet
79
+ category: withdraw
80
+ amount: 20000
81
+ position: 1
82
+ date: 2009-08-02
@@ -0,0 +1,11 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe AccountsHelper do
4
+
5
+ #Delete this example and add some real ones or delete this file
6
+ it "is included in the helper object" do
7
+ included_modules = (class << helper; self; end).send :included_modules
8
+ included_modules.should include(AccountsHelper)
9
+ end
10
+
11
+ end
@@ -0,0 +1,11 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe CategoriesHelper do
4
+
5
+ #Delete this example and add some real ones or delete this file
6
+ it "is included in the helper object" do
7
+ included_modules = (class << helper; self; end).send :included_modules
8
+ included_modules.should include(CategoriesHelper)
9
+ end
10
+
11
+ end
@@ -0,0 +1,11 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe ItemsHelper do
4
+
5
+ #Delete this example and add some real ones or delete this file
6
+ it "is included in the helper object" do
7
+ included_modules = (class << helper; self; end).send :included_modules
8
+ included_modules.should include(ItemsHelper)
9
+ end
10
+
11
+ end
@@ -0,0 +1,13 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Account do
4
+ fixtures :accounts, :incomes
5
+
6
+ it "should be valid" do
7
+ accounts(:bank).should be_valid
8
+ end
9
+
10
+ it "should have incomes" do
11
+ accounts(:bank).should have(1).incomes
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Category do
4
+ fixtures :categories
5
+
6
+ it "should be valid" do
7
+ categories(:salary).should be_valid
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Income do
4
+ fixtures :accounts, :categories, :incomes
5
+
6
+ it "should be valid" do
7
+ incomes(:august_sarary).should be_valid
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Item do
4
+ before(:each) do
5
+ @valid_attributes = {
6
+
7
+ }
8
+ end
9
+
10
+ it "should create a new instance given valid attributes" do
11
+ Item.create!(@valid_attributes)
12
+ end
13
+ end
data/spec/rcov.opts ADDED
@@ -0,0 +1,2 @@
1
+ --exclude "spec/*,gems/*"
2
+ --rails
data/spec/spec.opts ADDED
@@ -0,0 +1,4 @@
1
+ --colour
2
+ --format progress
3
+ --loadby mtime
4
+ --reverse
@@ -0,0 +1,51 @@
1
+ # This file is copied to ~/spec when you run 'ruby script/generate rspec'
2
+ # from the project root directory.
3
+ ENV["RAILS_ENV"] ||= 'test'
4
+ require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
5
+ require 'spec/autorun'
6
+ require 'spec/rails'
7
+
8
+ # Requires supporting files with custom matchers and macros, etc,
9
+ # in ./support/ and its subdirectories.
10
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
11
+
12
+ Spec::Runner.configure do |config|
13
+ # If you're not using ActiveRecord you should remove these
14
+ # lines, delete config/database.yml and disable :active_record
15
+ # in your config/boot.rb
16
+ config.use_transactional_fixtures = true
17
+ config.use_instantiated_fixtures = false
18
+ config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
19
+
20
+ # == Fixtures
21
+ #
22
+ # You can declare fixtures for each example_group like this:
23
+ # describe "...." do
24
+ # fixtures :table_a, :table_b
25
+ #
26
+ # Alternatively, if you prefer to declare them only once, you can
27
+ # do so right here. Just uncomment the next line and replace the fixture
28
+ # names with your fixtures.
29
+ #
30
+ # config.global_fixtures = :table_a, :table_b
31
+ #
32
+ # If you declare global fixtures, be aware that they will be declared
33
+ # for all of your examples, even those that don't use them.
34
+ #
35
+ # You can also declare which fixtures to use (for example fixtures for test/fixtures):
36
+ #
37
+ # config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
38
+ #
39
+ # == Mock Framework
40
+ #
41
+ # RSpec uses it's own mocking framework by default. If you prefer to
42
+ # use mocha, flexmock or RR, uncomment the appropriate line:
43
+ #
44
+ # config.mock_with :mocha
45
+ # config.mock_with :flexmock
46
+ # config.mock_with :rr
47
+ #
48
+ # == Notes
49
+ #
50
+ # For more information take a look at Spec::Runner::Configuration and Spec::Runner
51
+ end
@@ -0,0 +1,23 @@
1
+ ActsAsList
2
+ ==========
3
+
4
+ This acts_as extension provides the capabilities for sorting and reordering a number of objects in a list. The class that has this specified needs to have a +position+ column defined as an integer on the mapped database table.
5
+
6
+
7
+ Example
8
+ =======
9
+
10
+ class TodoList < ActiveRecord::Base
11
+ has_many :todo_items, :order => "position"
12
+ end
13
+
14
+ class TodoItem < ActiveRecord::Base
15
+ belongs_to :todo_list
16
+ acts_as_list :scope => :todo_list
17
+ end
18
+
19
+ todo_list.first.move_to_bottom
20
+ todo_list.last.move_higher
21
+
22
+
23
+ Copyright (c) 2007 David Heinemeier Hansson, released under the MIT license
@@ -0,0 +1,3 @@
1
+ $:.unshift "#{File.dirname(__FILE__)}/lib"
2
+ require 'active_record/acts/list'
3
+ ActiveRecord::Base.class_eval { include ActiveRecord::Acts::List }