Permalink
Browse files

Remove old AR2.1 test application

  • Loading branch information...
1 parent 263155c commit dd1c7ae832345fb7a4a4f9bda6f775a956f757fc @mperham mperham committed Nov 21, 2010
Showing with 0 additions and 923 deletions.
  1. +0 −58 example/Rakefile
  2. +0 −22 example/app/controllers/accounts_controller.rb
  3. +0 −39 example/app/controllers/application.rb
  4. +0 −8 example/app/controllers/figments_controller.rb
  5. +0 −2 example/app/helpers/accounts_helper.rb
  6. +0 −3 example/app/helpers/application_helper.rb
  7. +0 −2 example/app/helpers/figments_helper.rb
  8. +0 −3 example/app/models/account.rb
  9. +0 −4 example/app/models/figment.rb
  10. +0 −47 example/app/views/accounts/index.html.erb
  11. +0 −8 example/app/views/layouts/application.html.erb
  12. +0 −109 example/config/boot.rb
  13. +0 −21 example/config/database.yml
  14. +0 −67 example/config/environment.rb
  15. +0 −17 example/config/environments/development.rb
  16. +0 −22 example/config/environments/production.rb
  17. +0 −22 example/config/environments/test.rb
  18. +0 −10 example/config/initializers/inflections.rb
  19. +0 −5 example/config/initializers/mime_types.rb
  20. +0 −15 example/config/initializers/new_rails_defaults.rb
  21. +0 −45 example/config/routes.rb
  22. +0 −14 example/db/migrate/20080702154628_create_accounts.rb
  23. +0 −14 example/db/migrate/20080702154820_create_figments.rb
  24. +0 −28 example/db/schema.rb
  25. +0 −30 example/public/404.html
  26. +0 −30 example/public/422.html
  27. +0 −30 example/public/500.html
  28. +0 −10 example/public/dispatch.cgi
  29. +0 −24 example/public/dispatch.fcgi
  30. +0 −10 example/public/dispatch.rb
  31. 0 example/public/favicon.ico
  32. BIN example/public/images/rails.png
  33. +0 −5 example/public/robots.txt
  34. +0 −3 example/script/about
  35. +0 −3 example/script/console
  36. +0 −3 example/script/dbconsole
  37. +0 −3 example/script/destroy
  38. +0 −3 example/script/generate
  39. +0 −3 example/script/performance/benchmarker
  40. +0 −3 example/script/performance/profiler
  41. +0 −3 example/script/performance/request
  42. +0 −3 example/script/plugin
  43. +0 −3 example/script/process/inspector
  44. +0 −3 example/script/process/reaper
  45. +0 −3 example/script/process/spawner
  46. +0 −3 example/script/runner
  47. +0 −3 example/script/server
  48. +0 −7 example/test/fixtures/accounts.yml
  49. +0 −12 example/test/functional/accounts_controller_test.rb
  50. +0 −97 example/test/integration/account_figments_test.rb
  51. +0 −41 example/test/test_helper.rb
