Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Migrate to Rails 3 (Change: Rails 2.3.5 - 3.0.3, Ruby 1.8.7 - 1.9.2, …

…Devise 1.0.7 - 1.1.5, RSpec 1.3.0 - 2.4.0, Cucumber 0.7.1 - 0.10.0, cucumber-rails 0.3.0 - 0.3.2, rspec-rails 1.3.2 - 2.4.1, Webrat 0.7.0 - Capybara 0.4.1.1, email_spec 0.6.0 - 1.1.1, chronic-duration 0.9.1 - 0.9.2, validates_timeliness 2.2.2 - 3.0.5, time_travel still at 0.1.0, started using Timeliness for US date format in Ruby 1.9, RVM, Bundler, Autotest, Spork, stop using outdated legacy_migrations, set correct time zone)
  • Loading branch information...
commit e221934800c299a11174d649b6e13890c5860eb6 1 parent ffb6fbb
@esambo authored
Showing with 5,095 additions and 4,950 deletions.
  1. +8 −0 .autotest
  2. +0 −4 .gems
  3. +2 −0  .gitignore
  4. +2 −0  .rspec
  5. +32 −0 .rvmrc
  6. +64 −0 Gemfile
  7. +200 −0 Gemfile.lock
  8. +1 −1  README.rdoc
  9. +2 −5 Rakefile
  10. +1 −8 app/controllers/application_controller.rb
  11. +1 −2  app/controllers/tasks_controller.rb
  12. +20 −1 app/helpers/application_helper.rb
  13. +0 −22 app/helpers/layout_helper.rb
  14. +17 −17 app/models/task.rb
  15. +9 −2 app/models/user.rb
  16. +0 −16 app/views/confirmations/new.html.erb
  17. +12 −0 app/views/devise/confirmations/new.html.erb
  18. +7 −0 app/views/devise/mailer/confirmation_instructions.html.erb
  19. +10 −0 app/views/devise/mailer/reset_password_instructions.html.erb
  20. +9 −0 app/views/devise/mailer/unlock_instructions.html.erb
  21. +16 −0 app/views/devise/passwords/edit.html.erb
  22. +12 −0 app/views/devise/passwords/new.html.erb
  23. +25 −0 app/views/devise/registrations/edit.html.erb
  24. +18 −0 app/views/devise/registrations/new.html.erb
  25. +17 −0 app/views/devise/sessions/new.html.erb
  26. +19 −0 app/views/devise/shared/_links.erb
  27. +12 −0 app/views/devise/unlocks/new.html.erb
  28. +0 −7 app/views/devise_mailer/confirmation_instructions.html.erb
  29. +0 −10 app/views/devise_mailer/reset_password_instructions.html.erb
  30. +31 −34 app/views/layouts/application.html.erb
  31. +7 −9 app/views/layouts/tasks.html.erb
  32. +0 −20 app/views/passwords/edit.html.erb
  33. +0 −16 app/views/passwords/new.html.erb
  34. +0 −26 app/views/sessions/new.html.erb
  35. +37 −23 app/views/tasks/_form.html.erb
  36. +2 −4 app/views/tasks/edit.html.erb
  37. +6 −6 app/views/tasks/index.html.erb
  38. +2 −4 app/views/tasks/new.html.erb
  39. +8 −7 app/views/tasks/show.html.erb
  40. +0 −21 app/views/users/edit.html.erb
  41. +0 −15 app/views/users/new.html.erb
  42. +4 −0 config.ru
  43. +42 −0 config/application.rb
  44. +13 −110 config/boot.rb
  45. +5 −4 config/cucumber.yml
  46. +2 −2 config/database.yml
  47. +4 −47 config/environment.rb
  48. +0 −32 config/environments/cucumber.rb
  49. +26 −13 config/environments/development.rb
  50. +45 −21 config/environments/production.rb
  51. +39 −34 config/environments/test.rb
  52. +2 −2 config/initializers/backtrace_silencers.rb
  53. +82 −44 config/initializers/devise.rb
  54. +1 −1  config/initializers/inflections.rb
  55. +0 −21 config/initializers/new_rails_defaults.rb
  56. +7 −0 config/initializers/secret_token.rb
  57. +3 −10 config/initializers/session_store.rb
  58. +42 −0 config/initializers/validates_timeliness.rb
  59. +17 −13 config/locales/devise.en.yml
  60. +9 −1 config/locales/en.yml
  61. +16 −0 config/locales/validates_timeliness.en.yml
  62. +42 −24 config/routes.rb
  63. +2 −2 db/seeds.rb
  64. +6 −6 features/authentication.feature
  65. +4 −4 features/step_definitions/authentication_steps.rb
  66. +3 −3 features/step_definitions/task_steps.rb
  67. +118 −172 features/step_definitions/web_steps.rb
  68. +62 −47 features/support/env.rb
  69. +10 −4 features/support/paths.rb
  70. +1 −1  features/task_description.feature
  71. +6 −6 features/task_now.feature
  72. +2 −2 features/task_stop_validation.feature
  73. +15 −4 features/task_time.feature
  74. +3 −3 features/task_title.feature
  75. 0  lib/tasks/.gitkeep
  76. +7 −1 lib/tasks/cucumber.rake
  77. +0 −144 lib/tasks/rspec.rake
  78. +15 −19 public/404.html
  79. +15 −19 public/422.html
  80. +14 −18 public/500.html
  81. +5 −3 public/javascripts/controls.js
  82. +7 −6 public/javascripts/dragdrop.js
  83. +8 −13 public/javascripts/effects.js
  84. +3,381 −1,700 public/javascripts/prototype.js
  85. +175 −0 public/javascripts/rails.js
  86. 0  public/stylesheets/.gitkeep
  87. +15 −13 public/stylesheets/scaffold.css
  88. +0 −4 script/about
  89. +0 −6 script/autospec
  90. +0 −3  script/console
  91. 0  script/cucumber
  92. +0 −3  script/dbconsole
  93. +0 −3  script/destroy
  94. +0 −3  script/generate
  95. +0 −3  script/performance/benchmarker
  96. +0 −3  script/performance/profiler
  97. +0 −3  script/plugin
  98. +6 −0 script/rails
  99. +0 −3  script/runner
  100. +0 −3  script/server
  101. +0 −10 script/spec
  102. +55 −49 spec/controllers/tasks_controller_spec.rb
  103. +0 −13 spec/fixtures/tasks.yml
  104. +0 −11 spec/helpers/welcome_helper_spec.rb
  105. +0 −4 spec/integration/tasks_spec.rb
  106. +46 −18 spec/models/task_spec.rb
  107. +5 −0 spec/models/user_spec.rb
  108. +0 −2  spec/rcov.opts
  109. +11 −0 spec/requests/tasks_spec.rb
  110. +6 −4 spec/routing/tasks_routing_spec.rb
  111. +0 −4 spec/spec.opts
  112. +61 −53 spec/spec_helper.rb
  113. +6 −4 spec/support/authentication_helper_methods.rb
  114. +4 −11 spec/views/tasks/edit.html.erb_spec.rb
  115. +5 −15 spec/views/tasks/index.html.erb_spec.rb
  116. +4 −11 spec/views/tasks/new.html.erb_spec.rb
  117. +2 −8 spec/views/tasks/show.html.erb_spec.rb
  118. +0 −9 test/performance/browsing_test.rb
  119. +0 −38 test/test_helper.rb
  120. 0  vendor/plugins/.gitkeep
  121. +0 −20 vendor/plugins/legacy_migrations/MIT-LICENSE
  122. +0 −44 vendor/plugins/legacy_migrations/README
  123. +0 −55 vendor/plugins/legacy_migrations/Rakefile
  124. +0 −1  vendor/plugins/legacy_migrations/VERSION
  125. +0 −5 vendor/plugins/legacy_migrations/config/database.yml
  126. +0 −1  vendor/plugins/legacy_migrations/install.rb
  127. +0 −72 vendor/plugins/legacy_migrations/legacy_migrations.gemspec
  128. +0 −114 vendor/plugins/legacy_migrations/lib/legacy_migrations.rb
  129. +0 −38 vendor/plugins/legacy_migrations/lib/legacy_migrations/row_matchers.rb
  130. +0 −22 vendor/plugins/legacy_migrations/lib/legacy_migrations/source_iterators.rb
  131. +0 −17 vendor/plugins/legacy_migrations/lib/legacy_migrations/squirrel.rb
  132. +0 −36 vendor/plugins/legacy_migrations/lib/legacy_migrations/squirrel/extensions.rb
  133. +0 −83 vendor/plugins/legacy_migrations/lib/legacy_migrations/squirrel/paginator.rb
  134. +0 −532 vendor/plugins/legacy_migrations/lib/legacy_migrations/squirrel/squirrel.rb
  135. +0 −94 vendor/plugins/legacy_migrations/lib/legacy_migrations/status_report.rb
  136. +0 −82 vendor/plugins/legacy_migrations/lib/legacy_migrations/transformations.rb
  137. +0 −4 vendor/plugins/legacy_migrations/rails/init.rb
  138. +0 −21 vendor/plugins/legacy_migrations/spec/db/schema.rb
  139. BIN  vendor/plugins/legacy_migrations/spec/db/test.sqlite3
  140. +0 −145 vendor/plugins/legacy_migrations/spec/legacy_migrations_spec.rb
  141. +0 −68 vendor/plugins/legacy_migrations/spec/lib/transformations_spec.rb
  142. +0 −14 vendor/plugins/legacy_migrations/spec/models.rb
  143. +0 −2  vendor/plugins/legacy_migrations/spec/spec.opts
  144. +0 −30 vendor/plugins/legacy_migrations/spec/spec_helper.rb
  145. +0 −1  vendor/plugins/legacy_migrations/uninstall.rb
  146. +0 −20 vendor/plugins/time_travel/MIT-LICENSE
  147. +0 −44 vendor/plugins/time_travel/README.rdoc
  148. +0 −28 vendor/plugins/time_travel/Rakefile
  149. +0 −1  vendor/plugins/time_travel/VERSION
  150. +0 −1  vendor/plugins/time_travel/init.rb
  151. +0 −16 vendor/plugins/time_travel/lib/time_travel.rb
  152. +0 −9 vendor/plugins/time_travel/lib/time_travel/date_extensions.rb
  153. +0 −13 vendor/plugins/time_travel/lib/time_travel/string_extensions.rb
  154. +0 −36 vendor/plugins/time_travel/lib/time_travel/time_extensions.rb
  155. +0 −131 vendor/plugins/time_travel/spec/time_travel_spec.rb
