hublot 0.0.1 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/{LICENSE.txt → MIT-LICENSE} +2 -4
- data/README.rdoc +42 -0
- data/Rakefile +34 -1
- data/lib/hublot.rb +1 -1
- data/lib/hublot/pretty.rb +16 -16
- data/lib/hublot/rails.rb +9 -0
- data/lib/hublot/version.rb +2 -2
- data/lib/tasks/hublot_tasks.rake +4 -0
- data/test/dummy/Guardfile +24 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/models/comment.rb +7 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +59 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +58 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20130715211742_create_comments.rb +9 -0
- data/test/dummy/db/schema.rb +22 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +57 -0
- data/test/dummy/log/test.log +3069 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/dummy/spec/factories.rb +86 -0
- data/test/dummy/spec/features/hublot_prettifies_time_with_zone_spec.rb +83 -0
- data/test/dummy/spec/models/comment_spec.rb +73 -0
- data/test/dummy/spec/spec_helper.rb +38 -0
- data/test/dummy/test/fixtures/comments.yml +7 -0
- data/test/dummy/test/unit/comment_test.rb +7 -0
- data/test/dummy/tmp/rspec_guard_result +1 -0
- data/test/hublot_test.rb +7 -0
- data/test/test_helper.rb +15 -0
- metadata +131 -57
- data/.gitignore +0 -17
- data/.rspec +0 -1
- data/Gemfile +0 -9
- data/README.md +0 -50
- data/hublot.gemspec +0 -24
- data/lib/clock/clockmanifest.rb +0 -17
- data/lib/clock/friday.rb +0 -9
- data/lib/clock/last_friday.rb +0 -9
- data/lib/clock/last_monday.rb +0 -9
- data/lib/clock/last_saturday.rb +0 -9
- data/lib/clock/last_sunday.rb +0 -9
- data/lib/clock/last_thursday.rb +0 -9
- data/lib/clock/last_tuesday.rb +0 -9
- data/lib/clock/last_wednesday.rb +0 -9
- data/lib/clock/monday.rb +0 -9
- data/lib/clock/next_monday.rb +0 -9
- data/lib/clock/next_sunday.rb +0 -9
- data/lib/clock/saturday.rb +0 -9
- data/lib/clock/sunday.rb +0 -9
- data/lib/clock/thursday.rb +0 -9
- data/lib/clock/timepiece.rb +0 -15
- data/lib/clock/tuesday.rb +0 -9
- data/lib/clock/wednesday.rb +0 -9
- data/lib/example_objects/active_record_example.rb +0 -14
- data/spec/clock_spec.rb +0 -119
- data/spec/pretty_spec.rb +0 -77
data/.gitignore
DELETED
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|
data/Gemfile
DELETED
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 %>
|
data/hublot.gemspec
DELETED
@@ -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
|
data/lib/clock/clockmanifest.rb
DELETED
@@ -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'
|
data/lib/clock/friday.rb
DELETED
data/lib/clock/last_friday.rb
DELETED
data/lib/clock/last_monday.rb
DELETED
data/lib/clock/last_saturday.rb
DELETED
data/lib/clock/last_sunday.rb
DELETED
data/lib/clock/last_thursday.rb
DELETED
data/lib/clock/last_tuesday.rb
DELETED
data/lib/clock/last_wednesday.rb
DELETED
data/lib/clock/monday.rb
DELETED
data/lib/clock/next_monday.rb
DELETED
data/lib/clock/next_sunday.rb
DELETED
data/lib/clock/saturday.rb
DELETED
data/lib/clock/sunday.rb
DELETED
data/lib/clock/thursday.rb
DELETED
data/lib/clock/timepiece.rb
DELETED
data/lib/clock/tuesday.rb
DELETED
data/lib/clock/wednesday.rb
DELETED
data/spec/clock_spec.rb
DELETED
@@ -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
|