hublot 0.0.1 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +15 -0
  2. data/{LICENSE.txt → MIT-LICENSE} +2 -4
  3. data/README.rdoc +42 -0
  4. data/Rakefile +34 -1
  5. data/lib/hublot.rb +1 -1
  6. data/lib/hublot/pretty.rb +16 -16
  7. data/lib/hublot/rails.rb +9 -0
  8. data/lib/hublot/version.rb +2 -2
  9. data/lib/tasks/hublot_tasks.rake +4 -0
  10. data/test/dummy/Guardfile +24 -0
  11. data/test/dummy/Rakefile +7 -0
  12. data/test/dummy/app/assets/javascripts/application.js +15 -0
  13. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  14. data/test/dummy/app/controllers/application_controller.rb +3 -0
  15. data/test/dummy/app/helpers/application_helper.rb +2 -0
  16. data/test/dummy/app/models/comment.rb +7 -0
  17. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  18. data/test/dummy/config.ru +4 -0
  19. data/test/dummy/config/application.rb +59 -0
  20. data/test/dummy/config/boot.rb +10 -0
  21. data/test/dummy/config/database.yml +25 -0
  22. data/test/dummy/config/environment.rb +5 -0
  23. data/test/dummy/config/environments/development.rb +37 -0
  24. data/test/dummy/config/environments/production.rb +67 -0
  25. data/test/dummy/config/environments/test.rb +37 -0
  26. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  27. data/test/dummy/config/initializers/inflections.rb +15 -0
  28. data/test/dummy/config/initializers/mime_types.rb +5 -0
  29. data/test/dummy/config/initializers/secret_token.rb +7 -0
  30. data/test/dummy/config/initializers/session_store.rb +8 -0
  31. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  32. data/test/dummy/config/locales/en.yml +5 -0
  33. data/test/dummy/config/routes.rb +58 -0
  34. data/test/dummy/db/development.sqlite3 +0 -0
  35. data/test/dummy/db/migrate/20130715211742_create_comments.rb +9 -0
  36. data/test/dummy/db/schema.rb +22 -0
  37. data/test/dummy/db/test.sqlite3 +0 -0
  38. data/test/dummy/log/development.log +57 -0
  39. data/test/dummy/log/test.log +3069 -0
  40. data/test/dummy/public/404.html +26 -0
  41. data/test/dummy/public/422.html +26 -0
  42. data/test/dummy/public/500.html +25 -0
  43. data/test/dummy/public/favicon.ico +0 -0
  44. data/test/dummy/script/rails +6 -0
  45. data/test/dummy/spec/factories.rb +86 -0
  46. data/test/dummy/spec/features/hublot_prettifies_time_with_zone_spec.rb +83 -0
  47. data/test/dummy/spec/models/comment_spec.rb +73 -0
  48. data/test/dummy/spec/spec_helper.rb +38 -0
  49. data/test/dummy/test/fixtures/comments.yml +7 -0
  50. data/test/dummy/test/unit/comment_test.rb +7 -0
  51. data/test/dummy/tmp/rspec_guard_result +1 -0
  52. data/test/hublot_test.rb +7 -0
  53. data/test/test_helper.rb +15 -0
  54. metadata +131 -57
  55. data/.gitignore +0 -17
  56. data/.rspec +0 -1
  57. data/Gemfile +0 -9
  58. data/README.md +0 -50
  59. data/hublot.gemspec +0 -24
  60. data/lib/clock/clockmanifest.rb +0 -17
  61. data/lib/clock/friday.rb +0 -9
  62. data/lib/clock/last_friday.rb +0 -9
  63. data/lib/clock/last_monday.rb +0 -9
  64. data/lib/clock/last_saturday.rb +0 -9
  65. data/lib/clock/last_sunday.rb +0 -9
  66. data/lib/clock/last_thursday.rb +0 -9
  67. data/lib/clock/last_tuesday.rb +0 -9
  68. data/lib/clock/last_wednesday.rb +0 -9
  69. data/lib/clock/monday.rb +0 -9
  70. data/lib/clock/next_monday.rb +0 -9
  71. data/lib/clock/next_sunday.rb +0 -9
  72. data/lib/clock/saturday.rb +0 -9
  73. data/lib/clock/sunday.rb +0 -9
  74. data/lib/clock/thursday.rb +0 -9
  75. data/lib/clock/timepiece.rb +0 -15
  76. data/lib/clock/tuesday.rb +0 -9
  77. data/lib/clock/wednesday.rb +0 -9
  78. data/lib/example_objects/active_record_example.rb +0 -14
  79. data/spec/clock_spec.rb +0 -119
  80. data/spec/pretty_spec.rb +0 -77
