Permalink
Browse files

basic todo adding

  • Loading branch information...
0 parents commit 11e699d37eae4e8927357334d1f01407c029ed95 Austin Schneider committed May 15, 2012
Showing with 1,050 additions and 0 deletions.
  1. +5 −0 .gitignore
  2. +1 −0 .rspec
  3. +20 −0 Gemfile
  4. +172 −0 Gemfile.lock
  5. +3 −0 README.rdoc
  6. +7 −0 Rakefile
  7. BIN app/assets/images/rails.png
  8. +15 −0 app/assets/javascripts/application.js
  9. +13 −0 app/assets/stylesheets/application.css
  10. +3 −0 app/controllers/application_controller.rb
  11. +25 −0 app/controllers/todos_controller.rb
  12. +2 −0 app/helpers/application_helper.rb
  13. 0 app/mailers/.gitkeep
  14. 0 app/models/.gitkeep
  15. +15 −0 app/models/account.rb
  16. +7 −0 app/models/todo.rb
  17. +14 −0 app/views/layouts/application.html.erb
  18. +9 −0 app/views/todos/index.html.haml
  19. +4 −0 config.ru
  20. +65 −0 config/application.rb
  21. +6 −0 config/boot.rb
  22. +8 −0 config/cucumber.yml
  23. +5 −0 config/environment.rb
  24. +37 −0 config/environments/development.rb
  25. +67 −0 config/environments/production.rb
  26. +37 −0 config/environments/test.rb
  27. +7 −0 config/initializers/backtrace_silencers.rb
  28. +15 −0 config/initializers/inflections.rb
  29. +5 −0 config/initializers/mime_types.rb
  30. +7 −0 config/initializers/secret_token.rb
  31. +8 −0 config/initializers/session_store.rb
  32. +14 −0 config/initializers/wrap_parameters.rb
  33. +5 −0 config/locales/en.yml
  34. +7 −0 config/routes.rb
  35. +12 −0 db/migrate/20120515032510_create_todos.rb
  36. +22 −0 db/schema.rb
  37. +7 −0 db/seeds.rb
  38. +2 −0 doc/README_FOR_APP
  39. +14 −0 features/step_definitions/todo_steps.rb
  40. +59 −0 features/support/env.rb
  41. +8 −0 features/todos.feature
  42. 0 lib/assets/.gitkeep
  43. 0 lib/tasks/.gitkeep
  44. +65 −0 lib/tasks/cucumber.rake
  45. 0 log/.gitkeep
  46. +26 −0 public/404.html
  47. +26 −0 public/422.html
  48. +25 −0 public/500.html
  49. 0 public/favicon.ico
  50. +5 −0 public/robots.txt
  51. +10 −0 script/cucumber
  52. +6 −0 script/rails
  53. +60 −0 spec/controllers/todos_controller_spec.rb
  54. +46 −0 spec/models/account_spec.rb
  55. +17 −0 spec/models/todo_spec.rb
  56. +32 −0 spec/spec_helper.rb
  57. 0 vendor/assets/javascripts/.gitkeep
  58. 0 vendor/assets/stylesheets/.gitkeep
  59. 0 vendor/plugins/.gitkeep
