seamusabshere-has_timestamps 1.3 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION.yml ADDED
@@ -0,0 +1,4 @@
1
+ ---
2
+ :major: 1
3
+ :minor: 4
4
+ :patch: 0
@@ -17,7 +17,7 @@ module HasTimestamps
17
17
  end
18
18
  after_save :save_or_destroy_timestamps
19
19
 
20
- def timestamp!(key)
20
+ def timestamp(key)
21
21
  timestamps[key.to_s] = Time.now
22
22
  end
23
23
 
@@ -29,7 +29,7 @@ module SharedTests
29
29
  end
30
30
 
31
31
  it "should set timestamp" do
32
- @person.timestamp!(:hailed)
32
+ @person.timestamp(:hailed)
33
33
  @person.save
34
34
  @person.reload
35
35
  assert_simultaneous Time.now, @person.timestamps[:hailed]
@@ -37,7 +37,7 @@ module SharedTests
37
37
 
38
38
  it "should reset timestamp" do
39
39
  old_time = @person.timestamps[:saluted]
40
- @person.timestamp!(:saluted)
40
+ @person.timestamp(:saluted)
41
41
  @person.save
42
42
  @person.reload
43
43
  assert_not_simultaneous(old_time, @person.timestamps[:saluted])
@@ -90,7 +90,7 @@ module SharedTests
90
90
 
91
91
  it "should save timestamps" do
92
92
  assert_difference('Timestamp.count', 1) do
93
- @person.timestamp!(:hailed)
93
+ @person.timestamp(:hailed)
94
94
  @person.save
95
95
  end
96
96
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seamusabshere-has_timestamps
3
3
  version: !ruby/object:Gem::Version
4
- version: "1.3"
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seamus Abshere
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-02 00:00:00 -08:00
12
+ date: 2009-02-10 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -22,21 +22,19 @@ extensions: []
22
22
  extra_rdoc_files: []
23
23
 
24
24
  files:
25
- - has_timestamps.gemspec
25
+ - VERSION.yml
26
26
  - lib/has_timestamps.rb
27
27
  - lib/timestamp.rb
28
- - MIT-LICENSE
29
- - Rakefile
30
- - README
31
- - tasks/has_timestamps_tasks.rake
28
+ - test/has_timestamps_test.rb
29
+ - test/test_helper.rb
32
30
  - init.rb
33
31
  - rails/init.rb
34
- - test/test_helper.rb
35
- has_rdoc: false
32
+ has_rdoc: true
36
33
  homepage: http://github.com/seamusabshere/has_timestamps
37
34
  post_install_message:
38
- rdoc_options: []
39
-
35
+ rdoc_options:
36
+ - --inline-source
37
+ - --charset=UTF-8
40
38
  require_paths:
41
39
  - lib
42
40
  required_ruby_version: !ruby/object:Gem::Requirement
data/MIT-LICENSE DELETED
@@ -1,20 +0,0 @@
1
- Copyright (c) 2008 [name of plugin creator]
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README DELETED
@@ -1,72 +0,0 @@
1
- HasTimestamps
2
- =================
3
-
4
- Lets you timestamp models, like if you want to fake a CRM.
5
-
6
- Note: it doesn't save objects automatically, so you have to run a "user.save" (etc.) when you're done timestamping.
7
-
8
- Installation
9
- ============
10
-
11
- You should be able to run this as a plugin or as a gem.
12
-
13
- For environment.rb:
14
-
15
- config.gem 'seamusabshere-has_timestamps', :lib => 'has_timestamps', :source => 'http://gems.github.com'
16
-
17
- Then be sure to:
18
-
19
- rake gems:install
20
-
21
- Example
22
- =======
23
-
24
- class CreateTimestamps < ActiveRecord::Migration
25
- def self.up
26
- create_table(:timestamps) do |t|
27
- t.integer :timestampable_id
28
- t.string :timestampable_type
29
- t.string :key
30
- t.datetime :stamped_at
31
- t.timestamps
32
- end
33
- end
34
-
35
- def self.down
36
- drop_table(:timestamps)
37
- end
38
- end
39
-
40
- then...
41
-
42
- class User < ActiveRecord::Base
43
- has_timestamps
44
- end
45
-
46
- >> user.timestamps
47
- => []
48
- >> user.timestamp!(:hailed)
49
- => Wed Dec 10 15:11:52 -0500 2008
50
- >> user.timestamps
51
- => [#<Timestamp id: nil, timestampable_id: 14, timestampable_type: "User", key: "hailed", stamped_at: "2008-12-10 15:11:52", created_at: nil, updated_at: nil>]
52
- >> user.timestamped?(:hailed)
53
- => true
54
- >> user.save
55
- => true
56
- >> user.timestamped?(:saluted)
57
- => false
58
- >> user.timestamp!(:saluted)
59
- => Wed Dec 10 15:12:28 -0500 2008
60
- >> user.timestamped?(:saluted)
61
- => true
62
- >> user.timestamps[:saluted]
63
- => Wed Dec 10 15:12:28 -0500 2008
64
- >> user.timestamps[:hailed]
65
- => Wed Dec 10 15:11:52 -0500 2008
66
-
67
- Credits
68
- =======
69
-
70
- Thanks to Fingertips for inspiration.
71
-
72
- Copyright (c) 2008 Seamus Abshere, released under the MIT license.
data/Rakefile DELETED
@@ -1,22 +0,0 @@
1
- require 'rake'
2
- require 'rake/testtask'
3
- require 'rake/rdoctask'
4
-
5
- desc 'Default: run unit tests.'
6
- task :default => :test
7
-
8
- desc 'Test the has_timestamps plugin.'
9
- Rake::TestTask.new(:test) do |t|
10
- t.libs << 'lib'
11
- t.pattern = 'test/**/*_test.rb'
12
- t.verbose = true
13
- end
14
-
15
- desc 'Generate documentation for the has_timestamps plugin.'
16
- Rake::RDocTask.new(:rdoc) do |rdoc|
17
- rdoc.rdoc_dir = 'rdoc'
18
- rdoc.title = 'HasTimestamps'
19
- rdoc.options << '--line-numbers' << '--inline-source'
20
- rdoc.rdoc_files.include('README')
21
- rdoc.rdoc_files.include('lib/**/*.rb')
22
- end
@@ -1,26 +0,0 @@
1
- Gem::Specification.new do |s|
2
- s.name = "has_timestamps"
3
- s.version = "1.3"
4
- s.date = "2009-01-02"
5
- s.summary = "Rails plugin to add named timestamps to ActiveRecord models."
6
- s.email = "seamus@abshere.net"
7
- s.homepage = "http://github.com/seamusabshere/has_timestamps"
8
- s.description = "has_timestamps is a Rails plugin that allows you to add named timestamps to ActiveRecord models without adding database columns."
9
- s.has_rdoc = false
10
- s.authors = "Seamus Abshere"
11
- s.files = [
12
- "has_timestamps.gemspec",
13
- "lib/has_timestamps.rb",
14
- "lib/timestamp.rb",
15
- "MIT-LICENSE",
16
- "Rakefile",
17
- "README",
18
- "tasks/has_timestamps_tasks.rake",
19
- "init.rb",
20
- "rails/init.rb",
21
- "test/test_helper.rb"
22
- ]
23
- s.test_files = [
24
- "test/has_timestamps_test.rb"
25
- ]
26
- end
@@ -1,4 +0,0 @@
1
- # desc "Explaining what the task does"
2
- # task :has_timestamps do
3
- # # Task goes here
4
- # end