Permalink
Browse files

adding revised episode 133

  • Loading branch information...
1 parent 07c6edc commit c564579d30b1a673ebfea336ee61d2ade29d2950 @ryanb committed Mar 24, 2012
Showing with 998 additions and 0 deletions.
  1. +17 −0 episode-133/revised/README.md
  2. +15 −0 episode-133/revised/store-after/.gitignore
  3. +5 −0 episode-133/revised/store-after/Capfile
  4. +38 −0 episode-133/revised/store-after/Gemfile
  5. +126 −0 episode-133/revised/store-after/Gemfile.lock
  6. +3 −0 episode-133/revised/store-after/README.rdoc
  7. +7 −0 episode-133/revised/store-after/Rakefile
  8. BIN episode-133/revised/store-after/app/assets/images/rails.png
  9. +15 −0 episode-133/revised/store-after/app/assets/javascripts/application.js
  10. +13 −0 episode-133/revised/store-after/app/assets/stylesheets/application.css
  11. +3 −0 episode-133/revised/store-after/app/controllers/application_controller.rb
  12. +2 −0 episode-133/revised/store-after/app/helpers/application_helper.rb
  13. 0 episode-133/revised/store-after/app/mailers/.gitkeep
  14. 0 episode-133/revised/store-after/app/models/.gitkeep
  15. +14 −0 episode-133/revised/store-after/app/views/layouts/application.html.erb
  16. +4 −0 episode-133/revised/store-after/config.ru
  17. +59 −0 episode-133/revised/store-after/config/application.rb
  18. +6 −0 episode-133/revised/store-after/config/boot.rb
  19. +25 −0 episode-133/revised/store-after/config/database.yml
  20. +18 −0 episode-133/revised/store-after/config/deploy.rb
  21. +5 −0 episode-133/revised/store-after/config/environment.rb
  22. +37 −0 episode-133/revised/store-after/config/environments/development.rb
  23. +67 −0 episode-133/revised/store-after/config/environments/production.rb
  24. +37 −0 episode-133/revised/store-after/config/environments/test.rb
  25. +7 −0 episode-133/revised/store-after/config/initializers/backtrace_silencers.rb
  26. +15 −0 episode-133/revised/store-after/config/initializers/inflections.rb
  27. +5 −0 episode-133/revised/store-after/config/initializers/mime_types.rb
  28. +7 −0 episode-133/revised/store-after/config/initializers/secret_token.rb
  29. +8 −0 episode-133/revised/store-after/config/initializers/session_store.rb
  30. +14 −0 episode-133/revised/store-after/config/initializers/wrap_parameters.rb
  31. +5 −0 episode-133/revised/store-after/config/locales/en.yml
  32. +58 −0 episode-133/revised/store-after/config/routes.rb
  33. +7 −0 episode-133/revised/store-after/db/seeds.rb
  34. +2 −0 episode-133/revised/store-after/doc/README_FOR_APP
  35. 0 episode-133/revised/store-after/lib/assets/.gitkeep
  36. 0 episode-133/revised/store-after/lib/tasks/.gitkeep
  37. 0 episode-133/revised/store-after/log/.gitkeep
  38. +26 −0 episode-133/revised/store-after/public/404.html
  39. +26 −0 episode-133/revised/store-after/public/422.html
  40. +25 −0 episode-133/revised/store-after/public/500.html
  41. 0 episode-133/revised/store-after/public/favicon.ico
  42. +241 −0 episode-133/revised/store-after/public/index.html
  43. +5 −0 episode-133/revised/store-after/public/robots.txt
  44. +6 −0 episode-133/revised/store-after/script/rails
  45. 0 episode-133/revised/store-after/test/fixtures/.gitkeep
  46. 0 episode-133/revised/store-after/test/functional/.gitkeep
  47. 0 episode-133/revised/store-after/test/integration/.gitkeep
  48. +12 −0 episode-133/revised/store-after/test/performance/browsing_test.rb
  49. +13 −0 episode-133/revised/store-after/test/test_helper.rb
  50. 0 episode-133/revised/store-after/test/unit/.gitkeep
  51. 0 episode-133/revised/store-after/vendor/assets/javascripts/.gitkeep
  52. 0 episode-133/revised/store-after/vendor/assets/stylesheets/.gitkeep
  53. 0 episode-133/revised/store-after/vendor/plugins/.gitkeep
