Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial commit

  • Loading branch information...
commit 193e6895f4be63f2b953142159d95ad8943c26cf 0 parents
@kyleshank authored
Showing with 9,814 additions and 0 deletions.
  1. +2 −0  .bundle/config
  2. +6 −0 .gitignore
  3. +4 −0 Capfile
  4. +13 −0 Gemfile
  5. +122 −0 Gemfile.lock
  6. +661 −0 LICENSE
  7. +256 −0 README
  8. +7 −0 Rakefile
  9. +70 −0 app/controllers/accounts_controller.rb
  10. +48 −0 app/controllers/application_controller.rb
  11. +26 −0 app/controllers/donations_controller.rb
  12. +12 −0 app/controllers/dya_controller.rb
  13. +15 −0 app/controllers/statuses_controller.rb
  14. +19 −0 app/helpers/accounts_helper.rb
  15. +10 −0 app/helpers/application_helper.rb
  16. +2 −0  app/helpers/donated_statuses_helper.rb
  17. +2 −0  app/helpers/donations_helper.rb
  18. +2 −0  app/helpers/statuses_helper.rb
  19. +12 −0 app/models/account.rb
  20. +15 −0 app/models/donated_status.rb
  21. +12 −0 app/models/donation.rb
  22. +34 −0 app/models/status.rb
  23. +5 −0 app/views/accounts/_statuses.html.erb
  24. +8 −0 app/views/accounts/index.html.erb
  25. +22 −0 app/views/accounts/show.html.erb
  26. +25 −0 app/views/dya/index.html.erb
  27. +19 −0 app/views/layouts/_account.html.erb
  28. +5 −0 app/views/layouts/_footer.html.erb
  29. +39 −0 app/views/layouts/application.html.erb
  30. +4 −0 config.ru
  31. +42 −0 config/application.rb
  32. +13 −0 config/boot.rb
  33. +50 −0 config/deploy.rb
  34. +5 −0 config/environment.rb
  35. +31 −0 config/environments/development.rb
  36. +35 −0 config/environments/test.rb
  37. +7 −0 config/initializers/backtrace_silencers.rb
  38. +10 −0 config/initializers/inflections.rb
  39. +5 −0 config/initializers/mime_types.rb
  40. +7 −0 config/initializers/secret_token.rb
  41. +8 −0 config/initializers/session_store.rb
  42. +5 −0 config/locales/en.yml
  43. +16 −0 config/routes.rb
  44. +17 −0 db/migrate/20110104035023_create_accounts.rb
  45. +13 −0 db/migrate/20110104035535_create_donations.rb
  46. +14 −0 db/migrate/20110104041341_create_statuses.rb
  47. +13 −0 db/migrate/20110104041353_create_donated_statuses.rb
  48. +21 −0 db/migrate/20110105044317_create_delayed_jobs.rb
  49. +31 −0 db/migrate/20110105132446_add_twitter_fields.rb
  50. +72 −0 db/schema.rb
  51. +7 −0 db/seeds.rb
  52. +2 −0  doc/README_FOR_APP
  53. 0  lib/tasks/.gitkeep
  54. +26 −0 public/404.html
  55. +26 −0 public/422.html
  56. +26 −0 public/500.html
  57. 0  public/favicon.ico
  58. BIN  public/images/agplv3-155x51.png
  59. BIN  public/images/bg.png
  60. BIN  public/images/index-logo.png
  61. BIN  public/images/logo.png
  62. BIN  public/images/rails.png
  63. BIN  public/images/sign-in-with-twitter-d.png
  64. BIN  public/images/sign-in-with-twitter-l.png
  65. +2 −0  public/javascripts/application.js
  66. +7,179 −0 public/javascripts/jquery.js
  67. +167 −0 public/javascripts/jquery.min.js
  68. +160 −0 public/javascripts/rails.js
  69. +5 −0 public/robots.txt
  70. 0  public/stylesheets/.gitkeep
  71. +178 −0 public/stylesheets/screen.css
  72. +6 −0 script/rails
  73. +11 −0 test/fixtures/accounts.yml
  74. +11 −0 test/fixtures/donated_statuses.yml
  75. +11 −0 test/fixtures/donations.yml
  76. +11 −0 test/fixtures/statuses.yml
  77. +8 −0 test/functional/accounts_controller_test.rb
  78. +8 −0 test/functional/donations_controller_test.rb
  79. +8 −0 test/functional/statuses_controller_test.rb
  80. +9 −0 test/performance/browsing_test.rb
  81. +13 −0 test/test_helper.rb
  82. +8 −0 test/unit/account_test.rb
  83. +8 −0 test/unit/donated_status_test.rb
  84. +8 −0 test/unit/donation_test.rb
  85. +4 −0 test/unit/helpers/accounts_helper_test.rb
  86. +4 −0 test/unit/helpers/donated_statuses_helper_test.rb
  87. +4 −0 test/unit/helpers/donations_helper_test.rb
  88. +4 −0 test/unit/helpers/statuses_helper_test.rb
  89. +8 −0 test/unit/status_test.rb
  90. BIN  vendor/cache/abstract-1.0.0.gem
  91. BIN  vendor/cache/actionmailer-3.0.3.gem
  92. BIN  vendor/cache/actionpack-3.0.3.gem
  93. BIN  vendor/cache/activemodel-3.0.3.gem
  94. BIN  vendor/cache/activerecord-3.0.3.gem
  95. BIN  vendor/cache/activeresource-3.0.3.gem
  96. BIN  vendor/cache/activesupport-3.0.3.gem
  97. BIN  vendor/cache/addressable-2.2.2.gem
  98. BIN  vendor/cache/arel-2.0.4.gem
  99. BIN  vendor/cache/authlogic-2.1.6.gem
  100. BIN  vendor/cache/builder-2.1.2.gem
  101. BIN  vendor/cache/daemons-1.1.0.gem
  102. BIN  vendor/cache/erubis-2.6.6.gem
  103. BIN  vendor/cache/faraday-0.5.3.gem
  104. BIN  vendor/cache/faraday_middleware-0.3.1.gem
  105. BIN  vendor/cache/hashie-0.4.0.gem
  106. BIN  vendor/cache/i18n-0.4.2.gem
  107. BIN  vendor/cache/jquery-rails-0.2.6.gem
  108. BIN  vendor/cache/kgio-2.1.1.gem
  109. BIN  vendor/cache/mail-2.2.10.gem
  110. BIN  vendor/cache/mime-types-1.16.gem
  111. BIN  vendor/cache/multi_json-0.0.5.gem
  112. BIN  vendor/cache/multi_xml-0.2.0.gem
  113. BIN  vendor/cache/multipart-post-1.0.1.gem
  114. BIN  vendor/cache/mysql2-0.2.6.gem
  115. BIN  vendor/cache/oauth-0.4.4.gem
  116. BIN  vendor/cache/oauth-plugin-0.3.14.gem
  117. BIN  vendor/cache/polyglot-0.3.1.gem
  118. BIN  vendor/cache/rack-1.2.1.gem
  119. BIN  vendor/cache/rack-mount-0.6.13.gem
  120. BIN  vendor/cache/rack-test-0.5.6.gem
  121. BIN  vendor/cache/rails-3.0.3.gem
  122. BIN  vendor/cache/railties-3.0.3.gem
  123. BIN  vendor/cache/rake-0.8.7.gem
  124. BIN  vendor/cache/simple_oauth-0.1.3.gem
  125. BIN  vendor/cache/thor-0.14.6.gem
  126. BIN  vendor/cache/treetop-1.4.9.gem
  127. BIN  vendor/cache/twitter-1.0.0.gem
  128. BIN  vendor/cache/tzinfo-0.3.23.gem
  129. BIN  vendor/cache/unicorn-3.2.1.gem
  130. BIN  vendor/cache/will_paginate-2.3.15.gem
  131. 0  vendor/plugins/.gitkeep
