Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding episode 277

  • Loading branch information...
commit 7952d134c5832462d3962f6ad13799c413ab7a43 1 parent b5db06c
@ryanb authored
Showing with 848 additions and 0 deletions.
  1. +14 −0 episode-277/README
  2. +6 −0 episode-277/uhoh-after/.gitignore
  3. +12 −0 episode-277/uhoh-after/Gemfile
  4. +93 −0 episode-277/uhoh-after/Gemfile.lock
  5. +20 −0 episode-277/uhoh-after/MIT-LICENSE
  6. +20 −0 episode-277/uhoh-after/README.rdoc
  7. +39 −0 episode-277/uhoh-after/Rakefile
  8. 0  episode-277/uhoh-after/app/assets/images/uhoh/.gitkeep
  9. BIN  episode-277/uhoh-after/app/assets/images/uhoh/alert.png
  10. +9 −0 episode-277/uhoh-after/app/assets/javascripts/uhoh/application.js
  11. +5 −0 episode-277/uhoh-after/app/assets/javascripts/uhoh/failures.js
  12. +7 −0 episode-277/uhoh-after/app/assets/stylesheets/uhoh/application.css
  13. +29 −0 episode-277/uhoh-after/app/assets/stylesheets/uhoh/failures.css
  14. +4 −0 episode-277/uhoh-after/app/controllers/uhoh/application_controller.rb
  15. +7 −0 episode-277/uhoh-after/app/controllers/uhoh/failures_controller.rb
  16. +4 −0 episode-277/uhoh-after/app/helpers/uhoh/application_helper.rb
  17. +4 −0 episode-277/uhoh-after/app/helpers/uhoh/failures_helper.rb
  18. +4 −0 episode-277/uhoh-after/app/models/uhoh/failure.rb
  19. +14 −0 episode-277/uhoh-after/app/views/layouts/uhoh/application.html.erb
  20. +11 −0 episode-277/uhoh-after/app/views/uhoh/failures/index.html.erb
  21. +6 −0 episode-277/uhoh-after/config/initializers/exception_handler.rb
  22. +3 −0  episode-277/uhoh-after/config/routes.rb
  23. +9 −0 episode-277/uhoh-after/db/migrate/20110727184726_create_uhoh_failures.rb
  24. +4 −0 episode-277/uhoh-after/lib/tasks/uhoh_tasks.rake
  25. +4 −0 episode-277/uhoh-after/lib/uhoh.rb
  26. +5 −0 episode-277/uhoh-after/lib/uhoh/engine.rb
  27. +6 −0 episode-277/uhoh-after/script/rails
  28. +7 −0 episode-277/uhoh-after/test/dummy/Rakefile
  29. +9 −0 episode-277/uhoh-after/test/dummy/app/assets/javascripts/application.js
  30. +2 −0  episode-277/uhoh-after/test/dummy/app/assets/javascripts/simulate.js
  31. +7 −0 episode-277/uhoh-after/test/dummy/app/assets/stylesheets/application.css
  32. +4 −0 episode-277/uhoh-after/test/dummy/app/assets/stylesheets/simulate.css
  33. +3 −0  episode-277/uhoh-after/test/dummy/app/controllers/application_controller.rb
  34. +6 −0 episode-277/uhoh-after/test/dummy/app/controllers/simulate_controller.rb
  35. +2 −0  episode-277/uhoh-after/test/dummy/app/helpers/application_helper.rb
  36. +2 −0  episode-277/uhoh-after/test/dummy/app/helpers/simulate_helper.rb
  37. 0  episode-277/uhoh-after/test/dummy/app/mailers/.gitkeep
  38. 0  episode-277/uhoh-after/test/dummy/app/models/.gitkeep
  39. +14 −0 episode-277/uhoh-after/test/dummy/app/views/layouts/application.html.erb
  40. +2 −0  episode-277/uhoh-after/test/dummy/app/views/simulate/failure.html.erb
  41. +4 −0 episode-277/uhoh-after/test/dummy/config.ru
  42. +42 −0 episode-277/uhoh-after/test/dummy/config/application.rb
  43. +10 −0 episode-277/uhoh-after/test/dummy/config/boot.rb
  44. +25 −0 episode-277/uhoh-after/test/dummy/config/database.yml
  45. +5 −0 episode-277/uhoh-after/test/dummy/config/environment.rb
  46. +27 −0 episode-277/uhoh-after/test/dummy/config/environments/development.rb
  47. +51 −0 episode-277/uhoh-after/test/dummy/config/environments/production.rb
  48. +39 −0 episode-277/uhoh-after/test/dummy/config/environments/test.rb
  49. +7 −0 episode-277/uhoh-after/test/dummy/config/initializers/backtrace_silencers.rb
  50. +10 −0 episode-277/uhoh-after/test/dummy/config/initializers/inflections.rb
  51. +5 −0 episode-277/uhoh-after/test/dummy/config/initializers/mime_types.rb
  52. +7 −0 episode-277/uhoh-after/test/dummy/config/initializers/secret_token.rb
  53. +8 −0 episode-277/uhoh-after/test/dummy/config/initializers/session_store.rb
  54. +12 −0 episode-277/uhoh-after/test/dummy/config/initializers/wrap_parameters.rb
  55. +5 −0 episode-277/uhoh-after/test/dummy/config/locales/en.yml
  56. +6 −0 episode-277/uhoh-after/test/dummy/config/routes.rb
  57. +21 −0 episode-277/uhoh-after/test/dummy/db/schema.rb
  58. 0  episode-277/uhoh-after/test/dummy/lib/assets/.gitkeep
  59. 0  episode-277/uhoh-after/test/dummy/log/.gitkeep
  60. +26 −0 episode-277/uhoh-after/test/dummy/public/404.html
  61. +26 −0 episode-277/uhoh-after/test/dummy/public/422.html
  62. +26 −0 episode-277/uhoh-after/test/dummy/public/500.html
  63. 0  episode-277/uhoh-after/test/dummy/public/favicon.ico
  64. +6 −0 episode-277/uhoh-after/test/dummy/script/rails
  65. +9 −0 episode-277/uhoh-after/test/dummy/test/functional/simulate_controller_test.rb
  66. +4 −0 episode-277/uhoh-after/test/dummy/test/unit/helpers/simulate_helper_test.rb
  67. +7 −0 episode-277/uhoh-after/test/fixtures/uhoh/failures.yml
  68. +11 −0 episode-277/uhoh-after/test/functional/uhoh/failures_controller_test.rb
  69. +10 −0 episode-277/uhoh-after/test/integration/navigation_test.rb
  70. +10 −0 episode-277/uhoh-after/test/test_helper.rb
  71. +7 −0 episode-277/uhoh-after/test/uhoh_test.rb
  72. +6 −0 episode-277/uhoh-after/test/unit/helpers/uhoh/failures_helper_test.rb
  73. +9 −0 episode-277/uhoh-after/test/unit/uhoh/failure_test.rb
  74. +10 −0 episode-277/uhoh-after/uhoh.gemspec
