17 Retrospective 15.4 Task J4: Add a locale switcher.
git add .
git commit -a -m "save work"
[master c8d7ec9] save work
98 files changed, 2315 insertions(+), 112 deletions(-)
create mode 100644 app/controllers/admin_controller.rb
create mode 100644 app/controllers/carts_controller.rb
create mode 100644 app/controllers/line_items_controller.rb
create mode 100644 app/controllers/orders_controller.rb
create mode 100644 app/controllers/sessions_controller.rb
create mode 100644 app/controllers/store_controller.rb
create mode 100644 app/controllers/users_controller.rb
create mode 100644 app/helpers/admin_helper.rb
create mode 100644 app/helpers/carts_helper.rb
create mode 100644 app/helpers/line_items_helper.rb
create mode 100644 app/helpers/orders_helper.rb
create mode 100644 app/helpers/sessions_helper.rb
create mode 100644 app/helpers/store_helper.rb
create mode 100644 app/helpers/users_helper.rb
create mode 100644 app/mailers/order_notifier.rb
create mode 100644 app/models/cart.rb
create mode 100644 app/models/line_item.rb
create mode 100644 app/models/order.rb
create mode 100644 app/models/user.rb
create mode 100644 app/views/admin/index.html.erb
create mode 100644 app/views/carts/_cart.html.erb
create mode 100644 app/views/carts/_form.html.erb
create mode 100644 app/views/carts/edit.html.erb
create mode 100644 app/views/carts/index.html.erb
create mode 100644 app/views/carts/new.html.erb
create mode 100644 app/views/carts/show.html.erb
create mode 100644 app/views/line_items/_form.html.erb
create mode 100644 app/views/line_items/_line_item.html.erb
create mode 100644 app/views/line_items/_line_item.text.erb
create mode 100644 app/views/line_items/create.js.rjs
create mode 100644 app/views/line_items/edit.html.erb
create mode 100644 app/views/line_items/index.html.erb
create mode 100644 app/views/line_items/new.html.erb
create mode 100644 app/views/line_items/show.html.erb
create mode 100644 app/views/order_notifier/received.text.erb
create mode 100644 app/views/order_notifier/shipped.html.erb
create mode 100644 app/views/order_notifier/shipped.text.erb
create mode 100644 app/views/orders/_form.html.erb
create mode 100644 app/views/orders/edit.html.erb
create mode 100644 app/views/orders/index.html.erb
create mode 100644 app/views/orders/new.html.erb
create mode 100644 app/views/orders/show.html.erb
create mode 100644 app/views/products/who_bought.atom.builder
create mode 100644 app/views/products/who_bought.html.erb
create mode 100644 app/views/products/who_bought.xml.builder
create mode 100644 app/views/sessions/create.html.erb
create mode 100644 app/views/sessions/destroy.html.erb
create mode 100644 app/views/sessions/new.html.erb
create mode 100644 app/views/store/index.html.erb
create mode 100644 app/views/users/_form.html.erb
create mode 100644 app/views/users/edit.html.erb
create mode 100644 app/views/users/index.html.erb
create mode 100644 app/views/users/new.html.erb
create mode 100644 app/views/users/show.html.erb
create mode 100644 config/initializers/i18n.rb
rewrite config/locales/en.yml (97%)
create mode 100644 config/locales/es.yml
rewrite config/routes.rb (96%)
create mode 100644 db/migrate/20110711000002_create_carts.rb
create mode 100644 db/migrate/20110711000003_create_line_items.rb
create mode 100644 db/migrate/20110711000004_add_quantity_to_line_items.rb
create mode 100644 db/migrate/20110711000005_combine_items_in_cart.rb
create mode 100644 db/migrate/20110711000006_add_price_to_line_item.rb
create mode 100644 db/migrate/20110711000007_create_orders.rb
create mode 100644 db/migrate/20110711000008_add_order_id_to_line_item.rb
create mode 100644 db/migrate/20110711000009_create_users.rb
create mode 100644 script/load_orders.rb
create mode 100644 test/fixtures/carts.yml
create mode 100644 test/fixtures/line_items.yml
create mode 100644 test/fixtures/orders.yml
create mode 100644 test/fixtures/users.yml
create mode 100644 test/functional/admin_controller_test.rb
create mode 100644 test/functional/carts_controller_test.rb
create mode 100644 test/functional/line_items_controller_test.rb
create mode 100644 test/functional/order_notifier_test.rb
create mode 100644 test/functional/orders_controller_test.rb
create mode 100644 test/functional/sessions_controller_test.rb
create mode 100644 test/functional/store_controller_test.rb
create mode 100644 test/functional/users_controller_test.rb
create mode 100644 test/integration/dsl_user_stories_test.rb
create mode 100644 test/integration/user_stories_test.rb
create mode 100644 test/unit/cart_test.rb
create mode 100644 test/unit/helpers/admin_helper_test.rb
create mode 100644 test/unit/helpers/carts_helper_test.rb
create mode 100644 test/unit/helpers/line_items_helper_test.rb
create mode 100644 test/unit/helpers/orders_helper_test.rb
create mode 100644 test/unit/helpers/sessions_helper_test.rb
create mode 100644 test/unit/helpers/store_helper_test.rb
create mode 100644 test/unit/helpers/users_helper_test.rb
create mode 100644 test/unit/line_item_test.rb
create mode 100644 test/unit/order_test.rb
create mode 100644 test/unit/user_test.rb
edit config/database.yml
# SQLite version 3.x
# gem install 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: mysql
encoding: utf8
reconnect: false
database: depot_production
pool: 5
username: username
password: password
host: localhost
edit Gemfile
# source 'http://rubygems.org'
gem 'rails', :path => "/home/rubys/git/rails" # '3.0.15'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
group :production do
gem 'mysql'
end
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
gem 'capistrano'
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19', :require => 'ruby-debug'
# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
# group :development, :test do
# gem 'webrat'
# end
gem 'will_paginate', '~> 3.0'
bundle install
Using rake (0.9.2.2)
Using abstract (1.0.0)
Using activesupport (3.0.15)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.15)
Using erubis (2.6.6)
Using rack (1.2.5)
Using rack-mount (0.6.14)
Using rack-test (0.5.7)
Using tzinfo (0.3.33)
Using actionpack (3.0.15)
Using mime-types (1.19)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.2.19)
Using actionmailer (3.0.15)
Using arel (2.0.10)
Using activerecord (3.0.15)
Using activeresource (3.0.15)
Using bundler (1.1.3)
Using highline (1.6.13)
Using net-ssh (2.5.2)
Using net-scp (1.0.4)
Using net-sftp (2.0.5)
Using net-ssh-gateway (1.1.0)
Using capistrano (2.12.0)
Using json (1.7.3)
Using mysql (2.8.1)
Using rdoc (3.12)
Using thor (0.14.6)
Using railties (3.0.15)
Using rails (3.0.15)
Using sqlite3 (1.3.6)
Using will_paginate (3.0.3)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
rake db:setup RAILS_ENV=production
depot_production already exists
-- create_table("carts", {:force=>true})
-> 0.2204s
-- create_table("line_items", {:force=>true})
-> 0.2171s
-- create_table("orders", {:force=>true})
-> 0.1917s
-- create_table("products", {:force=>true})
-> 0.1837s
-- create_table("users", {:force=>true})
-> 0.3003s
-- initialize_schema_migrations_table()
-> 0.0010s
-- assume_migrated_upto_version(20110711000009, "db/migrate")
-> 0.0012s
bundle pack
Using rake (0.9.2.2)
Using abstract (1.0.0)
Using activesupport (3.0.15)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.15)
Using erubis (2.6.6)
Using rack (1.2.5)
Using rack-mount (0.6.14)
Using rack-test (0.5.7)
Using tzinfo (0.3.33)
Using actionpack (3.0.15)
Using mime-types (1.19)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.2.19)
Using actionmailer (3.0.15)
Using arel (2.0.10)
Using activerecord (3.0.15)
Using activeresource (3.0.15)
Using bundler (1.1.3)
Using highline (1.6.13)
Using net-ssh (2.5.2)
Using net-scp (1.0.4)
Using net-sftp (2.0.5)
Using net-ssh-gateway (1.1.0)
Using capistrano (2.12.0)
Using json (1.7.3)
Using mysql (2.8.1)
Using rdoc (3.12)
Using thor (0.14.6)
Using railties (3.0.15)
Using rails (3.0.15)
Using sqlite3 (1.3.6)
Using will_paginate (3.0.3)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Updating .gem files in vendor/cache
* rake-0.9.2.2.gem
* abstract-1.0.0.gem
Could not find activesupport-3.0.15.gem for installation
capify .
[add] writing './Capfile'
[add] writing './config/deploy.rb'
[done] capified!
edit config/deploy.rb
# be sure to change these
set :user, 'rubys'
set :domain, 'depot.pragprog.com'
set :application, 'depot'
# adjust if you are using RVM, remove if you are not
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require "rvm/capistrano"
set :rvm_ruby_string, '1.9.2'
set :rvm_type, :user
# file paths
set :repository, "#{user}@#{domain}:git/#{application}.git"
set :deploy_to, "/home/#{user}/#{domain}"
# distribute your applications across servers (the instructions below put them
# all on the same server, defined above as 'domain', adjust as necessary)
role :app, domain
role :web, domain
role :db, domain, :primary => true
# you might need to set this if you aren't seeing password prompts
# default_run_options[:pty] = true
# As Capistrano executes in a non-interactive mode and therefore doesn't cause
# any of your shell profile scripts to be run, the following might be needed
# if (for example) you have locally installed gems or applications. Note:
# this needs to contain the full values for the variables set, not simply
# the deltas.
# default_environment['PATH']='<your paths>:/usr/local/bin:/usr/bin:/bin'
# default_environment['GEM_PATH']='<your paths>:/usr/lib/ruby/gems/1.8'
# miscellaneous options
set :deploy_via, :remote_cache
set :scm, 'git'
set :branch, 'master'
set :scm_verbose, true
set :use_sudo, false
set :rails_env, :production
namespace :deploy do
desc "cause Passenger to initiate a restart"
task :restart do
run "touch #{current_path}/tmp/restart.txt"
end
desc "reload the database with seed data"
task :seed do
run "cd #{current_path}; rake db:seed RAILS_ENV=#{rails_env}"
end
end
after "deploy:update_code", :bundle_install
desc "install the necessary prerequisites"
task :bundle_install, :roles => :app do
run "cd #{release_path} && bundle install"
end
edit config/environments/production.rb
Depot::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The production environment is meant for finished, "live" apps.
# 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
# Specifies the header that your server uses for sending files
config.action_dispatch.x_sendfile_header = "X-Sendfile"
# For nginx:
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
# If you have no front-end server that supports something like X-Sendfile,
# just comment this out and Rails will serve the files
# 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
# Disable Rails's static asset server
# In production, Apache or nginx will already do this
config.serve_static_assets = false
# Enable serving of images, stylesheets, and javascripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
# 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
require 'active_support/core_ext/numeric/bytes'
config.logger = Logger.new(paths.log.first, 2, 10.kilobytes)
end
echo "Depot::Application.configure { paths.log.first }" | IRBRC=tmp/irbrc rails console production
Loading production environment (Rails 3.0.15)
>> Depot::Application.configure { paths.log.first }
=> "/home/rubys/git/awdwr/edition4/work-30/depot/log/production.log"
>>
git st
M Gemfile
M Gemfile.lock
M config/database.yml
M config/environments/production.rb
?? Capfile
?? config/deploy.rb
?? vendor/cache/