rubysync 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. data/bin/rubysync +312 -0
  2. data/examples/ar_client_webapp/README +182 -0
  3. data/examples/ar_client_webapp/Rakefile +10 -0
  4. data/examples/ar_client_webapp/app/controllers/application.rb +7 -0
  5. data/examples/ar_client_webapp/app/controllers/user_controller.rb +5 -0
  6. data/examples/ar_client_webapp/app/helpers/application_helper.rb +3 -0
  7. data/examples/ar_client_webapp/app/helpers/user_helper.rb +2 -0
  8. data/examples/ar_client_webapp/app/models/user.rb +2 -0
  9. data/examples/ar_client_webapp/config/boot.rb +45 -0
  10. data/examples/ar_client_webapp/config/database.yml +36 -0
  11. data/examples/ar_client_webapp/config/environment.rb +60 -0
  12. data/examples/ar_client_webapp/config/environments/development.rb +21 -0
  13. data/examples/ar_client_webapp/config/environments/production.rb +18 -0
  14. data/examples/ar_client_webapp/config/environments/test.rb +19 -0
  15. data/examples/ar_client_webapp/config/routes.rb +23 -0
  16. data/examples/ar_client_webapp/db/migrate/001_create_users.rb +13 -0
  17. data/examples/ar_client_webapp/db/schema.rb +13 -0
  18. data/examples/ar_client_webapp/doc/README_FOR_APP +2 -0
  19. data/examples/ar_client_webapp/public/404.html +30 -0
  20. data/examples/ar_client_webapp/public/500.html +30 -0
  21. data/examples/ar_client_webapp/public/dispatch.cgi +10 -0
  22. data/examples/ar_client_webapp/public/dispatch.fcgi +24 -0
  23. data/examples/ar_client_webapp/public/dispatch.rb +10 -0
  24. data/examples/ar_client_webapp/public/favicon.ico +0 -0
  25. data/examples/ar_client_webapp/public/images/rails.png +0 -0
  26. data/examples/ar_client_webapp/public/index.html +277 -0
  27. data/examples/ar_client_webapp/public/javascripts/application.js +2 -0
  28. data/examples/ar_client_webapp/public/javascripts/controls.js +833 -0
  29. data/examples/ar_client_webapp/public/javascripts/dragdrop.js +942 -0
  30. data/examples/ar_client_webapp/public/javascripts/effects.js +1088 -0
  31. data/examples/ar_client_webapp/public/javascripts/prototype.js +2515 -0
  32. data/examples/ar_client_webapp/public/robots.txt +1 -0
  33. data/examples/ar_client_webapp/script/about +3 -0
  34. data/examples/ar_client_webapp/script/breakpointer +3 -0
  35. data/examples/ar_client_webapp/script/console +3 -0
  36. data/examples/ar_client_webapp/script/destroy +3 -0
  37. data/examples/ar_client_webapp/script/generate +3 -0
  38. data/examples/ar_client_webapp/script/performance/benchmarker +3 -0
  39. data/examples/ar_client_webapp/script/performance/profiler +3 -0
  40. data/examples/ar_client_webapp/script/plugin +3 -0
  41. data/examples/ar_client_webapp/script/process/inspector +3 -0
  42. data/examples/ar_client_webapp/script/process/reaper +3 -0
  43. data/examples/ar_client_webapp/script/process/spawner +3 -0
  44. data/examples/ar_client_webapp/script/runner +3 -0
  45. data/examples/ar_client_webapp/script/server +3 -0
  46. data/examples/ar_client_webapp/test/fixtures/users.yml +5 -0
  47. data/examples/ar_client_webapp/test/functional/user_controller_test.rb +18 -0
  48. data/examples/ar_client_webapp/test/test_helper.rb +28 -0
  49. data/examples/ar_client_webapp/test/unit/user_test.rb +10 -0
  50. data/examples/ar_webapp/README +1 -0
  51. data/examples/ar_webapp/Rakefile +10 -0
  52. data/examples/ar_webapp/app/controllers/application.rb +7 -0
  53. data/examples/ar_webapp/app/controllers/hobbies_controller.rb +10 -0
  54. data/examples/ar_webapp/app/controllers/interests_controller.rb +9 -0
  55. data/examples/ar_webapp/app/controllers/people_controller.rb +14 -0
  56. data/examples/ar_webapp/app/controllers/ruby_sync_associations_controller.rb +10 -0
  57. data/examples/ar_webapp/app/helpers/application_helper.rb +3 -0
  58. data/examples/ar_webapp/app/models/hobby.rb +5 -0
  59. data/examples/ar_webapp/app/models/interest.rb +6 -0
  60. data/examples/ar_webapp/app/models/person.rb +9 -0
  61. data/examples/ar_webapp/app/models/ruby_sync_association.rb +5 -0
  62. data/examples/ar_webapp/app/models/ruby_sync_event.rb +9 -0
  63. data/examples/ar_webapp/app/models/ruby_sync_observer.rb +28 -0
  64. data/examples/ar_webapp/app/models/ruby_sync_operation.rb +20 -0
  65. data/examples/ar_webapp/app/models/ruby_sync_state.rb +2 -0
  66. data/examples/ar_webapp/app/models/ruby_sync_value.rb +7 -0
  67. data/examples/ar_webapp/app/views/layouts/application.rhtml +19 -0
  68. data/examples/ar_webapp/app/views/people/show.rhtml +18 -0
  69. data/examples/ar_webapp/config/boot.rb +45 -0
  70. data/examples/ar_webapp/config/database.yml +36 -0
  71. data/examples/ar_webapp/config/environment.rb +61 -0
  72. data/examples/ar_webapp/config/environments/development.rb +21 -0
  73. data/examples/ar_webapp/config/environments/production.rb +18 -0
  74. data/examples/ar_webapp/config/environments/test.rb +19 -0
  75. data/examples/ar_webapp/config/routes.rb +23 -0
  76. data/examples/ar_webapp/db/migrate/001_create_people.rb +12 -0
  77. data/examples/ar_webapp/db/migrate/002_create_interests.rb +12 -0
  78. data/examples/ar_webapp/db/migrate/003_create_hobbies.rb +11 -0
  79. data/examples/ar_webapp/db/migrate/004_create_ruby_sync_associations.rb +18 -0
  80. data/examples/ar_webapp/db/migrate/005_create_ruby_sync_events.rb +16 -0
  81. data/examples/ar_webapp/db/migrate/006_create_ruby_sync_operations.rb +15 -0
  82. data/examples/ar_webapp/db/migrate/007_create_ruby_sync_values.rb +12 -0
  83. data/examples/ar_webapp/db/migrate/008_ruby_sync_tracking.rb +16 -0
  84. data/examples/ar_webapp/db/migrate/009_create_ruby_sync_states.rb +10 -0
  85. data/examples/ar_webapp/db/schema.rb +56 -0
  86. data/examples/ar_webapp/doc/README_FOR_APP +2 -0
  87. data/examples/ar_webapp/public/404.html +30 -0
  88. data/examples/ar_webapp/public/500.html +30 -0
  89. data/examples/ar_webapp/public/dispatch.cgi +10 -0
  90. data/examples/ar_webapp/public/dispatch.fcgi +24 -0
  91. data/examples/ar_webapp/public/dispatch.rb +10 -0
  92. data/examples/ar_webapp/public/favicon.ico +0 -0
  93. data/examples/ar_webapp/public/images/rails.png +0 -0
  94. data/examples/ar_webapp/public/index.html +277 -0
  95. data/examples/ar_webapp/public/javascripts/application.js +2 -0
  96. data/examples/ar_webapp/public/javascripts/controls.js +833 -0
  97. data/examples/ar_webapp/public/javascripts/dragdrop.js +942 -0
  98. data/examples/ar_webapp/public/javascripts/effects.js +1088 -0
  99. data/examples/ar_webapp/public/javascripts/prototype.js +2515 -0
  100. data/examples/ar_webapp/public/robots.txt +1 -0
  101. data/examples/ar_webapp/script/about +3 -0
  102. data/examples/ar_webapp/script/breakpointer +3 -0
  103. data/examples/ar_webapp/script/console +3 -0
  104. data/examples/ar_webapp/script/destroy +3 -0
  105. data/examples/ar_webapp/script/generate +3 -0
  106. data/examples/ar_webapp/script/performance/benchmarker +3 -0
  107. data/examples/ar_webapp/script/performance/profiler +3 -0
  108. data/examples/ar_webapp/script/plugin +3 -0
  109. data/examples/ar_webapp/script/process/inspector +3 -0
  110. data/examples/ar_webapp/script/process/reaper +3 -0
  111. data/examples/ar_webapp/script/process/spawner +3 -0
  112. data/examples/ar_webapp/script/runner +3 -0
  113. data/examples/ar_webapp/script/server +3 -0
  114. data/examples/ar_webapp/test/fixtures/association_keys.yml +5 -0
  115. data/examples/ar_webapp/test/fixtures/hobbies.yml +5 -0
  116. data/examples/ar_webapp/test/fixtures/interests.yml +5 -0
  117. data/examples/ar_webapp/test/fixtures/people.yml +9 -0
  118. data/examples/ar_webapp/test/fixtures/ruby_sync_events.yml +5 -0
  119. data/examples/ar_webapp/test/fixtures/ruby_sync_operations.yml +5 -0
  120. data/examples/ar_webapp/test/fixtures/ruby_sync_states.yml +5 -0
  121. data/examples/ar_webapp/test/fixtures/ruby_sync_values.yml +5 -0
  122. data/examples/ar_webapp/test/test_helper.rb +28 -0
  123. data/examples/ar_webapp/test/unit/association_key_test.rb +8 -0
  124. data/examples/ar_webapp/test/unit/hobby_test.rb +10 -0
  125. data/examples/ar_webapp/test/unit/interest_test.rb +10 -0
  126. data/examples/ar_webapp/test/unit/person_test.rb +10 -0
  127. data/examples/ar_webapp/test/unit/ruby_sync_event_test.rb +12 -0
  128. data/examples/ar_webapp/test/unit/ruby_sync_observer_test.rb +57 -0
  129. data/examples/ar_webapp/test/unit/ruby_sync_operation_test.rb +10 -0
  130. data/examples/ar_webapp/test/unit/ruby_sync_state_test.rb +10 -0
  131. data/examples/ar_webapp/test/unit/ruby_sync_value_test.rb +10 -0
  132. data/examples/ims2/connectors/hr_db_connector.rb +8 -0
  133. data/examples/ims2/connectors/my_csv_connector.rb +12 -0
  134. data/examples/ims2/pipelines/hr_import_pipeline.rb +33 -0
  135. data/examples/my_ims/connectors/corp_directory_connector.rb +12 -0
  136. data/examples/my_ims/connectors/finance_connector.rb +7 -0
  137. data/examples/my_ims/connectors/hr_db_connector.rb +7 -0
  138. data/examples/my_ims/pipelines/finance_pipeline.rb +33 -0
  139. data/examples/my_ims/pipelines/hr_import_pipeline.rb +29 -0
  140. data/lib/ruby_sync/connectors/active_record_connector.rb +198 -0
  141. data/lib/ruby_sync/connectors/base_connector.rb +317 -0
  142. data/lib/ruby_sync/connectors/connector_event_processing.rb +78 -0
  143. data/lib/ruby_sync/connectors/csv_file_connector.rb +95 -0
  144. data/lib/ruby_sync/connectors/file_connector.rb +74 -0
  145. data/lib/ruby_sync/connectors/ldap_connector.rb +192 -0
  146. data/lib/ruby_sync/connectors/memory_connector.rb +185 -0
  147. data/lib/ruby_sync/event.rb +220 -0
  148. data/lib/ruby_sync/operation.rb +82 -0
  149. data/lib/ruby_sync/pipelines/base_pipeline.rb +360 -0
  150. data/lib/ruby_sync/util/metaid.rb +24 -0
  151. data/lib/ruby_sync/util/utilities.rb +115 -0
  152. data/lib/ruby_sync.rb +81 -0
  153. data/test/hashlike_tests.rb +111 -0
  154. data/test/ruby_sync_test.rb +48 -0
  155. data/test/test_active_record_vault.rb +113 -0
  156. data/test/test_csv_file_connector.rb +75 -0
  157. data/test/test_event.rb +40 -0
  158. data/test/test_ldap_connector.rb +89 -0
  159. data/test/test_memory_connectors.rb +40 -0
  160. data/test/ts_rubysync.rb +20 -0
  161. metadata +316 -0
