Permalink
Browse files

first commit

  • Loading branch information...
0 parents commit c53a914f663e563533a48c2fddf8d13f51799eb2 @ambethia committed Feb 16, 2012
Showing with 1,022 additions and 0 deletions.
  1. +7 −0 .gitignore
  2. +17 −0 Gemfile
  3. +97 −0 Gemfile.lock
  4. +20 −0 MIT-LICENSE
  5. +3 −0 README.rdoc
  6. +38 −0 Rakefile
  7. +4 −0 lib/tasks/time_tag_tasks.rake
  8. +1 −0 lib/time_tag_in_words.rb
  9. +9 −0 lib/time_tag_in_words/railtie.rb
  10. +3 −0 lib/time_tag_in_words/version.rb
  11. +12 −0 lib/time_tag_in_words/view_helpers.rb
  12. +261 −0 test/dummy/README.rdoc
  13. +7 −0 test/dummy/Rakefile
  14. +15 −0 test/dummy/app/assets/javascripts/application.js
  15. +13 −0 test/dummy/app/assets/stylesheets/application.css
  16. +3 −0 test/dummy/app/controllers/application_controller.rb
  17. +2 −0 test/dummy/app/helpers/application_helper.rb
  18. 0 test/dummy/app/mailers/.gitkeep
  19. 0 test/dummy/app/models/.gitkeep
  20. +14 −0 test/dummy/app/views/layouts/application.html.erb
  21. +4 −0 test/dummy/config.ru
  22. +56 −0 test/dummy/config/application.rb
  23. +10 −0 test/dummy/config/boot.rb
  24. +25 −0 test/dummy/config/database.yml
  25. +5 −0 test/dummy/config/environment.rb
  26. +37 −0 test/dummy/config/environments/development.rb
  27. +67 −0 test/dummy/config/environments/production.rb
  28. +37 −0 test/dummy/config/environments/test.rb
  29. +7 −0 test/dummy/config/initializers/backtrace_silencers.rb
  30. +15 −0 test/dummy/config/initializers/inflections.rb
  31. +5 −0 test/dummy/config/initializers/mime_types.rb
  32. +7 −0 test/dummy/config/initializers/secret_token.rb
  33. +8 −0 test/dummy/config/initializers/session_store.rb
  34. +14 −0 test/dummy/config/initializers/wrap_parameters.rb
  35. +5 −0 test/dummy/config/locales/en.yml
  36. +58 −0 test/dummy/config/routes.rb
  37. 0 test/dummy/lib/assets/.gitkeep
  38. 0 test/dummy/log/.gitkeep
  39. +26 −0 test/dummy/public/404.html
  40. +26 −0 test/dummy/public/422.html
  41. +25 −0 test/dummy/public/500.html
  42. 0 test/dummy/public/favicon.ico
  43. +6 −0 test/dummy/script/rails
  44. +10 −0 test/test_helper.rb
  45. +21 −0 test/time_tag_in_words_test.rb
  46. +22 −0 time_tag.gemspec
