interlock 1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. data/CHANGELOG +2 -0
  2. data/LICENSE +184 -0
  3. data/Manifest +89 -0
  4. data/README +168 -0
  5. data/TODO +3 -0
  6. data/examples/memcached.yml +10 -0
  7. data/init.rb +2 -0
  8. data/interlock.gemspec +52 -0
  9. data/lib/interlock/action_controller.rb +123 -0
  10. data/lib/interlock/action_view.rb +34 -0
  11. data/lib/interlock/active_record.rb +29 -0
  12. data/lib/interlock/config.rb +78 -0
  13. data/lib/interlock/core_extensions.rb +64 -0
  14. data/lib/interlock/interlock.rb +112 -0
  15. data/lib/interlock/memcached.rb +30 -0
  16. data/lib/interlock.rb +25 -0
  17. data/test/integration/app/README +203 -0
  18. data/test/integration/app/Rakefile +10 -0
  19. data/test/integration/app/app/controllers/application.rb +10 -0
  20. data/test/integration/app/app/controllers/eval_controller.rb +7 -0
  21. data/test/integration/app/app/controllers/items_controller.rb +32 -0
  22. data/test/integration/app/app/helpers/application_helper.rb +3 -0
  23. data/test/integration/app/app/helpers/eval_helper.rb +2 -0
  24. data/test/integration/app/app/helpers/items_helper.rb +2 -0
  25. data/test/integration/app/app/models/item.rb +2 -0
  26. data/test/integration/app/app/views/items/list.html.erb +10 -0
  27. data/test/integration/app/app/views/items/recent.html.erb +14 -0
  28. data/test/integration/app/app/views/items/show.html.erb +8 -0
  29. data/test/integration/app/app/views/shared/_related.html.erb +6 -0
  30. data/test/integration/app/config/boot.rb +108 -0
  31. data/test/integration/app/config/database.yml +24 -0
  32. data/test/integration/app/config/environment.rb +25 -0
  33. data/test/integration/app/config/environments/development.rb +8 -0
  34. data/test/integration/app/config/environments/production.rb +18 -0
  35. data/test/integration/app/config/environments/test.rb +22 -0
  36. data/test/integration/app/config/initializers/inflections.rb +10 -0
  37. data/test/integration/app/config/initializers/mime_types.rb +5 -0
  38. data/test/integration/app/config/memcached.yml +9 -0
  39. data/test/integration/app/config/routes.rb +35 -0
  40. data/test/integration/app/coverage/cache-43041 +0 -0
  41. data/test/integration/app/coverage/index.html +414 -0
  42. data/test/integration/app/coverage/vendor-plugins-interlock-lib-interlock-action_controller_rb.html +733 -0
  43. data/test/integration/app/coverage/vendor-plugins-interlock-lib-interlock-action_view_rb.html +644 -0
  44. data/test/integration/app/coverage/vendor-plugins-interlock-lib-interlock-active_record_rb.html +639 -0
  45. data/test/integration/app/coverage/vendor-plugins-interlock-lib-interlock-config_rb.html +688 -0
  46. data/test/integration/app/coverage/vendor-plugins-interlock-lib-interlock-core_extensions_rb.html +674 -0
  47. data/test/integration/app/coverage/vendor-plugins-interlock-lib-interlock-interlock_rb.html +722 -0
  48. data/test/integration/app/coverage/vendor-plugins-interlock-lib-interlock-memcached_rb.html +640 -0
  49. data/test/integration/app/coverage/vendor-plugins-interlock-lib-interlock_rb.html +635 -0
  50. data/test/integration/app/db/migrate/001_create_items.rb +13 -0
  51. data/test/integration/app/db/schema.rb +21 -0
  52. data/test/integration/app/doc/README_FOR_APP +2 -0
  53. data/test/integration/app/public/404.html +30 -0
  54. data/test/integration/app/public/422.html +30 -0
  55. data/test/integration/app/public/500.html +30 -0
  56. data/test/integration/app/public/dispatch.cgi +10 -0
  57. data/test/integration/app/public/dispatch.fcgi +24 -0
  58. data/test/integration/app/public/dispatch.rb +10 -0
  59. data/test/integration/app/public/favicon.ico +0 -0
  60. data/test/integration/app/public/images/rails.png +0 -0
  61. data/test/integration/app/public/index.html +277 -0
  62. data/test/integration/app/public/javascripts/application.js +2 -0
  63. data/test/integration/app/public/javascripts/controls.js +963 -0
  64. data/test/integration/app/public/javascripts/dragdrop.js +972 -0
  65. data/test/integration/app/public/javascripts/effects.js +1120 -0
  66. data/test/integration/app/public/javascripts/prototype.js +4200 -0
  67. data/test/integration/app/public/robots.txt +5 -0
  68. data/test/integration/app/script/about +3 -0
  69. data/test/integration/app/script/console +3 -0
  70. data/test/integration/app/script/destroy +3 -0
  71. data/test/integration/app/script/generate +3 -0
  72. data/test/integration/app/script/performance/benchmarker +3 -0
  73. data/test/integration/app/script/performance/profiler +3 -0
  74. data/test/integration/app/script/performance/request +3 -0
  75. data/test/integration/app/script/plugin +3 -0
  76. data/test/integration/app/script/process/inspector +3 -0
  77. data/test/integration/app/script/process/reaper +3 -0
  78. data/test/integration/app/script/process/spawner +3 -0
  79. data/test/integration/app/script/runner +3 -0
  80. data/test/integration/app/script/server +3 -0
  81. data/test/integration/app/test/fixtures/items.yml +13 -0
  82. data/test/integration/app/test/functional/eval_controller_test.rb +10 -0
  83. data/test/integration/app/test/functional/items_controller_test.rb +10 -0
  84. data/test/integration/app/test/test_helper.rb +9 -0
  85. data/test/integration/app/test/unit/item_test.rb +8 -0
  86. data/test/integration/server_test.rb +161 -0
  87. data/test/setup.rb +15 -0
  88. data/test/teardown.rb +4 -0
  89. data/test/test_helper.rb +13 -0
  90. data/test/unit/memcached_test.rb +45 -0
  91. data.tar.gz.sig +0 -0
  92. metadata +172 -0
  93. metadata.gz.sig +1 -0
