dm-is-versioned 1.0.2 → 1.1.0.rc1
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/Gemfile +24 -92
- data/LICENSE +1 -1
- data/README.rdoc +187 -1
- data/Rakefile +1 -5
- data/VERSION +1 -1
- data/dm-is-versioned.gemspec +40 -35
- data/spec/versioned_spec.rb +4 -1
- data/tasks/spec.rake +0 -3
- metadata +60 -35
- data/.gitignore +0 -37
- data/tasks/ci.rake +0 -1
- data/tasks/local_gemfile.rake +0 -16
- data/tasks/metrics.rake +0 -36
data/Gemfile
CHANGED
@@ -1,110 +1,42 @@
|
|
1
|
-
|
2
|
-
# recommended to create a local Gemfile and use this instead of the git
|
3
|
-
# sources. This will make sure that you are developing against your
|
4
|
-
# other local datamapper sources that you currently work on. Gemfile.local
|
5
|
-
# will behave identically to the standard Gemfile apart from the fact that
|
6
|
-
# it fetches the datamapper gems from local paths. This means that you can use
|
7
|
-
# the same environment variables, like ADAPTER(S) or PLUGIN(S) when running
|
8
|
-
# bundle commands. Gemfile.local is added to .gitignore, so you don't need to
|
9
|
-
# worry about accidentally checking local development paths into git.
|
10
|
-
# In order to create a local Gemfile, all you need to do is run:
|
11
|
-
#
|
12
|
-
# bundle exec rake local_gemfile
|
13
|
-
#
|
14
|
-
# This will give you a Gemfile.local file that points to your local clones of
|
15
|
-
# the various datamapper gems. It's assumed that all datamapper repo clones
|
16
|
-
# reside in the same directory. You can use the Gemfile.local like so for
|
17
|
-
# running any bundle command:
|
18
|
-
#
|
19
|
-
# BUNDLE_GEMFILE=Gemfile.local bundle foo
|
20
|
-
#
|
21
|
-
# You can also specify which adapter(s) should be part of the bundle by setting
|
22
|
-
# an environment variable. This of course also works when using the Gemfile.local
|
23
|
-
#
|
24
|
-
# bundle foo # dm-sqlite-adapter
|
25
|
-
# ADAPTER=mysql bundle foo # dm-mysql-adapter
|
26
|
-
# ADAPTERS=sqlite,mysql bundle foo # dm-sqlite-adapter and dm-mysql-adapter
|
27
|
-
#
|
28
|
-
# Of course you can also use the ADAPTER(S) variable when using the Gemfile.local
|
29
|
-
# and running specs against selected adapters.
|
30
|
-
#
|
31
|
-
# For easily working with adapters supported on your machine, it's recommended
|
32
|
-
# that you first install all adapters that you are planning to use or work on
|
33
|
-
# by doing something like
|
34
|
-
#
|
35
|
-
# ADAPTERS=sqlite,mysql,postgres bundle install
|
36
|
-
#
|
37
|
-
# This will clone the various repositories and make them available to bundler.
|
38
|
-
# Once you have them installed you can easily switch between adapters for the
|
39
|
-
# various development tasks. Running something like
|
40
|
-
#
|
41
|
-
# ADAPTER=mysql bundle exec rake spec
|
42
|
-
#
|
43
|
-
# will make sure that the dm-mysql-adapter is part of the bundle, and will be used
|
44
|
-
# when running the specs.
|
45
|
-
#
|
46
|
-
# You can also specify which plugin(s) should be part of the bundle by setting
|
47
|
-
# an environment variable. This also works when using the Gemfile.local
|
48
|
-
#
|
49
|
-
# bundle foo # dm-migrations
|
50
|
-
# PLUGINS=dm-validations bundle foo # dm-migrations and dm-validations
|
51
|
-
# PLUGINS=dm-validations,dm-types bundle foo # dm-migrations, dm-validations and dm-types
|
52
|
-
#
|
53
|
-
# Of course you can combine the PLUGIN(S) and ADAPTER(S) env vars to run specs
|
54
|
-
# for certain adapter/plugin combinations.
|
55
|
-
#
|
56
|
-
# Finally, to speed up running specs and other tasks, it's recommended to run
|
57
|
-
#
|
58
|
-
# bundle lock
|
59
|
-
#
|
60
|
-
# after running 'bundle install' for the first time. This will make 'bundle exec' run
|
61
|
-
# a lot faster compared to the unlocked version. With an unlocked bundle you would
|
62
|
-
# typically just run 'bundle install' from time to time to fetch the latest sources from
|
63
|
-
# upstream. When you locked your bundle, you need to run
|
64
|
-
#
|
65
|
-
# bundle install --relock
|
66
|
-
#
|
67
|
-
# to make sure to fetch the latest updates and then lock the bundle again. Gemfile.lock
|
68
|
-
# is added to the .gitignore file, so you don't need to worry about accidentally checking
|
69
|
-
# it into version control.
|
1
|
+
require 'pathname'
|
70
2
|
|
71
3
|
source 'http://rubygems.org'
|
72
4
|
|
73
|
-
|
74
|
-
|
5
|
+
SOURCE = ENV.fetch('SOURCE', :git).to_sym
|
6
|
+
REPO_POSTFIX = SOURCE == :path ? '' : '.git'
|
7
|
+
DATAMAPPER = SOURCE == :path ? Pathname(__FILE__).dirname.parent : 'http://github.com/datamapper'
|
8
|
+
DM_VERSION = '~> 1.1.0.rc1'
|
75
9
|
|
76
|
-
group :runtime do
|
10
|
+
group :runtime do
|
77
11
|
|
78
12
|
if ENV['EXTLIB']
|
79
|
-
gem 'extlib',
|
13
|
+
gem 'extlib', '~> 0.9.15', SOURCE => "#{DATAMAPPER}/extlib#{REPO_POSTFIX}", :require => nil
|
80
14
|
else
|
81
|
-
gem 'activesupport', '~> 3.0.
|
15
|
+
gem 'activesupport', '~> 3.0.4', :require => nil
|
16
|
+
gem 'i18n', '~> 0.5.0'
|
82
17
|
end
|
83
18
|
|
84
|
-
gem 'dm-core',
|
19
|
+
gem 'dm-core', DM_VERSION, SOURCE => "#{DATAMAPPER}/dm-core#{REPO_POSTFIX}"
|
85
20
|
|
86
21
|
end
|
87
22
|
|
88
|
-
group
|
23
|
+
group :development do
|
89
24
|
|
90
|
-
gem '
|
91
|
-
gem '
|
92
|
-
gem '
|
25
|
+
gem 'jeweler', '~> 1.5.2'
|
26
|
+
gem 'rake', '~> 0.8.7'
|
27
|
+
gem 'rspec', '~> 1.3.1'
|
93
28
|
|
94
29
|
end
|
95
30
|
|
96
|
-
group :quality do
|
31
|
+
group :quality do
|
97
32
|
|
98
|
-
gem '
|
99
|
-
gem '
|
100
|
-
gem '
|
101
|
-
gem 'roodi', '~> 2.1'
|
102
|
-
gem 'yard', '~> 0.5'
|
103
|
-
gem 'yardstick', '~> 0.1'
|
33
|
+
gem 'rcov', '~> 0.9.9', :platforms => :mri_18
|
34
|
+
gem 'yard', '~> 0.6'
|
35
|
+
gem 'yardstick', '~> 0.2'
|
104
36
|
|
105
37
|
end
|
106
38
|
|
107
|
-
group :datamapper do
|
39
|
+
group :datamapper do
|
108
40
|
|
109
41
|
adapters = ENV['ADAPTER'] || ENV['ADAPTERS']
|
110
42
|
adapters = adapters.to_s.tr(',', ' ').split.uniq - %w[ in_memory ]
|
@@ -114,27 +46,27 @@ group :datamapper do # We need this because we want to pin these dependencies to
|
|
114
46
|
|
115
47
|
if (do_adapters = DM_DO_ADAPTERS & adapters).any?
|
116
48
|
options = {}
|
117
|
-
options[:git] = "#{DATAMAPPER}/do
|
49
|
+
options[:git] = "#{DATAMAPPER}/do#{REPO_POSTFIX}" if ENV['DO_GIT'] == 'true'
|
118
50
|
|
119
|
-
gem 'data_objects',
|
51
|
+
gem 'data_objects', DO_VERSION, options.dup
|
120
52
|
|
121
53
|
do_adapters.each do |adapter|
|
122
54
|
adapter = 'sqlite3' if adapter == 'sqlite'
|
123
55
|
gem "do_#{adapter}", DO_VERSION, options.dup
|
124
56
|
end
|
125
57
|
|
126
|
-
gem 'dm-do-adapter', DM_VERSION,
|
58
|
+
gem 'dm-do-adapter', DM_VERSION, SOURCE => "#{DATAMAPPER}/dm-do-adapter#{REPO_POSTFIX}"
|
127
59
|
end
|
128
60
|
|
129
61
|
adapters.each do |adapter|
|
130
|
-
gem "dm-#{adapter}-adapter", DM_VERSION,
|
62
|
+
gem "dm-#{adapter}-adapter", DM_VERSION, SOURCE => "#{DATAMAPPER}/dm-#{adapter}-adapter#{REPO_POSTFIX}"
|
131
63
|
end
|
132
64
|
|
133
65
|
plugins = ENV['PLUGINS'] || ENV['PLUGIN']
|
134
66
|
plugins = plugins.to_s.tr(',', ' ').split.push('dm-migrations').uniq
|
135
67
|
|
136
68
|
plugins.each do |plugin|
|
137
|
-
gem plugin, DM_VERSION,
|
69
|
+
gem plugin, DM_VERSION, SOURCE => "#{DATAMAPPER}/#{plugin}#{REPO_POSTFIX}"
|
138
70
|
end
|
139
71
|
|
140
72
|
end
|
data/LICENSE
CHANGED
data/README.rdoc
CHANGED
@@ -1,3 +1,189 @@
|
|
1
1
|
= dm-is-versioned
|
2
2
|
|
3
|
-
DataMapper plugin enabling simple versioning of models.
|
3
|
+
DataMapper plugin enabling <b>simple</b> versioning of models.
|
4
|
+
|
5
|
+
When a model is versioned, and updated, instead of <b>the previous version</b>
|
6
|
+
being lost in the mists of time, it <b>is saved in a subsidiary table</b>, so that it
|
7
|
+
can be restored later if needed.
|
8
|
+
|
9
|
+
<b>Please Note!</b> this gem behaves differently to how AR's :acts_as_versioned works.
|
10
|
+
There is currently no multi version storage possible.
|
11
|
+
|
12
|
+
|
13
|
+
== Installation
|
14
|
+
|
15
|
+
=== Stable
|
16
|
+
|
17
|
+
Install the <tt>dm-is-versioned</tt> gem.
|
18
|
+
|
19
|
+
$ (sudo)? gem install dm-is-versioned
|
20
|
+
|
21
|
+
=== Edge
|
22
|
+
|
23
|
+
Download or clone <tt>dm-is-versioned</tt> from Github[http://github.com/datamapper/dm-is-versioned/].
|
24
|
+
|
25
|
+
$ cd /path/to/dm-is-versioned
|
26
|
+
|
27
|
+
$ rake install # will install dm-is-versioned
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
== Getting started
|
32
|
+
|
33
|
+
To start using this gem, just require <tt>dm-is-versioned</tt> in your app.
|
34
|
+
|
35
|
+
|
36
|
+
Lets say we have a Post class, and we want to retain the previous version of a post.
|
37
|
+
Just do this:
|
38
|
+
|
39
|
+
class Post
|
40
|
+
include DataMapper::Resource
|
41
|
+
|
42
|
+
property :id, Serial
|
43
|
+
property :title, String
|
44
|
+
property :body, Text
|
45
|
+
property :updated_at, DateTime
|
46
|
+
|
47
|
+
is_versioned :on => :updated_at
|
48
|
+
|
49
|
+
## this syntax also works
|
50
|
+
# is :versioned, :on => :updated_at
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
That simple snippet will automatically create a second <tt>Post::Version</tt> model
|
56
|
+
and a (<tt>post_versions</tt>) table in your DB when you auto migrate or auto upgrade:
|
57
|
+
|
58
|
+
Post.auto_migrate! # => will run auto_migrate! on Post::Version, too
|
59
|
+
Post.auto_upgrade! # => will run auto_upgrade! on Post::Version, too
|
60
|
+
|
61
|
+
# or
|
62
|
+
DataMapper.auto_migrate! # => will run auto_migrate! on Post::Version, too
|
63
|
+
DataMapper.auto_upgrade! # => will run auto_upgrade! on Post::Version, too
|
64
|
+
|
65
|
+
# don't forget to require 'dm-migrations' before you migrate.
|
66
|
+
|
67
|
+
|
68
|
+
OK, now that we have a versioned model, let's see what we can do with it.
|
69
|
+
|
70
|
+
|
71
|
+
== Usage
|
72
|
+
|
73
|
+
We start with creating a new Post:
|
74
|
+
|
75
|
+
post = Post.create(:title => 'A versioned Post title', :body => "A versioned Post body")
|
76
|
+
# automatically saved
|
77
|
+
|
78
|
+
|
79
|
+
When we create this Post, no secondary version is created.
|
80
|
+
|
81
|
+
The versioning only takes place when we update our Post:
|
82
|
+
|
83
|
+
post.title = "An updated & versioned Post title"
|
84
|
+
post.save
|
85
|
+
|
86
|
+
|
87
|
+
In the <tt>Post::Version</tt> (<tt>post_versions</tt>) table we would now find the previous version of the Post.
|
88
|
+
|
89
|
+
This is how it would look like:
|
90
|
+
|
91
|
+
# db.post table
|
92
|
+
---------------------------------------------------------------------------------------
|
93
|
+
| id | title | body | updated_at |
|
94
|
+
---------------------------------------------------------------------------------------
|
95
|
+
| 1 | 'An updated & versioned Post title' | 'A versioned Post body' | DateTime |
|
96
|
+
|
97
|
+
|
98
|
+
# db.post_versions table
|
99
|
+
---------------------------------------------------------------------------------------
|
100
|
+
| id | title | body | updated_at |
|
101
|
+
---------------------------------------------------------------------------------------
|
102
|
+
| 1 | 'A versioned Post title' | 'A versioned Post body' | DateTime |
|
103
|
+
|
104
|
+
|
105
|
+
=== #versions
|
106
|
+
|
107
|
+
Once you have a versioned model, you can retrieve <b>the previous version</b>, like this:
|
108
|
+
|
109
|
+
old_post = post.versions.first
|
110
|
+
=> #<Post::Version @id=1 @title="A versioned Post title" @body=... @updated_at=...>
|
111
|
+
|
112
|
+
|
113
|
+
<b>Please Note!</b> that the <tt>#versions</tt> method returns an array by default.
|
114
|
+
|
115
|
+
|
116
|
+
That's basically what <tt>dm-is-versioned</tt> does.
|
117
|
+
|
118
|
+
|
119
|
+
== Gotchas
|
120
|
+
|
121
|
+
Now there are some gotcha's that might not be entirely obvious to everyone, so let's clarify
|
122
|
+
them here.
|
123
|
+
|
124
|
+
=== Make sure the versioned trigger has a value
|
125
|
+
|
126
|
+
In this type of scenario:
|
127
|
+
|
128
|
+
class Post
|
129
|
+
<snip...>
|
130
|
+
property :updated_at, DateTime
|
131
|
+
|
132
|
+
is_versioned :on => :updated_at
|
133
|
+
end
|
134
|
+
|
135
|
+
|
136
|
+
You must ensure that the versioned trigger always has a value, either through:
|
137
|
+
|
138
|
+
# using the dm-timestamps gem, which automatically updates the :updated_at attribute
|
139
|
+
timestamps :at
|
140
|
+
|
141
|
+
# or a callback method, that updates the value before save
|
142
|
+
before(:save) { self.updated_at = Time.now }
|
143
|
+
|
144
|
+
|
145
|
+
Without this, things just don't work.
|
146
|
+
|
147
|
+
|
148
|
+
=== Ensure you use <tt>dm-migrations</tt> gem
|
149
|
+
|
150
|
+
The <tt>post_versions</tt> table is NOT created unless you migrate your models through:
|
151
|
+
|
152
|
+
DataMapper.auto_migrate! / Post.auto_migrate!
|
153
|
+
DataMapper.auto_upgrade! / Post.auto_upgrade!
|
154
|
+
|
155
|
+
That’s about it.
|
156
|
+
|
157
|
+
|
158
|
+
== Errors / Bugs
|
159
|
+
|
160
|
+
If something is not behaving intuitively, it is a bug, and should be reported.
|
161
|
+
Report it here: http://datamapper.lighthouseapp.com/
|
162
|
+
|
163
|
+
|
164
|
+
== TODOs
|
165
|
+
|
166
|
+
* Make it work more like AR's :acts_as_versioned plugin, with support for multiple versions and so on.
|
167
|
+
* Enable replacing a current version with an old version.
|
168
|
+
* Anything else missing?
|
169
|
+
|
170
|
+
|
171
|
+
== Note on Patches/Pull Requests
|
172
|
+
|
173
|
+
* Fork the project.
|
174
|
+
* Make your feature addition or bug fix.
|
175
|
+
* Add tests for it. This is important so we don't break it in a future version unintentionally.
|
176
|
+
* Commit, do not mess with rakefile, version, or history.
|
177
|
+
* (if you want to have your own version, that is fine but bump version in a commit by itself we can ignore when we pull)
|
178
|
+
* Send us a pull request. Bonus points for topic branches.
|
179
|
+
|
180
|
+
|
181
|
+
== Copyright
|
182
|
+
|
183
|
+
Copyright (c) 2011 Timothy Bennett. Released under the MIT License.
|
184
|
+
|
185
|
+
See LICENSE for details.
|
186
|
+
|
187
|
+
=== Credits
|
188
|
+
|
189
|
+
Credit also goes to these contributors[http://github.com/datamapper/dm-is-versioned/contributors].
|
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
|
4
4
|
begin
|
5
|
-
gem 'jeweler', '~> 1.
|
5
|
+
gem 'jeweler', '~> 1.5.2'
|
6
6
|
require 'jeweler'
|
7
7
|
|
8
8
|
Jeweler::Tasks.new do |gem|
|
@@ -15,10 +15,6 @@ begin
|
|
15
15
|
gem.has_rdoc = 'yard'
|
16
16
|
|
17
17
|
gem.rubyforge_project = 'datamapper'
|
18
|
-
|
19
|
-
gem.add_dependency 'dm-core', '~> 1.0.2'
|
20
|
-
|
21
|
-
gem.add_development_dependency 'rspec', '~> 1.3'
|
22
18
|
end
|
23
19
|
|
24
20
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.1.0.rc1
|
data/dm-is-versioned.gemspec
CHANGED
@@ -1,68 +1,73 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
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{dm-is-versioned}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.1.0.rc1"
|
9
9
|
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new("
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Bernerd Schaefer"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-02-28}
|
13
13
|
s.description = %q{DataMapper plugin enabling simple versioning of models}
|
14
14
|
s.email = %q{bernerd [a] wieck [d] com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
|
17
|
+
"README.rdoc"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
|
-
"
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
"tasks/metrics.rake",
|
36
|
-
"tasks/spec.rake",
|
37
|
-
"tasks/yard.rake",
|
38
|
-
"tasks/yardstick.rake"
|
20
|
+
"Gemfile",
|
21
|
+
"LICENSE",
|
22
|
+
"README.rdoc",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"dm-is-versioned.gemspec",
|
26
|
+
"lib/dm-is-versioned.rb",
|
27
|
+
"lib/dm-is-versioned/is/versioned.rb",
|
28
|
+
"spec/rcov.opts",
|
29
|
+
"spec/spec.opts",
|
30
|
+
"spec/spec_helper.rb",
|
31
|
+
"spec/versioned_spec.rb",
|
32
|
+
"tasks/spec.rake",
|
33
|
+
"tasks/yard.rake",
|
34
|
+
"tasks/yardstick.rake"
|
39
35
|
]
|
40
|
-
s.has_rdoc = %q{yard}
|
41
36
|
s.homepage = %q{http://github.com/datamapper/dm-is-versioned}
|
42
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
43
37
|
s.require_paths = ["lib"]
|
44
38
|
s.rubyforge_project = %q{datamapper}
|
45
|
-
s.rubygems_version = %q{1.
|
39
|
+
s.rubygems_version = %q{1.5.2}
|
46
40
|
s.summary = %q{DataMapper plugin enabling simple versioning of models}
|
47
41
|
s.test_files = [
|
48
42
|
"spec/spec_helper.rb",
|
49
|
-
|
43
|
+
"spec/versioned_spec.rb"
|
50
44
|
]
|
51
45
|
|
52
46
|
if s.respond_to? :specification_version then
|
53
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
54
47
|
s.specification_version = 3
|
55
48
|
|
56
49
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
57
|
-
s.add_runtime_dependency(%q<
|
58
|
-
s.
|
50
|
+
s.add_runtime_dependency(%q<activesupport>, ["~> 3.0.4"])
|
51
|
+
s.add_runtime_dependency(%q<i18n>, ["~> 0.5.0"])
|
52
|
+
s.add_runtime_dependency(%q<dm-core>, ["~> 1.1.0.rc1"])
|
53
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
54
|
+
s.add_development_dependency(%q<rake>, ["~> 0.8.7"])
|
55
|
+
s.add_development_dependency(%q<rspec>, ["~> 1.3.1"])
|
59
56
|
else
|
60
|
-
s.add_dependency(%q<
|
61
|
-
s.add_dependency(%q<
|
57
|
+
s.add_dependency(%q<activesupport>, ["~> 3.0.4"])
|
58
|
+
s.add_dependency(%q<i18n>, ["~> 0.5.0"])
|
59
|
+
s.add_dependency(%q<dm-core>, ["~> 1.1.0.rc1"])
|
60
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
61
|
+
s.add_dependency(%q<rake>, ["~> 0.8.7"])
|
62
|
+
s.add_dependency(%q<rspec>, ["~> 1.3.1"])
|
62
63
|
end
|
63
64
|
else
|
64
|
-
s.add_dependency(%q<
|
65
|
-
s.add_dependency(%q<
|
65
|
+
s.add_dependency(%q<activesupport>, ["~> 3.0.4"])
|
66
|
+
s.add_dependency(%q<i18n>, ["~> 0.5.0"])
|
67
|
+
s.add_dependency(%q<dm-core>, ["~> 1.1.0.rc1"])
|
68
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
69
|
+
s.add_dependency(%q<rake>, ["~> 0.8.7"])
|
70
|
+
s.add_dependency(%q<rspec>, ["~> 1.3.1"])
|
66
71
|
end
|
67
72
|
end
|
68
73
|
|
data/spec/versioned_spec.rb
CHANGED
@@ -34,7 +34,10 @@ describe 'DataMapper::Is::Versioned' do
|
|
34
34
|
|
35
35
|
Story.properties.each do |property|
|
36
36
|
it "should have its parent's property #{property.name}" do
|
37
|
-
Story::Version.properties.
|
37
|
+
Story::Version.properties.any? do |version_property|
|
38
|
+
version_property.name == property.name &&
|
39
|
+
version_property.primitive == property.primitive
|
40
|
+
end
|
38
41
|
end
|
39
42
|
end
|
40
43
|
end
|
data/tasks/spec.rake
CHANGED
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dm-is-versioned
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 1
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
version: 1.0.2
|
4
|
+
prerelease: 6
|
5
|
+
version: 1.1.0.rc1
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Bernerd Schaefer
|
@@ -14,38 +10,75 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date:
|
13
|
+
date: 2011-02-28 00:00:00 -08:00
|
18
14
|
default_executable:
|
19
15
|
dependencies:
|
20
16
|
- !ruby/object:Gem::Dependency
|
21
|
-
name:
|
22
|
-
prerelease: false
|
17
|
+
name: activesupport
|
23
18
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
19
|
none: false
|
25
20
|
requirements:
|
26
21
|
- - ~>
|
27
22
|
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
- 1
|
30
|
-
- 0
|
31
|
-
- 2
|
32
|
-
version: 1.0.2
|
23
|
+
version: 3.0.4
|
33
24
|
type: :runtime
|
25
|
+
prerelease: false
|
34
26
|
version_requirements: *id001
|
35
27
|
- !ruby/object:Gem::Dependency
|
36
|
-
name:
|
37
|
-
prerelease: false
|
28
|
+
name: i18n
|
38
29
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
30
|
none: false
|
40
31
|
requirements:
|
41
32
|
- - ~>
|
42
33
|
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
version: "1.3"
|
47
|
-
type: :development
|
34
|
+
version: 0.5.0
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
48
37
|
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: dm-core
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.1.0.rc1
|
46
|
+
type: :runtime
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: jeweler
|
51
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ~>
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 1.5.2
|
57
|
+
type: :development
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: *id004
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: rake
|
62
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ~>
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 0.8.7
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: *id005
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: rspec
|
73
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ~>
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 1.3.1
|
79
|
+
type: :development
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: *id006
|
49
82
|
description: DataMapper plugin enabling simple versioning of models
|
50
83
|
email: bernerd [a] wieck [d] com
|
51
84
|
executables: []
|
@@ -56,7 +89,6 @@ extra_rdoc_files:
|
|
56
89
|
- LICENSE
|
57
90
|
- README.rdoc
|
58
91
|
files:
|
59
|
-
- .gitignore
|
60
92
|
- Gemfile
|
61
93
|
- LICENSE
|
62
94
|
- README.rdoc
|
@@ -69,19 +101,16 @@ files:
|
|
69
101
|
- spec/spec.opts
|
70
102
|
- spec/spec_helper.rb
|
71
103
|
- spec/versioned_spec.rb
|
72
|
-
- tasks/ci.rake
|
73
|
-
- tasks/local_gemfile.rake
|
74
|
-
- tasks/metrics.rake
|
75
104
|
- tasks/spec.rake
|
76
105
|
- tasks/yard.rake
|
77
106
|
- tasks/yardstick.rake
|
78
|
-
has_rdoc:
|
107
|
+
has_rdoc: true
|
79
108
|
homepage: http://github.com/datamapper/dm-is-versioned
|
80
109
|
licenses: []
|
81
110
|
|
82
111
|
post_install_message:
|
83
|
-
rdoc_options:
|
84
|
-
|
112
|
+
rdoc_options: []
|
113
|
+
|
85
114
|
require_paths:
|
86
115
|
- lib
|
87
116
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -89,21 +118,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
89
118
|
requirements:
|
90
119
|
- - ">="
|
91
120
|
- !ruby/object:Gem::Version
|
92
|
-
segments:
|
93
|
-
- 0
|
94
121
|
version: "0"
|
95
122
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
123
|
none: false
|
97
124
|
requirements:
|
98
|
-
- - "
|
125
|
+
- - ">"
|
99
126
|
- !ruby/object:Gem::Version
|
100
|
-
|
101
|
-
- 0
|
102
|
-
version: "0"
|
127
|
+
version: 1.3.1
|
103
128
|
requirements: []
|
104
129
|
|
105
130
|
rubyforge_project: datamapper
|
106
|
-
rubygems_version: 1.
|
131
|
+
rubygems_version: 1.5.2
|
107
132
|
signing_key:
|
108
133
|
specification_version: 3
|
109
134
|
summary: DataMapper plugin enabling simple versioning of models
|
data/.gitignore
DELETED
@@ -1,37 +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
|
-
## 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.local
|
33
|
-
Gemfile.lock
|
34
|
-
Gemfile.local.lock
|
35
|
-
|
36
|
-
## PROJECT::SPECIFIC
|
37
|
-
spec/db/
|
data/tasks/ci.rake
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
task :ci => [ :verify_measurements, 'metrics:all' ]
|
data/tasks/local_gemfile.rake
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
desc "Support bundling from local source code (allows BUNDLE_GEMFILE=Gemfile.local bundle foo)"
|
2
|
-
task :local_gemfile do |t|
|
3
|
-
|
4
|
-
root = Pathname(__FILE__).dirname.parent
|
5
|
-
datamapper = root.parent
|
6
|
-
|
7
|
-
root.join('Gemfile.local').open('w') do |f|
|
8
|
-
root.join('Gemfile').open.each do |line|
|
9
|
-
line.sub!(/DATAMAPPER = 'git:\/\/github.com\/datamapper'/, "DATAMAPPER = '#{datamapper}'")
|
10
|
-
line.sub!(/:git => \"#\{DATAMAPPER\}\/(.+?)(?:\.git)?\"/, ':path => "#{DATAMAPPER}/\1"')
|
11
|
-
line.sub!(/do_options\[:git\] = \"#\{DATAMAPPER\}\/(.+?)(?:\.git)?\"/, 'do_options[:path] = "#{DATAMAPPER}/\1"')
|
12
|
-
f.puts line
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
data/tasks/metrics.rake
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'metric_fu'
|
3
|
-
rescue LoadError
|
4
|
-
namespace :metrics do
|
5
|
-
task :all do
|
6
|
-
abort 'metric_fu is not available. In order to run metrics:all, you must: gem install metric_fu'
|
7
|
-
end
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
begin
|
12
|
-
require 'reek/adapters/rake_task'
|
13
|
-
|
14
|
-
Reek::RakeTask.new do |t|
|
15
|
-
t.fail_on_error = true
|
16
|
-
t.verbose = false
|
17
|
-
t.source_files = 'lib/**/*.rb'
|
18
|
-
end
|
19
|
-
rescue LoadError
|
20
|
-
task :reek do
|
21
|
-
abort 'Reek is not available. In order to run reek, you must: gem install reek'
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
begin
|
26
|
-
require 'roodi'
|
27
|
-
require 'roodi_task'
|
28
|
-
|
29
|
-
RoodiTask.new do |t|
|
30
|
-
t.verbose = false
|
31
|
-
end
|
32
|
-
rescue LoadError
|
33
|
-
task :roodi do
|
34
|
-
abort 'Roodi is not available. In order to run roodi, you must: gem install roodi'
|
35
|
-
end
|
36
|
-
end
|