dm-is-versioned 0.10.2 → 1.0.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/.gitignore +36 -0
- data/Gemfile +141 -0
- data/Rakefile +2 -3
- data/VERSION +1 -1
- data/dm-is-versioned.gemspec +18 -14
- data/lib/dm-is-versioned/is/versioned.rb +27 -17
- data/lib/dm-is-versioned.rb +1 -0
- data/spec/spec_helper.rb +5 -26
- data/spec/versioned_spec.rb +11 -12
- data/tasks/local_gemfile.rake +18 -0
- data/tasks/spec.rake +0 -3
- metadata +40 -28
data/.gitignore
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
|
|
35
|
+
## PROJECT::SPECIFIC
|
|
36
|
+
spec/db/
|
data/Gemfile
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# If you're working on more than one datamapper gem at a time, then it's
|
|
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.
|
|
70
|
+
|
|
71
|
+
source 'http://rubygems.org'
|
|
72
|
+
|
|
73
|
+
DATAMAPPER = 'git://github.com/datamapper'
|
|
74
|
+
DM_VERSION = '~> 1.0.0.rc1'
|
|
75
|
+
|
|
76
|
+
group :runtime do # Runtime dependencies (as in the gemspec)
|
|
77
|
+
|
|
78
|
+
if ENV['EXTLIB']
|
|
79
|
+
gem 'extlib', '~> 0.9.15', :git => "#{DATAMAPPER}/extlib.git"
|
|
80
|
+
else
|
|
81
|
+
gem 'activesupport', '~> 3.0.0.beta3', :git => 'git://github.com/rails/rails.git', :require => nil
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
gem 'dm-core', DM_VERSION, :git => "#{DATAMAPPER}/dm-core.git"
|
|
85
|
+
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
group(:development) do # Development dependencies (as in the gemspec)
|
|
89
|
+
|
|
90
|
+
gem 'rake', '~> 0.8.7'
|
|
91
|
+
gem 'rspec', '~> 1.3'
|
|
92
|
+
gem 'jeweler', '~> 1.4'
|
|
93
|
+
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
group :quality do # These gems contain rake tasks that check the quality of the source code
|
|
97
|
+
|
|
98
|
+
gem 'metric_fu', '~> 1.3'
|
|
99
|
+
gem 'rcov', '~> 0.9.7'
|
|
100
|
+
gem 'reek', '~> 1.2.7'
|
|
101
|
+
gem 'roodi', '~> 2.1'
|
|
102
|
+
gem 'yard', '~> 0.5'
|
|
103
|
+
gem 'yardstick', '~> 0.1'
|
|
104
|
+
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
group :datamapper do # We need this because we want to pin these dependencies to their git master sources
|
|
108
|
+
|
|
109
|
+
adapters = ENV['ADAPTER'] || ENV['ADAPTERS']
|
|
110
|
+
adapters = adapters.to_s.gsub(',',' ').split(' ') - ['in_memory']
|
|
111
|
+
|
|
112
|
+
unless adapters.empty?
|
|
113
|
+
|
|
114
|
+
DO_VERSION = '~> 0.10.2'
|
|
115
|
+
DM_DO_ADAPTERS = %w[sqlite postgres mysql oracle sqlserver]
|
|
116
|
+
|
|
117
|
+
gem 'data_objects', DO_VERSION, :git => "#{DATAMAPPER}/do.git"
|
|
118
|
+
|
|
119
|
+
adapters.each do |adapter|
|
|
120
|
+
if DM_DO_ADAPTERS.any? { |dm_do_adapter| dm_do_adapter =~ /#{adapter}/ }
|
|
121
|
+
adapter = 'sqlite3' if adapter == 'sqlite'
|
|
122
|
+
gem "do_#{adapter}", DO_VERSION, :git => "#{DATAMAPPER}/do.git"
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
gem 'dm-do-adapter', DM_VERSION, :git => "#{DATAMAPPER}/dm-do-adapter.git"
|
|
127
|
+
|
|
128
|
+
adapters.each do |adapter|
|
|
129
|
+
gem "dm-#{adapter}-adapter", DM_VERSION, :git => "#{DATAMAPPER}/dm-#{adapter}-adapter.git"
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
plugins = ENV['PLUGINS'] || ENV['PLUGIN']
|
|
135
|
+
plugins = (plugins.to_s.gsub(',',' ').split(' ') + ['dm-migrations']).uniq
|
|
136
|
+
|
|
137
|
+
plugins.each do |plugin|
|
|
138
|
+
gem plugin, DM_VERSION, :git => "#{DATAMAPPER}/#{plugin}.git"
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
end
|
data/Rakefile
CHANGED
|
@@ -15,10 +15,9 @@ begin
|
|
|
15
15
|
|
|
16
16
|
gem.rubyforge_project = 'datamapper'
|
|
17
17
|
|
|
18
|
-
gem.add_dependency 'dm-core', '~> 0.
|
|
18
|
+
gem.add_dependency 'dm-core', '~> 1.0.0.rc1'
|
|
19
19
|
|
|
20
|
-
gem.add_development_dependency 'rspec', '~> 1.
|
|
21
|
-
gem.add_development_dependency 'yard', '~> 0.4.0'
|
|
20
|
+
gem.add_development_dependency 'rspec', '~> 1.3'
|
|
22
21
|
end
|
|
23
22
|
|
|
24
23
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
1.0.0.rc1
|
data/dm-is-versioned.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{dm-is-versioned}
|
|
8
|
-
s.version = "0.
|
|
8
|
+
s.version = "1.0.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{2010-05-19}
|
|
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 = [
|
|
@@ -17,7 +17,9 @@ Gem::Specification.new do |s|
|
|
|
17
17
|
"README.rdoc"
|
|
18
18
|
]
|
|
19
19
|
s.files = [
|
|
20
|
-
"
|
|
20
|
+
".gitignore",
|
|
21
|
+
"Gemfile",
|
|
22
|
+
"LICENSE",
|
|
21
23
|
"README.rdoc",
|
|
22
24
|
"Rakefile",
|
|
23
25
|
"VERSION",
|
|
@@ -29,6 +31,7 @@ Gem::Specification.new do |s|
|
|
|
29
31
|
"spec/spec_helper.rb",
|
|
30
32
|
"spec/versioned_spec.rb",
|
|
31
33
|
"tasks/ci.rake",
|
|
34
|
+
"tasks/local_gemfile.rake",
|
|
32
35
|
"tasks/metrics.rake",
|
|
33
36
|
"tasks/spec.rake",
|
|
34
37
|
"tasks/yard.rake",
|
|
@@ -38,26 +41,27 @@ Gem::Specification.new do |s|
|
|
|
38
41
|
s.rdoc_options = ["--charset=UTF-8"]
|
|
39
42
|
s.require_paths = ["lib"]
|
|
40
43
|
s.rubyforge_project = %q{datamapper}
|
|
41
|
-
s.rubygems_version = %q{1.3.
|
|
44
|
+
s.rubygems_version = %q{1.3.6}
|
|
42
45
|
s.summary = %q{DataMapper plugin enabling simple versioning of models}
|
|
46
|
+
s.test_files = [
|
|
47
|
+
"spec/spec_helper.rb",
|
|
48
|
+
"spec/versioned_spec.rb"
|
|
49
|
+
]
|
|
43
50
|
|
|
44
51
|
if s.respond_to? :specification_version then
|
|
45
52
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
46
53
|
s.specification_version = 3
|
|
47
54
|
|
|
48
55
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
|
49
|
-
s.add_runtime_dependency(%q<dm-core>, ["~> 0.
|
|
50
|
-
s.add_development_dependency(%q<rspec>, ["~> 1.
|
|
51
|
-
s.add_development_dependency(%q<yard>, ["~> 0.4.0"])
|
|
56
|
+
s.add_runtime_dependency(%q<dm-core>, ["~> 1.0.0.rc1"])
|
|
57
|
+
s.add_development_dependency(%q<rspec>, ["~> 1.3"])
|
|
52
58
|
else
|
|
53
|
-
s.add_dependency(%q<dm-core>, ["~> 0.
|
|
54
|
-
s.add_dependency(%q<rspec>, ["~> 1.
|
|
55
|
-
s.add_dependency(%q<yard>, ["~> 0.4.0"])
|
|
59
|
+
s.add_dependency(%q<dm-core>, ["~> 1.0.0.rc1"])
|
|
60
|
+
s.add_dependency(%q<rspec>, ["~> 1.3"])
|
|
56
61
|
end
|
|
57
62
|
else
|
|
58
|
-
s.add_dependency(%q<dm-core>, ["~> 0.
|
|
59
|
-
s.add_dependency(%q<rspec>, ["~> 1.
|
|
60
|
-
s.add_dependency(%q<yard>, ["~> 0.4.0"])
|
|
63
|
+
s.add_dependency(%q<dm-core>, ["~> 1.0.0.rc1"])
|
|
64
|
+
s.add_dependency(%q<rspec>, ["~> 1.3"])
|
|
61
65
|
end
|
|
62
66
|
end
|
|
63
67
|
|
|
@@ -48,13 +48,7 @@ module DataMapper
|
|
|
48
48
|
def is_versioned(options = {})
|
|
49
49
|
@on = on = options[:on]
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
self::Version.auto_migrate!
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
after_class_method :auto_upgrade! do |retval|
|
|
56
|
-
self::Version.auto_upgrade!
|
|
57
|
-
end
|
|
51
|
+
extend(Migration) if respond_to?(:auto_migrate!)
|
|
58
52
|
|
|
59
53
|
properties.each do |property|
|
|
60
54
|
name = property.name
|
|
@@ -65,13 +59,11 @@ module DataMapper
|
|
|
65
59
|
end
|
|
66
60
|
end
|
|
67
61
|
|
|
68
|
-
after :update do
|
|
69
|
-
if
|
|
62
|
+
after :update do
|
|
63
|
+
if clean? && pending_version_attributes.key?(on)
|
|
70
64
|
model::Version.create(attributes.merge(pending_version_attributes))
|
|
71
65
|
pending_version_attributes.clear
|
|
72
66
|
end
|
|
73
|
-
|
|
74
|
-
retval
|
|
75
67
|
end
|
|
76
68
|
|
|
77
69
|
extend ClassMethods
|
|
@@ -84,13 +76,16 @@ module DataMapper
|
|
|
84
76
|
model = DataMapper::Model.new
|
|
85
77
|
|
|
86
78
|
properties.each do |property|
|
|
87
|
-
type = property
|
|
88
|
-
|
|
79
|
+
type = case property
|
|
80
|
+
when DataMapper::Property::Discriminator then Class
|
|
81
|
+
when DataMapper::Property::Serial then Integer
|
|
82
|
+
else
|
|
83
|
+
property.class
|
|
84
|
+
end
|
|
89
85
|
|
|
90
|
-
options = property.options.merge(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
)
|
|
86
|
+
options = property.options.merge(:key => property.name == @on)
|
|
87
|
+
|
|
88
|
+
options[:key] = true if options.delete(:serial)
|
|
94
89
|
|
|
95
90
|
model.property(property.name, type, options)
|
|
96
91
|
end
|
|
@@ -128,6 +123,21 @@ module DataMapper
|
|
|
128
123
|
version_model.all(query)
|
|
129
124
|
end
|
|
130
125
|
end # InstanceMethods
|
|
126
|
+
|
|
127
|
+
module Migration
|
|
128
|
+
|
|
129
|
+
def auto_migrate!(repository_name = self.repository_name)
|
|
130
|
+
super
|
|
131
|
+
self::Version.auto_migrate!
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def auto_upgrade!(repository_name = self.repository_name)
|
|
135
|
+
super
|
|
136
|
+
self::Version.auto_upgrade!
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
end # Migration
|
|
140
|
+
|
|
131
141
|
end # Versioned
|
|
132
142
|
end # Is
|
|
133
143
|
end # DataMapper
|
data/lib/dm-is-versioned.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
|
@@ -1,30 +1,9 @@
|
|
|
1
|
-
require '
|
|
2
|
-
|
|
3
|
-
# Use local dm-core if running from a typical dev checkout.
|
|
4
|
-
lib = File.join('..', '..', 'dm-core', 'lib')
|
|
5
|
-
$LOAD_PATH.unshift(lib) if File.directory?(lib)
|
|
6
|
-
require 'dm-core'
|
|
7
|
-
|
|
8
|
-
# Support running specs with 'rake spec' and 'spec'
|
|
9
|
-
$LOAD_PATH.unshift('lib') unless $LOAD_PATH.include?('lib')
|
|
1
|
+
require 'dm-core/spec/setup'
|
|
2
|
+
require 'dm-core/spec/lib/adapter_helpers'
|
|
10
3
|
|
|
11
4
|
require 'dm-is-versioned'
|
|
5
|
+
require 'dm-migrations'
|
|
12
6
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
begin
|
|
17
|
-
DataMapper.setup(name, ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri)
|
|
18
|
-
DataMapper::Repository.adapters[:default] = DataMapper::Repository.adapters[name]
|
|
19
|
-
true
|
|
20
|
-
rescue LoadError => e
|
|
21
|
-
warn "Could not load do_#{name}: #{e}"
|
|
22
|
-
false
|
|
23
|
-
end
|
|
7
|
+
Spec::Runner.configure do |config|
|
|
8
|
+
config.extend(DataMapper::Spec::Adapters::Helpers)
|
|
24
9
|
end
|
|
25
|
-
|
|
26
|
-
ENV['ADAPTER'] ||= 'sqlite3'
|
|
27
|
-
|
|
28
|
-
HAS_SQLITE3 = load_driver(:sqlite3, 'sqlite3::memory:')
|
|
29
|
-
HAS_MYSQL = load_driver(:mysql, 'mysql://localhost/dm_core_test')
|
|
30
|
-
HAS_POSTGRES = load_driver(:postgres, 'postgres://postgres@localhost/dm_core_test')
|
data/spec/versioned_spec.rb
CHANGED
|
@@ -19,8 +19,10 @@ class Story
|
|
|
19
19
|
is_versioned :on => :updated_at
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
describe 'DataMapper::Is::Versioned' do
|
|
23
|
+
|
|
24
|
+
supported_by :sqlite, :mysql, :postgres do
|
|
25
|
+
|
|
24
26
|
describe 'inner class' do
|
|
25
27
|
it 'should be present' do
|
|
26
28
|
Story::Version.should be_a_kind_of(DataMapper::Model)
|
|
@@ -39,7 +41,6 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
|
|
|
39
41
|
|
|
40
42
|
describe '#create' do
|
|
41
43
|
before :all do
|
|
42
|
-
Story.auto_migrate!
|
|
43
44
|
Story.create(:title => 'A Very Interesting Article')
|
|
44
45
|
end
|
|
45
46
|
|
|
@@ -49,14 +50,10 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
|
|
|
49
50
|
end
|
|
50
51
|
|
|
51
52
|
describe '#save' do
|
|
52
|
-
before :all do
|
|
53
|
-
Story.auto_migrate!
|
|
54
|
-
end
|
|
55
|
-
|
|
56
53
|
describe '(with new resource)' do
|
|
57
54
|
before :all do
|
|
58
55
|
@story = Story.new(:title => 'A Story')
|
|
59
|
-
@story.save
|
|
56
|
+
@story.save.should be(true)
|
|
60
57
|
end
|
|
61
58
|
|
|
62
59
|
it 'should not create a versioned copy' do
|
|
@@ -67,7 +64,7 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
|
|
|
67
64
|
describe '(with a clean existing resource)' do
|
|
68
65
|
before :all do
|
|
69
66
|
@story = Story.create(:title => 'A Story')
|
|
70
|
-
@story.save
|
|
67
|
+
@story.save.should be(true)
|
|
71
68
|
end
|
|
72
69
|
|
|
73
70
|
it 'should not create a versioned copy' do
|
|
@@ -80,7 +77,7 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
|
|
|
80
77
|
@story = Story.create(:title => 'A Story')
|
|
81
78
|
@story.title = 'An Inner Update'
|
|
82
79
|
@story.title = 'An Updated Story'
|
|
83
|
-
@story.save
|
|
80
|
+
@story.save.should be(true)
|
|
84
81
|
end
|
|
85
82
|
|
|
86
83
|
it 'should create a versioned copy' do
|
|
@@ -100,8 +97,8 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
|
|
|
100
97
|
|
|
101
98
|
describe '#versions' do
|
|
102
99
|
before :all do
|
|
103
|
-
Story.auto_migrate!
|
|
104
100
|
@story = Story.create(:title => 'A Story')
|
|
101
|
+
@story.should be_saved
|
|
105
102
|
end
|
|
106
103
|
|
|
107
104
|
it 'should return an empty array when there are no versions' do
|
|
@@ -115,9 +112,11 @@ if HAS_SQLITE3 || HAS_MYSQL || HAS_POSTGRES
|
|
|
115
112
|
it "should not return another object's versions" do
|
|
116
113
|
@story2 = Story.create(:title => 'A Different Story')
|
|
117
114
|
@story2.title = 'A Different Title'
|
|
118
|
-
@story2.save
|
|
115
|
+
@story2.save.should be(true)
|
|
119
116
|
@story.versions.should == Story::Version.all(:id => @story.id)
|
|
120
117
|
end
|
|
121
118
|
end
|
|
119
|
+
|
|
122
120
|
end
|
|
121
|
+
|
|
123
122
|
end
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
source_regex = /DATAMAPPER = 'git:\/\/github.com\/datamapper'/
|
|
8
|
+
gem_source_regex = /:git => \"#\{DATAMAPPER\}\/(.+?)(?:\.git)?\"/
|
|
9
|
+
|
|
10
|
+
root.join('Gemfile.local').open('w') do |f|
|
|
11
|
+
root.join('Gemfile').open.each do |line|
|
|
12
|
+
line.sub!(source_regex, "DATAMAPPER = '#{datamapper}'")
|
|
13
|
+
line.sub!(gem_source_regex, ':path => "#{DATAMAPPER}/\1"')
|
|
14
|
+
f.puts line
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
end
|
data/tasks/spec.rake
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dm-is-versioned
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
4
|
+
prerelease: true
|
|
5
|
+
segments:
|
|
6
|
+
- 1
|
|
7
|
+
- 0
|
|
8
|
+
- 0
|
|
9
|
+
- rc1
|
|
10
|
+
version: 1.0.0.rc1
|
|
5
11
|
platform: ruby
|
|
6
12
|
authors:
|
|
7
13
|
- Bernerd Schaefer
|
|
@@ -9,39 +15,37 @@ autorequire:
|
|
|
9
15
|
bindir: bin
|
|
10
16
|
cert_chain: []
|
|
11
17
|
|
|
12
|
-
date:
|
|
18
|
+
date: 2010-05-19 00:00:00 -07:00
|
|
13
19
|
default_executable:
|
|
14
20
|
dependencies:
|
|
15
21
|
- !ruby/object:Gem::Dependency
|
|
16
22
|
name: dm-core
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
prerelease: false
|
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
|
20
25
|
requirements:
|
|
21
26
|
- - ~>
|
|
22
27
|
- !ruby/object:Gem::Version
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
segments:
|
|
29
|
+
- 1
|
|
30
|
+
- 0
|
|
31
|
+
- 0
|
|
32
|
+
- rc1
|
|
33
|
+
version: 1.0.0.rc1
|
|
34
|
+
type: :runtime
|
|
35
|
+
version_requirements: *id001
|
|
25
36
|
- !ruby/object:Gem::Dependency
|
|
26
37
|
name: rspec
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
38
|
+
prerelease: false
|
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
|
30
40
|
requirements:
|
|
31
41
|
- - ~>
|
|
32
42
|
- !ruby/object:Gem::Version
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
|
|
43
|
+
segments:
|
|
44
|
+
- 1
|
|
45
|
+
- 3
|
|
46
|
+
version: "1.3"
|
|
37
47
|
type: :development
|
|
38
|
-
|
|
39
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
40
|
-
requirements:
|
|
41
|
-
- - ~>
|
|
42
|
-
- !ruby/object:Gem::Version
|
|
43
|
-
version: 0.4.0
|
|
44
|
-
version:
|
|
48
|
+
version_requirements: *id002
|
|
45
49
|
description: DataMapper plugin enabling simple versioning of models
|
|
46
50
|
email: bernerd [a] wieck [d] com
|
|
47
51
|
executables: []
|
|
@@ -52,6 +56,8 @@ extra_rdoc_files:
|
|
|
52
56
|
- LICENSE
|
|
53
57
|
- README.rdoc
|
|
54
58
|
files:
|
|
59
|
+
- .gitignore
|
|
60
|
+
- Gemfile
|
|
55
61
|
- LICENSE
|
|
56
62
|
- README.rdoc
|
|
57
63
|
- Rakefile
|
|
@@ -64,6 +70,7 @@ files:
|
|
|
64
70
|
- spec/spec_helper.rb
|
|
65
71
|
- spec/versioned_spec.rb
|
|
66
72
|
- tasks/ci.rake
|
|
73
|
+
- tasks/local_gemfile.rake
|
|
67
74
|
- tasks/metrics.rake
|
|
68
75
|
- tasks/spec.rake
|
|
69
76
|
- tasks/yard.rake
|
|
@@ -81,20 +88,25 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
81
88
|
requirements:
|
|
82
89
|
- - ">="
|
|
83
90
|
- !ruby/object:Gem::Version
|
|
91
|
+
segments:
|
|
92
|
+
- 0
|
|
84
93
|
version: "0"
|
|
85
|
-
version:
|
|
86
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
95
|
requirements:
|
|
88
|
-
- - "
|
|
96
|
+
- - ">"
|
|
89
97
|
- !ruby/object:Gem::Version
|
|
90
|
-
|
|
91
|
-
|
|
98
|
+
segments:
|
|
99
|
+
- 1
|
|
100
|
+
- 3
|
|
101
|
+
- 1
|
|
102
|
+
version: 1.3.1
|
|
92
103
|
requirements: []
|
|
93
104
|
|
|
94
105
|
rubyforge_project: datamapper
|
|
95
|
-
rubygems_version: 1.3.
|
|
106
|
+
rubygems_version: 1.3.6
|
|
96
107
|
signing_key:
|
|
97
108
|
specification_version: 3
|
|
98
109
|
summary: DataMapper plugin enabling simple versioning of models
|
|
99
|
-
test_files:
|
|
100
|
-
|
|
110
|
+
test_files:
|
|
111
|
+
- spec/spec_helper.rb
|
|
112
|
+
- spec/versioned_spec.rb
|