View
@@ -1,58 +0,0 @@
-# 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.join(File.dirname(__FILE__), 'config', 'boot'))
-
-require 'rake'
-require 'rake/testtask'
-require 'rake/rdoctask'
-require 'tasks/rails'
-
-require 'fileutils'
-include FileUtils::Verbose
-
-namespace :db do
- task :migrate do
- require 'erb'
- require 'logger'
- require 'active_record'
- reference = YAML::load(ERB.new(IO.read("config/database.yml")).result)
- env = RAILS_ENV = ENV['RAILS_ENV'] || 'development'
- ActiveRecord::Base.logger = Logger.new(STDOUT)
- ActiveRecord::Base.logger.level = Logger::WARN
- ActiveRecord::Base.configurations = reference.dup
- old_config = reference[env]
- reference.each_key do |name|
- next unless name.include? env
- next if name.include? 'slave' # Replicated databases should not be touched directly
-
- puts "Migrating #{name}"
- ActiveRecord::Base.clear_active_connections!
- ActiveRecord::Base.configurations[env] = reference[name]
- ActiveRecord::Base.establish_connection RAILS_ENV
- ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
- ActiveRecord::Migrator.migrate("db/migrate/", ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
- end
- end
-end
-
-namespace :app do
- task :prepare => [:clean, :copy_plugin, :migrate]
-
- task :copy_plugin do
- mkdir_p 'vendor/plugins/data_fabric'
- cp_r '../lib', 'vendor/plugins/data_fabric'
- cp '../init.rb', 'vendor/plugins/data_fabric'
- end
-
- task :clean do
- rm_rf 'vendor/plugins/data_fabric'
- rm_f 'db/*.sqlite3'
- end
-
- task :migrate do
- sh "rake db:migrate"
- sh "rake RAILS_ENV=test db:migrate"
- end
-end
-
@@ -1,22 +0,0 @@
-class AccountsController < ApplicationController
- layout 'application'
-
- def index
- @accounts = Account.find(:all)
- end
-
- def choose
- @account = Account.find(params[:id])
- if @account
- session[:account_id] = @account.id
- flash[:notice] = "Selected account: #{@account.name}"
- end
- redirect_to '/'
- end
-
- def create
- Account.create!(params[:acct])
- flash[:notice] = "Account created successfully"
- redirect_to '/'
- end
-end
@@ -1,39 +0,0 @@
-# Filters added to this controller apply to all controllers in the application.
-# Likewise, all the methods added will be available for all controllers.
-
-class ApplicationController < ActionController::Base
- helper :all # include all helpers, all the time
-
- # See ActionController::RequestForgeryProtection for details
- # Uncomment the :secret if you're not using the cookie session store
- protect_from_forgery # :secret => '44f8cf8a0491c23ae99c031a900123cc'
-
- # See ActionController::Base for details
- # Uncomment this to filter the contents of submitted sensitive data parameters
- # from your application log (in this case, all fields with names like "password").
- # filter_parameter_logging :password
-
- before_filter :find_account
- around_filter :select_shard
-
- private
- def find_account
- aid = session[:account_id]
- if aid && aid.to_i != 0
- begin
- @account = Account.find(Integer(aid))
- rescue ActiveRecord::RecordNotFound => e
- RAILS_DEFAULT_LOGGER.warn "No such account #{aid}, skipping..."
- end
- end
- session[:account_id] = nil unless @account
- end
-
- def select_shard(&block)
- if @account
- DataFabric.activate_shard(:shard => @account.shard, &block)
- else
- yield
- end
- end
-end
@@ -1,8 +0,0 @@
-class FigmentsController < ApplicationController
-
- def create
- @account.figments.create!(params[:figment])
- flash[:notice] = "Figment created"
- redirect_to '/'
- end
-end
@@ -1,2 +0,0 @@
-module AccountsHelper
-end
@@ -1,3 +0,0 @@
-# Methods added to this helper will be available to all templates in the application.
-module ApplicationHelper
-end
@@ -1,2 +0,0 @@
-module FigmentsHelper
-end
@@ -1,3 +0,0 @@
-class Account < ActiveRecord::Base
- has_many :figments
-end
@@ -1,4 +0,0 @@
-class Figment < ActiveRecord::Base
- data_fabric :shard_by => 'shard', :replicated => false
- belongs_to :account
-end
@@ -1,47 +0,0 @@
-<hr/>
-<h2>Accounts</h2>
-<table>
- <thead>
- <tr><th>ID</th><th>Name</th><th>Shard</th><th>&nbsp;</th></tr>
- </thead>
- <tbody>
-<% @accounts.each do |account| %>
- <tr>
- <td><%= account.id %></td>
- <td><%= account.name %></td>
- <td><%= account.shard %></td>
- <td><%= link_to 'Choose', choose_account_path(account) %></td>
- </tr>
-<% end %>
- </tbody>
-</table>
-<hr/>
-<h2>New Account</h2>
-<p>
-<% form_for :acct, :url => accounts_path do |f| %>
- Name : <%= f.text_field :name %><br/>
- Shard: <%= select 'acct', 'shard', [[0,0],[1,1]] %><br/>
- <%= submit_tag 'Save' %>
-<% end %>
-</p>
-<hr/>
-<% if @account %>
-<h2>Current Account: <%= @account.name %></h2>
- <table>
- <thead>
- <tr><th>ID</th><th>Account</th><th>Value</th></tr>
- </thead>
- <tbody>
- <% @account.figments.each do |fig| %>
- <tr>
- <td><%= fig.id %></td>
- <td><%= fig.account.name %></td>
- <td><%= fig.value %></td>
- </tr>
- <% end %>
- </tbody>
- </table>
- Add Fig: <% form_for :figment, :url => figments_path do |f| %><%= f.text_field :value %><%= submit_tag 'Save' %><% end %>
-<% else %>
- <em>No account selected.</em>
-<% end %>
@@ -1,8 +0,0 @@
-<html>
- <body>
- <div id='flash' style="background-color: #DDFFDD;">
- <%= flash[:notice] %>
- </div>
- <%= yield %>
- </body>
-</html>
View
@@ -1,109 +0,0 @@
-# Don't change this file!
-# Configure your app in config/environment.rb and config/environments/*.rb
-
-RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
-
-module Rails
- class << self
- def boot!
- unless booted?
- preinitialize
- pick_boot.run
- end
- end
-
- def booted?
- defined? Rails::Initializer
- end
-
- def pick_boot
- (vendor_rails? ? VendorBoot : GemBoot).new
- end
-
- def vendor_rails?
- File.exist?("#{RAILS_ROOT}/vendor/rails")
- end
-
- def preinitialize
- load(preinitializer_path) if File.exist?(preinitializer_path)
- end
-
- def preinitializer_path
- "#{RAILS_ROOT}/config/preinitializer.rb"
- end
- end
-
- class Boot
- def run
- load_initializer
- Rails::Initializer.run(:set_load_path)
- end
- end
-
- class VendorBoot < Boot
- def load_initializer
- require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
- Rails::Initializer.run(:install_gem_spec_stubs)
- end
- end
-
- class GemBoot < Boot
- def load_initializer
- self.class.load_rubygems
- load_rails_gem
- require 'initializer'
- end
-
- def load_rails_gem
- if version = self.class.gem_version
- gem 'rails', version
- else
- gem 'rails'
- end
- rescue Gem::LoadError => load_error
- $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.)
- exit 1
- end
-
- class << self
- def rubygems_version
- Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion
- end
-
- def gem_version
- if defined? RAILS_GEM_VERSION
- RAILS_GEM_VERSION
- elsif ENV.include?('RAILS_GEM_VERSION')
- ENV['RAILS_GEM_VERSION']
- else
- parse_gem_version(read_environment_rb)
- end
- end
-
- def load_rubygems
- require 'rubygems'
-
- unless rubygems_version >= '0.9.4'
- $stderr.puts %(Rails requires RubyGems >= 0.9.4 (you have #{rubygems_version}). Please `gem update --system` and try again.)
- exit 1
- end
-
- rescue LoadError
- $stderr.puts %(Rails requires RubyGems >= 0.9.4. Please install RubyGems and try again: http://rubygems.rubyforge.org)
- exit 1
- end
-
- def parse_gem_version(text)
- $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
- end
-
- private
- def read_environment_rb
- File.read("#{RAILS_ROOT}/config/environment.rb")
- end
- end
- end
-end
-
-# All that for this:
-Rails.boot!
@@ -1,21 +0,0 @@
-# SQLite version 3.x
-# gem install sqlite3-ruby (not necessary on OS X Leopard)
-
-<% %w(development test production).each do |env| %>
-
-<%= env %>:
- adapter: sqlite3
- database: <%= "db/#{env}.sqlite3" %>
- timeout: 5000
-
-<%= "shard_0_#{env}" %>:
- adapter: sqlite3
- database: <%= "db/s0_#{env}.sqlite3" %>
- timeout: 5000
-
-<%= "shard_1_#{env}" %>:
- adapter: sqlite3
- database: <%= "db/s1_#{env}.sqlite3" %>
- timeout: 5000
-
-<% end %>
Oops, something went wrong.

0 comments on commit dd1c7ae

Please sign in to comment.