2  .bundle/config
@@ -0,0 +1,2 @@
+-BUNDLE_PATH: vendor/bundle
+-BUNDLE_DISABLE_SHARED_GEMS: "1"
6 .gitignore
@@ -0,0 +1,6 @@
+db/*.sqlite3
+log/*.log
+tmp/**/*
+config/database.yml
+.idea
+config/environments/production.rb
4 Capfile
@@ -0,0 +1,4 @@
+load 'deploy' if respond_to?(:namespace) # cap2 differentiator
+Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
+
+load 'config/deploy' # remove this line to skip loading any of the default tasks
13 Gemfile
@@ -0,0 +1,13 @@
+source 'http://rubygems.org'
+
+gem 'rails', '3.0.3'
+gem 'mysql2'
+gem 'oauth'
+gem 'oauth-plugin'
+gem 'twitter'
+gem "delayed_job", :git => 'git://github.com/collectiveidea/delayed_job.git'
+gem 'will_paginate'
+gem 'jquery-rails'
+gem 'authlogic'
+
+gem 'unicorn'
122 Gemfile.lock
@@ -0,0 +1,122 @@
+GIT
+ remote: git://github.com/collectiveidea/delayed_job.git
+ revision: 411719b38c51a7fbd060ea139fd64adb20107a5d
+ specs:
+ delayed_job (2.1.2)
+ activesupport (~> 3.0)
+ daemons
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ abstract (1.0.0)
+ actionmailer (3.0.3)
+ actionpack (= 3.0.3)
+ mail (~> 2.2.9)
+ actionpack (3.0.3)
+ activemodel (= 3.0.3)
+ activesupport (= 3.0.3)
+ builder (~> 2.1.2)
+ erubis (~> 2.6.6)
+ i18n (~> 0.4)
+ rack (~> 1.2.1)
+ rack-mount (~> 0.6.13)
+ rack-test (~> 0.5.6)
+ tzinfo (~> 0.3.23)
+ activemodel (3.0.3)
+ activesupport (= 3.0.3)
+ builder (~> 2.1.2)
+ i18n (~> 0.4)
+ activerecord (3.0.3)
+ activemodel (= 3.0.3)
+ activesupport (= 3.0.3)
+ arel (~> 2.0.2)
+ tzinfo (~> 0.3.23)
+ activeresource (3.0.3)
+ activemodel (= 3.0.3)
+ activesupport (= 3.0.3)
+ activesupport (3.0.3)
+ addressable (2.2.2)
+ arel (2.0.4)
+ authlogic (2.1.6)
+ activesupport
+ builder (2.1.2)
+ daemons (1.1.0)
+ erubis (2.6.6)
+ abstract (>= 1.0.0)
+ faraday (0.5.3)
+ addressable (~> 2.2.2)
+ multipart-post (~> 1.0.1)
+ rack (>= 1.1.0, < 2)
+ faraday_middleware (0.3.1)
+ faraday (~> 0.5.3)
+ hashie (0.4.0)
+ i18n (0.4.2)
+ jquery-rails (0.2.6)
+ rails (~> 3.0)
+ thor (~> 0.14.4)
+ kgio (2.1.1)
+ mail (2.2.10)
+ activesupport (>= 2.3.6)
+ i18n (~> 0.4.1)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.16)
+ multi_json (0.0.5)
+ multi_xml (0.2.0)
+ multipart-post (1.0.1)
+ mysql2 (0.2.6)
+ oauth (0.4.4)
+ oauth-plugin (0.3.14)
+ oauth (>= 0.3.5)
+ polyglot (0.3.1)
+ rack (1.2.1)
+ rack-mount (0.6.13)
+ rack (>= 1.0.0)
+ rack-test (0.5.6)
+ rack (>= 1.0)
+ rails (3.0.3)
+ actionmailer (= 3.0.3)
+ actionpack (= 3.0.3)
+ activerecord (= 3.0.3)
+ activeresource (= 3.0.3)
+ activesupport (= 3.0.3)
+ bundler (~> 1.0)
+ railties (= 3.0.3)
+ railties (3.0.3)
+ actionpack (= 3.0.3)
+ activesupport (= 3.0.3)
+ rake (>= 0.8.7)
+ thor (~> 0.14.4)
+ rake (0.8.7)
+ simple_oauth (0.1.3)
+ thor (0.14.6)
+ treetop (1.4.9)
+ polyglot (>= 0.3.1)
+ twitter (1.0.0)
+ faraday (~> 0.5.3)
+ faraday_middleware (~> 0.3.0)
+ hashie (~> 0.4.0)
+ multi_json (~> 0.0.5)
+ multi_xml (~> 0.2.0)
+ simple_oauth (~> 0.1.2)
+ tzinfo (0.3.23)
+ unicorn (3.2.1)
+ kgio (~> 2.1)
+ rack
+ will_paginate (2.3.15)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ authlogic
+ delayed_job!
+ jquery-rails
+ mysql2
+ oauth
+ oauth-plugin
+ rails (= 3.0.3)
+ twitter
+ unicorn
+ will_paginate
661 LICENSE
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU Affero General Public License is a free, copyleft license for
+software and other kinds of works, specifically designed to ensure
+cooperation with the community in the case of network server software.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+our General Public Licenses are intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ Developers that use our General Public Licenses protect your rights
+with two steps: (1) assert copyright on the software, and (2) offer
+you this License which gives you legal permission to copy, distribute
+and/or modify the software.
+
+ A secondary benefit of defending all users' freedom is that
+improvements made in alternate versions of the program, if they
+receive widespread use, become available for other developers to
+incorporate. Many developers of free software are heartened and
+encouraged by the resulting cooperation. However, in the case of
+software used on network servers, this result may fail to come about.
+The GNU General Public License permits making a modified version and
+letting the public access it on a server without ever releasing its
+source code to the public.
+
+ The GNU Affero General Public License is designed specifically to
+ensure that, in such cases, the modified source code becomes available
+to the community. It requires the operator of a network server to
+provide the source code of the modified version running there to the
+users of that server. Therefore, public use of a modified version, on
+a publicly accessible server, gives the public access to the source
+code of the modified version.
+
+ An older license, called the Affero General Public License and
+published by Affero, was designed to accomplish similar goals. This is
+a different license, not a version of the Affero GPL, but Affero has
+released a new version of the Affero GPL which permits relicensing under
+this license.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU Affero General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Remote Network Interaction; Use with the GNU General Public License.
+
+ Notwithstanding any other provision of this License, if you modify the
+Program, your modified version must prominently offer all users
+interacting with it remotely through a computer network (if your version
+supports such interaction) an opportunity to receive the Corresponding
+Source of your version by providing access to the Corresponding Source
+from a network server at no charge, through some standard or customary
+means of facilitating copying of software. This Corresponding Source
+shall include the Corresponding Source for any work covered by version 3
+of the GNU General Public License that is incorporated pursuant to the
+following paragraph.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the work with which it is combined will remain governed by version
+3 of the GNU General Public License.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU Affero General Public License from time to time. Such new versions
+will be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU Affero General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU Affero General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU Affero General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If your software can interact with users remotely through a computer
+network, you should also make sure that it provides a way for users to
+get its source. For example, if your program is a web application, its
+interface could display a "Source" link that leads users to an archive
+of the code. There are many ways you could offer source, and different
+solutions will be better for different programs; see section 13 for the
+specific requirements.
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+<http://www.gnu.org/licenses/>.
256 README
@@ -0,0 +1,256 @@
+== Welcome to Rails
+
+Rails is a web-application framework that includes everything needed to create
+database-backed web applications according to the Model-View-Control pattern.
+
+This pattern splits the view (also called the presentation) into "dumb"
+templates that are primarily responsible for inserting pre-built data in between
+HTML tags. The model contains the "smart" domain objects (such as Account,
+Product, Person, Post) that holds all the business logic and knows how to
+persist themselves to a database. The controller handles the incoming requests
+(such as Save New Account, Update Product, Show Post) by manipulating the model
+and directing data to the view.
+
+In Rails, the model is handled by what's called an object-relational mapping
+layer entitled Active Record. This layer allows you to present the data from
+database rows as objects and embellish these data objects with business logic
+methods. You can read more about Active Record in
+link:files/vendor/rails/activerecord/README.html.
+
+The controller and view are handled by the Action Pack, which handles both
+layers by its two parts: Action View and Action Controller. These two layers
+are bundled in a single package due to their heavy interdependence. This is
+unlike the relationship between the Active Record and Action Pack that is much
+more separate. Each of these packages can be used independently outside of
+Rails. You can read more about Action Pack in
+link:files/vendor/rails/actionpack/README.html.
+
+
+== Getting Started
+
+1. At the command prompt, create a new Rails application:
+ <tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
+
+2. Change directory to <tt>myapp</tt> and start the web server:
+ <tt>cd myapp; rails server</tt> (run with --help for options)
+
+3. Go to http://localhost:3000/ and you'll see:
+ "Welcome aboard: You're riding Ruby on Rails!"
+
+4. Follow the guidelines to start developing your application. You can find
+the following resources handy:
+
+* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
+* Ruby on Rails Tutorial Book: http://www.railstutorial.org/
+
+
+== Debugging Rails
+
+Sometimes your application goes wrong. Fortunately there are a lot of tools that
+will help you debug it and get it back on the rails.
+
+First area to check is the application log files. Have "tail -f" commands
+running on the server.log and development.log. Rails will automatically display
+debugging and runtime information to these files. Debugging info will also be
+shown in the browser on requests from 127.0.0.1.
+
+You can also log your own messages directly into the log file from your code
+using the Ruby logger class from inside your controllers. Example:
+
+ class WeblogController < ActionController::Base
+ def destroy
+ @weblog = Weblog.find(params[:id])
+ @weblog.destroy
+ logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
+ end
+ end
+
+The result will be a message in your log file along the lines of:
+
+ Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
+
+More information on how to use the logger is at http://www.ruby-doc.org/core/
+
+Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
+several books available online as well:
+
+* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
+* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
+
+These two books will bring you up to speed on the Ruby language and also on
+programming in general.
+
+
+== Debugger
+
+Debugger support is available through the debugger command when you start your
+Mongrel or WEBrick server with --debugger. This means that you can break out of
+execution at any point in the code, investigate and change the model, and then,
+resume execution! You need to install ruby-debug to run the server in debugging
+mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
+
+ class WeblogController < ActionController::Base
+ def index
+ @posts = Post.find(:all)
+ debugger
+ end
+ end
+
+So the controller will accept the action, run the first line, then present you
+with a IRB prompt in the server window. Here you can do things like:
+
+ >> @posts.inspect
+ => "[#<Post:0x14a6be8
+ @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
+ #<Post:0x14a6620
+ @attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
+ >> @posts.first.title = "hello from a debugger"
+ => "hello from a debugger"
+
+...and even better, you can examine how your runtime objects actually work:
+
+ >> f = @posts.first
+ => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
+ >> f.
+ Display all 152 possibilities? (y or n)
+
+Finally, when you're ready to resume execution, you can enter "cont".
+
+
+== Console
+
+The console is a Ruby shell, which allows you to interact with your
+application's domain model. Here you'll have all parts of the application
+configured, just like it is when the application is running. You can inspect
+domain models, change values, and save to the database. Starting the script
+without arguments will launch it in the development environment.
+
+To start the console, run <tt>rails console</tt> from the application
+directory.
+
+Options:
+
+* Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
+ made to the database.
+* Passing an environment name as an argument will load the corresponding
+ environment. Example: <tt>rails console production</tt>.
+
+To reload your controllers and models after launching the console run
+<tt>reload!</tt>
+
+More information about irb can be found at:
+link:http://www.rubycentral.com/pickaxe/irb.html
+
+
+== dbconsole
+
+You can go to the command line of your database directly through <tt>rails
+dbconsole</tt>. You would be connected to the database with the credentials
+defined in database.yml. Starting the script without arguments will connect you
+to the development database. Passing an argument will connect you to a different
+database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
+PostgreSQL and SQLite 3.
+
+== Description of Contents
+
+The default directory structure of a generated Ruby on Rails application:
+
+ |-- app
+ | |-- controllers
+ | |-- helpers
+ | |-- mailers
+ | |-- models
+ | `-- views
+ | `-- layouts
+ |-- config
+ | |-- environments
+ | |-- initializers
+ | `-- locales
+ |-- db
+ |-- doc
+ |-- lib
+ | `-- tasks
+ |-- log
+ |-- public
+ | |-- images
+ | |-- javascripts
+ | `-- stylesheets
+ |-- script
+ |-- test
+ | |-- fixtures
+ | |-- functional
+ | |-- integration
+ | |-- performance
+ | `-- unit
+ |-- tmp
+ | |-- cache
+ | |-- pids
+ | |-- sessions
+ | `-- sockets
+ `-- vendor
+ `-- plugins
+
+app
+ Holds all the code that's specific to this particular application.
+
+app/controllers
+ Holds controllers that should be named like weblogs_controller.rb for
+ automated URL mapping. All controllers should descend from
+ ApplicationController which itself descends from ActionController::Base.
+
+app/models
+ Holds models that should be named like post.rb. Models descend from
+ ActiveRecord::Base by default.
+
+app/views
+ Holds the template files for the view that should be named like
+ weblogs/index.html.erb for the WeblogsController#index action. All views use
+ eRuby syntax by default.
+
+app/views/layouts
+ Holds the template files for layouts to be used with views. This models the
+ common header/footer method of wrapping views. In your views, define a layout
+ using the <tt>layout :default</tt> and create a file named default.html.erb.
+ Inside default.html.erb, call <% yield %> to render the view using this
+ layout.
+
+app/helpers
+ Holds view helpers that should be named like weblogs_helper.rb. These are
+ generated for you automatically when using generators for controllers.
+ Helpers can be used to wrap functionality for your views into methods.
+
+config
+ Configuration files for the Rails environment, the routing map, the database,
+ and other dependencies.
+
+db
+ Contains the database schema in schema.rb. db/migrate contains all the
+ sequence of Migrations for your schema.
+
+doc
+ This directory is where your application documentation will be stored when
+ generated using <tt>rake doc:app</tt>
+
+lib
+ Application specific libraries. Basically, any kind of custom code that
+ doesn't belong under controllers, models, or helpers. This directory is in
+ the load path.
+
+public
+ The directory available for the web server. Contains subdirectories for
+ images, stylesheets, and javascripts. Also contains the dispatchers and the
+ default HTML files. This should be set as the DOCUMENT_ROOT of your web
+ server.
+
+script
+ Helper scripts for automation and generation.
+
+test
+ Unit and functional tests along with fixtures. When using the rails generate
+ command, template test files will be generated for you and placed in this
+ directory.
+
+vendor
+ External libraries that the application depends on. Also includes the plugins
+ subdirectory. If the app has frozen rails, those gems also go here, under
+ vendor/rails/. This directory is in the load path.
7 Rakefile
@@ -0,0 +1,7 @@
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require File.expand_path('../config/application', __FILE__)
+require 'rake'
+
+Dya::Application.load_tasks
70 app/controllers/accounts_controller.rb
@@ -0,0 +1,70 @@
+class AccountsController < ApplicationController
+ include AccountsHelper
+
+ before_filter :login_required, :only => [:index]
+
+ def index
+ @donated_statuses = Status.donated_through_account(current_account).desc.paginate(:page => params[:page], :per_page=>10)
+ end
+
+ def show
+ @account = Account.first(:conditions => {:screen_name => params[:id]})
+ render_not_found and return unless @account
+ @donation = current_account.donations.for_campaign(@account.id).first
+ @statuses = @account.statuses.desc.paginate(:page => params[:page], :per_page=>10)
+ end
+
+ def new
+ redirect_to get_twitter_request_token.authorize_url.gsub("authorize","authenticate")
+ end
+
+ def create
+ consumer = OAuth::Consumer.new(Twitter.consumer_key, Twitter.consumer_secret, {:site=>"http://twitter.com" })
+ request_token = OAuth::RequestToken.new(consumer, session[:request_token], session[:request_token_secret])
+
+ begin
+ access_token = request_token.get_access_token(:oauth_verifier => params[:oauth_verifier])
+ response = consumer.request(:get, '/account/verify_credentials.json', access_token, { :scheme => :query_string })
+
+ case response
+ when Net::HTTPSuccess
+ user_info = JSON.parse(response.body)
+
+ @account = Account.first(:conditions => {:uid => user_info["id"]})
+
+ unless @account
+ @account = Account.new(
+ :uid => user_info["id"],
+ :screen_name => user_info["screen_name"],
+ :token => access_token.token,
+ :secret => access_token.secret
+ )
+ end
+
+ @account.name = user_info["name"]
+ @account.followers = (user_info["followers_count"] || 0).to_i
+ @account.url = user_info["url"]
+ @account.description = user_info["description"]
+ @account.location = user_info["location"]
+ @account.profile_sidebar_border_color = user_info["profile_sidebar_border_color"]
+ @account.profile_sidebar_fill_color = user_info["profile_sidebar_fill_color"]
+ @account.profile_link_color = user_info["profile_link_color"]
+ @account.profile_image_url = user_info["profile_image_url"]
+ @account.profile_background_color = user_info["profile_background_color"]
+ @account.profile_background_image_url = user_info["profile_background_image_url"]
+ @account.profile_text_color = user_info["profile_text_color"]
+ @account.profile_background_tile = user_info["profile_background_tile"]
+ @account.profile_use_background_image = user_info["profile_use_background_image"]
+
+ if @account.save
+ self.current_account=@account
+ end
+
+ redirect_to dashboard_path
+ end
+ rescue OAuth::Unauthorized
+ request.flash.now["notice"] = "Oops! OAuth Unauthorized error."
+ redirect_to "/"
+ end
+ end
+end
48 app/controllers/application_controller.rb
@@ -0,0 +1,48 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+
+ helper_method :current_account
+
+ rescue_from ActiveRecord::RecordNotFound, :with => :render_not_found
+ rescue_from ActionController::MethodNotAllowed, :with => :render_not_found unless Rails.env == "development"
+ rescue_from ActionView::MissingTemplate, :with => :render_not_found unless Rails.env == "development"
+
+ def current_account=(account)
+ @current_account = account
+ session[:current_account] = account.id
+ end
+
+ private
+
+ helper_method :render_not_found
+ def render_not_found
+ render :layout => nil, :file => "#{RAILS_ROOT}/public/404.html", :status => "404 Not Found"
+ end
+
+ def render_access_denied
+ render :layout => nil, :file => "#{RAILS_ROOT}/public/403.html", :status => "403 Forbidden"
+ end
+
+ def current_account
+ return @current_account if defined?(@current_account)
+ @current_account = Account.find(session[:current_account]) unless session[:current_account].blank?
+ end
+
+ def login_required
+ unless current_account
+ store_location
+ flash[:notice] = "You must be logged in to access this page"
+ redirect_to "/"
+ return false
+ end
+ end
+
+ def store_location
+ session[:return_to] = request.fullpath
+ end
+
+ def redirect_back_or_default(default)
+ redirect_to(session[:return_to] || default)
+ session[:return_to] = nil
+ end
+end
26 app/controllers/donations_controller.rb
@@ -0,0 +1,26 @@
+class DonationsController < ApplicationController
+
+ def index
+ @donations = current_account.donations
+ end
+
+ def create
+ @donation = Donation.new(params[:donation])
+ @donation.account = current_account
+ if @donation.save
+ request.flash.now["notice"] = "Donation made to #{@donation.campaign.name}"
+ else
+ request.flash.now["notice"] = "There was an error donating to #{@donation.campaign.name}"
+ end
+ redirect_to account_permalink_path(@donation.campaign)
+ end
+
+ def destroy
+ @donation = Donation.find(params[:id])
+ if @donation.account_id == current_account.id
+ @donation.destroy
+ end
+ redirect_to account_permalink_path(@donation.campaign)
+ end
+
+end
12 app/controllers/dya_controller.rb
@@ -0,0 +1,12 @@
+class DyaController < ApplicationController
+ def index
+ redirect_to dashboard_path and return if current_account
+ render :layout => false
+ end
+
+ def signout
+ @current_account = nil
+ session.delete(:current_account)
+ redirect_to "/"
+ end
+end
15 app/controllers/statuses_controller.rb
@@ -0,0 +1,15 @@
+class StatusesController < ApplicationController
+
+ before_filter :login_required
+
+ def create
+ @status = current_account.statuses.new(params[:status])
+
+ if @status.save
+ request.flash.now["notice"] = "Status publishing to Twitter"
+ end
+
+ redirect_to account_permalink_path(current_account)
+ end
+
+end
19 app/helpers/accounts_helper.rb
@@ -0,0 +1,19 @@
+module AccountsHelper
+ def get_twitter_request_token
+ get_request_token(Twitter.consumer_key,
+ Twitter.consumer_secret,
+ "http://twitter.com",
+ "http://#{request.host_with_port}/accounts/oauth_create")
+ end
+
+ private
+
+ def get_request_token consumer_key, consumer_secret, site, return_url
+ consumer = OAuth::Consumer.new(consumer_key, consumer_secret, { :site => site })
+ request_token = consumer.get_request_token(:oauth_callback => return_url)
+
+ session[:request_token] = request_token.token
+ session[:request_token_secret] = request_token.secret
+ request_token
+ end
+end
10 app/helpers/application_helper.rb
@@ -0,0 +1,10 @@
+module ApplicationHelper
+ def ul(collection, *args)
+ return if collection.empty?
+ list_items = ""
+ collection.each do |c|
+ list_items << "<li>#{c}</li>"
+ end
+ content_tag :ul, list_items.html_safe, args
+ end
+end
2  app/helpers/donated_statuses_helper.rb
@@ -0,0 +1,2 @@
+module DonatedStatusesHelper
+end
2  app/helpers/donations_helper.rb
@@ -0,0 +1,2 @@
+module DonationsHelper
+end
2  app/helpers/statuses_helper.rb
@@ -0,0 +1,2 @@
+module StatusesHelper
+end
12 app/models/account.rb
@@ -0,0 +1,12 @@
+class Account < ActiveRecord::Base
+ has_many :donations, :dependent => :destroy
+ has_many :donors, :class_name => "Donation", :foreign_key => "campaign_id", :include => :account, :dependent => :destroy
+ has_many :statuses
+
+ validates_presence_of :name, :screen_name, :uid, :token, :secret
+ validates_uniqueness_of :screen_name, :uid
+
+ def to_param
+ self.screen_name
+ end
+end
15 app/models/donated_status.rb
@@ -0,0 +1,15 @@
+class DonatedStatus < ActiveRecord::Base
+ belongs_to :donation
+ belongs_to :status
+
+ validates_presence_of :donation, :status
+
+ after_create :retweet
+
+ private
+
+ def retweet
+ client = Twitter::Client.new(:oauth_token => self.donation.account.token, :oauth_token_secret => self.donation.account.secret)
+ client.retweet(self.status.twitter_status_id)
+ end
+end
12 app/models/donation.rb
@@ -0,0 +1,12 @@
+class Donation < ActiveRecord::Base
+ belongs_to :account
+ belongs_to :campaign, :class_name => "Account", :foreign_key => "campaign_id"
+
+ has_many :donated_statuses
+ has_many :statuses, :through => :donated_statuses
+
+ validates_presence_of :account, :campaign
+ validates_uniqueness_of :account_id, :scope =>[:campaign_id]
+
+ scope :for_campaign, lambda {|i| {:conditions => {:campaign_id => i}}}
+end
34 app/models/status.rb
@@ -0,0 +1,34 @@
+class Status < ActiveRecord::Base
+ belongs_to :account
+ has_many :donated_statuses
+ has_many :donations, :through => :donated_statuses
+
+ validates_presence_of :account, :body
+ validates_length_of :body, :maximum=>140, :minimum => 1
+
+ scope :donated_through_account, lambda {|a| {:joins => "INNER JOIN donated_statuses ON donated_statuses.status_id = statuses.id INNER JOIN donations ON donations.id = donated_statuses.donation_id INNER JOIN accounts ON donations.account_id = accounts.id ", :conditions => ["accounts.id = ?", a.id], :group => "statuses.id" } }
+ scope :desc, :order => "statuses.id desc"
+ scope :limit, lambda {|l| {:limit => l}}
+
+ before_create do
+ tweet = Twitter::Client.new(:oauth_token => self.account.token, :oauth_token_secret => self.account.secret)
+ response = tweet.update(self.body)
+ self.twitter_status_id = response["id"]
+ end
+
+ after_create do
+ self.delay.publish
+ end
+
+ def publish
+ unless self.twitter_status_id.blank?
+ self.account.donors.each do |donation|
+ donation.donated_statuses.create(:status => self)
+ end
+ end
+ end
+
+ def twitter_permalink
+ "http://twitter.com/#{self.account.screen_name}/statuses/#{self.twitter_status_id}"
+ end
+end
5 app/views/accounts/_statuses.html.erb
@@ -0,0 +1,5 @@
+<ul class="statuses">
+ <% statuses.each do |status| %>
+ <li><%=image_tag(status.account.profile_image_url || "https://s3.amazonaws.com/twitter_production/a/1294097328/images/default_profile_3_normal.png")%><div><span class="screen_name"><%=status.account.screen_name%></span><span class="name"><%=status.account.name%></span></div><div class="body"><%=auto_link status.body%></div><div class="time"><%=link_to "#{time_ago_in_words(status.created_at)} ago",status.twitter_permalink, :target=>"_blank"%></div></li>
+ <% end %>
+</ul>
8 app/views/accounts/index.html.erb
@@ -0,0 +1,8 @@
+<h2>Donation Timeline</h2>
+<% if @donated_statuses.empty? %>
+ <p>No donations made yet! Donate to some accounts!</p>
+ <p></p>
+<%else%>
+<%=render :partial => "statuses", :object => @donated_statuses%>
+<%=will_paginate @donated_statuses%>
+<% end %>
22 app/views/accounts/show.html.erb
@@ -0,0 +1,22 @@
+<div id="account">
+<h1><% unless @account.profile_image_url.blank?%><img src="<%=@account.profile_image_url%>"/><% end %><%=@account.name%></h1>
+<h2>@<%=@account.screen_name%></h2>
+
+<% if current_account.id == @account.id %>
+<% form_for @status || Status.new, :url => statuses_path do |f| %>
+<div><%=f.text_area :body, :maxlength => 140%></div>
+<div><%=f.submit "Publish", :class => "button", :confirm => "Are you sure you *really* want to publish this update?"%> through <%=pluralize(@account.donors.count, "donation")%> reaching ~<%=pluralize @account.donors.sum("accounts.followers").to_i, "followers"%></div>
+<% end %>
+<% else %>
+ <% if @donation %>
+ <%= button_to "Un-Donate", donation_path(@donation), :confirm => "Are you sure?", :method => :delete %>
+ <% else %>
+ <%form_for Donation.new(:campaign_id => @account.id) do |f|%>
+ <%=f.hidden_field :campaign_id%>
+ <%=f.submit "Donate"%>
+ <%end%>
+ <% end %>
+<% end %>
+
+<%=render :partial => "statuses", :object => @statuses%>
+</div>
25 app/views/dya/index.html.erb
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Donate Your Account</title>
+ <%= stylesheet_link_tag :all %>
+ <%= javascript_include_tag :defaults %>
+ <%= csrf_meta_tag %>
+ <%=yield :head%>
+</head>
+<body>
+
+<div id="index">
+
+<div id="logo"><%=image_tag("index-logo.png")%></div>
+
+<div id="button">
+ <%=link_to image_tag("sign-in-with-twitter-d.png"), new_account_path %>
+</div>
+
+<%=render :partial => "layouts/footer"%>
+
+</div>
+
+</body>
+</html>
19 app/views/layouts/_account.html.erb
@@ -0,0 +1,19 @@
+<style type="text/css">
+ body{
+ <% unless account.profile_background_color.blank?%>background-color: #<%=account.profile_background_color%>;<%end%>
+ <% if account.profile_use_background_image %>
+ <% unless account.profile_background_image_url.blank?%>background-image: url(<%=account.profile_background_image_url%>);<% end %>
+ <% unless account.profile_background_tile%>background-repeat: no-repeat;<% end %>
+ <% end %>
+ <% unless account.profile_text_color.blank?%>color: #<%=account.profile_text_color%>;<% end %>
+ }
+ <% unless account.profile_link_color.blank? %>
+ a{color: #<%=account.profile_link_color%>}
+ a:hover{color: #<%=account.profile_link_color%>}
+ <% end %>
+ <% unless account.profile_text_color.blank? %>
+ #container #content{
+ color: #<%=account.profile_text_color%>;
+ }
+ <% end %>
+</style>
5 app/views/layouts/_footer.html.erb
@@ -0,0 +1,5 @@
+<div id="footer">
+ <div><%=link_to image_tag("agplv3-155x51.png"), "http://www.gnu.org/licenses/agpl.html"%><br/> Licensed under the <a href="http://www.gnu.org/licenses/agpl.html">AGPL version 3</a></div>
+ <div>Donate Your Account is an <a href="http://kyleshank.com/open-source-web-applications">Open Source Web Application</a>.<br/>Source code for this application is available at: <a href="http://github.com/kyleshank/donateyouraccount">http://github.com/kyleshank/donateyouraccount</a></div>
+ <div>&copy;2011 <a href="http://kyleshank.com">Kyle Shank</a></div>
+</div>
39 app/views/layouts/application.html.erb
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Donate Your Account</title>
+ <%= stylesheet_link_tag :all %>
+ <%= javascript_include_tag :defaults %>
+ <%= csrf_meta_tag %>
+<% if @account %>
+<%=render :partial => "Layouts/account", :object => @account%>
+<% elsif current_account %>
+<%=render :partial => "Layouts/account", :object => current_account%>
+<% end %>
+</head>
+<body>
+
+<div id="container">
+
+<div id="header">
+<h1><a href="/"><span>Donate Your Account</span></a></h1>
+<ul id="nav">
+<% if current_account %>
+ <li><%=link_to current_account.screen_name, account_permalink_path(current_account)%></li>
+ <li class="last"><%=link_to "Sign out", signout_path%></li>
+<% else %>
+ <li class="last"><%=link_to image_tag("sign-in-with-twitter-d.png"), new_account_path %></li>
+<% end %>
+</ul>
+</div>
+
+<div id="content">
+<%= yield %>
+</div>
+
+<%=render :partial => "layouts/footer"%>
+
+</div>
+
+</body>
+</html>
4 config.ru
@@ -0,0 +1,4 @@
+# This file is used by Rack-based servers to start the application.
+
+require ::File.expand_path('../config/environment', __FILE__)
+run Dya::Application
42 config/application.rb
@@ -0,0 +1,42 @@
+require File.expand_path('../boot', __FILE__)
+
+require 'rails/all'
+
+# If you have a Gemfile, require the gems listed there, including any gems
+# you've limited to :test, :development, or :production.
+Bundler.require(:default, Rails.env) if defined?(Bundler)
+
+module Dya
+ class Application < Rails::Application
+ # Settings in config/environments/* take precedence over those specified here.
+ # Application configuration should go into files in config/initializers
+ # -- all .rb files in that directory are automatically loaded.
+
+ # Custom directories with classes and modules you want to be autoloadable.
+ # config.autoload_paths += %W(#{config.root}/extras)
+
+ # Only load the plugins named here, in the order given (default is alphabetical).
+ # :all can be used as a placeholder for all plugins not explicitly named.
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
+
+ # Activate observers that should always be running.
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
+
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
+ # config.time_zone = 'Central Time (US & Canada)'
+
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
+ # config.i18n.default_locale = :de
+
+ # JavaScript files you want as :defaults (application.js is always included).
+ # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
+
+ # Configure the default encoding used in templates for Ruby 1.9.
+ config.encoding = "utf-8"
+
+ # Configure sensitive parameters which will be filtered from the log file.
+ config.filter_parameters += [:password]
+ end
+end
13 config/boot.rb
@@ -0,0 +1,13 @@
+require 'rubygems'
+
+# Set up gems listed in the Gemfile.
+gemfile = File.expand_path('../../Gemfile', __FILE__)
+begin
+ ENV['BUNDLE_GEMFILE'] = gemfile
+ require 'bundler'
+ Bundler.setup
+rescue Bundler::GemNotFound => e
+ STDERR.puts e.message
+ STDERR.puts "Try running `bundle install`."
+ exit!
+end if File.exist?(gemfile)
50 config/deploy.rb
@@ -0,0 +1,50 @@
+#require "bundler/capistrano"
+
+set :application, "dya"
+set :hostname, "donateyouraccount.com"
+
+set :user, "dya"
+set :host, "#{user}@#{hostname}"
+
+set :scm, :git
+set :repository, "git@github.com:kyleshank/donateyouraccount.git"
+set :use_sudo, false
+ssh_options[:forward_agent] = true
+default_run_options[:pty] = true
+
+set :deploy_to, "/var/www/#{application}"
+set :deploy_via, :remote_cache
+set :runner, user
+set :keep_releases, 10
+
+role :app, "donateyouraccount.com"
+role :web, "donateyouraccount.com"
+role :db, "donateyouraccount.com", :primary => true
+
+namespace :deploy do
+ desc "Restart Unicorn"
+ task :restart do
+ run "kill -USR2 `cat #{deploy_to}/shared/pids/unicorn.pid`"
+ end
+
+ task :symlink_config, :roles => :app do
+ run "ln -sf #{deploy_to}/shared/database.yml #{release_path}/config/database.yml"
+ end
+
+end
+
+namespace :bundler do
+ task :create_symlink, :roles => :app do
+ shared_dir = File.join(shared_path, 'bundle')
+ release_dir = File.join(current_release, 'vendor','bundle')
+ run("mkdir -p #{shared_dir} && ln -s #{shared_dir} #{release_dir}")
+ end
+
+ task :bundle_new_release, :roles => :app do
+ run "bundle install --gemfile #{release_path}/Gemfile --path /var/www/dya/shared/bundle --deployment --without cucumber test"
+ bundler.create_symlink
+ end
+end
+
+after 'deploy:update_code', 'bundler:bundle_new_release', "deploy:symlink_config"
+after "deploy:update", "deploy:cleanup"
5 config/environment.rb
@@ -0,0 +1,5 @@
+# Load the rails application
+require File.expand_path('../application', __FILE__)
+
+# Initialize the rails application
+Dya::Application.initialize!
31 config/environments/development.rb
@@ -0,0 +1,31 @@
+Dya::Application.configure do
+ # Settings specified here will take precedence over those in config/application.rb
+
+ # In the development environment your application's code is reloaded on
+ # every request. This slows down response time but is perfect for development
+ # since you don't have to restart the webserver when you make code changes.
+ config.cache_classes = false
+
+ # Log error messages when you accidentally call methods on nil.
+ config.whiny_nils = true
+
+ # Show full error reports and disable caching
+ config.consider_all_requests_local = true
+ config.action_view.debug_rjs = true
+ config.action_controller.perform_caching = false
+
+ # Don't care if the mailer can't send
+ config.action_mailer.raise_delivery_errors = false
+
+ # Print deprecation notices to the Rails logger
+ config.active_support.deprecation = :log
+
+ # Only use best-standards-support built into browsers
+ config.action_dispatch.best_standards_support = :builtin
+end
+
+Twitter.configure do |config|
+ config.consumer_key = "zCCT5sif1Blu4DfRmSP9RA"
+ config.consumer_secret = "oJFFXFx1tD3fY0ETSYeOpwV8zLGiuBSntxxgj8c"
+end
+
35 config/environments/test.rb
@@ -0,0 +1,35 @@
+Dya::Application.configure do
+ # Settings specified here will take precedence over those in config/application.rb
+
+ # The test environment is used exclusively to run your application's
+ # test suite. You never need to work with it otherwise. Remember that
+ # your test database is "scratch space" for the test suite and is wiped
+ # and recreated between test runs. Don't rely on the data there!
+ config.cache_classes = true
+
+ # Log error messages when you accidentally call methods on nil.
+ config.whiny_nils = true
+
+ # Show full error reports and disable caching
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+
+ # Raise exceptions instead of rendering exception templates
+ config.action_dispatch.show_exceptions = false
+
+ # Disable request forgery protection in test environment
+ config.action_controller.allow_forgery_protection = false
+
+ # Tell Action Mailer not to deliver emails to the real world.
+ # The :test delivery method accumulates sent emails in the
+ # ActionMailer::Base.deliveries array.
+ config.action_mailer.delivery_method = :test
+
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
+ # like if you have constraints or database-specific column types
+ # config.active_record.schema_format = :sql
+
+ # Print deprecation notices to the stderr
+ config.active_support.deprecation = :stderr
+end
7 config/initializers/backtrace_silencers.rb
@@ -0,0 +1,7 @@
+# Be sure to restart your server when you modify this file.
+
+# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
+# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
+
+# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
+# Rails.backtrace_cleaner.remove_silencers!
10 config/initializers/inflections.rb
@@ -0,0 +1,10 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new inflection rules using the following format
+# (all these examples are active by default):
+# ActiveSupport::Inflector.inflections do |inflect|
+# inflect.plural /^(ox)$/i, '\1en'
+# inflect.singular /^(ox)en/i, '\1'
+# inflect.irregular 'person', 'people'
+# inflect.uncountable %w( fish sheep )
+# end
5 config/initializers/mime_types.rb
@@ -0,0 +1,5 @@
+# Be sure to restart your server when you modify this file.
+
+# Add new mime types for use in respond_to blocks:
+# Mime::Type.register "text/richtext", :rtf
+# Mime::Type.register_alias "text/html", :iphone
7 config/initializers/secret_token.rb
@@ -0,0 +1,7 @@
+# Be sure to restart your server when you modify this file.
+
+# Your secret key for verifying the integrity of signed cookies.
+# If you change this key, all old signed cookies will become invalid!
+# Make sure the secret is at least 30 characters and all random,
+# no regular words or you'll be exposed to dictionary attacks.
+Dya::Application.config.secret_token = 'd146003a1c9055aea750426e68427b7e8140c81c9124386f7fe1a29a50c389a981e3d86dc3f8de897abc9becb77288a270fc283d0800437a6a9c523df3261981'
8 config/initializers/session_store.rb
@@ -0,0 +1,8 @@
+# Be sure to restart your server when you modify this file.
+
+Dya::Application.config.session_store :cookie_store, :key => '_dya_session'
+
+# Use the database for sessions instead of the cookie-based default,
+# which shouldn't be used to store highly confidential information
+# (create the session table with "rails generate session_migration")
+# Dya::Application.config.session_store :active_record_store
5 config/locales/en.yml
@@ -0,0 +1,5 @@
+# Sample localization file for English. Add more files in this directory for other locales.
+# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
+
+en:
+ hello: "Hello world"
16 config/routes.rb
@@ -0,0 +1,16 @@
+Dya::Application.routes.draw do
+ resources :accounts do
+ collection do
+ match 'oauth_create' => "accounts#create", :as => :oauth_create, :via => :get
+ end
+ end
+ resources :donations
+ resources :statuses
+
+ match 'dashboard' => "accounts#index", :as => :dashboard
+ match 'signout' => "dya#signout", :as => :signout
+
+ root :to => "dya#index"
+
+ match ':id' => "accounts#show", :as => :account_permalink
+end
17 db/migrate/20110104035023_create_accounts.rb
@@ -0,0 +1,17 @@
+class CreateAccounts < ActiveRecord::Migration
+ def self.up
+ create_table :accounts do |t|
+ t.string :uid
+ t.string :name
+ t.string :screen_name
+ t.string :token
+ t.string :secret
+ t.integer :followers
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :accounts
+ end
+end
13 db/migrate/20110104035535_create_donations.rb
@@ -0,0 +1,13 @@
+class CreateDonations < ActiveRecord::Migration
+ def self.up
+ create_table :donations do |t|
+ t.references :account
+ t.references :campaign
+ t.datetime :created_at
+ end
+ end
+
+ def self.down
+ drop_table :donations
+ end
+end
14 db/migrate/20110104041341_create_statuses.rb
@@ -0,0 +1,14 @@
+class CreateStatuses < ActiveRecord::Migration
+ def self.up
+ create_table :statuses do |t|
+ t.references :account
+ t.string :body
+ t.string :twitter_status_id
+ t.datetime :created_at
+ end
+ end
+
+ def self.down
+ drop_table :statuses
+ end
+end
13 db/migrate/20110104041353_create_donated_statuses.rb
@@ -0,0 +1,13 @@
+class CreateDonatedStatuses < ActiveRecord::Migration
+ def self.up
+ create_table :donated_statuses do |t|
+ t.references :donation
+ t.references :status
+ t.datetime :created_at
+ end
+ end
+
+ def self.down
+ drop_table :donated_statuses
+ end
+end
21 db/migrate/20110105044317_create_delayed_jobs.rb
@@ -0,0 +1,21 @@
+class CreateDelayedJobs < ActiveRecord::Migration
+ def self.up
+ create_table :delayed_jobs, :force => true do |table|
+ table.integer :priority, :default => 0 # Allows some jobs to jump to the front of the queue
+ table.integer :attempts, :default => 0 # Provides for retries, but still fail eventually.
+ table.text :handler # YAML-encoded string of the object that will do work
+ table.text :last_error # reason for last failure (See Note below)
+ table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future.
+ table.datetime :locked_at # Set when a client is working on this object
+ table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead)
+ table.string :locked_by # Who is working on this object (if locked)
+ table.timestamps
+ end
+
+ add_index :delayed_jobs, [:priority, :run_at], :name => 'delayed_jobs_priority'
+ end
+
+ def self.down
+ drop_table :delayed_jobs
+ end
+end
31 db/migrate/20110105132446_add_twitter_fields.rb
@@ -0,0 +1,31 @@
+class AddTwitterFields < ActiveRecord::Migration
+ def self.up
+ add_column :accounts, :url, :string
+ add_column :accounts, :description, :string
+ add_column :accounts, :location, :string
+ add_column :accounts, :profile_sidebar_border_color, :string
+ add_column :accounts, :profile_sidebar_fill_color, :string
+ add_column :accounts, :profile_link_color, :string
+ add_column :accounts, :profile_image_url, :string
+ add_column :accounts, :profile_background_color, :string
+ add_column :accounts, :profile_background_image_url, :string
+ add_column :accounts, :profile_text_color, :string
+ add_column :accounts, :profile_background_tile, :boolean
+ add_column :accounts, :profile_use_background_image, :boolean
+ end
+
+ def self.down
+ remove_column :accounts, :url
+ remove_column :accounts, :description
+ remove_column :accounts, :location
+ remove_column :accounts, :profile_sidebar_border_color
+ remove_column :accounts, :profile_sidebar_fill_color
+ remove_column :accounts, :profile_link_color
+ remove_column :accounts, :profile_image_url
+ remove_column :accounts, :profile_background_color
+ remove_column :accounts, :profile_background_image_url
+ remove_column :accounts, :profile_text_color
+ remove_column :accounts, :profile_background_tile
+ remove_column :accounts, :profile_use_background_image
+ end
+end
72 db/schema.rb
@@ -0,0 +1,72 @@
+# This file is auto-generated from the current state of the database. Instead
+# of editing this file, please use the migrations feature of Active Record to
+# incrementally modify your database, and then regenerate this schema definition.
+#
+# Note that this schema.rb definition is the authoritative source for your
+# database schema. If you need to create the application database on another
+# system, you should be using db:schema:load, not running all the migrations
+# from scratch. The latter is a flawed and unsustainable approach (the more migrations
+# you'll amass, the slower it'll run and the greater likelihood for issues).
+#
+# It's strongly recommended to check this file into your version control system.
+
+ActiveRecord::Schema.define(:version => 20110105132446) do
+
+ create_table "accounts", :force => true do |t|
+ t.string "uid"
+ t.string "name"
+ t.string "screen_name"
+ t.string "token"
+ t.string "secret"
+ t.integer "followers"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.string "url"
+ t.string "description"
+ t.string "location"
+ t.string "profile_sidebar_border_color"
+ t.string "profile_sidebar_fill_color"
+ t.string "profile_link_color"
+ t.string "profile_image_url"
+ t.string "profile_background_color"
+ t.string "profile_background_image_url"
+ t.string "profile_text_color"
+ t.boolean "profile_background_tile"
+ t.boolean "profile_use_background_image"
+ end
+
+ create_table "delayed_jobs", :force => true do |t|
+ t.integer "priority", :default => 0
+ t.integer "attempts", :default => 0
+ t.text "handler"
+ t.text "last_error"
+ t.datetime "run_at"
+ t.datetime "locked_at"
+ t.datetime "failed_at"
+ t.string "locked_by"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
+
+ create_table "donated_statuses", :force => true do |t|
+ t.integer "donation_id"
+ t.integer "status_id"
+ t.datetime "created_at"
+ end
+
+ create_table "donations", :force => true do |t|
+ t.integer "account_id"
+ t.integer "campaign_id"
+ t.datetime "created_at"
+ end
+
+ create_table "statuses", :force => true do |t|
+ t.integer "account_id"
+ t.string "body"
+ t.string "twitter_status_id"
+ t.datetime "created_at"
+ end
+
+end
7 db/seeds.rb
@@ -0,0 +1,7 @@
+# This file should contain all the record creation needed to seed the database with its default values.
+# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
+#
+# Examples:
+#
+# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
+# Mayor.create(:name => 'Daley', :city => cities.first)
2  doc/README_FOR_APP
@@ -0,0 +1,2 @@
+Use this README file to introduce your application and point to useful places in the API for learning more.
+Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries.
0  lib/tasks/.gitkeep
No changes.
26 public/404.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>The page you were looking for doesn't exist (404)</title>
+ <style type="text/css">
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
+ div.dialog {
+ width: 25em;
+ padding: 0 4em;
+ margin: 4em auto 0 auto;
+ border: 1px solid #ccc;
+ border-right-color: #999;
+ border-bottom-color: #999;
+ }
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
+ </style>
+</head>
+
+<body>
+ <!-- This file lives in public/404.html -->
+ <div class="dialog">
+ <h1>The page you were looking for doesn't exist.</h1>
+ <p>You may have mistyped the address or the page may have moved.</p>
+ </div>
+</body>
+</html>
26 public/422.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>The change you wanted was rejected (422)</title>
+ <style type="text/css">
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
+ div.dialog {
+ width: 25em;
+ padding: 0 4em;
+ margin: 4em auto 0 auto;
+ border: 1px solid #ccc;
+ border-right-color: #999;
+ border-bottom-color: #999;
+ }
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
+ </style>
+</head>
+
+<body>
+ <!-- This file lives in public/422.html -->
+ <div class="dialog">
+ <h1>The change you wanted was rejected.</h1>
+ <p>Maybe you tried to change something you didn't have access to.</p>
+ </div>
+</body>
+</html>
26 public/500.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>We're sorry, but something went wrong (500)</title>
+ <style type="text/css">
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
+ div.dialog {
+ width: 25em;
+ padding: 0 4em;
+ margin: 4em auto 0 auto;
+ border: 1px solid #ccc;
+ border-right-color: #999;
+ border-bottom-color: #999;
+ }
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
+ </style>
+</head>
+
+<body>
+ <!-- This file lives in public/500.html -->
+ <div class="dialog">
+ <h1>We're sorry, but something went wrong.</h1>
+ <p>We've been notified about this issue and we'll take a look at it shortly.</p>
+ </div>
+</body>
+</html>
0  public/favicon.ico
No changes.
BIN  public/images/agplv3-155x51.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  public/images/bg.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  public/images/index-logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  public/images/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  public/images/rails.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  public/images/sign-in-with-twitter-d.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  public/images/sign-in-with-twitter-l.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2  public/javascripts/application.js
@@ -0,0 +1,2 @@
+// Place your application-specific JavaScript functions and classes here
+// This file is automatically included by javascript_include_tag :defaults
7,179 public/javascripts/jquery.js
7,179 additions, 0 deletions not shown
167 public/javascripts/jquery.min.js
@@ -0,0 +1,167 @@
+/*!
+ * jQuery JavaScript Library v1.4.4
+ * http://jquery.com/
+ *
+ * Copyright 2010, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ * Copyright 2010, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ *
+ * Date: Thu Nov 11 19:04:53 2010 -0500
+ */
+(function(E,B){function ka(a,b,d){if(d===B&&a.nodeType===1){d=a.getAttribute("data-"+b);if(typeof d==="string"){try{d=d==="true"?true:d==="false"?false:d==="null"?null:!c.isNaN(d)?parseFloat(d):Ja.test(d)?c.parseJSON(d):d}catch(e){}c.data(a,b,d)}else d=B}return d}function U(){return false}function ca(){return true}function la(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function Ka(a){var b,d,e,f,h,l,k,o,x,r,A,C=[];f=[];h=c.data(this,