@@ -0,0 +1,7 @@
+.bundle/
+log/*.log
+pkg/
+test/dummy/db/*.sqlite3
+test/dummy/log/*.log
+test/dummy/tmp/
+test/dummy/.sass-cache
@@ -0,0 +1,17 @@
+source "http://rubygems.org"
+
+# Declare your gem's dependencies in time_tag_in_words.gemspec.
+# Bundler will treat runtime dependencies like base dependencies, and
+# development dependencies will be added by default to the :development group.
+gemspec
+
+# jquery-rails is used by the dummy application
+gem "jquery-rails"
+
+# Declare any dependencies that are still in development here instead of in
+# your gemspec. These might include edge Rails or gems from your path or
+# Git. Remember to move these dependencies to your gemspec before releasing
+# your gem to rubygems.org.
+
+# To use debugger
+# gem 'ruby-debug19', :require => 'ruby-debug'
@@ -0,0 +1,97 @@
+PATH
+ remote: .
+ specs:
+ time_tag_in_words (0.0.1)
+ rails (~> 3)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ actionmailer (3.2.1)
+ actionpack (= 3.2.1)
+ mail (~> 2.4.0)
+ actionpack (3.2.1)
+ activemodel (= 3.2.1)
+ activesupport (= 3.2.1)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ journey (~> 1.0.1)
+ rack (~> 1.4.0)
+ rack-cache (~> 1.1)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.1.2)
+ activemodel (3.2.1)
+ activesupport (= 3.2.1)
+ builder (~> 3.0.0)
+ activerecord (3.2.1)
+ activemodel (= 3.2.1)
+ activesupport (= 3.2.1)
+ arel (~> 3.0.0)
+ tzinfo (~> 0.3.29)
+ activeresource (3.2.1)
+ activemodel (= 3.2.1)
+ activesupport (= 3.2.1)
+ activesupport (3.2.1)
+ i18n (~> 0.6)
+ multi_json (~> 1.0)
+ arel (3.0.0)
+ builder (3.0.0)
+ erubis (2.7.0)
+ hike (1.2.1)
+ i18n (0.6.0)
+ journey (1.0.1)
+ jquery-rails (2.0.0)
+ railties (>= 3.2.0.beta, < 5.0)
+ thor (~> 0.14)
+ json (1.6.5)
+ mail (2.4.1)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.17.2)
+ multi_json (1.0.4)
+ polyglot (0.3.3)
+ rack (1.4.1)
+ rack-cache (1.1)
+ rack (>= 0.4)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.1)
+ rack (>= 1.0)
+ rails (3.2.1)
+ actionmailer (= 3.2.1)
+ actionpack (= 3.2.1)
+ activerecord (= 3.2.1)
+ activeresource (= 3.2.1)
+ activesupport (= 3.2.1)
+ bundler (~> 1.0)
+ railties (= 3.2.1)
+ railties (3.2.1)
+ actionpack (= 3.2.1)
+ activesupport (= 3.2.1)
+ 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)
+ sprockets (2.1.2)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ sqlite3 (1.3.5)
+ thor (0.14.6)
+ tilt (1.3.3)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.31)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ jquery-rails
+ sqlite3
+ time_tag_in_words!
@@ -0,0 +1,20 @@
+Copyright 2012 Jason L Perry
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,3 @@
+= TimeTagInWords
+
+Rails helper, giving convenient tags for timestamps.
@@ -0,0 +1,38 @@
+#!/usr/bin/env rake
+begin
+ require 'bundler/setup'
+rescue LoadError
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
+end
+begin
+ require 'rdoc/task'
+rescue LoadError
+ require 'rdoc/rdoc'
+ require 'rake/rdoctask'
+ RDoc::Task = Rake::RDocTask
+end
+
+RDoc::Task.new(:rdoc) do |rdoc|
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.title = 'TimeTagInWords'
+ rdoc.options << '--line-numbers'
+ rdoc.rdoc_files.include('README.rdoc')
+ rdoc.rdoc_files.include('lib/**/*.rb')
+end
+
+
+
+
+Bundler::GemHelper.install_tasks
+
+require 'rake/testtask'
+
+Rake::TestTask.new(:test) do |t|
+ t.libs << 'lib'
+ t.libs << 'test'
+ t.pattern = 'test/**/*_test.rb'
+ t.verbose = false
+end
+
+
+task :default => :test
@@ -0,0 +1,4 @@
+# desc "Explaining what the task does"
+# task :time_tag_in_words do
+# # Task goes here
+# end
@@ -0,0 +1 @@
+require 'time_tag_in_words/railtie' if defined?(Rails)
@@ -0,0 +1,9 @@
+require 'time_tag_in_words/view_helpers'
+
+module TimeTagInWords
+ class Railtie < Rails::Railtie
+ initializer "time_tag_in_words.view_helpers" do
+ ActionView::Base.send :include, TimeTagInWords::ViewHelpers
+ end
+ end
+end
@@ -0,0 +1,3 @@
+module TimeTagInWords
+ VERSION = "0.0.1"
+end
@@ -0,0 +1,12 @@
+module TimeTagInWords
+ module ViewHelpers
+
+ def time_tag_in_words(time)
+ suffix = time > Time.now ? "from now" : "ago"
+ content_tag :time, :datetime => time.to_s(:db),
+ :title => time.to_s(:long_ordinal) do
+ [distance_of_time_in_words_to_now(time), suffix] * ' '
+ end
+ end
+ end
+end
Oops, something went wrong.

0 comments on commit c53a914

Please sign in to comment.