Permalink
Browse files

Initial work in getting to Rails 3

  • Loading branch information...
1 parent d47af88 commit 69eec430045595b8b2913cfb905a74e2db6735ee @seven1m seven1m committed Oct 15, 2010
Showing with 5,985 additions and 2,661 deletions.
  1. +2 −2 .gitignore
  2. +1 −0 .rvmrc
  3. +6 −0 BROKEN.md
  4. +22 −0 Gemfile
  5. +111 −0 Gemfile.lock
  6. +9 −11 Rakefile
  7. +3 −2 app/controllers/application_controller.rb
  8. +1 −1 app/models/family.rb
  9. +2 −2 app/models/group.rb
  10. +1 −1 app/models/message.rb
  11. +2 −2 app/models/person.rb
  12. +5 −1 app/models/relationship.rb
  13. +4 −0 config.ru
  14. +36 −0 config/application.rb
  15. +13 −109 config/boot.rb
  16. +4 −36 config/environment.rb
  17. +21 −15 config/environments/development.rb
  18. +44 −13 config/environments/production.rb
  19. +35 −33 config/environments/test.rb
  20. +2 −1 config/initializers/_libs.rb
  21. +2 −3 config/initializers/_settings.rb
  22. +7 −0 config/initializers/backtrace_silencers.rb
  23. +1 −1 config/initializers/date_time.rb
  24. +10 −0 config/initializers/inflections.rb
  25. +7 −0 config/initializers/secret_token.rb
  26. +8 −0 config/initializers/session_store.rb
  27. +0 −23 config/initializers/sessions_patch.rb
  28. +214 −107 config/routes.rb
  29. +7 −0 db/seeds.rb
  30. +0 −12 features/news/flag.feature
  31. +0 −8 features/news/manage.feature
  32. +0 −47 features/news/submit.feature
  33. +0 −15 features/step_definitions/news_steps.rb
  34. +0 −5 features/step_definitions/session_steps.rb
  35. +0 −8 features/step_definitions/setting_steps.rb
  36. +0 −119 features/step_definitions/webrat_steps.rb
  37. +0 −18 features/support/env.rb
  38. +0 −29 features/support/paths.rb
  39. +2 −1 lib/db_tools.rb
  40. +6 −0 lib/rake_abandon.rb
  41. 0 lib/tasks/.gitkeep
  42. +0 −15 lib/tasks/cucumber.rake
  43. +22 −6 public/404.html
  44. +26 −0 public/422.html
  45. +22 −8 public/500.html
  46. BIN public/images/rails.png
  47. +0 −12 public/javascripts/application.js
  48. +5 −3 public/javascripts/controls.js
  49. +7 −6 public/javascripts/dragdrop.js
  50. +8 −13 public/javascripts/effects.js
  51. +3,381 −1,700 public/javascripts/prototype.js
  52. +175 −0 public/javascripts/rails.js
  53. +5 −1 public/robots.txt
  54. 0 public/stylesheets/.gitkeep
  55. +0 −3 script/about
  56. +0 −3 script/breakpointer
  57. +0 −3 script/console
  58. +0 −8 script/cucumber
  59. +0 −3 script/dbconsole
  60. +0 −3 script/destroy
  61. +0 −3 script/generate
  62. +0 −3 script/performance/benchmarker
  63. +0 −3 script/performance/profiler
  64. +0 −3 script/performance/request
  65. +0 −3 script/plugin
  66. +0 −3 script/process/inspector
  67. +0 −3 script/process/reaper
  68. +0 −3 script/process/spawner
  69. +6 −0 script/rails
  70. +0 −3 script/runner
  71. +0 −3 script/server
  72. +0 −113 script/sync
  73. +0 −93 script/twitter
  74. +9 −0 test/performance/browsing_test.rb
  75. +5 −8 test/test_helper.rb
  76. +0 −2 test/unit/notifier_test.rb
  77. 0 vendor/plugins/.gitkeep
  78. +3 −3 vendor/plugins/acts_as_scoped_globally/lib/acts_as_scoped_globally.rb
  79. +20 −0 vendor/plugins/rails_upgrade/MIT-LICENSE
  80. +20 −0 vendor/plugins/rails_upgrade/README
  81. +22 −0 vendor/plugins/rails_upgrade/Rakefile
  82. +2 −0 vendor/plugins/rails_upgrade/init.rb
  83. +38 −0 vendor/plugins/rails_upgrade/install.rb
  84. +472 −0 vendor/plugins/rails_upgrade/lib/application_checker.rb
  85. +95 −0 vendor/plugins/rails_upgrade/lib/gemfile_generator.rb
  86. +51 −0 vendor/plugins/rails_upgrade/lib/new_configuration_generator.rb
  87. 0 vendor/plugins/rails_upgrade/lib/rails_upgrade.rb
  88. +349 −0 vendor/plugins/rails_upgrade/lib/routes_upgrader.rb
  89. +78 −0 vendor/plugins/rails_upgrade/lib/tasks/rails_upgrade_tasks.rake
  90. +293 −0 vendor/plugins/rails_upgrade/test/application_checker_test.rb
  91. +72 −0 vendor/plugins/rails_upgrade/test/gemfile_generator_test.rb
  92. +63 −0 vendor/plugins/rails_upgrade/test/new_configuration_generator_test.rb
  93. +142 −0 vendor/plugins/rails_upgrade/test/routes_upgrader_test.rb
  94. +5 −0 vendor/plugins/rails_upgrade/test/test_helper.rb
  95. +1 −0 vendor/plugins/rails_upgrade/uninstall.rb