View
8 .autotest
@@ -0,0 +1,8 @@
+require 'autotest/growl'
+require 'autotest/fsevent'
+
+Autotest.add_hook :initialize do |autotest|
+ autotest.add_mapping(/^spec\/requests\/.*_spec\.rb$/) do
+ autotest.files_matching(/^spec\/requests\/.*_spec\.rb$/)
+ end
+end
View
4 .gems
@@ -1,4 +0,0 @@
-validates_timeliness --version '>= 2.2.2'
-warden --version 0.10.3
-devise --version 1.0.7
-chronic_duration --version '>= 0.9.1'
View
2  .gitignore
@@ -3,6 +3,8 @@ log/*.log
tmp
tmp/pids/*.pid
db/*.sqlite3
+.bundle
.idea
+*.tmproj
webrat-*.html
rerun.txt
View
2  .rspec
@@ -0,0 +1,2 @@
+--colour
+--drb
View
32 .rvmrc
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+# Based on: http://rvm.beginrescueend.com/workflow/rvmrc/
+
+ruby_string="ruby-1.9.2-p136"
+gemset_name="timefliesby"
+
+if rvm list strings | grep -q "${ruby_string}" ; then
+
+ # Load or create the specified environment
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
+ && -s "${rvm_path:-$HOME/.rvm}/environments/${ruby_string}@${gemset_name}" ]] ; then
+ \. "${rvm_path:-$HOME/.rvm}/environments/${ruby_string}@${gemset_name}"
+ else
+ rvm --create "${ruby_string}@${gemset_name}"
+ fi
+
+ (
+ # Ensure that Bundler is installed, install it if it is not.
+ if ! command -v bundle ; then
+ gem install bundler
+ fi
+
+ # Bundle while redcing excess noise.
+ bundle | grep -v 'Using' | grep -v 'complete' | sed '/^$/d'
+ )&
+
+else
+
+ # Notify the user to install the desired interpreter before proceeding.
+ echo "${ruby_string} was not found, please run 'rvm install ${ruby_string}' and then cd back into the project directory."
+
+fi
View
64 Gemfile
@@ -0,0 +1,64 @@
+source 'http://rubygems.org'
+
+gem 'rails', '3.0.3'
+
+# Bundle edge Rails instead:
+# gem 'rails', :git => 'git://github.com/rails/rails.git'
+
+gem 'sqlite3-ruby', :require => 'sqlite3'
+gem 'validates_timeliness'
+gem 'chronic_duration'
+gem 'devise'
+
+#potential:
+# gem 'chronic'
+# gem 'delocalize'
+
+
+group :development do
+ gem "rspec-rails", "~> 2.4"
+ gem 'passenger'
+ gem 'autotest-growl' if RUBY_PLATFORM =~ /darwin/
+ gem 'autotest-fsevent' if RUBY_PLATFORM =~ /darwin/
+ gem 'heroku'
+ # gem 'legacy_migrations',
+ # :git => 'git://github.com/btelles/legacy_migrations.git',
+ # :branch => 'rails3'
+end
+
+group :test do
+ gem "rspec-rails", "~> 2.4"
+ gem 'cucumber-rails'
+ gem 'capybara'
+ gem 'database_cleaner'
+ gem 'email_spec'
+ gem 'spork'
+ gem 'autotest'
+ gem 'time_travel'
+ gem 'syntax'
+ gem 'ruby-debug-base19'
+ gem 'ruby-debug-ide'
+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'
+
+# 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
View
200 Gemfile.lock
@@ -0,0 +1,200 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ ZenTest (4.4.2)
+ abstract (1.0.0)
+ actionmailer (3.0.3)
+ actionpack (= 3.0.3)
+ mail (~> 2.2.9)
+ actionpack (3.0.3)
+ activemodel (= 3.0.3)
+ activesupport (= 3.0.3)
+ builder (~> 2.1.2)
+ erubis (~> 2.6.6)
+ i18n (~> 0.4)
+ rack (~> 1.2.1)
+ rack-mount (~> 0.6.13)
+ rack-test (~> 0.5.6)
+ tzinfo (~> 0.3.23)
+ activemodel (3.0.3)
+ activesupport (= 3.0.3)
+ builder (~> 2.1.2)
+ i18n (~> 0.4)
+ activerecord (3.0.3)
+ activemodel (= 3.0.3)
+ activesupport (= 3.0.3)
+ arel (~> 2.0.2)
+ tzinfo (~> 0.3.23)
+ activeresource (3.0.3)
+ activemodel (= 3.0.3)
+ activesupport (= 3.0.3)
+ activesupport (3.0.3)
+ archive-tar-minitar (0.5.2)
+ arel (2.0.7)
+ autotest (4.4.6)
+ ZenTest (>= 4.4.1)
+ autotest-fsevent (0.2.4)
+ sys-uname
+ autotest-growl (0.2.9)
+ bcrypt-ruby (2.1.4)
+ builder (2.1.2)
+ capybara (0.4.1.1)
+ celerity (>= 0.7.9)
+ culerity (>= 0.2.4)
+ mime-types (>= 1.16)
+ nokogiri (>= 1.3.3)
+ rack (>= 1.0.0)
+ rack-test (>= 0.5.4)
+ selenium-webdriver (>= 0.0.27)
+ xpath (~> 0.1.3)
+ celerity (0.8.7)
+ childprocess (0.1.6)
+ ffi (~> 0.6.3)
+ chronic_duration (0.9.2)
+ columnize (0.3.2)
+ configuration (1.2.0)
+ cucumber (0.10.0)
+ builder (>= 2.1.2)
+ diff-lcs (~> 1.1.2)
+ gherkin (~> 2.3.2)
+ json (~> 1.4.6)
+ term-ansicolor (~> 1.0.5)
+ cucumber-rails (0.3.2)
+ cucumber (>= 0.8.0)
+ culerity (0.2.15)
+ daemon_controller (0.2.5)
+ database_cleaner (0.6.1)
+ devise (1.1.5)
+ bcrypt-ruby (~> 2.1.2)
+ warden (~> 1.0.2)
+ diff-lcs (1.1.2)
+ email_spec (1.1.1)
+ rspec (~> 2.0)
+ erubis (2.6.6)
+ abstract (>= 1.0.0)
+ fastthread (1.0.7)
+ ffi (0.6.3)
+ rake (>= 0.8.7)
+ file-tail (1.0.5)
+ spruz (>= 0.1.0)
+ gherkin (2.3.3)
+ json (~> 1.4.6)
+ heroku (1.17.10)
+ json (~> 1.4.6)
+ launchy (~> 0.3.2)
+ rest-client (>= 1.4.0, < 1.7.0)
+ i18n (0.5.0)
+ json (1.4.6)
+ json_pure (1.5.1)
+ launchy (0.3.7)
+ configuration (>= 0.0.5)
+ rake (>= 0.8.1)
+ linecache19 (0.5.11)
+ ruby_core_source (>= 0.1.4)
+ mail (2.2.15)
+ activesupport (>= 2.3.6)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.16)
+ nokogiri (1.4.4)
+ passenger (3.0.2)
+ daemon_controller (>= 0.2.5)
+ fastthread (>= 1.0.1)
+ file-tail
+ rack
+ rake (>= 0.8.1)
+ polyglot (0.3.1)
+ rack (1.2.1)
+ rack-mount (0.6.13)
+ rack (>= 1.0.0)
+ rack-test (0.5.7)
+ rack (>= 1.0)
+ rails (3.0.3)
+ actionmailer (= 3.0.3)
+ actionpack (= 3.0.3)
+ activerecord (= 3.0.3)
+ activeresource (= 3.0.3)
+ activesupport (= 3.0.3)
+ bundler (~> 1.0)
+ railties (= 3.0.3)
+ railties (3.0.3)
+ actionpack (= 3.0.3)
+ activesupport (= 3.0.3)
+ rake (>= 0.8.7)
+ thor (~> 0.14.4)
+ rake (0.8.7)
+ rest-client (1.6.1)
+ mime-types (>= 1.16)
+ rspec (2.4.0)
+ rspec-core (~> 2.4.0)
+ rspec-expectations (~> 2.4.0)
+ rspec-mocks (~> 2.4.0)
+ rspec-core (2.4.0)
+ rspec-expectations (2.4.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.4.0)
+ rspec-rails (2.4.1)
+ actionpack (~> 3.0)
+ activesupport (~> 3.0)
+ railties (~> 3.0)
+ rspec (~> 2.4.0)
+ ruby-debug-base19 (0.11.24)
+ columnize (>= 0.3.1)
+ linecache19 (>= 0.5.11)
+ ruby_core_source (>= 0.1.4)
+ ruby-debug-ide (0.4.16)
+ rake (>= 0.8.1)
+ ruby_core_source (0.1.4)
+ archive-tar-minitar (>= 0.5.2)
+ rubyzip (0.9.4)
+ selenium-webdriver (0.1.2)
+ childprocess (~> 0.1.5)
+ ffi (~> 0.6.3)
+ json_pure
+ rubyzip
+ spork (0.8.4)
+ spruz (0.2.2)
+ sqlite3 (1.3.3)
+ sqlite3-ruby (1.3.3)
+ sqlite3 (>= 1.3.3)
+ syntax (1.0.0)
+ sys-uname (0.8.5)
+ term-ansicolor (1.0.5)
+ thor (0.14.6)
+ time_travel (0.1.0)
+ timeliness (0.3.3)
+ treetop (1.4.9)
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.24)
+ validates_timeliness (3.0.5)
+ timeliness (~> 0.3.2)
+ warden (1.0.3)
+ rack (>= 1.0.0)
+ xpath (0.1.3)
+ nokogiri (~> 1.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ autotest
+ autotest-fsevent
+ autotest-growl
+ capybara
+ chronic_duration
+ cucumber-rails
+ database_cleaner
+ devise
+ email_spec
+ heroku
+ passenger
+ rails (= 3.0.3)
+ rspec-rails (~> 2.4)
+ ruby-debug-base19
+ ruby-debug-ide
+ spork
+ sqlite3-ruby
+ syntax
+ time_travel
+ validates_timeliness
View
2  README.rdoc
@@ -17,4 +17,4 @@ http://www.timefliesby.com
== LICENSE:
-Copyright (c) 2009 Emmanuel Sambo, released under the MIT license
+Copyright (c) 2011 Emmanuel Sambo, released under the MIT license
View
7 Rakefile
@@ -1,10 +1,7 @@
# 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 File.expand_path('../config/application', __FILE__)
require 'rake'
-require 'rake/testtask'
-require 'rake/rdoctask'
-require 'tasks/rails'
+Timefliesby::Application.load_tasks
View
9 app/controllers/application_controller.rb
@@ -1,10 +1,3 @@
-# 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
- protect_from_forgery # See ActionController::RequestForgeryProtection for details
-
- # Scrub sensitive parameters from your log
- filter_parameter_logging :password, :password_confirmation
+ protect_from_forgery
end
View
3  app/controllers/tasks_controller.rb
@@ -73,8 +73,7 @@ def update
respond_to do |format|
if @task.update_attributes(params[:task])
- flash[:notice] = 'Task was successfully updated.'
- format.html { redirect_to(@task) }
+ format.html { redirect_to(@task, :notice => 'Task was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
View
21 app/helpers/application_helper.rb
@@ -1,3 +1,22 @@
-# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
+ def title(page_title = nil, show_title = true)
+ @show_title = show_title
+ if page_title.nil?
+ @content_for_title = controller.action_name.titleize
+ else
+ @content_for_title = page_title.to_s
+ end
+ end
+
+ def show_title?
+ @show_title
+ end
+
+ def stylesheet(*args)
+ content_for(:head) { stylesheet_link_tag(*args) }
+ end
+
+ def javascript(*args)
+ content_for(:head) { javascript_include_tag(*args) }
+ end
end
View
22 app/helpers/layout_helper.rb
@@ -1,22 +0,0 @@
-# These helper methods can be called in your template to set variables to be used in the layout
-# This module should be included in all views globally,
-# to do so you may need to add this line to your ApplicationController
-# helper :layout
-module LayoutHelper
- def title(page_title, show_title = true)
- @content_for_title = page_title.to_s
- @show_title = show_title
- end
-
- def show_title?
- @show_title
- end
-
- def stylesheet(*args)
- content_for(:head) { stylesheet_link_tag(*args) }
- end
-
- def javascript(*args)
- content_for(:head) { javascript_include_tag(*args) }
- end
-end
View
34 app/models/task.rb
@@ -5,36 +5,36 @@ class Task < ActiveRecord::Base
validates_presence_of :user
validates_associated :user, :message => 'Bad user association' #Doesn't seem to do anything...
attr_accessor :first_task
- validates_datetime :start, :on_or_after => '2000-01-01T08:00:00-0600'
+ validates_datetime :start, :on_or_after => '2000-01-01 08:00'
validates_datetime :stop, :on_or_before => 3.months.from_now #, :allow_blank => true
validate :valid_stop
- def initial
- self.first_task = false
- end
+# # works, but I don't really need it!
+# def after_initialize
+# @first_task = false
+# end
def duration
- ChronicDuration.output((stop - start).round, :format => :chrono) if valid?
+ ChronicDuration.output((self[:stop] - self[:start]).round, :format => :chrono) if valid?
end
- def now time = Time.now
- self.stop = time
- if self.start.blank?
-# previous_task = Task.first(:order => "start DESC", :conditions => ["stop <= ? AND stop IS NOT NULL", Time.zone.now])
- previous_task = self.user.tasks.first(:order => "start DESC", :conditions => ["stop <= ?", time])
+ def now(time = Time.zone.now)
+ self[:stop] = time
+ if self[:start].blank?
+ # previous_task = user.tasks.first(:order => "start DESC", :conditions => ["stop <= ? AND stop IS NOT NULL", Time.zone.now])
+ previous_task = user.tasks.first(:order => "start DESC", :conditions => ["stop <= ?", time.to_s(:db)])
end
if previous_task && !previous_task.stop.blank?
- self.start = previous_task.stop
- self.first_task = false
- else
- self.start = time
- self.first_task = true
+ self[:start] = previous_task.stop
+ @first_task = false
+ elsif self[:start].blank?
+ self[:start] = time
+ @first_task = true
end
end
def valid_stop
- if !stop.blank? && Time.parse(stop.to_s) < Time.parse(start.to_s)
-# if !stop.blank? && stop < start
+ if !self[:stop].blank? && self[:stop] < self[:start]
errors.add :stop, 'needs to be greater than start.'
end
end
View
11 app/models/user.rb
@@ -1,5 +1,12 @@
class User < ActiveRecord::Base
- devise :database_authenticatable, :confirmable, :recoverable, :registerable, :rememberable, :trackable, :validatable, :lockable
- attr_accessible :email, :password, :password_confirmation
+ # Include default devise modules. Others available are:
+ # :token_authenticatable and :timeoutable
+ devise :database_authenticatable, :registerable,
+ :recoverable, :rememberable, :trackable, :validatable,
+ :confirmable, :lockable
+
+ # Setup accessible (or protected) attributes for your model
+ attr_accessible :email, :password, :password_confirmation, :remember_me
+
has_many :tasks
end
View
16 app/views/confirmations/new.html.erb
@@ -1,16 +0,0 @@
-<h2>Resend confirmation instructions</h2>
-
-<% form_for resource_name, resource, :url => confirmation_path(resource_name) do |f| %>
- <%= f.error_messages %>
-
- <p><%= f.label :email %></p>
- <p><%= f.text_field :email %></p>
-
- <p><%= f.submit "Resend confirmation instructions" %></p>
-<% end %>
-
-<%= link_to "Sign in", new_session_path(resource_name) %><br />
-
-<%- if devise_mapping.recoverable? %>
- <%= link_to "Forgot password?", new_password_path(resource_name) %><br />
-<% end -%>
View
12 app/views/devise/confirmations/new.html.erb
@@ -0,0 +1,12 @@
+<h2>Resend confirmation instructions</h2>
+
+<%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
+ <%= devise_error_messages! %>
+
+ <p><%= f.label :email %><br />
+ <%= f.text_field :email %></p>
+
+ <p><%= f.submit "Resend confirmation instructions" %></p>
+<% end %>
+
+<%= render :partial => "devise/shared/links" %>
View
7 app/views/devise/mailer/confirmation_instructions.html.erb
@@ -0,0 +1,7 @@
+<p>Welcome <%= @resource.email %>!</p> to TimeFliesBy!
+
+<p>You can confirm your account through the link below:</p>
+
+<p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p>
+
+<p>For any questions, please send an email to support@timefliesby.com</p>
View
10 app/views/devise/mailer/reset_password_instructions.html.erb
@@ -0,0 +1,10 @@
+<p>Hello <%= @resource.email %>!</p> to TimeFliesBy!
+
+<p>Someone has requested a link to change your password, and you can do this through the link below.</p>
+
+<p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %></p>
+
+<p>If you didn't request this, please ignore this email.</p>
+<p>Your password won't change until you access the link above and create a new one.</p>
+
+<p>For any questions, please send an email to support@timefliesby.com</p>
View
9 app/views/devise/mailer/unlock_instructions.html.erb
@@ -0,0 +1,9 @@
+<p>Hello <%= @resource.email %>!</p> to TimeFliesBy!
+
+<p>Your account has been locked due to an excessive amount of unsuccessful sign in attempts.</p>
+
+<p>Click the link below to unlock your account:</p>
+
+<p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %></p>
+
+<p>For any questions, please send an email to support@timefliesby.com</p>
View
16 app/views/devise/passwords/edit.html.erb
@@ -0,0 +1,16 @@
+<h2>Change your password</h2>
+
+<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
+ <%= devise_error_messages! %>
+ <%= f.hidden_field :reset_password_token %>
+
+ <p><%= f.label :password %><br />
+ <%= f.password_field :password %></p>
+
+ <p><%= f.label :password_confirmation %><br />
+ <%= f.password_field :password_confirmation %></p>
+
+ <p><%= f.submit "Change my password" %></p>
+<% end %>
+
+<%= render :partial => "devise/shared/links" %>
View
12 app/views/devise/passwords/new.html.erb
@@ -0,0 +1,12 @@
+<h2>Forgot your password?</h2>
+
+<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
+ <%= devise_error_messages! %>
+
+ <p><%= f.label :email %><br />
+ <%= f.text_field :email %></p>
+
+ <p><%= f.submit "Send me reset password instructions" %></p>
+<% end %>
+
+<%= render :partial => "devise/shared/links" %>
View
25 app/views/devise/registrations/edit.html.erb
@@ -0,0 +1,25 @@
+<h2>Edit <%= resource_name.to_s.humanize %></h2>
+
+<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
+ <%= devise_error_messages! %>
+
+ <p><%= f.label :email %><br />
+ <%= f.text_field :email %></p>
+
+ <p><%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
+ <%= f.password_field :password %></p>
+
+ <p><%= f.label :password_confirmation %><br />
+ <%= f.password_field :password_confirmation %></p>
+
+ <p><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
+ <%= f.password_field :current_password %></p>
+
+ <p><%= f.submit "Update" %></p>
+<% end %>
+
+<h3>Cancel my account</h3>
+
+<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
+
+<%= link_to "Back", :back %>
View
18 app/views/devise/registrations/new.html.erb
@@ -0,0 +1,18 @@
+<h2>Register</h2>
+
+<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
+ <%= devise_error_messages! %>
+
+ <p><%= f.label :email %><br />
+ <%= f.text_field :email %></p>
+
+ <p><%= f.label :password %><br />
+ <%= f.password_field :password %></p>
+
+ <p><%= f.label :password_confirmation %><br />
+ <%= f.password_field :password_confirmation %></p>
+
+ <p><%= f.submit "Register" %></p>
+<% end %>
+
+<%= render :partial => "devise/shared/links" %>
View
17 app/views/devise/sessions/new.html.erb
@@ -0,0 +1,17 @@
+<h2>Sign in</h2>
+
+<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
+ <p><%= f.label :email %><br />
+ <%= f.text_field :email %></p>
+
+ <p><%= f.label :password %><br />
+ <%= f.password_field :password %></p>
+
+ <% if devise_mapping.rememberable? -%>
+ <p><%= f.check_box :remember_me %> <%= f.label :remember_me %></p>
+ <% end -%>
+
+ <p><%= f.submit "Sign in" %></p>
+<% end %>
+
+<%= render :partial => "devise/shared/links" %>
View
19 app/views/devise/shared/_links.erb
@@ -0,0 +1,19 @@
+<%- if controller_name != 'sessions' %>
+ <%= link_to "Sign in", new_session_path(resource_name) %><br />
+<% end -%>
+
+<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
+ <%= link_to "Register", new_registration_path(resource_name) %><br />
+<% end -%>
+
+<%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
+ <%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
+<% end -%>
+
+<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
+ <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
+<% end -%>
+
+<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
+ <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
+<% end -%>
View
12 app/views/devise/unlocks/new.html.erb
@@ -0,0 +1,12 @@
+<h2>Resend unlock instructions</h2>
+
+<%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %>
+ <%= devise_error_messages! %>
+
+ <p><%= f.label :email %><br />
+ <%= f.text_field :email %></p>
+
+ <p><%= f.submit "Resend unlock instructions" %></p>
+<% end %>
+
+<%= render :partial => "devise/shared/links" %>
View
7 app/views/devise_mailer/confirmation_instructions.html.erb
@@ -1,7 +0,0 @@
-Welcome <%= @resource.email %> to TimeFliesBy!
-
-You can confirm your account through the link below:
-
-<%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %>
-
-For any questions, please send an email to support@timefliesby.com
View
10 app/views/devise_mailer/reset_password_instructions.html.erb
@@ -1,10 +0,0 @@
-Hello <%= @resource.email %> to TimeFliesBy!
-
-Someone has requested a link to change your password, and you can do this through the link below.
-
-<%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %>
-
-If you didn't request this, please ignore this email.
-Your password won't change until you access the link above and create a new one.
-
-For any questions, please send an email to support@timefliesby.com
View
65 app/views/layouts/application.html.erb
@@ -1,38 +1,35 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<!DOCTYPE html>
<html>
- <head>
- <title><%= h(yield(:title) || "Devise") %></title>
- <%= stylesheet_link_tag 'application' %>
- <%= yield(:head) %>
- </head>
- <body>
- <div id="container">
- <%- flash.each do |name, msg| -%>
- <%= content_tag :div, msg, :id => "flash_#{name}" %>
- <%- end -%>
+<head>
+ <title>Time Flies By | <%= title %></title>
+ <%= stylesheet_link_tag :all %>
+ <%= javascript_include_tag :defaults %>
+ <%= csrf_meta_tag %>
+ <%= yield :head %>
+</head>
+<body>
+ <div id="container">
+ <%- flash.each do |name, msg| -%>
+ <%= content_tag :div, msg, :id => "flash_#{name}" %>
+ <%- end -%>
- <div id="user_login_box" style="float:right">
- <% if user_signed_in? -%>
- <%= current_user.email %> |
- <%= link_to 'My info', edit_user_path %> |
- <%= link_to 'Sign out', destroy_user_session_path %>
- <% else -%>
- <%= link_to 'Register', new_user_path %> |
- <%= link_to 'Sign in', new_user_session_path %>
- <% end -%>
- </div>
- <div style="float:left">
- <%= link_to 'Home', root_path %> |
- <%= link_to 'Tasks', tasks_path %>
- </div>
- <div style="clear:both"></div>
-
- <%- if show_title? -%>
- <h1><%=h yield(:title) %></h1>
- <%- end -%>
-
- <%= yield %>
+ <div id="user_login_box" style="float:right">
+ <% if user_signed_in? -%>
+ <%= current_user.email %> |
+ <%= link_to 'My info', edit_user_registration_path %> |
+ <%= link_to 'Sign out', destroy_user_session_path %>
+ <% else -%>
+ <%= link_to 'Register', new_user_registration_path %> |
+ <%= link_to 'Sign in', new_user_session_path %>
+ <% end -%>
</div>
- </body>
+ <div style="float:left">
+ <%= link_to 'Home', root_path %> |
+ <%= link_to 'Tasks', tasks_path %>
+ </div>
+ <div style="clear:both"></div>
+
+ <%= yield %>
+ </div>
+</body>
</html>
View
16 app/views/layouts/tasks.html.erb
@@ -1,10 +1,7 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!DOCTYPE html>
+<html>
<head>
- <meta http-equiv="content-type" content="text/html;charset=UTF-8"/>
- <title><%= h(yield(:title) || "Tasks: #{controller.action_name}") %></title>
+ <title>Time Flies By | <%= title %></title>
<%= stylesheet_link_tag 'scaffold' %>
<%= stylesheet_link_tag 'application' %>
<%= yield(:head) %>
@@ -18,10 +15,10 @@
<div id="user_login_box" style="float:right">
<% if user_signed_in? -%>
<%= current_user.email %> |
- <%= link_to 'My info', edit_user_path %> |
+ <%= link_to 'My info', edit_user_registration_path %> |
<%= link_to 'Sign out', destroy_user_session_path %>
<% else -%>
- <%= link_to 'Register', new_user_path %> |
+ <%= link_to 'Register', new_user_registration_path %> |
<%= link_to 'Sign in', new_user_session_path %>
<% end -%>
</div>
@@ -32,9 +29,10 @@
<div style="clear:both"></div>
<%- if show_title? -%>
- <h1><%= h yield(:title) %></h1>
+ <h1><%= title %></h1>
<%- end -%>
+
<%= yield %>
</div>
</body>
View
20 app/views/passwords/edit.html.erb
@@ -1,20 +0,0 @@
-<h2>Change your password</h2>
-
-<% form_for resource_name, resource, :url => password_path(resource_name), :html => { :method => :put } do |f| %>
- <%= f.error_messages %>
- <%= f.hidden_field :reset_password_token %>
-
- <p><%= f.label :password %></p>
- <p><%= f.password_field :password %></p>
-
- <p><%= f.label :password_confirmation %></p>
- <p><%= f.password_field :password_confirmation %></p>
-
- <p><%= f.submit "Change my password" %></p>
-<% end %>
-
-<%= link_to "Sign in", new_session_path(resource_name) %><br />
-
-<%- if devise_mapping.confirmable? %>
- <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
-<% end -%>
View
16 app/views/passwords/new.html.erb
@@ -1,16 +0,0 @@
-<h2>Forgot your password?</h2>
-
-<% form_for resource_name, resource, :url => password_path(resource_name) do |f| %>
- <%= f.error_messages %>
-
- <p><%= f.label :email %></p>
- <p><%= f.text_field :email %></p>
-
- <p><%= f.submit "Send me reset password instructions" %></p>
-<% end %>
-
-<%= link_to "Sign in", new_session_path(resource_name) %><br />
-
-<%- if devise_mapping.confirmable? %>
- <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
-<% end -%>
View
26 app/views/sessions/new.html.erb
@@ -1,26 +0,0 @@
-<h2>Sign in</h2>
-
-<%- if devise_mapping.authenticatable? %>
- <% form_for resource_name, resource, :url => session_path(resource_name) do |f| -%>
- <p><%= f.label :email %></p>
- <p><%= f.text_field :email %></p>
-
- <p><%= f.label :password %></p>
- <p><%= f.password_field :password %></p>
-
- <% if devise_mapping.rememberable? -%>
- <p><%= f.check_box :remember_me %> <%= f.label :remember_me %></p>
- <% end -%>
-
- <p><%= f.submit "Sign in" %></p>
- <% end -%>
-<% end%>
-
-<%= link_to 'Not yet registered?', new_user_path %><br />
-<%- if devise_mapping.recoverable? %>
- <%= link_to "Forgot password?", new_password_path(resource_name) %><br />
-<% end -%>
-
-<%- if devise_mapping.confirmable? %>
- <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
-<% end -%>
View
60 app/views/tasks/_form.html.erb
@@ -1,24 +1,38 @@
-<%= f.error_messages %>
+<%= form_for(@task) do |f| %>
+ <% if @task.errors.any? %>
+ <div id="error_explanation">
+ <h2><%= pluralize(@task.errors.count, "error") %> prohibited this task from being saved:</h2>
-<p>
- <%= f.label :title %><br />
- <%= f.text_field :title %>
-</p>
-<p>
- <%= f.label :start %><br />
- <%# f.datetime_select :start %>
- <%= f.text_field :start %>
-</p>
-<p>
- <%= f.label :stop %><br />
- <%# f.datetime_select :stop %>
- <%= f.text_field :stop %>
-</p>
-<p>
- <%= f.label :description %><br />
- <%= f.text_area :description %>
-</p>
-<p>
- <%= f.submit submit_label %><br />
- <%= f.submit 'Now' %>
-</p>
+ <ul>
+ <% @task.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div class="field">
+ <%= f.label :title %><br />
+ <%= f.text_field :title %>
+ </div>
+ <div class="field">
+ <%= f.label :start %><br />
+ <%#= f.datetime_select :start %>
+ <%#= f.text_field :start #Can't seem to find value! %>
+ <%= text_field_tag 'task[start]', @task.start.nil? ? nil : l(@task.start, :format => :nice), :size => 30 %>
+ </div>
+ <div class="field">
+ <%= f.label :stop %><br />
+ <%#= f.datetime_select :stop %>
+ <%#= f.text_field :stop #Can't seem to find value! %>
+ <%= text_field_tag 'task[stop]', @task.stop.nil? ? nil : l(@task.stop, :format => :nice), :size => 30 %>
+ </div>
+ <div class="field">
+ <%= f.label :description %><br />
+ <%= f.text_area :description %>
+ </div>
+ <div class="actions">
+ <%= f.submit %><br />
+ <%= f.submit 'Now' %>
+ </div>
+<% end %>
View
6 app/views/tasks/edit.html.erb
@@ -1,8 +1,6 @@
<% title 'Editing task' -%>
-<% form_for(@task) do |f| %>
- <%= render :partial => 'form', :locals => { :f => f, :submit_label => 'Update' } %>
-<% end %>
+<%= render 'form' %>
<%= link_to 'Show', @task %> |
-<%= link_to 'Back', tasks_path %>
+<%= link_to 'Back', tasks_path %>
View
12 app/views/tasks/index.html.erb
@@ -14,11 +14,11 @@
<% @tasks.each do |task| %>
<tr>
- <td class="rightSpace"><%=h task.title %></td>
- <td class="rightSpace"><%=h task.duration %></td>
- <td class="rightSpace"><%=h task.start %></td>
- <td class="rightSpace"><%=h task.stop %></td>
- <td class="rightSpace"><%=h task.description %></td>
+ <td class="rightSpace"><%= task.title %></td>
+ <td class="rightSpace"><%= task.duration %></td>
+ <td class="rightSpace"><%= task.start %></td>
+ <td class="rightSpace"><%= task.stop %></td>
+ <td class="rightSpace"><%= task.description %></td>
<td><%= link_to 'Show', task %></td>
<td><%= link_to 'Edit', edit_task_path(task) %></td>
<td><%= link_to 'Destroy', task, :confirm => 'Are you sure?', :method => :delete %></td>
@@ -28,4 +28,4 @@
<br />
-<%= link_to 'New task', new_task_path %>
+<%= link_to 'New Task', new_task_path %>
View
6 app/views/tasks/new.html.erb
@@ -1,7 +1,5 @@
<% title 'New task' -%>
-<% form_for(@task) do |f| %>
- <%= render :partial => 'form', :locals => { :f => f, :submit_label => 'Create' } %>
-<% end %>
+<%= render 'form' %>
-<%= link_to 'Back', tasks_path %>
+<%= link_to 'Back', tasks_path %>
View
15 app/views/tasks/show.html.erb
@@ -1,30 +1,31 @@
<% title 'Show task' -%>
+<p id="notice"><%= notice %></p>
+
<p>
<b>Title:</b>
- <%=h @task.title %>
+ <%= @task.title %>
</p>
<p>
<b>Duration:</b>
- <%=h @task.duration %>
+ <%= @task.duration %>
</p>
<p>
<b>Start:</b>
- <%=h @task.start %>
+ <%= @task.start %>
</p>
<p>
<b>Stop:</b>
- <%=h @task.stop %>
+ <%= @task.stop %>
</p>
<p>
<b>Description:</b>
- <%=h @task.description %>
+ <%= @task.description %>
</p>
-
<%= link_to 'Edit', edit_task_path(@task) %> |
-<%= link_to 'Back', tasks_path %>
+<%= link_to 'Back', tasks_path %>
View
21 app/views/users/edit.html.erb
@@ -1,21 +0,0 @@
-<% title 'Editing My Info' -%>
-
-<% form_for @user, :url => user_path do |f| -%>
- <% field_set_tag 'Update my email' do -%>
- <p><%= f.text_field :email %></p>
- <%= error_message_on @user, :email %>
- <p class="submit"><%= f.submit 'Update email' %></p>
- <% end -%>
-<% end -%>
-
-<% form_for @user, :url => user_path do |f| -%>
- <% field_set_tag 'Update my password' do -%>
- <p><%= f.password_field :password %></p>
- <%= error_message_on @user, :password %>
- <p><%= f.password_field :password_confirmation %></p>
- <%= error_message_on @user, :password_confirmation %>
- <p class="submit"><%= f.submit 'Update password' %></p>
- <% end -%>
-<% end -%>
-
-<%= link_to "Cancel my account", user_path, :method => :delete, :confirm => "Are you sure?" %>
View
15 app/views/users/new.html.erb
@@ -1,15 +0,0 @@
-<% title 'Register' -%>
-
-<% form_for @user, :url => user_path do |f| -%>
- <%= f.error_messages %>
- <p><%= f.label :email %></p>
- <p><%= f.text_field :email %></p>
- <p><%= f.label :password %></p>
- <p><%= f.password_field :password %></p>
- <p><%= f.label :password_confirmation %></p>
- <p><%= f.password_field :password_confirmation %></p>
-
- <p class="submit"><%= f.submit "Register" %></p>
-<% end -%>
-<p>Already registered? <%= link_to 'Sign in', new_user_session_path %></p>
-
View
4 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 Timefliesby::Application
View
42 config/application.rb
@@ -0,0 +1,42 @@
+require File.expand_path('../boot', __FILE__)
+
+require 'rails/all'
+
+# If you have a Gemfile, require the gems listed there, including any gems
+# you've limited to :test, :development, or :production.
+Bundler.require(:default, Rails.env) if defined?(Bundler)
+
+module Timefliesby
+ 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
+
+ # JavaScript files you want as :defaults (application.js is always included).
+ # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
+
+ # 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, :password_confirmation]
+ end
+end
View
123 config/boot.rb
@@ -1,110 +1,13 @@
-# 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)
- Rails::GemDependency.add_frozen_gem_path
- 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 rescue nil
- 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
- min_version = '1.3.2'
- require 'rubygems'
- unless rubygems_version >= min_version
- $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
- exit 1
- end
-
- rescue LoadError
- $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. 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!
+require 'rubygems'
+
+# Set up gems listed in the Gemfile.
+gemfile = File.expand_path('../../Gemfile', __FILE__)
+begin
+ ENV['BUNDLE_GEMFILE'] = gemfile
+ require 'bundler'
+ Bundler.setup
+rescue Bundler::GemNotFound => e
+ STDERR.puts e.message
+ STDERR.puts "Try running `bundle install`."
+ exit!
+end if File.exist?(gemfile)
View
9 config/cucumber.yml
@@ -1,7 +1,8 @@
<%
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
-rerun_opts = rerun.to_s.strip.empty? ? "--format progress features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
-std_opts = "#{rerun_opts} --format rerun --out rerun.txt --strict --tags ~@wip"
+rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
+std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip"
%>
-default: <%= std_opts %>
-wip: --tags @wip:3 --wip features
+default: --drb <%= std_opts %> features
+wip: --drb --tags @wip:3 --wip features
+rerun: --drb <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
View
4 config/database.yml
@@ -15,7 +15,7 @@ development:
# 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: &TEST
+test: &test
adapter: sqlite3
database: db/test.sqlite3
pool: 5
@@ -28,4 +28,4 @@ production:
timeout: 5000
cucumber:
- <<: *TEST
+ <<: *test
View
51 config/environment.rb
@@ -1,48 +1,5 @@
-# Be sure to restart your server when you modify this file
+# Load the rails application
+require File.expand_path('../application', __FILE__)
-# Specifies gem version of Rails to use when vendor/rails is not present
-RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
-
-# Bootstrap the Rails environment, frameworks, and default configuration
-require File.join(File.dirname(__FILE__), 'boot')
-
-Rails::Initializer.run do |config|
- # 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.
-
- # Add additional load paths for your own custom dirs
- # config.load_paths += %W( #{RAILS_ROOT}/extras )
-
- # Specify gems that this application depends on and have them installed with rake gems:install
- # config.gem "bj"
- # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
- # config.gem "sqlite3-ruby", :lib => "sqlite3"
- # config.gem "aws-s3", :lib => "aws/s3"
- config.gem 'validates_timeliness', :version => '>= 2.2.2'
- config.gem "warden", :version => "0.10.3"
- config.gem "devise", :version => "1.0.7"
- config.gem "chronic_duration", :version => "0.9.1"
-
- # 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 ]
-
- # Skip frameworks you're not going to use. To use Rails without a database,
- # you must remove the Active Record framework.
- # config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
-
- # 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.
- # config.time_zone = 'UTC'
- # config.time_zone = 'Central Time (US & Canada)' #Need to replace Time.now with Time.now.in_time_zone or Time.zone.now
-
- # 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}')]
- # config.i18n.default_locale = :de
-
- config.action_mailer.default_url_options = { :host => 'localhost:3000' }
-end
+# Initialize the rails application
+Timefliesby::Application.initialize!
View
32 config/environments/cucumber.rb
@@ -1,32 +0,0 @@
-# IMPORTANT: This file was generated by Cucumber-Rails 0.3.0
-# Edit at your own peril - it's recommended to regenerate this file
-# in the future when you upgrade to a newer version of Cucumber.
-
-# IMPORTANT: Setting config.cache_classes to false is known to
-# break Cucumber's use_transactional_fixtures method.
-# For more information see https://rspec.lighthouseapp.com/projects/16211/tickets/165
-config.cache_classes = true
-
-# Log error messages when you accidentally call methods on nil.
-config.whiny_nils = true
-
-# Show full error reports and disable caching
-config.action_controller.consider_all_requests_local = true
-config.action_controller.perform_caching = 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
-
-config.gem 'cucumber', :lib => false, :version => '>=0.7.1' unless File.directory?(File.join(Rails.root, 'vendor/plugins/cucumber'))
-config.gem 'cucumber-rails', :lib => false, :version => '>=0.3.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/cucumber-rails'))
-config.gem 'database_cleaner', :lib => false, :version => '>=0.5.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/database_cleaner'))
-config.gem 'webrat', :lib => false, :version => '>=0.7.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/webrat'))
-config.gem 'rspec', :lib => false, :version => '>=1.3.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec'))
-config.gem 'rspec-rails', :lib => false, :version => '>=1.3.2' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
-config.gem 'email_spec', :lib => 'email_spec', :version => '>=0.6.0'
-
View
39 config/environments/development.rb
@@ -1,17 +1,30 @@
-# Settings specified here will take precedence over those in config/environment.rb
+Timefliesby::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 webserver when you make code changes.
-config.cache_classes = false
+ # 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 webserver when you make code changes.
+ config.cache_classes = false
-# Log error messages when you accidentally call methods on nil.
-config.whiny_nils = true
+ # Log error messages when you accidentally call methods on nil.
+ config.whiny_nils = true
-# Show full error reports and disable caching
-config.action_controller.consider_all_requests_local = true
-config.action_view.debug_rjs = true
-config.action_controller.perform_caching = false
+ # Show full error reports and disable caching
+ config.consider_all_requests_local = true
+ config.action_view.debug_rjs = 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
+
+ # Devise
+ config.action_mailer.default_url_options = { :host => 'localhost:3000' }
+
+end
-# Don't care if the mailer can't send
-config.action_mailer.raise_delivery_errors = false
View
66 config/environments/production.rb
@@ -1,29 +1,53 @@
-# Settings specified here will take precedence over those in config/environment.rb
+Timefliesby::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
+ # 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.action_controller.consider_all_requests_local = false
-config.action_controller.perform_caching = true
-config.action_view.cache_template_loading = true
+ # Full error reports are disabled and caching is turned on
+ config.consider_all_requests_local = false
+ config.action_controller.perform_caching = true
-# See everything in the log (default is :info)
-# config.log_level = :debug
+ # Specifies the header that your server uses for sending files
+ config.action_dispatch.x_sendfile_header = "X-Sendfile"
-# Use a different logger for distributed setups
-# config.logger = SyslogLogger.new
+ # For nginx:
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
-# Use a different cache store in production
-# config.cache_store = :mem_cache_store
+ # If you have no front-end server that supports something like X-Sendfile,
+ # just comment this out and Rails will serve the files
-# Enable serving of images, stylesheets, and javascripts from an asset server
-# config.action_controller.asset_host = "http://assets.example.com"
+ # See everything in the log (default is :info)
+ # config.log_level = :debug
-# Disable delivery errors, bad email addresses will be ignored
-config.action_mailer.raise_delivery_errors = true
-config.action_mailer.default_url_options = { :host => 'timefliesby.com' }
+ # Use a different logger for distributed setups
+ # config.logger = SyslogLogger.new
-# Enable threaded mode
-# config.threadsafe!
+ # 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
+
+ # Devise
+ config.action_mailer.default_url_options = { :host => 'timefliesby.com' }
+
+end
View
73 config/environments/test.rb
@@ -1,34 +1,39 @@
-# Settings specified here will take precedence over those in config/environment.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
-
-# Log error messages when you accidentally call methods on nil.
-config.whiny_nils = true
-
-# Show full error reports and disable caching
-config.action_controller.consider_all_requests_local = true
-config.action_controller.perform_caching = false
-config.action_view.cache_template_loading = true
-
-# 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
-
-config.gem 'test-unit', :lib => 'test/unit', :version => '= 1.2.3'
-config.gem 'rspec-rails', :lib => false, :version => '>= 1.2.9'
-config.gem 'rspec', :lib => false, :version => '>= 1.2.9'
-config.gem 'cucumber', :version => '>= 0.4.3'
-config.gem 'webrat', :version => '>= 0.5.3'
+Timefliesby::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
+
+ # 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
+
+ # Devise
+ config.action_mailer.default_url_options = { :host => 'localhost:3000' }
+
+end
View
4 config/initializers/backtrace_silencers.rb
@@ -3,5 +3,5 @@
# 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 do debug a problem that might steem from framework code.
-# Rails.backtrace_cleaner.remove_silencers!
+# 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
126 config/initializers/devise.rb
@@ -1,27 +1,20 @@
# Use this hook to configure devise mailer, warden hooks and so forth. The first
# four configuration values can also be set straight in your models.
Devise.setup do |config|
+ # ==> Mailer Configuration
# Configure the e-mail address which will be shown in DeviseMailer.
config.mailer_sender = "TimeFliesBy <noreply@timefliesby.com>"
-
- # Configure the content type of DeviseMailer mails (defaults to text/html")
- # config.mailer_content_type = "text/plain"
- # ==> Configuration for :authenticatable
- # Invoke `rake secret` and use the printed value to setup a pepper to generate
- # the encrypted password. By default no pepper is used.
- config.pepper = "5772cedd58c8de601417e4f60cf5e2dd77f0ab2d2ac46ee3abc251e3b60f87ea14ceec362cdc58bb9a7283ccca1f326d6b344dbb7f6494351e218fbe30f6800a"
-
- # Configure how many times you want the password is reencrypted. Default is 10.
- config.stretches = 10
+ # Configure the class responsible to send e-mails.
+ # config.mailer = "Devise::Mailer"
- # Define which will be the encryption algorithm. Supported algorithms are :sha1
- # (default), :sha512 and :bcrypt. Devise also supports encryptors from others
- # authentication tools as :clearance_sha1, :authlogic_sha512 (then you should set
- # stretches above to 20 for default behavior) and :restful_authentication_sha1
- # (then you should set stretches to 10, and copy REST_AUTH_SITE_KEY to pepper)
- config.encryptor = :bcrypt
+ # ==> ORM configuration
+ # Load and configure the ORM. Supports :active_record (default) and
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
+ # available as additional gems.
+ require 'devise/orm/active_record'
+ # ==> Configuration for any authentication mechanism
# Configure which keys are used when authenticating an user. By default is
# just :email. You can configure it to use [:username, :subdomain], so for
# authenticating an user, both parameters are required. Remember that those
@@ -29,61 +22,112 @@
# session. If you need permissions, you should implement that in a before filter.
# config.authentication_keys = [ :email ]
+ # Tell if authentication through request.params is enabled. True by default.
+ # config.params_authenticatable = true
+
+ # Tell if authentication through HTTP Basic Auth is enabled. False by default.
+ # config.http_authenticatable = false
+
+ # Set this to true to use Basic Auth for AJAX requests. True by default.
+ # config.http_authenticatable_on_xhr = true
+
# The realm used in Http Basic Authentication
# config.http_authentication_realm = "Application"
+ # ==> Configuration for :database_authenticatable
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
+ # using other encryptors, it sets how many times you want the password re-encrypted.
+ # config.stretches = 10
+ config.stretches = Rails.env.test? ? 1 : 10
+
+ # Define which will be the encryption algorithm. Devise also supports encryptors
+ # from others authentication tools as :clearance_sha1, :authlogic_sha512 (then
+ # you should set stretches above to 20 for default behavior) and :restful_authentication_sha1
+ # (then you should set stretches to 10, and copy REST_AUTH_SITE_KEY to pepper)
+ config.encryptor = :bcrypt
+
+ # Setup a pepper to generate the encrypted password.
+ config.pepper = "5772cedd58c8de601417e4f60cf5e2dd77f0ab2d2ac46ee3abc251e3b60f87ea14ceec362cdc58bb9a7283ccca1f326d6b344dbb7f6494351e218fbe30f6800a"
+
# ==> Configuration for :confirmable
- # The time you want give to your user to confirm his account. During this time
+ # The time you want to give your user to confirm his account. During this time
# he will be able to access your application without confirming. Default is nil.
+ # When confirm_within is zero, the user won't be able to sign in without confirming.
+ # You can use this to let your user access some features of your application
+ # without confirming the account, but blocking it after a certain period
+ # (ie 2 days).
config.confirm_within = 2.days
# ==> Configuration for :rememberable
# The time the user will be remembered without asking for credentials again.
config.remember_for = 2.years
+ # If true, a valid remember token can be re-used between multiple browsers.
+ # config.remember_across_browsers = true
+
+ # If true, extends the user's remember period when remembered via cookie.
+ # config.extend_remember_period = false
+
+ # ==> Configuration for :validatable
+ # Range for password length
+ # config.password_length = 6..20
+
+ # Regex to use to validate the email address
+ # config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
+
# ==> Configuration for :timeoutable
# The time you want to timeout the user session without activity. After this
# time the user will be asked for credentials again.
# config.timeout_in = 10.minutes
# ==> Configuration for :lockable
- # Number of authentication tries before locking an account.
- config.maximum_attempts = 5
+ # Defines which strategy will be used to lock an account.
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
+ # :none = No lock strategy. You should handle locking by yourself.
+ # config.lock_strategy = :failed_attempts
# Defines which strategy will be used to unlock an account.
# :email = Sends an unlock link to the user email
- # :time = Reanables login after a certain ammount of time (see :unlock_in below)
- # :both = enables both strategies
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
+ # :both = Enables both strategies
+ # :none = No unlock strategy. You should handle unlocking by yourself.
config.unlock_strategy = :both
+ # Number of authentication tries before locking an account if lock_strategy
+ # is failed attempts.
+ config.maximum_attempts = 5
+
# Time interval to unlock the account if :time is enabled as unlock_strategy.
config.unlock_in = 1.hour
# ==> Configuration for :token_authenticatable
# Defines name of the authentication token params key
- #config.token_authentication_key = :auth_token
-
- # ==> General configuration
- # Load and configure the ORM. Supports :active_record (default), :mongo_mapper
- # (requires mongo_ext installed) and :data_mapper (experimental).
- # require 'devise/orm/mongo_mapper'
- # config.orm = :mongo_mapper
+ # config.token_authentication_key = :auth_token
+ # ==> Scopes configuration
# Turn scoped views on. Before rendering "sessions/new", it will first check for
- # "sessions/users/new". It's turned off by default because it's slower if you
+ # "users/sessions/new". It's turned off by default because it's slower if you
# are using only default views.
# config.scoped_views = true
- # By default, devise detects the role accessed based on the url. So whenever
- # accessing "/users/sign_in", it knows you are accessing an User. This makes
- # routes as "/sign_in" not possible, unless you tell Devise to use the default
- # scope, setting true below.
- # config.use_default_scope = true
-
- # Configure the default scope used by Devise. By default it's the first devise
- # role declared in your routes.
+ # Configure the default scope given to Warden. By default it's the first
+ # devise role declared in your routes.
# config.default_scope = :user
+ # Configure sign_out behavior.
+ # By default sign_out is scoped (i.e. /users/sign_out affects only :user scope).
+ # In case of sign_out_all_scopes set to true any logout action will sign out all active scopes.
+ # config.sign_out_all_scopes = false
+
+ # ==> Navigation configuration
+ # Lists the formats that should be treated as navigational. Formats like
+ # :html, should redirect to the sign in page when the user does not have
+ # access, but formats like :xml or :json, should return 401.
+ # If you have any extra navigational formats, like :iphone or :mobile, you
+ # should add them to the navigational formats lists. Default is [:html]
+ # config.navigational_formats = [:html, :iphone]
+
+ # ==> Warden configuration
# If you want to use other strategies, that are not (yet) supported by Devise,
# you can configure them inside the config.warden block. The example below
# allows you to setup OAuth, using http://github.com/roman/warden_oauth
@@ -94,12 +138,6 @@
# twitter.consumer_key = <YOUR CONSUMER KEY>
# twitter.options :site => 'http://twitter.com'
# end
- # manager.default_strategies.unshift :twitter_oauth
- # end
-
- # Configure default_url_options if you are using dynamic segments in :path_prefix
- # for devise_for.
- # config.default_url_options do
- # { :locale => I18n.locale }
+ # manager.default_strategies(:scope => :user).unshift :twitter_oauth
# end
end
View
2  config/initializers/inflections.rb
@@ -1,6 +1,6 @@
# Be sure to restart your server when you modify this file.
-# Add new inflection rules using the following format
+# 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'
View
21 config/initializers/new_rails_defaults.rb
@@ -1,21 +0,0 @@
-# Be sure to restart your server when you modify this file.
-
-# These settings change the behavior of Rails 2 apps and will be defaults
-# for Rails 3. You can remove this initializer when Rails 3 is released.
-
-if defined?(ActiveRecord)
- # Include Active Record class name as root for JSON serialized output.
- ActiveRecord::Base.include_root_in_json = true
-
- # Store the full class name (including module namespace) in STI type column.
- ActiveRecord::Base.store_full_sti_class = true
-end
-
-ActionController::Routing.generate_best_match = false
-
-# Use ISO 8601 format for JSON serialized times and dates.
-ActiveSupport.use_standard_json_time_format = true
-
-# Don't escape HTML entities in JSON, leave that for the #json_escape helper.
-# if you're including raw json in an HTML page.
-ActiveSupport.escape_html_entities_in_json = false
View
7 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.
+Timefliesby::Application.config.secret_token = 'ebf63d727c85aac063d07e3dcaca530efec87b1ae1fa168faa6798bab72226825d91b0122e732ac41b58dd69cf2ec49dd0128362264d134d2159ea2df2a6e102'
View
13 config/initializers/session_store.rb
@@ -1,15 +1,8 @@
# Be sure to restart your server when you modify this file.
-# Your secret key for verifying cookie session data integrity.
-# If you change this key, all old sessions 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.
-ActionController::Base.session = {
- :key => '_timefliesby_session',
- :secret => 'bf2419071a4747c0d515a71d04848aa449d448cb492ec42d3eb3f77707fff092c6924163ba2f89fc4cc2cb01b3ee98e05479f0bacb70d69cade54017743fb5bc'
-}
+Timefliesby::Application.config.session_store :cookie_store, :key => '_timefliesby_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 "rake db:sessions:create")
-# ActionController::Base.session_store = :active_record_store
+# (create the session table with "rails generate session_migration")
+# Timefliesby::Application.config.session_store :active_record_store
View
42 config/initializers/validates_timeliness.rb
@@ -0,0 +1,42 @@
+ValidatesTimeliness.setup do |config|
+ # Extend ORM/ODMs for full support (:active_record, :mongoid).
+ config.extend_orms = [ :active_record ]
+
+ # Default timezone
+ config.default_timezone = :cst
+
+ # Set the dummy date part for a time type values. (for a time-only type)
+ config.dummy_date_for_time_type = [ 1999, 1, 1 ]
+
+ # Ignore errors when restriction options are evaluated (By default these errors are displayed in Rails test mode)
+ config.ignore_restriction_errors = false
+
+ # Re-display invalid values in date/time selects (To activate it, uncomment)
+ config.enable_date_time_select_extension!
+
+ # Handle multiparameter date/time values strictly (To activate it, uncomment this line)