View
14 episode-277/README
@@ -0,0 +1,14 @@
+RailsCasts Episode #277 Mountable Engines
+
+http://railscasts.com/episodes/277-mountable-engines
+
+Commands used in episode
+
+ rails -v
+ rails plugin new uhoh --mountable
+ rails g controller failures index
+ rails g model failure message:text
+ rake db:migrate
+ rake uhoh:install:migrations
+ cd test/dummy
+ rails g controller simulate failure
View
6 episode-277/uhoh-after/.gitignore
@@ -0,0 +1,6 @@
+.bundle/
+log/*.log
+pkg/
+test/dummy/db/*.sqlite3
+test/dummy/log/*.log
+test/dummy/tmp/
View
12 episode-277/uhoh-after/Gemfile
@@ -0,0 +1,12 @@
+source "http://rubygems.org"
+
+gem 'rails', '3.1.0.rc5'
+
+# Bundle edge Rails instead:
+# gem 'rails', :git => 'git://github.com/rails/rails.git'
+
+gem 'sqlite3'
+
+gem 'jquery-rails'
+# To use debugger
+# gem 'ruby-debug19', :require => 'ruby-debug'
View
93 episode-277/uhoh-after/Gemfile.lock
@@ -0,0 +1,93 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ actionmailer (3.1.0.rc5)
+ actionpack (= 3.1.0.rc5)
+ mail (~> 2.3.0)
+ actionpack (3.1.0.rc5)
+ activemodel (= 3.1.0.rc5)
+ activesupport (= 3.1.0.rc5)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ i18n (~> 0.6)
+ rack (~> 1.3.1)
+ rack-cache (~> 1.0.2)
+ rack-mount (~> 0.8.1)
+ rack-test (~> 0.6.0)
+ sprockets (~> 2.0.0.beta.12)
+ activemodel (3.1.0.rc5)
+ activesupport (= 3.1.0.rc5)
+ bcrypt-ruby (~> 2.1.4)
+ builder (~> 3.0.0)
+ i18n (~> 0.6)
+ activerecord (3.1.0.rc5)
+ activemodel (= 3.1.0.rc5)
+ activesupport (= 3.1.0.rc5)
+ arel (~> 2.1.4)
+ tzinfo (~> 0.3.29)
+ activeresource (3.1.0.rc5)
+ activemodel (= 3.1.0.rc5)
+ activesupport (= 3.1.0.rc5)
+ activesupport (3.1.0.rc5)
+ multi_json (~> 1.0)
+ arel (2.1.4)
+ bcrypt-ruby (2.1.4)
+ builder (3.0.0)
+ erubis (2.7.0)
+ hike (1.2.0)
+ i18n (0.6.0)
+ jquery-rails (1.0.12)
+ railties (~> 3.0)
+ thor (~> 0.14)
+ mail (2.3.0)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.16)
+ multi_json (1.0.3)
+ polyglot (0.3.2)
+ rack (1.3.2)
+ rack-cache (1.0.2)
+ rack (>= 0.4)
+ rack-mount (0.8.1)
+ rack (>= 1.0.0)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.1)
+ rack (>= 1.0)
+ rails (3.1.0.rc5)
+ actionmailer (= 3.1.0.rc5)
+ actionpack (= 3.1.0.rc5)
+ activerecord (= 3.1.0.rc5)
+ activeresource (= 3.1.0.rc5)
+ activesupport (= 3.1.0.rc5)
+ bundler (~> 1.0)
+ railties (= 3.1.0.rc5)
+ railties (3.1.0.rc5)
+ actionpack (= 3.1.0.rc5)
+ activesupport (= 3.1.0.rc5)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.6)
+ rake (0.9.2)
+ rdoc (3.8)
+ sprockets (2.0.0.beta.12)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (!= 1.3.0, ~> 1.1)
+ sqlite3 (1.3.4)
+ thor (0.14.6)
+ tilt (1.3.2)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.29)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ jquery-rails
+ rails (= 3.1.0.rc5)
+ sqlite3
View
20 episode-277/uhoh-after/MIT-LICENSE
@@ -0,0 +1,20 @@
+Copyright 2011 YOURNAME
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
20 episode-277/uhoh-after/README.rdoc
@@ -0,0 +1,20 @@
+= Uhoh
+
+This is a mountable engine created in RailsCasts episode #277. This is not a gem so these instructions will not work, but you can use this as an example readme for your own mountable engine.
+
+== Installation
+
+First add the gem to your Gemfile and run the bundle command.
+
+ gem 'uhoh'
+
+Next, mount the engine in your routes.rb under the path you want.
+
+ mount Uhoh::Engine => "/uhoh"
+
+Then copy over the migrations and run them.
+
+ rake uhoh:install:migrations
+ rake db:migrate
+
+Now when an exception is raised in your application it should be browsable at the "/uhoh" path. Don't forget to password protect if you're using this in production.
View
39 episode-277/uhoh-after/Rakefile
@@ -0,0 +1,39 @@
+#!/usr/bin/env rake
+begin
+ require 'bundler/setup'
+rescue LoadError
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
+end
+begin
+ require 'rdoc/task'
+rescue LoadError
+ require 'rdoc/rdoc'
+ require 'rake/rdoctask'
+ RDoc::Task = Rake::RDocTask
+end
+
+RDoc::Task.new(:rdoc) do |rdoc|
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.title = 'Uhoh'
+ rdoc.options << '--line-numbers'
+ rdoc.rdoc_files.include('README.rdoc')
+ rdoc.rdoc_files.include('lib/**/*.rb')
+end
+
+APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
+load 'rails/tasks/engine.rake'
+
+
+Bundler::GemHelper.install_tasks
+
+require 'rake/testtask'
+
+Rake::TestTask.new(:test) do |t|
+ t.libs << 'lib'
+ t.libs << 'test'
+ t.pattern = 'test/**/*_test.rb'
+ t.verbose = false
+end
+
+
+task :default => :test
View
0  episode-277/uhoh-after/app/assets/images/uhoh/.gitkeep
No changes.
View
BIN  episode-277/uhoh-after/app/assets/images/uhoh/alert.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
9 episode-277/uhoh-after/app/assets/javascripts/uhoh/application.js
@@ -0,0 +1,9 @@
+// This is a manifest file that'll be compiled into including all the files listed below.
+// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
+// be included in the compiled file accessible from http://example.com/assets/application.js
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// the compiled file.
+//
+//= require jquery
+//= require jquery_ujs
+//= require_tree .
View
5 episode-277/uhoh-after/app/assets/javascripts/uhoh/failures.js
@@ -0,0 +1,5 @@
+$(function() {
+ $("li").click(function() {
+ $(this).slideUp();
+ });
+});
View
7 episode-277/uhoh-after/app/assets/stylesheets/uhoh/application.css
@@ -0,0 +1,7 @@
+/*
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
+ *= require_self
+ *= require_tree .
+*/
View
29 episode-277/uhoh-after/app/assets/stylesheets/uhoh/failures.css
@@ -0,0 +1,29 @@
+html, body {
+ background-color: #DDD;
+ font-family: Verdana;
+}
+
+body {
+ padding: 20px 200px;
+}
+
+img {
+ display: block;
+ margin: 0 auto;
+}
+
+a {
+ color: #000;
+}
+
+ul {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+}
+
+li {
+ background-color: #FFF;
+ margin-bottom: 10px;
+ padding: 5px 10px;
+}
View
4 episode-277/uhoh-after/app/controllers/uhoh/application_controller.rb
@@ -0,0 +1,4 @@
+module Uhoh
+ class ApplicationController < ActionController::Base
+ end
+end
View
7 episode-277/uhoh-after/app/controllers/uhoh/failures_controller.rb
@@ -0,0 +1,7 @@
+module Uhoh
+ class FailuresController < ApplicationController
+ def index
+ @failures = Failure.all
+ end
+ end
+end
View
4 episode-277/uhoh-after/app/helpers/uhoh/application_helper.rb
@@ -0,0 +1,4 @@
+module Uhoh
+ module ApplicationHelper
+ end
+end
View
4 episode-277/uhoh-after/app/helpers/uhoh/failures_helper.rb
@@ -0,0 +1,4 @@
+module Uhoh
+ module FailuresHelper
+ end
+end
View
4 episode-277/uhoh-after/app/models/uhoh/failure.rb
@@ -0,0 +1,4 @@
+module Uhoh
+ class Failure < ActiveRecord::Base
+ end
+end
View
14 episode-277/uhoh-after/app/views/layouts/uhoh/application.html.erb
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Uhoh</title>
+ <%= stylesheet_link_tag "uhoh/application" %>
+ <%= javascript_include_tag "uhoh/application" %>
+ <%= csrf_meta_tags %>
+</head>
+<body>
+
+<%= yield %>
+
+</body>
+</html>
View
11 episode-277/uhoh-after/app/views/uhoh/failures/index.html.erb
@@ -0,0 +1,11 @@
+<%= image_tag "uhoh/alert.png" %>
+
+<h1>Failures</h1>
+<ul>
+ <% for failure in @failures %>
+ <li><%= failure.message %></li>
+ <% end %>
+</ul>
+
+<p><%= link_to "Failures", root_url %></p>
+<p><%= link_to "Simulate Failure", main_app.simulate_failure_path %></p>
View
6 episode-277/uhoh-after/config/initializers/exception_handler.rb
@@ -0,0 +1,6 @@
+ActiveSupport::Notifications.subscribe "process_action.action_controller" do |name, start, finish, id, payload|
+ if payload[:exception]
+ name, message = *payload[:exception]
+ Uhoh::Failure.create!(:message => message)
+ end
+end
View
3  episode-277/uhoh-after/config/routes.rb
@@ -0,0 +1,3 @@
+Uhoh::Engine.routes.draw do
+ root :to => "failures#index"
+end
View
9 episode-277/uhoh-after/db/migrate/20110727184726_create_uhoh_failures.rb
@@ -0,0 +1,9 @@
+class CreateUhohFailures < ActiveRecord::Migration
+ def change
+ create_table :uhoh_failures do |t|
+ t.text :message
+
+ t.timestamps
+ end
+ end
+end
View
4 episode-277/uhoh-after/lib/tasks/uhoh_tasks.rake
@@ -0,0 +1,4 @@
+# desc "Explaining what the task does"
+# task :uhoh do
+# # Task goes here
+# end
View
4 episode-277/uhoh-after/lib/uhoh.rb
@@ -0,0 +1,4 @@
+require "uhoh/engine"
+
+module Uhoh
+end
View
5 episode-277/uhoh-after/lib/uhoh/engine.rb
@@ -0,0 +1,5 @@
+module Uhoh
+ class Engine < Rails::Engine
+ isolate_namespace Uhoh
+ end
+end
View
6 episode-277/uhoh-after/script/rails
@@ -0,0 +1,6 @@
+#!/usr/bin/env ruby
+#!/usr/bin/env ruby
+# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
+
+ENGINE_PATH = File.expand_path('../..', __FILE__)
+load File.expand_path('../../test/dummy/script/rails', __FILE__)
View
7 episode-277/uhoh-after/test/dummy/Rakefile
@@ -0,0 +1,7 @@
+#!/usr/bin/env rake
+# 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__)
+
+Dummy::Application.load_tasks
View
9 episode-277/uhoh-after/test/dummy/app/assets/javascripts/application.js
@@ -0,0 +1,9 @@
+// This is a manifest file that'll be compiled into including all the files listed below.
+// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
+// be included in the compiled file accessible from http://example.com/assets/application.js
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// the compiled file.
+//
+//= require jquery
+//= require jquery_ujs
+//= require_tree .
View
2  episode-277/uhoh-after/test/dummy/app/assets/javascripts/simulate.js
@@ -0,0 +1,2 @@
+// Place all the behaviors and hooks related to the matching controller here.
+// All this logic will automatically be available in application.js.
View
7 episode-277/uhoh-after/test/dummy/app/assets/stylesheets/application.css
@@ -0,0 +1,7 @@
+/*
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
+ *= require_self
+ *= require_tree .
+*/
View
4 episode-277/uhoh-after/test/dummy/app/assets/stylesheets/simulate.css
@@ -0,0 +1,4 @@
+/*
+ Place all the styles related to the matching controller here.
+ They will automatically be included in application.css.
+*/
View
3  episode-277/uhoh-after/test/dummy/app/controllers/application_controller.rb
@@ -0,0 +1,3 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+end
View
6 episode-277/uhoh-after/test/dummy/app/controllers/simulate_controller.rb
@@ -0,0 +1,6 @@
+class SimulateController < ApplicationController
+ def failure
+ # redirect_to uhoh_engine.root_url
+ raise "Simulating an exception"
+ end
+end
View
2  episode-277/uhoh-after/test/dummy/app/helpers/application_helper.rb
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
View
2  episode-277/uhoh-after/test/dummy/app/helpers/simulate_helper.rb
@@ -0,0 +1,2 @@
+module SimulateHelper
+end
View
0  episode-277/uhoh-after/test/dummy/app/mailers/.gitkeep
No changes.
View
0  episode-277/uhoh-after/test/dummy/app/models/.gitkeep
No changes.
View
14 episode-277/uhoh-after/test/dummy/app/views/layouts/application.html.erb
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Dummy</title>
+ <%= stylesheet_link_tag "application" %>
+ <%= javascript_include_tag "application" %>
+ <%= csrf_meta_tags %>
+</head>
+<body>
+
+<%= yield %>
+
+</body>
+</html>
View
2  episode-277/uhoh-after/test/dummy/app/views/simulate/failure.html.erb
@@ -0,0 +1,2 @@
+<h1>Simulate#failure</h1>
+<p>Find me in app/views/simulate/failure.html.erb</p>
View
4 episode-277/uhoh-after/test/dummy/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 Dummy::Application
View
42 episode-277/uhoh-after/test/dummy/config/application.rb
@@ -0,0 +1,42 @@
+require File.expand_path('../boot', __FILE__)
+
+require 'rails/all'
+
+Bundler.require
+require "uhoh"
+
+module Dummy
+ 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
+
+ # 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]
+
+ # Enable the asset pipeline
+ config.assets.enabled = true
+ end
+end
+
View
10 episode-277/uhoh-after/test/dummy/config/boot.rb
@@ -0,0 +1,10 @@
+require 'rubygems'
+gemfile = File.expand_path('../../../../Gemfile', __FILE__)
+
+if File.exist?(gemfile)
+ ENV['BUNDLE_GEMFILE'] = gemfile
+ require 'bundler'
+ Bundler.setup
+end
+
+$:.unshift File.expand_path('../../../../lib', __FILE__)
View
25 episode-277/uhoh-after/test/dummy/config/database.yml
@@ -0,0 +1,25 @@
+# SQLite version 3.x
+# gem install sqlite3
+#
+# Ensure the SQLite 3 gem is defined in your Gemfile
+# gem 'sqlite3'
+development:
+ adapter: sqlite3
+ database: db/development.sqlite3
+ pool: 5
+ timeout: 5000
+
+# Warning: The database defined as "test" will be erased and
+# re-generated from your development database when you run "rake".
+# Do not set this db to the same as development or production.
+test:
+ adapter: sqlite3
+ database: db/test.sqlite3
+ pool: 5
+ timeout: 5000
+
+production:
+ adapter: sqlite3
+ database: db/production.sqlite3
+ pool: 5
+ timeout: 5000
View
5 episode-277/uhoh-after/test/dummy/config/environment.rb
@@ -0,0 +1,5 @@
+# Load the rails application
+require File.expand_path('../application', __FILE__)
+
+# Initialize the rails application
+Dummy::Application.initialize!
View
27 episode-277/uhoh-after/test/dummy/config/environments/development.rb
@@ -0,0 +1,27 @@
+Dummy::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 web server 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_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
+
+ # Do not compress assets
+ config.assets.compress = false
+end
View
51 episode-277/uhoh-after/test/dummy/config/environments/production.rb
@@ -0,0 +1,51 @@
+Dummy::Application.configure do
+ # Settings specified here will take precedence over those in config/application.rb
+
+ # Code is not reloaded between requests
+ config.cache_classes = true
+
+ # Full error reports are disabled and caching is turned on
+ config.consider_all_requests_local = false
+ config.action_controller.perform_caching = true
+
+ # Disable Rails's static asset server (Apache or nginx will already do this)
+ config.serve_static_assets = false
+
+ # Compress JavaScripts and CSS
+ config.assets.compress = true
+
+ # Specifies the header that your server uses for sending files
+ # (comment out if your front-end server doesn't support this)
+ config.action_dispatch.x_sendfile_header = "X-Sendfile" # Use 'X-Accel-Redirect' for nginx
+
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
+ # config.force_ssl = true
+
+ # See everything in the log (default is :info)
+ # config.log_level = :debug
+
+ # Use a different logger for distributed setups
+ # config.logger = SyslogLogger.new
+
+ # Use a different cache store in production
+ # config.cache_store = :mem_cache_store
+
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server
+ # config.action_controller.asset_host = "http://assets.example.com"
+
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
+ # config.assets.precompile += %w( search.js )
+
+ # Disable delivery errors, bad email addresses will be ignored
+ # config.action_mailer.raise_delivery_errors = false
+
+ # Enable threaded mode
+ # config.threadsafe!
+
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
+ # the I18n.default_locale when a translation can not be found)
+ config.i18n.fallbacks = true
+
+ # Send deprecation notices to registered listeners
+ config.active_support.deprecation = :notify
+end
View
39 episode-277/uhoh-after/test/dummy/config/environments/test.rb
@@ -0,0 +1,39 @@
+Dummy::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
+
+ # Configure static asset server for tests with Cache-Control for performance
+ config.serve_static_assets = true
+ config.static_cache_control = "public, max-age=3600"
+
+ # 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
View
7 episode-277/uhoh-after/test/dummy/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!
View
10 episode-277/uhoh-after/test/dummy/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
View
5 episode-277/uhoh-after/test/dummy/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
View
7 episode-277/uhoh-after/test/dummy/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.
+Dummy::Application.config.secret_token = 'fd43056eab9c8d9a012babf3fa98cd9db49787f4fe72aef069a788934dfb86f112a33365473f4a0ac5cace72f943b6bdba4a2cfad9d4c99f5b77bbf4f3308755'
View
8 episode-277/uhoh-after/test/dummy/config/initializers/session_store.rb
@@ -0,0 +1,8 @@
+# Be sure to restart your server when you modify this file.
+
+Dummy::Application.config.session_store :cookie_store, key: '_dummy_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")
+# Dummy::Application.config.session_store :active_record_store
View
12 episode-277/uhoh-after/test/dummy/config/initializers/wrap_parameters.rb
@@ -0,0 +1,12 @@
+# Be sure to restart your server when you modify this file.
+#
+# This file contains settings for ActionController::ParamsWrapper which
+# is enabled by default.
+
+# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
+ActionController::Base.wrap_parameters format: [:json]
+
+# Disable root element in JSON by default.
+if defined?(ActiveRecord)
+ ActiveRecord::Base.include_root_in_json = false
+end
View
5 episode-277/uhoh-after/test/dummy/config/locales/en.yml
@@ -0,0 +1,5 @@
+# Sample localization file for English. Add more files in this directory for other locales.
+# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
+
+en:
+ hello: "Hello world"
View
6 episode-277/uhoh-after/test/dummy/config/routes.rb
@@ -0,0 +1,6 @@
+Rails.application.routes.draw do
+
+ get "simulate/failure"
+
+ mount Uhoh::Engine => "/uhoh", :as => "uhoh_engine"
+end
View
21 episode-277/uhoh-after/test/dummy/db/schema.rb
@@ -0,0 +1,21 @@
+# 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 => 20110727184726) do
+
+ create_table "uhoh_failures", :force => true do |t|
+ t.text "message"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+end
View
0  episode-277/uhoh-after/test/dummy/lib/assets/.gitkeep
No changes.
View
0  episode-277/uhoh-after/test/dummy/log/.gitkeep
No changes.
View
26 episode-277/uhoh-after/test/dummy/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>
View
26 episode-277/uhoh-after/test/dummy/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>
View
26 episode-277/uhoh-after/test/dummy/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>
View
0  episode-277/uhoh-after/test/dummy/public/favicon.ico
No changes.
View
6 episode-277/uhoh-after/test/dummy/script/rails
@@ -0,0 +1,6 @@
+#!/usr/bin/env ruby
+# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
+
+APP_PATH = File.expand_path('../../config/application', __FILE__)
+require File.expand_path('../../config/boot', __FILE__)
+require 'rails/commands'
View
9 episode-277/uhoh-after/test/dummy/test/functional/simulate_controller_test.rb
@@ -0,0 +1,9 @@
+require 'test_helper'
+
+class SimulateControllerTest < ActionController::TestCase
+ test "should get failure" do
+ get :failure
+ assert_response :success
+ end
+
+end
View
4 episode-277/uhoh-after/test/dummy/test/unit/helpers/simulate_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class SimulateHelperTest < ActionView::TestCase
+end
View
7 episode-277/uhoh-after/test/fixtures/uhoh/failures.yml
@@ -0,0 +1,7 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/Fixtures.html
+
+one:
+ message: MyText
+
+two:
+ message: MyText
View
11 episode-277/uhoh-after/test/functional/uhoh/failures_controller_test.rb
@@ -0,0 +1,11 @@
+require 'test_helper'
+
+module Uhoh
+ class FailuresControllerTest < ActionController::TestCase
+ test "should get index" do
+ get :index
+ assert_response :success
+ end
+
+ end
+end
View
10 episode-277/uhoh-after/test/integration/navigation_test.rb
@@ -0,0 +1,10 @@
+require 'test_helper'
+
+class NavigationTest < ActionDispatch::IntegrationTest
+ fixtures :all
+
+ # test "the truth" do
+ # assert true
+ # end
+end
+
View
10 episode-277/uhoh-after/test/test_helper.rb
@@ -0,0 +1,10 @@
+# Configure Rails Environment
+ENV["RAILS_ENV"] = "test"
+
+require File.expand_path("../dummy/config/environment.rb", __FILE__)
+require "rails/test_help"
+
+Rails.backtrace_cleaner.remove_silencers!
+
+# Load support files
+Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
View
7 episode-277/uhoh-after/test/uhoh_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class UhohTest < ActiveSupport::TestCase
+ test "truth" do
+ assert_kind_of Module, Uhoh
+ end
+end
View
6 episode-277/uhoh-after/test/unit/helpers/uhoh/failures_helper_test.rb
@@ -0,0 +1,6 @@
+require 'test_helper'
+
+module Uhoh
+ class FailuresHelperTest < ActionView::TestCase
+ end
+end
View
9 episode-277/uhoh-after/test/unit/uhoh/failure_test.rb
@@ -0,0 +1,9 @@
+require 'test_helper'
+
+module Uhoh
+ class FailureTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+ end
+end
View
10 episode-277/uhoh-after/uhoh.gemspec
@@ -0,0 +1,10 @@
+# Provide a simple gemspec so you can easily use your
+# project in your rails apps through git.
+Gem::Specification.new do |s|
+ s.name = "uhoh"
+ s.summary = "Insert Uhoh summary."
+ s.description = "Insert Uhoh description."
+ s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
+ s.test_files = Dir["test/**/*"]
+ s.version = "0.0.1"
+end
Please sign in to comment.
Something went wrong with that request. Please try again.