View
@@ -1,4 +1,4 @@
-db/*.db
+.bundle
db/schema.rb
db/*.sql
db/*.backup.*
@@ -18,4 +18,4 @@ vendor/plugins/query_reviewer
pkg
*.deb
script/package
-db/bible.web.osis.xml
+db/bible.web.osis.xml
View
1 .rvmrc
@@ -0,0 +1 @@
+rvm use ree@rails3
View
@@ -0,0 +1,6 @@
+= Stuff that's broken/disabled for OneBody@rails3
+
+* feedzirra (not Rails 3 compatible)
+* whenever (maybe Rails 3 compatible)
+* `config.plugin_paths`
+* csv serialization `lib/csv_serialization.rb`
View
22 Gemfile
@@ -0,0 +1,22 @@
+source 'http://rubygems.org'
+
+gem 'rails', ' 3.0.0'
+gem 'mysql', '~> 2.8.1'
+gem 'liquid', '~> 2.0.0'
+gem 'highline', '~> 1.6.1'
+gem 'mini_magick', '>= 1.2.5'
+gem 'campaign_monitor_party', '>= 0.2.1'
+# FIXME
+#gem 'whenever', '~> 0.4.0'
+gem 'nokogiri', '~> 1.4.0'
+gem 'builder', '>= 2.1.2'
+# FIXME
+#gem 'feedzirra', '>= 0.0.23'
+gem 'fastercsv', '~> 1.5.0'
+gem 'pdf-writer', '~> 1.1.8', :require => 'pdf/writer'
+gem 'rubyzip', '~> 0.9.4', :require => 'zip/zip'
+
+group :development, :test do
+ gem 'faker', '>= 0.3.1'
+ gem 'shoulda', '~> 2.11.3'
+end
View
@@ -0,0 +1,111 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ abstract (1.0.0)
+ actionmailer (3.0.0)
+ actionpack (= 3.0.0)
+ mail (~> 2.2.5)
+ actionpack (3.0.0)
+ activemodel (= 3.0.0)
+ activesupport (= 3.0.0)
+ builder (~> 2.1.2)
+ erubis (~> 2.6.6)
+ i18n (~> 0.4.1)
+ rack (~> 1.2.1)
+ rack-mount (~> 0.6.12)
+ rack-test (~> 0.5.4)
+ tzinfo (~> 0.3.23)
+ activemodel (3.0.0)
+ activesupport (= 3.0.0)
+ builder (~> 2.1.2)
+ i18n (~> 0.4.1)
+ activerecord (3.0.0)
+ activemodel (= 3.0.0)
+ activesupport (= 3.0.0)
+ arel (~> 1.0.0)
+ tzinfo (~> 0.3.23)
+ activeresource (3.0.0)
+ activemodel (= 3.0.0)
+ activesupport (= 3.0.0)
+ activesupport (3.0.0)
+ arel (1.0.1)
+ activesupport (~> 3.0.0)
+ builder (2.1.2)
+ campaign_monitor_party (0.2.1)
+ httparty
+ color (1.4.1)
+ crack (0.1.8)
+ erubis (2.6.6)
+ abstract (>= 1.0.0)
+ faker (0.3.1)
+ fastercsv (1.5.3)
+ highline (1.6.1)
+ hoe (2.6.2)
+ rake (>= 0.8.7)
+ rubyforge (>= 2.0.4)
+ httparty (0.6.1)
+ crack (= 0.1.8)
+ i18n (0.4.1)
+ json_pure (1.4.6)
+ liquid (2.0.0)
+ mail (2.2.7)
+ activesupport (>= 2.3.6)
+ mime-types
+ treetop (>= 1.4.5)
+ mime-types (1.16)
+ mini_magick (2.3)
+ subexec (~> 0.0.4)
+ mysql (2.8.1)
+ nokogiri (1.4.3.1)
+ pdf-writer (1.1.8)
+ color (>= 1.4.0)
+ transaction-simple (~> 1.3)
+ 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.0)
+ actionmailer (= 3.0.0)
+ actionpack (= 3.0.0)
+ activerecord (= 3.0.0)
+ activeresource (= 3.0.0)
+ activesupport (= 3.0.0)
+ bundler (~> 1.0.0)
+ railties (= 3.0.0)
+ railties (3.0.0)
+ actionpack (= 3.0.0)
+ activesupport (= 3.0.0)
+ rake (>= 0.8.4)
+ thor (~> 0.14.0)
+ rake (0.8.7)
+ rubyforge (2.0.4)
+ json_pure (>= 1.1.7)
+ rubyzip (0.9.4)
+ shoulda (2.11.3)
+ subexec (0.0.4)
+ thor (0.14.3)
+ transaction-simple (1.4.0)
+ hoe (>= 1.1.7)
+ treetop (1.4.8)
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.23)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ builder (>= 2.1.2)
+ campaign_monitor_party (>= 0.2.1)
+ faker (>= 0.3.1)
+ fastercsv (~> 1.5.0)
+ highline (~> 1.6.1)
+ liquid (~> 2.0.0)
+ mini_magick (>= 1.2.5)
+ mysql (~> 2.8.1)
+ nokogiri (~> 1.4.0)
+ pdf-writer (~> 1.1.8)
+ rails (= 3.0.0)
+ rubyzip (~> 0.9.4)
+ shoulda (~> 2.11.3)
View
@@ -1,16 +1,14 @@
-require(File.join(File.dirname(__FILE__), 'config', 'boot'))
+# 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'
-require 'rake/testtask'
-require 'rake/rdoctask'
+#require 'rake/testtask'
+#require 'rake/rdoctask'
-class Rake::Task
- def abandon
- prerequisites.clear
- @actions.clear
- end
-end
+require Rails.root.join('lib/rake_abandon')
-require 'tasks/rails'
+OneBody::Application.load_tasks
+
+Dir["#{Rails.root}/plugins/*/**/tasks/**/*.rake"].sort.each { |ext| load ext }
-Dir["#{RAILS_ROOT}/plugins/*/**/tasks/**/*.rake"].sort.each { |ext| load ext }
@@ -1,6 +1,6 @@
-# Filters added to this controller will be run for all controllers in the application.
-# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
+ #protect_from_forgery
+
include ExceptionNotifiable
cache_sweeper :stream_item_sweeper, :only => %w(create update destroy)
@@ -232,3 +232,4 @@ def can_export?
end
end
+
View
@@ -49,7 +49,7 @@ class Family < ActiveRecord::Base
attr_accessible :legacy_id, :barcode_id, :alternate_barcode_id, :people_attributes, :if => Proc.new { Person.logged_in and Person.logged_in.admin?(:edit_profiles) }
has_one_photo :path => "#{DB_PHOTO_PATH}/families", :sizes => PHOTO_SIZES
- acts_as_logger LogItem
+ #acts_as_logger LogItem
alias_method 'photo_without_logging=', 'photo='
def photo=(p)
View
@@ -49,7 +49,7 @@ class Group < ActiveRecord::Base
belongs_to :parents_of_group, :class_name => 'Group', :foreign_key => 'parents_of'
belongs_to :site
- named_scope :active, :conditions => {:hidden => false}
+ scope :active, :conditions => {:hidden => false}
scope_by_site_id
@@ -83,7 +83,7 @@ def photo=(p)
self.photo_without_logging = p
end
- named_scope :checkin_destinations, :include => :group_times, :conditions => ['group_times.checkin_time_id is not null'], :order => 'group_times.ordering'
+ scope :checkin_destinations, :include => :group_times, :conditions => ['group_times.checkin_time_id is not null'], :order => 'group_times.ordering'
def name_group # returns something like "Morgan group"
"#{name}#{name =~ /group$/i ? '' : ' group'}"
View
@@ -75,7 +75,7 @@ def before_save
body.gsub! /http:\/\/.*?person_id=\d+&code=\d+/i, '--removed--'
end
- validate_on_create do |record|
+ validate :on => :create do |record|
if Message.find_by_person_id_and_subject_and_body(record.person_id, record.subject, record.body, :conditions => ['created_at >= ?', Date.today-1])
record.errors.add_to_base 'already saved' # Notifier relies on this message (don't change it)
end
View
@@ -130,8 +130,8 @@ class Person < ActiveRecord::Base
attr_accessible :classes, :shepherd, :mail_group, :legacy_id, :account_frozen, :member, :staff, :elder, :deacon, :can_sign_in, :visible_to_everyone, :visible_on_printed_directory, :full_access, :legacy_family_id, :child, :custom_type, :custom_fields, :medical_notes, :if => Proc.new { Person.logged_in and Person.logged_in.admin?(:edit_profiles) }
attr_accessible :id, :sequence, :can_pick_up, :cannot_pick_up, :family_id, :if => Proc.new { l = Person.logged_in and l.admin?(:edit_profiles) and l.admin?(:import_data) and Person.import_in_progress }
- named_scope :unsynced_to_donortools, lambda { {:conditions => ["synced_to_donortools = ? and deleted = ? and (child = ? or birthday <= ?)", false, false, false, 18.years.ago]} }
- named_scope :can_sign_in, :conditions => {:can_sign_in => true, :deleted => false}
+ scope :unsynced_to_donortools, lambda { {:conditions => ["synced_to_donortools = ? and deleted = ? and (child = ? or birthday <= ?)", false, false, false, 18.years.ago]} }
+ scope :can_sign_in, :conditions => {:can_sign_in => true, :deleted => false}
acts_as_password
has_one_photo :path => "#{DB_PHOTO_PATH}/people", :sizes => PHOTO_SIZES
@@ -20,12 +20,16 @@ class Relationship < ActiveRecord::Base
scope_by_site_id
validates_presence_of :name
- validates_inclusion_of :name, :in => I18n.t('relationships.names').keys.map { |r| r.to_s }
validates_presence_of :other_name, :if => Proc.new { |r| r.name == 'other' }
validates_presence_of :person_id
validates_presence_of :related_id
validates_uniqueness_of :name, :scope => [:other_name, :person_id, :related_id]
validates_uniqueness_of :other_name, :scope => [:name, :person_id, :related_id]
+ validates_each :name do |record, attribute, value|
+ unless I18n.t('relationships.names').keys.map { |r| r.to_s }.include?(value)
+ record.errors.add attribute, :inclusion
+ end
+ end
acts_as_logger LogItem
View
@@ -0,0 +1,4 @@
+# This file is used by Rack-based servers to start the application.
+
+require ::File.expand_path('../config/environment', __FILE__)
+run OneBody::Application
View
@@ -0,0 +1,36 @@
+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 OneBody
+ class Application < Rails::Application
+ # Custom directories with classes and modules you want to be autoloadable.
+ config.autoload_paths << "#{config.root}/app/sweepers"
+
+ # Custom directory for plugins
+ # FIXME
+ #config.plugin_paths << "#{config.root}/plugins"
+
+ # Cache store location
+ config.action_controller.cache_store = [:file_store, "#{config.root}/cache"]
+
+ # Activate observers that should always be running.
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
+
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
+ config.i18n.default_locale = File.exist?("#{config.root}/config/locale") ? File.read("#{config.root}/config/locale").strip.to_sym : :en
+ config.i18n.load_path += Dir["#{config.root}/plugins/**/config/locales/*.{rb,yml}"]
+
+ # 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
+
+(Setting.update_all if Setting.table_exists?) rescue nil
Oops, something went wrong.

0 comments on commit 69eec43

Please sign in to comment.