good_touch 0.1.0 → 0.2.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/README.rdoc CHANGED
@@ -1,6 +1,11 @@
1
1
  = good_touch
2
2
 
3
- Description goes here.
3
+ Update ActiveRecord timestamps without triggering callbacks.
4
+
5
+ = Installation
6
+
7
+ available on gemcutter:
8
+ http://rubygems.org/gems/good_touch
4
9
 
5
10
  == Note on Patches/Pull Requests
6
11
 
@@ -8,9 +13,7 @@ Description goes here.
8
13
  * Make your feature addition or bug fix.
9
14
  * Add tests for it. This is important so I don't break it in a
10
15
  future version unintentionally.
11
- * Commit, do not mess with rakefile, version, or history.
12
- (if you want to have your own version, that is fine but
13
- bump version in a commit by itself I can ignore when I pull)
16
+ * Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
14
17
  * Send me a pull request. Bonus points for topic branches.
15
18
 
16
19
  == Copyright
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
data/good_touch.gemspec CHANGED
@@ -1,49 +1,47 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{good_touch}
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Ryan Sonnek"]
12
- s.date = %q{2010-03-07}
11
+ s.authors = [%q{Ryan Sonnek}]
12
+ s.date = %q{2011-08-11}
13
13
  s.description = %q{ Update your timestamp attributes without invoking all ActiveRecord callbacks}
14
14
  s.email = %q{ryan@codecrate.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
- "README.rdoc"
17
+ "README.rdoc"
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
21
- ".gitignore",
22
- "LICENSE",
23
- "README.rdoc",
24
- "Rakefile",
25
- "VERSION",
26
- "good_touch.sqlite3",
27
- "lib/good_touch.rb",
28
- "test/database.yml",
29
- "test/helper.rb",
30
- "test/test_good_touch.rb"
21
+ "LICENSE",
22
+ "README.rdoc",
23
+ "Rakefile",
24
+ "VERSION",
25
+ "good_touch.gemspec",
26
+ "good_touch.sqlite3",
27
+ "lib/good_touch.rb",
28
+ "test/database.yml",
29
+ "test/helper.rb",
30
+ "test/test_good_touch.rb"
31
31
  ]
32
32
  s.homepage = %q{http://github.com/wireframe/good_touch}
33
- s.rdoc_options = ["--charset=UTF-8"]
34
- s.require_paths = ["lib"]
35
- s.rubygems_version = %q{1.3.5}
33
+ s.require_paths = [%q{lib}]
34
+ s.rubygems_version = %q{1.8.5}
36
35
  s.summary = %q{Rails 'touch' method without all the overhead}
37
36
  s.test_files = [
38
37
  "test/helper.rb",
39
- "test/test_good_touch.rb"
38
+ "test/test_good_touch.rb"
40
39
  ]
41
40
 
42
41
  if s.respond_to? :specification_version then
43
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
44
42
  s.specification_version = 3
45
43
 
46
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
44
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
47
45
  s.add_runtime_dependency(%q<activerecord>, [">= 2.1.0"])
48
46
  s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
49
47
  else
data/lib/good_touch.rb CHANGED
@@ -2,8 +2,8 @@ module GoodTouch
2
2
  module InstanceMethods
3
3
  #touch a record without triggering callbacks
4
4
  #update DB directly to avoid overhead of reindexing the user
5
- def good_touch(attr = :updated_at)
6
- self.class.update_all({attr => Time.now.utc}, {:id => self.id})
5
+ def good_touch(attr = :updated_at, value = Time.now.utc)
6
+ self.class.update_all({attr => value}, {:id => self.id})
7
7
  end
8
8
  end
9
9
  end
data/test/helper.rb CHANGED
@@ -1,7 +1,8 @@
1
1
  require 'rubygems'
2
2
  require 'test/unit'
3
3
  require 'shoulda'
4
- require 'activerecord'
4
+ require 'active_record'
5
+ require 'logger'
5
6
 
6
7
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
7
8
  $LOAD_PATH.unshift(File.dirname(__FILE__))
@@ -35,5 +35,15 @@ class TestGoodTouch < Test::Unit::TestCase
35
35
  @post.reload.posted_at
36
36
  end
37
37
  end
38
+
39
+ context "calling good_touch with a value" do
40
+ setup do
41
+ @time = Date.parse("01/01/2010 12:00")
42
+ @post.good_touch :updated_at, @time
43
+ end
44
+ should_change "updated_at timestamp", :to => @time do
45
+ @post.reload.updated_at
46
+ end
47
+ end
38
48
  end
39
49
  end
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: good_touch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ hash: 23
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
5
11
  platform: ruby
6
12
  authors:
7
13
  - Ryan Sonnek
@@ -9,29 +15,38 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-03-07 00:00:00 -06:00
13
- default_executable:
18
+ date: 2011-08-11 00:00:00 Z
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: activerecord
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
20
25
  requirements:
21
26
  - - ">="
22
27
  - !ruby/object:Gem::Version
28
+ hash: 11
29
+ segments:
30
+ - 2
31
+ - 1
32
+ - 0
23
33
  version: 2.1.0
24
- version:
34
+ type: :runtime
35
+ version_requirements: *id001
25
36
  - !ruby/object:Gem::Dependency
26
37
  name: thoughtbot-shoulda
27
- type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
30
41
  requirements:
31
42
  - - ">="
32
43
  - !ruby/object:Gem::Version
44
+ hash: 3
45
+ segments:
46
+ - 0
33
47
  version: "0"
34
- version:
48
+ type: :development
49
+ version_requirements: *id002
35
50
  description: " Update your timestamp attributes without invoking all ActiveRecord callbacks"
36
51
  email: ryan@codecrate.com
37
52
  executables: []
@@ -43,7 +58,6 @@ extra_rdoc_files:
43
58
  - README.rdoc
44
59
  files:
45
60
  - .document
46
- - .gitignore
47
61
  - LICENSE
48
62
  - README.rdoc
49
63
  - Rakefile
@@ -54,31 +68,36 @@ files:
54
68
  - test/database.yml
55
69
  - test/helper.rb
56
70
  - test/test_good_touch.rb
57
- has_rdoc: true
58
71
  homepage: http://github.com/wireframe/good_touch
59
72
  licenses: []
60
73
 
61
74
  post_install_message:
62
- rdoc_options:
63
- - --charset=UTF-8
75
+ rdoc_options: []
76
+
64
77
  require_paths:
65
78
  - lib
66
79
  required_ruby_version: !ruby/object:Gem::Requirement
80
+ none: false
67
81
  requirements:
68
82
  - - ">="
69
83
  - !ruby/object:Gem::Version
84
+ hash: 3
85
+ segments:
86
+ - 0
70
87
  version: "0"
71
- version:
72
88
  required_rubygems_version: !ruby/object:Gem::Requirement
89
+ none: false
73
90
  requirements:
74
91
  - - ">="
75
92
  - !ruby/object:Gem::Version
93
+ hash: 3
94
+ segments:
95
+ - 0
76
96
  version: "0"
77
- version:
78
97
  requirements: []
79
98
 
80
99
  rubyforge_project:
81
- rubygems_version: 1.3.5
100
+ rubygems_version: 1.8.5
82
101
  signing_key:
83
102
  specification_version: 3
84
103
  summary: Rails 'touch' method without all the overhead
data/.gitignore DELETED
@@ -1,23 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
- *.log
21
- *.sqllite3
22
-
23
- ## PROJECT::SPECIFIC