ardm-timestamps 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +35 -0
- data/.travis.yml +11 -0
- data/Gemfile +55 -0
- data/LICENSE +20 -0
- data/README.rdoc +17 -0
- data/Rakefile +4 -0
- data/ardm-timestamps.gemspec +25 -0
- data/lib/ardm-timestamps.rb +1 -0
- data/lib/data_mapper/timestamps/version.rb +5 -0
- data/lib/dm-timestamps.rb +70 -0
- data/spec/integration/timestamps_spec.rb +199 -0
- data/spec/rcov.opts +6 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +11 -0
- data/tasks/spec.rake +38 -0
- data/tasks/yard.rake +9 -0
- data/tasks/yardstick.rake +19 -0
- metadata +109 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 583bcb564f8777f6b7a43110756cd6e899bacb72
|
4
|
+
data.tar.gz: e967770881024b8a92a47afb695fea29b8007b0e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5c2806491966e63d2ea5e539643622e387053e3cbb329750e3b57357148c910c8758401305dbe94338897c6c9d07b00bc6537adea2f6070d81e69ee5aa9ebd8e
|
7
|
+
data.tar.gz: 8b6d40458249e8b705176770e1413e690ffb78a6c518d508c1e242b0bae5c1ca6c840814a19523811752946626be318d62634fed0e7a5cb046f7ebc650dc212f
|
data/.gitignore
ADDED
@@ -0,0 +1,35 @@
|
|
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
|
+
## Rubinius
|
17
|
+
*.rbc
|
18
|
+
|
19
|
+
## PROJECT::GENERAL
|
20
|
+
*.gem
|
21
|
+
coverage
|
22
|
+
rdoc
|
23
|
+
pkg
|
24
|
+
tmp
|
25
|
+
doc
|
26
|
+
log
|
27
|
+
.yardoc
|
28
|
+
measurements
|
29
|
+
|
30
|
+
## BUNDLER
|
31
|
+
.bundle
|
32
|
+
Gemfile.*
|
33
|
+
|
34
|
+
## PROJECT::SPECIFIC
|
35
|
+
spec/db/
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
gemspec
|
6
|
+
|
7
|
+
SOURCE = ENV.fetch('SOURCE', :git).to_sym
|
8
|
+
REPO_POSTFIX = SOURCE == :path ? '' : '.git'
|
9
|
+
DATAMAPPER = SOURCE == :path ? Pathname(__FILE__).dirname.parent : 'http://github.com/ar-dm'
|
10
|
+
DM_VERSION = '~> 1.2.0'
|
11
|
+
DO_VERSION = '~> 0.10.6'
|
12
|
+
DM_DO_ADAPTERS = %w[ sqlite postgres mysql oracle sqlserver ]
|
13
|
+
CURRENT_BRANCH = ENV.fetch('GIT_BRANCH', 'master')
|
14
|
+
|
15
|
+
gem 'ardm-core', DM_VERSION,
|
16
|
+
SOURCE => "#{DATAMAPPER}/ardm-core#{REPO_POSTFIX}",
|
17
|
+
:branch => CURRENT_BRANCH
|
18
|
+
|
19
|
+
group :datamapper do
|
20
|
+
|
21
|
+
adapters = ENV['ADAPTER'] || ENV['ADAPTERS']
|
22
|
+
adapters = adapters.to_s.tr(',', ' ').split.uniq - %w[ in_memory ]
|
23
|
+
|
24
|
+
if (do_adapters = DM_DO_ADAPTERS & adapters).any?
|
25
|
+
do_options = {}
|
26
|
+
do_options[:git] = "#{DATAMAPPER}/do#{REPO_POSTFIX}" if ENV['DO_GIT'] == 'true'
|
27
|
+
|
28
|
+
gem 'data_objects', DO_VERSION, do_options.dup
|
29
|
+
|
30
|
+
do_adapters.each do |adapter|
|
31
|
+
adapter = 'sqlite3' if adapter == 'sqlite'
|
32
|
+
gem "do_#{adapter}", DO_VERSION, do_options.dup
|
33
|
+
end
|
34
|
+
|
35
|
+
gem 'ardm-do-adapter', DM_VERSION,
|
36
|
+
SOURCE => "#{DATAMAPPER}/ardm-do-adapter#{REPO_POSTFIX}",
|
37
|
+
:branch => CURRENT_BRANCH
|
38
|
+
end
|
39
|
+
|
40
|
+
adapters.each do |adapter|
|
41
|
+
gem "ardm-#{adapter}-adapter", DM_VERSION,
|
42
|
+
SOURCE => "#{DATAMAPPER}/ardm-#{adapter}-adapter#{REPO_POSTFIX}",
|
43
|
+
:branch => CURRENT_BRANCH
|
44
|
+
end
|
45
|
+
|
46
|
+
plugins = ENV['PLUGINS'] || ENV['PLUGIN']
|
47
|
+
plugins = plugins.to_s.tr(',', ' ').split.push('ardm-migrations').uniq
|
48
|
+
|
49
|
+
plugins.each do |plugin|
|
50
|
+
gem plugin, DM_VERSION,
|
51
|
+
SOURCE => "#{DATAMAPPER}/#{plugin}#{REPO_POSTFIX}",
|
52
|
+
:branch => CURRENT_BRANCH
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Foy Savas
|
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.rdoc
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
= dm-timestamps
|
2
|
+
|
3
|
+
DataMapper plugin which adds "magic" to created_at, created_on, et cetera.
|
4
|
+
|
5
|
+
= Using
|
6
|
+
|
7
|
+
This plugin works by looking for the "created_at," "updated_at," "created_on"
|
8
|
+
and "updated_on" properties. If they exist, it does the right thing by setting
|
9
|
+
them or updating them. The *at properties should be of type DateTime, while the
|
10
|
+
*on properties should be of type Date.
|
11
|
+
|
12
|
+
Alternatively, you can have all of this setup for you if you use the "timestamps"
|
13
|
+
helper:
|
14
|
+
|
15
|
+
timestamps :at # Add created_at and updated_at
|
16
|
+
timestamps :on # Add created_on and updated_on
|
17
|
+
timestamps :created_at, :updated_on # Add these only
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/data_mapper/timestamps/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.name = "ardm-timestamps"
|
6
|
+
gem.version = DataMapper::Timestamps::VERSION
|
7
|
+
|
8
|
+
gem.authors = [ 'Martin Emde', 'Foy Savas', 'Dan Kubb' ]
|
9
|
+
gem.email = [ 'me@martinemde.com', "dan.kubb@gmail.com" ]
|
10
|
+
gem.summary = "Ardm fork of dm-timestamps"
|
11
|
+
gem.description = "DataMapper plugin for magical timestamps"
|
12
|
+
gem.homepage = "https://github.com/ar-dm/dm-timestamps"
|
13
|
+
gem.license = 'MIT'
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split("\n")
|
16
|
+
gem.test_files = `git ls-files -- {spec}/*`.split("\n")
|
17
|
+
gem.extra_rdoc_files = %w[LICENSE README.rdoc]
|
18
|
+
gem.require_paths = [ "lib" ]
|
19
|
+
|
20
|
+
gem.add_runtime_dependency 'ardm-core', '~> 1.2'
|
21
|
+
|
22
|
+
gem.add_development_dependency 'rake', '~> 0.9'
|
23
|
+
gem.add_development_dependency 'rspec', '~> 1.3'
|
24
|
+
end
|
25
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'dm-timestamps'
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'dm-core'
|
2
|
+
|
3
|
+
module DataMapper
|
4
|
+
module Timestamps
|
5
|
+
TIMESTAMP_PROPERTIES = {
|
6
|
+
:updated_at => [ DateTime, lambda { |r| DateTime.now } ],
|
7
|
+
:updated_on => [ Date, lambda { |r| Date.today } ],
|
8
|
+
:created_at => [ DateTime, lambda { |r| r.created_at || (DateTime.now if r.new?) } ],
|
9
|
+
:created_on => [ Date, lambda { |r| r.created_on || (Date.today if r.new?) } ],
|
10
|
+
}.freeze
|
11
|
+
|
12
|
+
def self.included(model)
|
13
|
+
model.before :save, :set_timestamps_on_save
|
14
|
+
model.extend ClassMethods
|
15
|
+
end
|
16
|
+
|
17
|
+
# Saves the record with the updated_at/on attributes set to the current time.
|
18
|
+
def touch
|
19
|
+
set_timestamps
|
20
|
+
save
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def set_timestamps_on_save
|
26
|
+
return unless dirty?
|
27
|
+
set_timestamps
|
28
|
+
end
|
29
|
+
|
30
|
+
def set_timestamps
|
31
|
+
TIMESTAMP_PROPERTIES.each do |name,(_type,proc)|
|
32
|
+
if properties.named?(name)
|
33
|
+
attribute_set(name, proc.call(self))
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
module ClassMethods
|
39
|
+
def timestamps(*names)
|
40
|
+
raise ArgumentError, 'You need to pass at least one argument' if names.empty?
|
41
|
+
|
42
|
+
names.each do |name|
|
43
|
+
case name
|
44
|
+
when *TIMESTAMP_PROPERTIES.keys
|
45
|
+
options = { :required => true }
|
46
|
+
|
47
|
+
if Property.accepted_options.include?(:auto_validation)
|
48
|
+
options.update(:auto_validation => false)
|
49
|
+
end
|
50
|
+
|
51
|
+
property name, TIMESTAMP_PROPERTIES[name].first, options
|
52
|
+
when :at
|
53
|
+
timestamps(:created_at, :updated_at)
|
54
|
+
when :on
|
55
|
+
timestamps(:created_on, :updated_on)
|
56
|
+
else
|
57
|
+
raise InvalidTimestampName, "Invalid timestamp property name '#{name}'"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end # module ClassMethods
|
62
|
+
|
63
|
+
class InvalidTimestampName < RuntimeError; end
|
64
|
+
|
65
|
+
Model.append_inclusions self
|
66
|
+
end # module Timestamp
|
67
|
+
|
68
|
+
# include Timestamp or Timestamps, it still works
|
69
|
+
Timestamp = Timestamps
|
70
|
+
end # module DataMapper
|
@@ -0,0 +1,199 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'DataMapper::Timestamp' do
|
4
|
+
|
5
|
+
supported_by :all do
|
6
|
+
|
7
|
+
describe "Timestamp (shared behavior)", :shared => true do
|
8
|
+
it "should not set the created_at/on fields if they're already set" do
|
9
|
+
green_smoothie = GreenSmoothie.new(:name => 'Banana')
|
10
|
+
time = (DateTime.now - 100)
|
11
|
+
green_smoothie.created_at = time
|
12
|
+
green_smoothie.created_on = time
|
13
|
+
green_smoothie.save
|
14
|
+
green_smoothie.created_at.should == time
|
15
|
+
green_smoothie.created_on.should == time
|
16
|
+
green_smoothie.created_at.should be_a_kind_of(DateTime)
|
17
|
+
green_smoothie.created_on.should be_a_kind_of(Date)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should set the created_at/on fields on creation" do
|
21
|
+
green_smoothie = GreenSmoothie.new(:name => 'Banana')
|
22
|
+
green_smoothie.created_at.should be_nil
|
23
|
+
green_smoothie.created_on.should be_nil
|
24
|
+
green_smoothie.save
|
25
|
+
green_smoothie.created_at.should be_a_kind_of(DateTime)
|
26
|
+
green_smoothie.created_on.should be_a_kind_of(Date)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should not alter the create_at/on fields on model updates" do
|
30
|
+
green_smoothie = GreenSmoothie.new(:id => 2, :name => 'Berry')
|
31
|
+
green_smoothie.created_at.should be_nil
|
32
|
+
green_smoothie.created_on.should be_nil
|
33
|
+
green_smoothie.save
|
34
|
+
original_created_at = green_smoothie.created_at
|
35
|
+
original_created_on = green_smoothie.created_on
|
36
|
+
green_smoothie.name = 'Strawberry'
|
37
|
+
green_smoothie.save
|
38
|
+
green_smoothie.created_at.should eql(original_created_at)
|
39
|
+
green_smoothie.created_on.should eql(original_created_on)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should set the updated_at/on fields on creation and on update" do
|
43
|
+
green_smoothie = GreenSmoothie.new(:name => 'Mango')
|
44
|
+
green_smoothie.updated_at.should be_nil
|
45
|
+
green_smoothie.updated_on.should be_nil
|
46
|
+
green_smoothie.save
|
47
|
+
green_smoothie.updated_at.should be_a_kind_of(DateTime)
|
48
|
+
green_smoothie.updated_on.should be_a_kind_of(Date)
|
49
|
+
original_updated_at = green_smoothie.updated_at
|
50
|
+
original_updated_on = green_smoothie.updated_on
|
51
|
+
time_tomorrow = DateTime.now + 1
|
52
|
+
date_tomorrow = Date.today + 1
|
53
|
+
DateTime.stub!(:now).and_return { time_tomorrow }
|
54
|
+
Date.stub!(:today).and_return { date_tomorrow }
|
55
|
+
green_smoothie.name = 'Cranberry Mango'
|
56
|
+
green_smoothie.save
|
57
|
+
green_smoothie.updated_at.should_not eql(original_updated_at)
|
58
|
+
green_smoothie.updated_on.should_not eql(original_updated_on)
|
59
|
+
green_smoothie.updated_at.should eql(time_tomorrow)
|
60
|
+
green_smoothie.updated_on.should eql(date_tomorrow)
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should only set the updated_at/on fields on dirty objects" do
|
64
|
+
green_smoothie = GreenSmoothie.new(:name => 'Mango')
|
65
|
+
green_smoothie.updated_at.should be_nil
|
66
|
+
green_smoothie.updated_on.should be_nil
|
67
|
+
green_smoothie.save
|
68
|
+
green_smoothie.updated_at.should be_a_kind_of(DateTime)
|
69
|
+
green_smoothie.updated_on.should be_a_kind_of(Date)
|
70
|
+
original_updated_at = green_smoothie.updated_at
|
71
|
+
original_updated_on = green_smoothie.updated_on
|
72
|
+
time_tomorrow = DateTime.now + 1
|
73
|
+
date_tomorrow = Date.today + 1
|
74
|
+
DateTime.stub!(:now).and_return { time_tomorrow }
|
75
|
+
Date.stub!(:today).and_return { date_tomorrow }
|
76
|
+
green_smoothie.save
|
77
|
+
green_smoothie.updated_at.should_not eql(time_tomorrow)
|
78
|
+
green_smoothie.updated_on.should_not eql(date_tomorrow)
|
79
|
+
green_smoothie.updated_at.should eql(original_updated_at)
|
80
|
+
green_smoothie.updated_on.should eql(original_updated_on)
|
81
|
+
end
|
82
|
+
|
83
|
+
describe '#touch' do
|
84
|
+
it 'should update the updated_at/on fields' do
|
85
|
+
green_smoothie = GreenSmoothie.create(:name => 'Mango')
|
86
|
+
|
87
|
+
time_tomorrow = DateTime.now + 1
|
88
|
+
date_tomorrow = Date.today + 1
|
89
|
+
DateTime.stub!(:now).and_return { time_tomorrow }
|
90
|
+
Date.stub!(:today).and_return { date_tomorrow }
|
91
|
+
|
92
|
+
green_smoothie.touch
|
93
|
+
|
94
|
+
green_smoothie.updated_at.should eql(time_tomorrow)
|
95
|
+
green_smoothie.updated_on.should eql(date_tomorrow)
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'should not update the created_at/on fields' do
|
99
|
+
green_smoothie = GreenSmoothie.create(:name => 'Mango')
|
100
|
+
|
101
|
+
original_created_at = green_smoothie.created_at
|
102
|
+
original_created_on = green_smoothie.created_on
|
103
|
+
|
104
|
+
green_smoothie.touch
|
105
|
+
|
106
|
+
green_smoothie.created_at.should equal(original_created_at)
|
107
|
+
green_smoothie.created_on.should equal(original_created_on)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
describe "explicit property declaration" do
|
113
|
+
before do
|
114
|
+
Object.send(:remove_const, :GreenSmoothie) if defined?(GreenSmoothie)
|
115
|
+
class GreenSmoothie
|
116
|
+
include DataMapper::Resource
|
117
|
+
|
118
|
+
property :id, Serial
|
119
|
+
property :name, String
|
120
|
+
property :created_at, DateTime, :required => true
|
121
|
+
property :created_on, Date, :required => true
|
122
|
+
property :updated_at, DateTime, :required => true
|
123
|
+
property :updated_on, Date, :required => true
|
124
|
+
|
125
|
+
auto_migrate!
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
it_should_behave_like "Timestamp (shared behavior)"
|
130
|
+
end
|
131
|
+
|
132
|
+
describe "implicit property declaration" do
|
133
|
+
before do
|
134
|
+
Object.send(:remove_const, :GreenSmoothie) if defined?(GreenSmoothie)
|
135
|
+
class GreenSmoothie
|
136
|
+
include DataMapper::Resource
|
137
|
+
|
138
|
+
property :id, Serial
|
139
|
+
property :name, String
|
140
|
+
|
141
|
+
timestamps :at, :on
|
142
|
+
|
143
|
+
auto_migrate!
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
it_should_behave_like "Timestamp (shared behavior)"
|
148
|
+
end
|
149
|
+
|
150
|
+
describe "timestamps helper" do
|
151
|
+
describe "inclusion" do
|
152
|
+
before :each do
|
153
|
+
@klass = Class.new do
|
154
|
+
include DataMapper::Resource
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
it "should provide #timestamps" do
|
159
|
+
@klass.should respond_to(:timestamps)
|
160
|
+
end
|
161
|
+
|
162
|
+
it "should set the *at properties" do
|
163
|
+
@klass.timestamps :at
|
164
|
+
|
165
|
+
@klass.properties.should be_named(:created_at)
|
166
|
+
@klass.properties[:created_at].should be_kind_of(DataMapper::Property::DateTime)
|
167
|
+
@klass.properties.should be_named(:updated_at)
|
168
|
+
@klass.properties[:updated_at].should be_kind_of(DataMapper::Property::DateTime)
|
169
|
+
end
|
170
|
+
|
171
|
+
it "should set the *on properties" do
|
172
|
+
@klass.timestamps :on
|
173
|
+
|
174
|
+
@klass.properties.should be_named(:created_on)
|
175
|
+
@klass.properties[:created_on].should be_kind_of(DataMapper::Property::Date)
|
176
|
+
@klass.properties.should be_named(:updated_on)
|
177
|
+
@klass.properties[:updated_on].should be_kind_of(DataMapper::Property::Date)
|
178
|
+
end
|
179
|
+
|
180
|
+
it "should set multiple properties" do
|
181
|
+
@klass.timestamps :created_at, :updated_on
|
182
|
+
|
183
|
+
@klass.properties.should be_named(:created_at)
|
184
|
+
@klass.properties.should be_named(:updated_on)
|
185
|
+
end
|
186
|
+
|
187
|
+
it "should fail on unknown property name" do
|
188
|
+
lambda { @klass.timestamps :wowee }.should raise_error(DataMapper::Timestamp::InvalidTimestampName)
|
189
|
+
end
|
190
|
+
|
191
|
+
it "should fail on empty arguments" do
|
192
|
+
lambda { @klass.timestamps }.should raise_error(ArgumentError)
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
end
|
198
|
+
|
199
|
+
end
|
data/spec/rcov.opts
ADDED
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
data/tasks/spec.rake
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
spec_defaults = lambda do |spec|
|
2
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
3
|
+
spec.libs << 'lib' << 'spec'
|
4
|
+
spec.spec_opts << '--options' << 'spec/spec.opts'
|
5
|
+
end
|
6
|
+
|
7
|
+
begin
|
8
|
+
require 'spec/rake/spectask'
|
9
|
+
|
10
|
+
Spec::Rake::SpecTask.new(:spec, &spec_defaults)
|
11
|
+
rescue LoadError
|
12
|
+
task :spec do
|
13
|
+
abort 'rspec is not available. In order to run spec, you must: gem install rspec'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
begin
|
18
|
+
require 'rcov'
|
19
|
+
require 'spec/rake/verify_rcov'
|
20
|
+
|
21
|
+
Spec::Rake::SpecTask.new(:rcov) do |rcov|
|
22
|
+
spec_defaults.call(rcov)
|
23
|
+
rcov.rcov = true
|
24
|
+
rcov.rcov_opts = File.read('spec/rcov.opts').split(/\s+/)
|
25
|
+
end
|
26
|
+
|
27
|
+
RCov::VerifyTask.new(:verify_rcov => :rcov) do |rcov|
|
28
|
+
rcov.threshold = 100
|
29
|
+
end
|
30
|
+
rescue LoadError
|
31
|
+
%w[ rcov verify_rcov ].each do |name|
|
32
|
+
task name do
|
33
|
+
abort "rcov is not available. In order to run #{name}, you must: gem install rcov"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
task :default => :spec
|
data/tasks/yard.rake
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
begin
|
2
|
+
require 'pathname'
|
3
|
+
require 'yardstick/rake/measurement'
|
4
|
+
require 'yardstick/rake/verify'
|
5
|
+
|
6
|
+
# yardstick_measure task
|
7
|
+
Yardstick::Rake::Measurement.new
|
8
|
+
|
9
|
+
# verify_measurements task
|
10
|
+
Yardstick::Rake::Verify.new do |verify|
|
11
|
+
verify.threshold = 100
|
12
|
+
end
|
13
|
+
rescue LoadError
|
14
|
+
%w[ yardstick_measure verify_measurements ].each do |name|
|
15
|
+
task name.to_s do
|
16
|
+
abort "Yardstick is not available. In order to run #{name}, you must: gem install yardstick"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ardm-timestamps
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Martin Emde
|
8
|
+
- Foy Savas
|
9
|
+
- Dan Kubb
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2015-01-29 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: ardm-core
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - "~>"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.2'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - "~>"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '1.2'
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: rake
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - "~>"
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0.9'
|
36
|
+
type: :development
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0.9'
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: rspec
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '1.3'
|
50
|
+
type: :development
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '1.3'
|
57
|
+
description: DataMapper plugin for magical timestamps
|
58
|
+
email:
|
59
|
+
- me@martinemde.com
|
60
|
+
- dan.kubb@gmail.com
|
61
|
+
executables: []
|
62
|
+
extensions: []
|
63
|
+
extra_rdoc_files:
|
64
|
+
- LICENSE
|
65
|
+
- README.rdoc
|
66
|
+
files:
|
67
|
+
- ".gitignore"
|
68
|
+
- ".travis.yml"
|
69
|
+
- Gemfile
|
70
|
+
- LICENSE
|
71
|
+
- README.rdoc
|
72
|
+
- Rakefile
|
73
|
+
- ardm-timestamps.gemspec
|
74
|
+
- lib/ardm-timestamps.rb
|
75
|
+
- lib/data_mapper/timestamps/version.rb
|
76
|
+
- lib/dm-timestamps.rb
|
77
|
+
- spec/integration/timestamps_spec.rb
|
78
|
+
- spec/rcov.opts
|
79
|
+
- spec/spec.opts
|
80
|
+
- spec/spec_helper.rb
|
81
|
+
- tasks/spec.rake
|
82
|
+
- tasks/yard.rake
|
83
|
+
- tasks/yardstick.rake
|
84
|
+
homepage: https://github.com/ar-dm/dm-timestamps
|
85
|
+
licenses:
|
86
|
+
- MIT
|
87
|
+
metadata: {}
|
88
|
+
post_install_message:
|
89
|
+
rdoc_options: []
|
90
|
+
require_paths:
|
91
|
+
- lib
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
requirements: []
|
103
|
+
rubyforge_project:
|
104
|
+
rubygems_version: 2.2.2
|
105
|
+
signing_key:
|
106
|
+
specification_version: 4
|
107
|
+
summary: Ardm fork of dm-timestamps
|
108
|
+
test_files: []
|
109
|
+
has_rdoc:
|