@@ -0,0 +1,5 @@
+/.bundle
+/config/database.yml
+/db/*.sqlite3
+/log/*.log
+/tmp
1 .rspec
@@ -0,0 +1 @@
+--color
20 Gemfile
@@ -0,0 +1,20 @@
+source 'https://rubygems.org'
+
+gem 'rails', '3.2.3'
+gem "pg", "~> 0.13.2"
+gem "jquery-rails", "~> 2.0.2"
+gem "haml-rails", "~> 0.3.4"
+
+# 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'
+ gem 'uglifier', '>= 1.0.3'
+end
+
+group :test do
+ gem "cucumber-rails", "~> 1.3.0", :require => false
+ gem "database_cleaner", "~> 0.7.2"
+ gem "rspec-rails", "~> 2.10.1"
+end
@@ -0,0 +1,172 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ actionmailer (3.2.3)
+ actionpack (= 3.2.3)
+ mail (~> 2.4.4)
+ actionpack (3.2.3)
+ activemodel (= 3.2.3)
+ activesupport (= 3.2.3)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ journey (~> 1.0.1)
+ rack (~> 1.4.0)
+ rack-cache (~> 1.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.1.2)
+ activemodel (3.2.3)
+ activesupport (= 3.2.3)
+ builder (~> 3.0.0)
+ activerecord (3.2.3)
+ activemodel (= 3.2.3)
+ activesupport (= 3.2.3)
+ arel (~> 3.0.2)
+ tzinfo (~> 0.3.29)
+ activeresource (3.2.3)
+ activemodel (= 3.2.3)
+ activesupport (= 3.2.3)
+ activesupport (3.2.3)
+ i18n (~> 0.6)
+ multi_json (~> 1.0)
+ addressable (2.2.8)
+ arel (3.0.2)
+ builder (3.0.0)
+ capybara (1.1.2)
+ mime-types (>= 1.16)
+ nokogiri (>= 1.3.3)
+ rack (>= 1.0.0)
+ rack-test (>= 0.5.4)
+ selenium-webdriver (~> 2.0)
+ xpath (~> 0.1.4)
+ childprocess (0.3.2)
+ ffi (~> 1.0.6)
+ 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.3.2)
+ cucumber (1.1.9)
+ builder (>= 2.1.2)
+ diff-lcs (>= 1.1.2)
+ gherkin (~> 2.9.0)
+ json (>= 1.4.6)
+ term-ansicolor (>= 1.0.6)
+ cucumber-rails (1.3.0)
+ capybara (>= 1.1.2)
+ cucumber (>= 1.1.8)
+ nokogiri (>= 1.5.0)
+ database_cleaner (0.7.2)
+ diff-lcs (1.1.3)
+ erubis (2.7.0)
+ execjs (1.3.2)
+ multi_json (~> 1.0)
+ ffi (1.0.11)
+ gherkin (2.9.3)
+ json (>= 1.4.6)
+ haml (3.1.4)
+ haml-rails (0.3.4)
+ actionpack (~> 3.0)
+ activesupport (~> 3.0)
+ haml (~> 3.0)
+ railties (~> 3.0)
+ hike (1.2.1)
+ i18n (0.6.0)
+ journey (1.0.3)
+ jquery-rails (2.0.2)
+ railties (>= 3.2.0, < 5.0)
+ thor (~> 0.14)
+ json (1.7.3)
+ libwebsocket (0.1.3)
+ addressable
+ mail (2.4.4)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.18)
+ multi_json (1.3.5)
+ nokogiri (1.5.2)
+ pg (0.13.2)
+ 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.3)
+ actionmailer (= 3.2.3)
+ actionpack (= 3.2.3)
+ activerecord (= 3.2.3)
+ activeresource (= 3.2.3)
+ activesupport (= 3.2.3)
+ bundler (~> 1.0)
+ railties (= 3.2.3)
+ railties (3.2.3)
+ actionpack (= 3.2.3)
+ activesupport (= 3.2.3)
+ 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)
+ rspec (2.10.0)
+ rspec-core (~> 2.10.0)
+ rspec-expectations (~> 2.10.0)
+ rspec-mocks (~> 2.10.0)
+ rspec-core (2.10.0)
+ rspec-expectations (2.10.0)
+ diff-lcs (~> 1.1.3)
+ rspec-mocks (2.10.1)
+ rspec-rails (2.10.1)
+ actionpack (>= 3.0)
+ activesupport (>= 3.0)
+ railties (>= 3.0)
+ rspec (~> 2.10.0)
+ rubyzip (0.9.8)
+ sass (3.1.18)
+ sass-rails (3.2.5)
+ railties (~> 3.2.0)
+ sass (>= 3.1.10)
+ tilt (~> 1.3)
+ selenium-webdriver (2.21.2)
+ childprocess (>= 0.2.5)
+ ffi (~> 1.0)
+ libwebsocket (~> 0.1.3)
+ multi_json (~> 1.0)
+ rubyzip
+ sprockets (2.1.3)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ term-ansicolor (1.0.7)
+ thor (0.14.6)
+ tilt (1.3.3)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.33)
+ uglifier (1.2.4)
+ execjs (>= 0.3.0)
+ multi_json (>= 1.0.2)
+ xpath (0.1.4)
+ nokogiri (~> 1.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ coffee-rails (~> 3.2.1)
+ cucumber-rails (~> 1.3.0)
+ database_cleaner (~> 0.7.2)
+ haml-rails (~> 0.3.4)
+ jquery-rails (~> 2.0.2)
+ pg (~> 0.13.2)
+ rails (= 3.2.3)
+ rspec-rails (~> 2.10.1)
+ sass-rails (~> 3.2.3)
+ uglifier (>= 1.0.3)
@@ -0,0 +1,3 @@
+# Todoapp
+
+Code for screencast
@@ -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__)
+
+Todoapp::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,25 @@
+class TodosController < ApplicationController
+
+ THE_ACCOUNT = Account.new
+
+ helper_method :todo, :todos
+
+ def create
+ todo.save!
+ redirect_to root_url
+ end
+
+
+ def todo
+ @todo ||= account.new_todo params[:todo]
+ end
+
+ def todos
+ account.todos
+ end
+
+ def account
+ THE_ACCOUNT
+ end
+
+end
@@ -0,0 +1,2 @@
+module ApplicationHelper
+end
No changes.
No changes.
@@ -0,0 +1,15 @@
+class Account
+
+ def ==(other)
+ other.is_a? self.class
+ end
+
+ def new_todo(*args)
+ Todo.new *args
+ end
+
+ def todos
+ Todo.order 'created_at DESC'
+ end
+
+end
@@ -0,0 +1,7 @@
+class Todo < ActiveRecord::Base
+
+ attr_accessible :description
+
+ delegate :to_s, :to => :description
+
+end
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Todoapp</title>
+ <%= stylesheet_link_tag "application", :media => "all" %>
+ <%= javascript_include_tag "application" %>
+ <%= csrf_meta_tags %>
+</head>
+<body>
+
+<%= yield %>
+
+</body>
+</html>
@@ -0,0 +1,9 @@
+= form_for todo do |f|
+ = f.label :description, 'To-do'
+ = f.text_field :description
+ %button Add
+
+#todo_list
+ %ul
+ - todos.each do |todo|
+ %li= todo
@@ -0,0 +1,4 @@
+# This file is used by Rack-based servers to start the application.
+
+require ::File.expand_path('../config/environment', __FILE__)
+run Todoapp::Application
Oops, something went wrong.

0 comments on commit 11e699d

Please sign in to comment.