@@ -0,0 +1 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/about'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/breakpointer'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/console'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/destroy'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/generate'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/performance/benchmarker'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/performance/profiler'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/plugin'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/process/inspector'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/process/reaper'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/process/spawner'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/runner'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/server'
@@ -0,0 +1,5 @@
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+ one:
3
+ id: 1
4
+ two:
5
+ id: 2
@@ -0,0 +1,18 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+ require 'user_controller'
3
+
4
+ # Re-raise errors caught by the controller.
5
+ class UserController; def rescue_action(e) raise e end; end
6
+
7
+ class UserControllerTest < Test::Unit::TestCase
8
+ def setup
9
+ @controller = UserController.new
10
+ @request = ActionController::TestRequest.new
11
+ @response = ActionController::TestResponse.new
12
+ end
13
+
14
+ # Replace this with your real tests.
15
+ def test_truth
16
+ assert true
17
+ end
18
+ end
@@ -0,0 +1,28 @@
1
+ ENV["RAILS_ENV"] = "test"
2
+ require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
3
+ require 'test_help'
4
+
5
+ class Test::Unit::TestCase
6
+ # Transactional fixtures accelerate your tests by wrapping each test method
7
+ # in a transaction that's rolled back on completion. This ensures that the
8
+ # test database remains unchanged so your fixtures don't have to be reloaded
9
+ # between every test method. Fewer database queries means faster tests.
10
+ #
11
+ # Read Mike Clark's excellent walkthrough at
12
+ # http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
13
+ #
14
+ # Every Active Record database supports transactions except MyISAM tables
15
+ # in MySQL. Turn off transactional fixtures in this case; however, if you
16
+ # don't care one way or the other, switching from MyISAM to InnoDB tables
17
+ # is recommended.
18
+ self.use_transactional_fixtures = true
19
+
20
+ # Instantiated fixtures are slow, but give you @david where otherwise you
21
+ # would need people(:david). If you don't want to migrate your existing
22
+ # test cases which use the @david style and don't mind the speed hit (each
23
+ # instantiated fixtures translates to a database query per test method),
24
+ # then set this back to true.
25
+ self.use_instantiated_fixtures = false
26
+
27
+ # Add more helper methods to be used by all tests here...
28
+ end
@@ -0,0 +1,10 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class UserTest < Test::Unit::TestCase
4
+ fixtures :users
5
+
6
+ # Replace this with your real tests.
7
+ def test_truth
8
+ assert true
9
+ end
10
+ end
@@ -0,0 +1 @@
1
+ This Ruby on Rails app exists for the purpose of demonstrating RubySync's ability to hook into a Rail application and use it's already defined model classes and configuration info to access it's database via ActiveRecord.
@@ -0,0 +1,10 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require(File.join(File.dirname(__FILE__), 'config', 'boot'))
5
+
6
+ require 'rake'
7
+ require 'rake/testtask'
8
+ require 'rake/rdoctask'
9
+
10
+ require 'tasks/rails'
@@ -0,0 +1,7 @@
1
+ # Filters added to this controller apply to all controllers in the application.
2
+ # Likewise, all the methods added will be available for all controllers.
3
+
4
+ class ApplicationController < ActionController::Base
5
+ # Pick a unique cookie name to distinguish our session data from others'
6
+ session :session_key => '_ar_webapp_session_id'
7
+ end
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Created by Ritchie Young on 2007-04-24.
4
+ # Copyright (c) 2007. All rights reserved.
5
+
6
+ class HobbiesController < ApplicationController
7
+
8
+ scaffold 'Hobby'
9
+
10
+ end
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Created by Ritchie Young on 2007-04-24.
4
+ # Copyright (c) 2007. All rights reserved.
5
+
6
+ class InterestsController < ApplicationController
7
+
8
+ scaffold 'Interest'
9
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Created by Ritchie Young on 2007-04-24.
4
+ # Copyright (c) 2007. All rights reserved.
5
+
6
+ class PeopleController < ApplicationController
7
+
8
+ scaffold 'Person'
9
+
10
+ def show
11
+ @person = Person.find params[:id]
12
+ end
13
+
14
+ end
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Created by Ritchie Young on 2007-05-15.
4
+ # Copyright (c) 2007. All rights reserved.
5
+
6
+ class RubySyncAssociationsController < ApplicationController
7
+
8
+ scaffold 'RubySyncAssociation'
9
+
10
+ end
@@ -0,0 +1,3 @@
1
+ # Methods added to this helper will be available to all templates in the application.
2
+ module ApplicationHelper
3
+ end
@@ -0,0 +1,5 @@
1
+ class Hobby < ActiveRecord::Base
2
+
3
+ has_many :interests
4
+ has_many :people, :through=>:interests
5
+ end
@@ -0,0 +1,6 @@
1
+ class Interest < ActiveRecord::Base
2
+
3
+ belongs_to :hobby
4
+ belongs_to :person
5
+
6
+ end
@@ -0,0 +1,9 @@
1
+ class Person < ActiveRecord::Base
2
+
3
+ has_many :ruby_sync_associations, :as=>:synchronizable, :dependent=>:destroy
4
+ has_many :interests
5
+ has_many :hobbies, :through=>:interests
6
+
7
+
8
+
9
+ end
@@ -0,0 +1,5 @@
1
+ class RubySyncAssociation < ActiveRecord::Base
2
+
3
+ belongs_to :synchronizable, :polymorphic=>true
4
+
5
+ end
@@ -0,0 +1,9 @@
1
+ class RubySyncEvent < ActiveRecord::Base
2
+
3
+ #belongs_to :trackable, :polymorphic=>true
4
+
5
+ has_many :operations,
6
+ :class_name => "RubySyncOperation",
7
+ :foreign_key => "ruby_sync_event_id"
8
+
9
+ end
@@ -0,0 +1,28 @@
1
+ class RubySyncObserver < ActiveRecord::Observer
2
+
3
+ observe Person
4
+
5
+ def after_create record
6
+ event = RubySyncEvent.create :timestamp=> Time.now,
7
+ :event_type=>'add',
8
+ :trackable_id=>record.id,
9
+ :trackable_type=>record.class.name,
10
+ :operations => RubySyncOperation.create_for(record, 'add')
11
+ end
12
+
13
+ def before_update record
14
+ RubySyncEvent.create :timestamp=> Time.now,
15
+ :event_type=>'modify',
16
+ :trackable_id=>record.id,
17
+ :trackable_type=>record.class.name,
18
+ :operations => RubySyncOperation.create_for(record, 'replace')
19
+ end
20
+
21
+ def after_destroy record
22
+ RubySyncEvent.create :timestamp=> Time.now,
23
+ :event_type=>'delete',
24
+ :trackable_id=>record.id,
25
+ :trackable_type=>record.class.name
26
+ end
27
+
28
+ end
@@ -0,0 +1,20 @@
1
+ class RubySyncOperation < ActiveRecord::Base
2
+
3
+ belongs_to :event,
4
+ :class_name => "RubySyncEvent",
5
+ :foreign_key => "ruby_sync_event_id"
6
+
7
+ has_many :values,
8
+ :class_name => "RubySyncValue",
9
+ :foreign_key => "ruby_sync_operation_id"
10
+
11
+
12
+ def self.create_for record, type
13
+ record.class.content_columns.map do |column|
14
+ values = [ RubySyncValue.new(:value=>record[column.name].to_s) ]
15
+ RubySyncOperation.new :operation=>type, :field_name=>column.name, :values=>values
16
+ end
17
+ end
18
+
19
+
20
+ end
@@ -0,0 +1,2 @@
1
+ class RubySyncState < ActiveRecord::Base
2
+ end
@@ -0,0 +1,7 @@
1
+ class RubySyncValue < ActiveRecord::Base
2
+
3
+ belongs_to :operation,
4
+ :class_name => "RubySyncOperation",
5
+ :foreign_key => "ruby_sync_operation_id"
6
+
7
+ end
@@ -0,0 +1,19 @@
1
+ <html>
2
+
3
+ <head></head>
4
+
5
+ <body>
6
+
7
+ <%= link_to "People", :controller=>:people %> |
8
+ <%= link_to "Interests", :controller=>:interests %> |
9
+ <%= link_to "Hobbies", :controller=>:hobbies %> |
10
+ <%= link_to "RubySyncAssociations", :controller=>:ruby_sync_associations %>
11
+
12
+
13
+ <hr/>
14
+ <%= yield %>
15
+
16
+
17
+
18
+ </body>
19
+ </html>
@@ -0,0 +1,18 @@
1
+ <h1><%="#{@person.first_name} #{@person.last_name}"%></h1>
2
+
3
+ <h2>Hobbies</h2>
4
+ <ul>
5
+ <% @person.hobbies.each do |hobby| %>
6
+ <li><%= hobby.name %></li>
7
+ <%end%>
8
+ </ul>
9
+
10
+
11
+ <h2>DirSync Associations</h2>
12
+ <ul>
13
+ <% @person.ruby_sync_associations.each do |assoc| %>
14
+ <li><%= "#{assoc.context}:#{assoc.key}" %>
15
+ <%= link_to "Delete", :action=>:delete%>
16
+ </li>
17
+ <%end%>
18
+ </ul>
@@ -0,0 +1,45 @@
1
+ # Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb
2
+
3
+ unless defined?(RAILS_ROOT)
4
+ root_path = File.join(File.dirname(__FILE__), '..')
5
+
6
+ unless RUBY_PLATFORM =~ /(:?mswin|mingw)/
7
+ require 'pathname'
8
+ root_path = Pathname.new(root_path).cleanpath(true).to_s
9
+ end
10
+
11
+ RAILS_ROOT = root_path
12
+ end
13
+
14
+ unless defined?(Rails::Initializer)
15
+ if File.directory?("#{RAILS_ROOT}/vendor/rails")
16
+ require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
17
+ else
18
+ require 'rubygems'
19
+
20
+ environment_without_comments = IO.readlines(File.dirname(__FILE__) + '/environment.rb').reject { |l| l =~ /^#/ }.join
21
+ environment_without_comments =~ /[^#]RAILS_GEM_VERSION = '([\d.]+)'/
22
+ rails_gem_version = $1
23
+
24
+ if version = defined?(RAILS_GEM_VERSION) ? RAILS_GEM_VERSION : rails_gem_version
25
+ # Asking for 1.1.6 will give you 1.1.6.5206, if available -- makes it easier to use beta gems
26
+ rails_gem = Gem.cache.search('rails', "~>#{version}.0").sort_by { |g| g.version.version }.last
27
+
28
+ if rails_gem
29
+ gem "rails", "=#{rails_gem.version.version}"
30
+ require rails_gem.full_gem_path + '/lib/initializer'
31
+ else
32
+ STDERR.puts %(Cannot find gem for Rails ~>#{version}.0:
33
+ Install the missing gem with 'gem install -v=#{version} rails', or
34
+ change environment.rb to define RAILS_GEM_VERSION with your desired version.
35
+ )
36
+ exit 1
37
+ end
38
+ else
39
+ gem "rails"
40
+ require 'initializer'
41
+ end
42
+ end
43
+
44
+ Rails::Initializer.run(:set_load_path)
45
+ end
@@ -0,0 +1,36 @@
1
+ # MySQL (default setup). Versions 4.1 and 5.0 are recommended.
2
+ #
3
+ # Install the MySQL driver:
4
+ # gem install mysql
5
+ # On MacOS X:
6
+ # gem install mysql -- --include=/usr/local/lib
7
+ # On Windows:
8
+ # gem install mysql
9
+ # Choose the win32 build.
10
+ # Install MySQL and put its /bin directory on your path.
11
+ #
12
+ # And be sure to use new-style password hashing:
13
+ # http://dev.mysql.com/doc/refman/5.0/en/old-client.html
14
+ development:
15
+ adapter: mysql
16
+ database: rubysync_development
17
+ username: root
18
+ password:
19
+ socket: /tmp/mysql.sock
20
+
21
+ # Warning: The database defined as 'test' will be erased and
22
+ # re-generated from your development database when you run 'rake'.
23
+ # Do not set this db to the same as development or production.
24
+ test:
25
+ adapter: mysql
26
+ database: rubysync_test
27
+ username: root
28
+ password:
29
+ socket: /tmp/mysql.sock
30
+
31
+ production:
32
+ adapter: mysql
33
+ database: ar_webapp_production
34
+ username: root
35
+ password:
36
+ socket: /tmp/mysql.sock
@@ -0,0 +1,61 @@
1
+ # Be sure to restart your web server when you modify this file.
2
+
3
+ # Uncomment below to force Rails into production mode when
4
+ # you don't control web/app server and can't set it the proper way
5
+ # ENV['RAILS_ENV'] ||= 'production'
6
+
7
+ # Specifies gem version of Rails to use when vendor/rails is not present
8
+ RAILS_GEM_VERSION = '1.2.3' unless defined? RAILS_GEM_VERSION
9
+
10
+ # Bootstrap the Rails environment, frameworks, and default configuration
11
+ require File.join(File.dirname(__FILE__), 'boot')
12
+
13
+ Rails::Initializer.run do |config|
14
+ # Settings in config/environments/* take precedence over those specified here
15
+
16
+ # Skip frameworks you're not going to use (only works if using vendor/rails)
17
+ # config.frameworks -= [ :action_web_service, :action_mailer ]
18
+
19
+ # Only load the plugins named here, by default all plugins in vendor/plugins are loaded
20
+ # config.plugins = %W( exception_notification ssl_requirement )
21
+
22
+ # Add additional load paths for your own custom dirs
23
+ # config.load_paths += %W( #{RAILS_ROOT}/extras )
24
+
25
+ # Force all environments to use the same logger level
26
+ # (by default production uses :info, the others :debug)
27
+ # config.log_level = :debug
28
+
29
+ # Use the database for sessions instead of the file system
30
+ # (create the session table with 'rake db:sessions:create')
31
+ # config.action_controller.session_store = :active_record_store
32
+
33
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
34
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
35
+ # like if you have constraints or database-specific column types
36
+ # config.active_record.schema_format = :sql
37
+
38
+ # Activate observers that should always be running
39
+ # config.active_record.observers = :cacher, :garbage_collector
40
+ config.active_record.observers = :ruby_sync_observer
41
+
42
+ # Make Active Record use UTC-base instead of local time
43
+ # config.active_record.default_timezone = :utc
44
+
45
+ # See Rails::Configuration for more options
46
+ end
47
+
48
+ # Add new inflection rules using the following format
49
+ # (all these examples are active by default):
50
+ # Inflector.inflections do |inflect|
51
+ # inflect.plural /^(ox)$/i, '\1en'
52
+ # inflect.singular /^(ox)en/i, '\1'
53
+ # inflect.irregular 'person', 'people'
54
+ # inflect.uncountable %w( fish sheep )
55
+ # end
56
+
57
+ # Add new mime types for use in respond_to blocks:
58
+ # Mime::Type.register "text/richtext", :rtf
59
+ # Mime::Type.register "application/x-mobile", :mobile
60
+
61
+ # Include your application configuration below
@@ -0,0 +1,21 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
3
+ # In the development environment your application's code is reloaded on
4
+ # every request. This slows down response time but is perfect for development
5
+ # since you don't have to restart the webserver when you make code changes.
6
+ config.cache_classes = false
7
+
8
+ # Log error messages when you accidentally call methods on nil.
9
+ config.whiny_nils = true
10
+
11
+ # Enable the breakpoint server that script/breakpointer connects to
12
+ config.breakpoint_server = true
13
+
14
+ # Show full error reports and disable caching
15
+ config.action_controller.consider_all_requests_local = true
16
+ config.action_controller.perform_caching = false
17
+ config.action_view.cache_template_extensions = false
18
+ config.action_view.debug_rjs = true
19
+
20
+ # Don't care if the mailer can't send
21
+ config.action_mailer.raise_delivery_errors = false
@@ -0,0 +1,18 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
3
+ # The production environment is meant for finished, "live" apps.
4
+ # Code is not reloaded between requests
5
+ config.cache_classes = true
6
+
7
+ # Use a different logger for distributed setups
8
+ # config.logger = SyslogLogger.new
9
+
10
+ # Full error reports are disabled and caching is turned on
11
+ config.action_controller.consider_all_requests_local = false
12
+ config.action_controller.perform_caching = true
13
+
14
+ # Enable serving of images, stylesheets, and javascripts from an asset server
15
+ # config.action_controller.asset_host = "http://assets.example.com"
16
+
17
+ # Disable delivery errors, bad email addresses will be ignored
18
+ # config.action_mailer.raise_delivery_errors = false
@@ -0,0 +1,19 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
3
+ # The test environment is used exclusively to run your application's
4
+ # test suite. You never need to work with it otherwise. Remember that
5
+ # your test database is "scratch space" for the test suite and is wiped
6
+ # and recreated between test runs. Don't rely on the data there!
7
+ config.cache_classes = true
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.action_controller.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Tell ActionMailer not to deliver emails to the real world.
17
+ # The :test delivery method accumulates sent emails in the
18
+ # ActionMailer::Base.deliveries array.
19
+ config.action_mailer.delivery_method = :test
@@ -0,0 +1,23 @@
1
+ ActionController::Routing::Routes.draw do |map|
2
+ # The priority is based upon order of creation: first created -> highest priority.
3
+
4
+ # Sample of regular route:
5
+ # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
6
+ # Keep in mind you can assign values other than :controller and :action
7
+
8
+ # Sample of named route:
9
+ # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
10
+ # This route can be invoked with purchase_url(:id => product.id)
11
+
12
+ # You can have the root of your site routed by hooking up ''
13
+ # -- just remember to delete public/index.html.
14
+ # map.connect '', :controller => "welcome"
15
+
16
+ # Allow downloading Web Service WSDL as a file with an extension
17
+ # instead of a file named 'wsdl'
18
+ map.connect ':controller/service.wsdl', :action => 'wsdl'
19
+
20
+ # Install the default route as the lowest priority.
21
+ map.connect ':controller/:action/:id.:format'
22
+ map.connect ':controller/:action/:id'
23
+ end
@@ -0,0 +1,12 @@
1
+ class CreatePeople < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :people do |t|
4
+ t.column :first_name, :string
5
+ t.column :last_name, :string
6
+ end
7
+ end
8
+
9
+ def self.down
10
+ drop_table :people
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ class CreateInterests < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :interests do |t|
4
+ t.column :person_id, :integer
5
+ t.column :hobby_id, :integer
6
+ end
7
+ end
8
+
9
+ def self.down
10
+ drop_table :interests
11
+ end
12
+ end
@@ -0,0 +1,11 @@
1
+ class CreateHobbies < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :hobbies do |t|
4
+ t.column :name, :string
5
+ end
6
+ end
7
+
8
+ def self.down
9
+ drop_table :hobbies
10
+ end
11
+ end