@@ -0,0 +1,17 @@
+# RailsCasts Episode #133: Capistrano Tasks (revised)
+
+http://railscasts.com/episodes/133-capistrano-tasks-revised
+
+Requires Ruby 1.9.2 or higher.
+
+### Commands used in episode:
+
+```
+rails new store
+cap hello
+bundle exec cap hello
+ssh deployer@72.14.183.209 'cat ~/hello'
+ssh deployer@72.14.183.209 'cat /hello'
+cap -T
+cap -e deploy
+```
@@ -0,0 +1,15 @@
+# See http://help.github.com/ignore-files/ for more about ignoring files.
+#
+# If you find yourself ignoring temporary files generated by your text editor
+# or operating system, you probably want to add a global ignore instead:
+# git config --global core.excludesfile ~/.gitignore_global
+
+# Ignore bundler config
+/.bundle
+
+# Ignore the default SQLite database.
+/db/*.sqlite3
+
+# Ignore all logfiles and tempfiles.
+/log/*.log
+/tmp
@@ -0,0 +1,5 @@
+load 'deploy'
+# Uncomment if you are using Rails' asset pipeline
+ # load 'deploy/assets'
+Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
+load 'config/deploy' # remove this line to skip loading any of the default tasks
@@ -0,0 +1,38 @@
+source 'https://rubygems.org'
+
+gem 'rails', '3.2.2'
+
+# Bundle edge Rails instead:
+# gem 'rails', :git => 'git://github.com/rails/rails.git'
+
+gem 'sqlite3'
+
+
+# Gems used only for assets and not required
+# in production environments by default.
+group :assets do
+ gem 'sass-rails', '~> 3.2.3'
+ gem 'coffee-rails', '~> 3.2.1'
+
+ # See https://github.com/sstephenson/execjs#readme for more supported runtimes
+ # gem 'therubyracer'
+
+ gem 'uglifier', '>= 1.0.3'
+end
+
+gem 'jquery-rails'
+
+# To use ActiveModel has_secure_password
+# gem 'bcrypt-ruby', '~> 3.0.0'
+
+# To use Jbuilder templates for JSON
+# gem 'jbuilder'
+
+# Use unicorn as the app server
+# gem 'unicorn'
+
+# Deploy with Capistrano
+gem 'capistrano'
+
+# To use debugger
+# gem 'ruby-debug19', :require => 'ruby-debug'
@@ -0,0 +1,126 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ actionmailer (3.2.2)
+ actionpack (= 3.2.2)
+ mail (~> 2.4.0)
+ actionpack (3.2.2)
+ activemodel (= 3.2.2)
+ activesupport (= 3.2.2)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ journey (~> 1.0.1)
+ rack (~> 1.4.0)
+ rack-cache (~> 1.1)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.1.2)
+ activemodel (3.2.2)
+ activesupport (= 3.2.2)
+ builder (~> 3.0.0)
+ activerecord (3.2.2)
+ activemodel (= 3.2.2)
+ activesupport (= 3.2.2)
+ arel (~> 3.0.2)
+ tzinfo (~> 0.3.29)
+ activeresource (3.2.2)
+ activemodel (= 3.2.2)
+ activesupport (= 3.2.2)
+ activesupport (3.2.2)
+ i18n (~> 0.6)
+ multi_json (~> 1.0)
+ arel (3.0.2)
+ builder (3.0.0)
+ capistrano (2.11.2)
+ highline
+ net-scp (>= 1.0.0)
+ net-sftp (>= 2.0.0)
+ net-ssh (>= 2.0.14)
+ net-ssh-gateway (>= 1.1.0)
+ coffee-rails (3.2.2)
+ coffee-script (>= 2.2.0)
+ railties (~> 3.2.0)
+ coffee-script (2.2.0)
+ coffee-script-source
+ execjs
+ coffee-script-source (1.2.0)
+ erubis (2.7.0)
+ execjs (1.3.0)
+ multi_json (~> 1.0)
+ highline (1.6.11)
+ hike (1.2.1)
+ i18n (0.6.0)
+ journey (1.0.3)
+ jquery-rails (2.0.1)
+ railties (>= 3.2.0, < 5.0)
+ thor (~> 0.14)
+ json (1.6.5)
+ mail (2.4.4)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.18)
+ multi_json (1.1.0)
+ net-scp (1.0.4)
+ net-ssh (>= 1.99.1)
+ net-sftp (2.0.5)
+ net-ssh (>= 2.0.9)
+ net-ssh (2.3.0)
+ net-ssh-gateway (1.1.0)
+ net-ssh (>= 1.99.1)
+ polyglot (0.3.3)
+ rack (1.4.1)
+ rack-cache (1.2)
+ rack (>= 0.4)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.1)
+ rack (>= 1.0)
+ rails (3.2.2)
+ actionmailer (= 3.2.2)
+ actionpack (= 3.2.2)
+ activerecord (= 3.2.2)
+ activeresource (= 3.2.2)
+ activesupport (= 3.2.2)
+ bundler (~> 1.0)
+ railties (= 3.2.2)
+ railties (3.2.2)
+ actionpack (= 3.2.2)
+ activesupport (= 3.2.2)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.6)
+ rake (0.9.2.2)
+ rdoc (3.12)
+ json (~> 1.4)
+ sass (3.1.15)
+ sass-rails (3.2.5)
+ railties (~> 3.2.0)
+ sass (>= 3.1.10)
+ tilt (~> 1.3)
+ sprockets (2.1.2)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ sqlite3 (1.3.5)
+ thor (0.14.6)
+ tilt (1.3.3)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.32)
+ uglifier (1.2.3)
+ execjs (>= 0.3.0)
+ multi_json (>= 1.0.2)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ capistrano
+ coffee-rails (~> 3.2.1)
+ jquery-rails
+ rails (= 3.2.2)
+ sass-rails (~> 3.2.3)
+ sqlite3
+ uglifier (>= 1.0.3)
@@ -0,0 +1,3 @@
+= Example RailsCasts Application
+
+Requires Ruby 1.9.2 or higher.
@@ -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__)
+
+Store::Application.load_tasks
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,15 @@
+// This is a manifest file that'll be compiled into application.js, which will include all the files
+// listed below.
+//
+// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
+// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
+//
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// the compiled file.
+//
+// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
+// GO AFTER THE REQUIRES BELOW.
+//
+//= require jquery
+//= require jquery_ujs
+//= require_tree .
@@ -0,0 +1,13 @@
+/*
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
+ * listed below.
+ *
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
+ *
+ * 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 .
+*/
@@ -0,0 +1,3 @@
+class ApplicationController < ActionController::Base
+ protect_from_forgery
+end
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Store</title>
+ <%= stylesheet_link_tag "application", :media => "all" %>
+ <%= javascript_include_tag "application" %>
+ <%= csrf_meta_tags %>
+</head>
+<body>
+
+<%= yield %>
+
+</body>
+</html>
@@ -0,0 +1,4 @@
+# This file is used by Rack-based servers to start the application.
+
+require ::File.expand_path('../config/environment', __FILE__)
+run Store::Application
@@ -0,0 +1,59 @@
+require File.expand_path('../boot', __FILE__)
+
+require 'rails/all'
+
+if defined?(Bundler)
+ # If you precompile assets before deploying to production, use this line
+ Bundler.require(*Rails.groups(:assets => %w(development test)))
+ # If you want your assets lazily compiled in production, use this line
+ # Bundler.require(:default, :assets, Rails.env)
+end
+
+module Store
+ 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]
+
+ # Use SQL instead of Active Record's schema dumper when creating the 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
+
+ # Enforce whitelist mode for mass assignment.
+ # This will create an empty whitelist of attributes available for mass-assignment for all models
+ # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
+ # parameters by using an attr_accessible or attr_protected declaration.
+ # config.active_record.whitelist_attributes = true
+
+ # Enable the asset pipeline
+ config.assets.enabled = true
+
+ # Version of your assets, change this if you want to expire all your assets
+ config.assets.version = '1.0'
+ end
+end
@@ -0,0 +1,6 @@
+require 'rubygems'
+
+# Set up gems listed in the Gemfile.
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+
+require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -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
@@ -0,0 +1,18 @@
+server "72.14.183.209", :web, :app, :db, primary: true
+set :user, "deployer"
+
+set :recipient, "Ruby"
+
+default_run_options[:pty] = true
+
+task :hello, roles: :db do
+ puts "Hello #{fetch(:recipient, "World")}"
+ # run "echo 'Hello World' > ~/hello"
+ run "#{sudo} cp ~/hello /hello"
+ # goodbye
+end
+
+task :goodbye do
+ puts "Goodbye #{recipient}"
+end
+after :hello, :goodbye
@@ -0,0 +1,5 @@
+# Load the rails application
+require File.expand_path('../application', __FILE__)
+
+# Initialize the rails application
+Store::Application.initialize!
Oops, something went wrong.

0 comments on commit c564579

Please sign in to comment.