@@ -0,0 +1,8 @@
1
+
2
+ <h1>Show</h1>
3
+ <% view_cache Item => :id do %>
4
+ <h3><%= @item.name %></h3>
5
+ <p><%= @item.description %></p>
6
+ <% end %>
7
+
8
+ <%= render :partial => 'shared/related' %>
@@ -0,0 +1,6 @@
1
+
2
+ <% view_cache :ignore => :all, :tag => 'related' do %>
3
+ <hr>
4
+ <h3>Related</h3>
5
+ <p><i><%= @related %></i></p>
6
+ <% end %>
@@ -0,0 +1,108 @@
1
+ # Don't change this file!
2
+ # Configure your app in config/environment.rb and config/environments/*.rb
3
+
4
+ RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
5
+
6
+ module Rails
7
+ class << self
8
+ def boot!
9
+ unless booted?
10
+ preinitialize
11
+ pick_boot.run
12
+ end
13
+ end
14
+
15
+ def booted?
16
+ defined? Rails::Initializer
17
+ end
18
+
19
+ def pick_boot
20
+ (vendor_rails? ? VendorBoot : GemBoot).new
21
+ end
22
+
23
+ def vendor_rails?
24
+ File.exist?("#{RAILS_ROOT}/vendor/rails")
25
+ end
26
+
27
+ def preinitialize
28
+ load(preinitializer_path) if File.exists?(preinitializer_path)
29
+ end
30
+
31
+ def preinitializer_path
32
+ "#{RAILS_ROOT}/config/preinitializer.rb"
33
+ end
34
+ end
35
+
36
+ class Boot
37
+ def run
38
+ load_initializer
39
+ Rails::Initializer.run(:set_load_path)
40
+ end
41
+ end
42
+
43
+ class VendorBoot < Boot
44
+ def load_initializer
45
+ require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
46
+ end
47
+ end
48
+
49
+ class GemBoot < Boot
50
+ def load_initializer
51
+ self.class.load_rubygems
52
+ load_rails_gem
53
+ require 'initializer'
54
+ end
55
+
56
+ def load_rails_gem
57
+ if version = self.class.gem_version
58
+ gem 'rails', version
59
+ else
60
+ gem 'rails'
61
+ end
62
+ rescue Gem::LoadError => load_error
63
+ $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
64
+ exit 1
65
+ end
66
+
67
+ class << self
68
+ def rubygems_version
69
+ Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion
70
+ end
71
+
72
+ def gem_version
73
+ if defined? RAILS_GEM_VERSION
74
+ RAILS_GEM_VERSION
75
+ elsif ENV.include?('RAILS_GEM_VERSION')
76
+ ENV['RAILS_GEM_VERSION']
77
+ else
78
+ parse_gem_version(read_environment_rb)
79
+ end
80
+ end
81
+
82
+ def load_rubygems
83
+ require 'rubygems'
84
+
85
+ unless rubygems_version >= '0.9.4'
86
+ $stderr.puts %(Rails requires RubyGems >= 0.9.4 (you have #{rubygems_version}). Please `gem update --system` and try again.)
87
+ exit 1
88
+ end
89
+
90
+ rescue LoadError
91
+ $stderr.puts %(Rails requires RubyGems >= 0.9.4. Please install RubyGems and try again: http://rubygems.rubyforge.org)
92
+ exit 1
93
+ end
94
+
95
+ def parse_gem_version(text)
96
+ $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*'([!~<>=]*\s*[\d.]+)'/
97
+ end
98
+
99
+ private
100
+ def read_environment_rb
101
+ File.read("#{RAILS_ROOT}/config/environment.rb")
102
+ end
103
+ end
104
+ end
105
+ end
106
+
107
+ # All that for this:
108
+ Rails.boot!
@@ -0,0 +1,24 @@
1
+
2
+ development:
3
+ adapter: mysql
4
+ encoding: utf8
5
+ database: interlock_development
6
+ username: root
7
+ password:
8
+ socket: /tmp/mysql.sock
9
+
10
+ test:
11
+ adapter: mysql
12
+ encoding: utf8
13
+ database: interlock_test
14
+ username: root
15
+ password:
16
+ socket: /tmp/mysql.sock
17
+
18
+ production:
19
+ adapter: mysql
20
+ encoding: utf8
21
+ database: interlock_production
22
+ username: root
23
+ password:
24
+ socket: /tmp/mysql.sock
@@ -0,0 +1,25 @@
1
+
2
+ RAILS_GEM_VERSION = ENV['MULTIRAILS_RAILS_VERSION'] if ENV['MULTIRAILS_RAILS_VERSION']
3
+
4
+ require File.join(File.dirname(__FILE__), 'boot')
5
+ require 'action_controller'
6
+
7
+ Rails::Initializer.run do |config|
8
+
9
+ if ActionController::Base.respond_to? 'session='
10
+ config.action_controller.session = {:session_key => '_app_session', :secret => '22cde4d5c1a61ba69a817953'}
11
+ end
12
+
13
+ # config.to_prepare do
14
+ # RAILS_DEFAULT_LOGGER.info "** interlock dependencies:"
15
+ # Interlock.dependencies.each do |klass, list|
16
+ # RAILS_DEFAULT_LOGGER.info " #{klass}:"
17
+ # list.each do |key, scope|
18
+ # RAILS_DEFAULT_LOGGER.info " #{key} => #{scope.inspect}"
19
+ # end
20
+ # end
21
+ # end
22
+
23
+ end
24
+
25
+ ENV['RAILS_ASSET_ID'] = rand.to_s
@@ -0,0 +1,8 @@
1
+
2
+ config.cache_classes = ENV['PRODUCTION']
3
+ config.whiny_nils = true
4
+ config.action_controller.consider_all_requests_local = !ENV['PRODUCTION']
5
+ config.action_controller.perform_caching = true
6
+ config.action_view.cache_template_extensions = ENV['PRODUCTION']
7
+ config.action_view.debug_rjs = !ENV['PRODUCTION']
8
+ 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,22 @@
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
+ # Disable request forgery protection in test environment
17
+ config.action_controller.allow_forgery_protection = false
18
+
19
+ # Tell ActionMailer not to deliver emails to the real world.
20
+ # The :test delivery method accumulates sent emails in the
21
+ # ActionMailer::Base.deliveries array.
22
+ config.action_mailer.delivery_method = :test
@@ -0,0 +1,10 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,9 @@
1
+ defaults:
2
+ ttl: 30
3
+ namespace: interlock
4
+ sessions: true
5
+
6
+ development:
7
+ servers:
8
+ - localhost:43042
9
+ - localhost:43043
@@ -0,0 +1,35 @@
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
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
13
+ # map.resources :products
14
+
15
+ # Sample resource route with options:
16
+ # map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
17
+
18
+ # Sample resource route with sub-resources:
19
+ # map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
20
+
21
+ # Sample resource route within a namespace:
22
+ # map.namespace :admin do |admin|
23
+ # # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
24
+ # admin.resources :products
25
+ # end
26
+
27
+ # You can have the root of your site routed with map.root -- just remember to delete public/index.html.
28
+ # map.root :controller => "welcome"
29
+
30
+ # See how all your routes lay out with "rake routes"
31
+
32
+ # Install the default routes as the lowest priority.
33
+ map.connect ':controller/:action/:id'
34
+ map.connect ':controller/:action/:id.:format'
35
+ end