data/.gitignore DELETED
@@ -1,17 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --color
data/Gemfile DELETED
@@ -1,9 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'bundler'
4
-
5
- group :development do
6
- gem 'pry'
7
- end
8
-
9
- gemspec
data/README.md DELETED
@@ -1,50 +0,0 @@
1
- Hublot
2
- ==================================
3
-
4
- Hublot makes Facebook-style datetime-contextual datetimes a cinch for your ActiveRecord objects.
5
-
6
- Examples
7
- ==================================
8
- ####Comment created a just now:
9
-
10
- just now
11
-
12
- ####Comment created seconds or minutes ago
13
-
14
- 10 seconds ago
15
- 2 minutes ago
16
-
17
- ####Comment created today
18
-
19
- Today at 5:30PM
20
-
21
- ####Comment created yesterday
22
-
23
- Yesterday at 5:30PM
24
-
25
- ####Comment created this week
26
-
27
- Monday at 5:30PM
28
-
29
- ####Comment created last week
30
-
31
- Last Monday at 5:30PM
32
-
33
- ####After that:
34
-
35
- Monday, July 1 at 5:30PM
36
-
37
- Use
38
- =================================
39
-
40
- gem 'hublot'
41
-
42
- Include Hublot in your ActiveRecord models:
43
-
44
- class Comment < ActiveRecord::Base
45
- include Hublot
46
- end
47
-
48
- Call the pretty method in your views:
49
-
50
- <%= @comment.pretty %>
@@ -1,24 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'hublot/version'
5
-
6
- Gem::Specification.new do |gem|
7
- gem.name = "hublot"
8
- gem.version = Hublot::VERSION
9
- gem.authors = ["Brett Shollenberger"]
10
- gem.email = ["brett.shollenberger@gmail.com"]
11
- gem.description = "Date-sensitive humanized datetim"
12
- gem.summary = "Include hublot inside any class that includes a created_at attribute, and call the pretty method on that object to return context-sensitive datetime."
13
- gem.homepage = ""
14
-
15
- gem.files = `git ls-files`.split($/)
16
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
- gem.require_paths = ["lib"]
19
-
20
- gem.add_development_dependency 'rspec'
21
- gem.add_development_dependency 'active_support'
22
- gem.add_development_dependency 'i18n'
23
- gem.add_development_dependency 'rake'
24
- end
@@ -1,17 +0,0 @@
1
- require 'clock/timepiece'
2
- require 'clock/monday'
3
- require 'clock/tuesday'
4
- require 'clock/wednesday'
5
- require 'clock/thursday'
6
- require 'clock/friday'
7
- require 'clock/saturday'
8
- require 'clock/sunday'
9
- require 'clock/last_monday'
10
- require 'clock/last_tuesday'
11
- require 'clock/last_wednesday'
12
- require 'clock/last_thursday'
13
- require 'clock/last_friday'
14
- require 'clock/last_saturday'
15
- require 'clock/last_sunday'
16
- require 'clock/next_monday'
17
- require 'clock/next_sunday'
@@ -1,9 +0,0 @@
1
- module Clock
2
-
3
- class Friday < Timepiece
4
- def initialize(datetime=DateTime.new(2013, 7, 12, 22, 22, 58))
5
- @datetime = datetime.to_time
6
- end
7
- end
8
-
9
- end
@@ -1,9 +0,0 @@
1
- module Clock
2
-
3
- class LastFriday < Timepiece
4
- def initialize(datetime=DateTime.new(2013, 7, 5, 22, 0, 58))
5
- @datetime = datetime.to_time
6
- end
7
- end
8
-
9
- end
@@ -1,9 +0,0 @@
1
- module Clock
2
-
3
- class LastMonday < Timepiece
4
- def initialize(datetime=DateTime.new(2013, 7, 1, 22, 0, 58))
5
- @datetime = datetime.to_time
6
- end
7
- end
8
-
9
- end
@@ -1,9 +0,0 @@
1
- module Clock
2
-
3
- class LastSaturday < Timepiece
4
- def initialize(datetime=DateTime.new(2013, 7, 6, 22, 0, 58))
5
- @datetime = datetime.to_time
6
- end
7
- end
8
-
9
- end
@@ -1,9 +0,0 @@
1
- module Clock
2
-
3
- class LastSunday < Timepiece
4
- def initialize(datetime=DateTime.new(2013, 7, 7, 22, 0, 58))
5
- @datetime = datetime.to_time
6
- end
7
- end
8
-
9
- end
@@ -1,9 +0,0 @@
1
- module Clock
2
-
3
- class LastThursday < Timepiece
4
- def initialize(datetime=DateTime.new(2013, 7, 4, 22, 0, 58))
5
- @datetime = datetime.to_time
6
- end
7
- end
8
-
9
- end
@@ -1,9 +0,0 @@
1
- module Clock
2
-
3
- class LastTuesday < Timepiece
4
- def initialize(datetime=DateTime.new(2013, 7, 2, 22, 0, 58))
5
- @datetime = datetime.to_time
6
- end
7
- end
8
-
9
- end
@@ -1,9 +0,0 @@
1
- module Clock
2
-
3
- class LastWednesday < Timepiece
4
- def initialize(datetime=DateTime.new(2013, 7, 3, 22, 0, 58))
5
- @datetime = datetime.to_time
6
- end
7
- end
8
-
9
- end
@@ -1,9 +0,0 @@
1
- module Clock
2
-
3
- class Monday < Timepiece
4
- def initialize(datetime=DateTime.new(2013, 7, 8, 22, 0, 58))
5
- @datetime = datetime.to_time
6
- end
7
- end
8
-
9
- end
@@ -1,9 +0,0 @@
1
- module Clock
2
-
3
- class NextMonday < Timepiece
4
- def initialize(datetime=DateTime.new(2013, 7, 15, 22, 22, 58))
5
- @datetime = datetime.to_time
6
- end
7
- end
8
-
9
- end
@@ -1,9 +0,0 @@
1
- module Clock
2
-
3
- class NextSunday < Timepiece
4
- def initialize(datetime=DateTime.new(2013, 7, 21, 22, 22, 58))
5
- @datetime = datetime.to_time
6
- end
7
- end
8
-
9
- end
@@ -1,9 +0,0 @@
1
- module Clock
2
-
3
- class Saturday < Timepiece
4
- def initialize(datetime=DateTime.new(2013, 7, 13, 22, 22, 58))
5
- @datetime = datetime.to_time
6
- end
7
- end
8
-
9
- end
@@ -1,9 +0,0 @@
1
- module Clock
2
-
3
- class Sunday < Timepiece
4
- def initialize(datetime=DateTime.new(2013, 7, 14, 22, 22, 58))
5
- @datetime = datetime.to_time
6
- end
7
- end
8
-
9
- end
@@ -1,9 +0,0 @@
1
- module Clock
2
-
3
- class Thursday < Timepiece
4
- def initialize(datetime=DateTime.new(2013, 7, 11, 22, 22, 58))
5
- @datetime = datetime.to_time
6
- end
7
- end
8
-
9
- end
@@ -1,15 +0,0 @@
1
- module Clock
2
-
3
- class Timepiece
4
- attr_accessor :datetime
5
-
6
- def initialize(datetime)
7
- @datetime = datetime.to_time
8
- end
9
-
10
- def day_of_week
11
- @datetime.strftime('%A')
12
- end
13
- end
14
-
15
- end
@@ -1,9 +0,0 @@
1
- module Clock
2
-
3
- class Tuesday < Timepiece
4
- def initialize(datetime=DateTime.new(2013, 7, 9, 22, 22, 58))
5
- @datetime = datetime.to_time
6
- end
7
- end
8
-
9
- end
@@ -1,9 +0,0 @@
1
- module Clock
2
-
3
- class Wednesday < Timepiece
4
- def initialize(datetime=DateTime.new(2013, 7, 10, 22, 22, 58))
5
- @datetime = datetime.to_time
6
- end
7
- end
8
-
9
- end
@@ -1,14 +0,0 @@
1
- module ExampleObjects
2
-
3
- class ActiveRecordExample
4
- include Hublot
5
-
6
- attr_accessor :created_at
7
-
8
- def initialize
9
- @created_at = Time.now
10
- end
11
-
12
- end
13
-
14
- end
@@ -1,119 +0,0 @@
1
- require 'rspec'
2
- require 'active_support/core_ext'
3
-
4
- require_relative '../lib/clock/clockmanifest'
5
-
6
- describe Clock do
7
- let(:monday) { Clock::Monday.new }
8
- let(:tuesday) { Clock::Tuesday.new }
9
- let(:wednesday) { Clock::Wednesday.new }
10
- let(:thursday) { Clock::Thursday.new }
11
- let(:friday) { Clock::Friday.new }
12
- let(:saturday) { Clock::Saturday.new }
13
- let(:sunday) { Clock::Sunday.new }
14
- let(:last_monday) { Clock::LastMonday.new }
15
- let(:last_tuesday) { Clock::LastTuesday.new }
16
- let(:last_wednesday) { Clock::LastWednesday.new }
17
- let(:last_thursday) { Clock::LastThursday.new }
18
- let(:last_friday) { Clock::LastFriday.new }
19
- let(:last_saturday) { Clock::LastSaturday.new }
20
- let(:last_sunday) { Clock::LastSunday.new }
21
- let(:next_monday) { Clock::NextMonday.new }
22
- let(:next_sunday) { Clock::NextSunday.new }
23
-
24
- describe "Monday" do
25
- it "is Monday" do
26
- expect(monday.day_of_week).to eql("Monday")
27
- end
28
- end
29
-
30
- describe "Tuesday" do
31
- it "is Tuesday" do
32
- expect(tuesday.day_of_week).to eql("Tuesday")
33
- end
34
- end
35
-
36
- describe "Wednesday" do
37
- it "is Wednesday" do
38
- expect(wednesday.day_of_week).to eql("Wednesday")
39
- end
40
- end
41
-
42
- describe "Thursday" do
43
- it "is Thursday" do
44
- expect(thursday.day_of_week).to eql("Thursday")
45
- end
46
- end
47
-
48
- describe "Friday" do
49
- it "is Friday" do
50
- expect(friday.day_of_week).to eql("Friday")
51
- end
52
- end
53
-
54
- describe "Saturday" do
55
- it "is Saturday" do
56
- expect(saturday.day_of_week).to eql("Saturday")
57
- end
58
- end
59
-
60
- describe "Sunday" do
61
- it "is Sunday" do
62
- expect(sunday.day_of_week).to eql("Sunday")
63
- end
64
- end
65
-
66
- describe "LastMonday" do
67
- it "is Monday" do
68
- expect(last_monday.day_of_week).to eql("Monday")
69
- end
70
- end
71
-
72
- describe "LastTuesday" do
73
- it "is Tuesday" do
74
- expect(last_tuesday.day_of_week).to eql("Tuesday")
75
- end
76
- end
77
-
78
- describe "LastWednesday" do
79
- it "is Wednesday" do
80
- expect(last_wednesday.day_of_week).to eql("Wednesday")
81
- end
82
- end
83
-
84
- describe "LastThursday" do
85
- it "is Thursday" do
86
- expect(last_thursday.day_of_week).to eql("Thursday")
87
- end
88
- end
89
-
90
- describe "LastFriday" do
91
- it "is Friday" do
92
- expect(last_friday.day_of_week).to eql("Friday")
93
- end
94
- end
95
-
96
- describe "LastSaturday" do
97
- it "is Saturday" do
98
- expect(last_saturday.day_of_week).to eql("Saturday")
99
- end
100
- end
101
-
102
- describe "LastSunday" do
103
- it "is Sunday" do
104
- expect(last_sunday.day_of_week).to eql("Sunday")
105
- end
106
- end
107
-
108
- describe "NextMonday" do
109
- it "is Monday" do
110
- expect(next_monday.day_of_week).to eql("Monday")
111
- end
112
- end
113
-
114
- describe "NextSunday" do
115
- it "is Sunday" do
116
- expect(next_sunday.day_of_week).to eql("Sunday")
117
- end
118
- end
119
- end