dm-active_model 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +5 -0
- data/CHANGELOG +77 -0
- data/LICENSE +20 -0
- data/README.rdoc +18 -0
- data/Rakefile +35 -0
- data/TODO +0 -0
- data/dm-active_model.gemspec +75 -0
- data/lib/dm-active_model.rb +71 -0
- data/lib/dm-active_model/version.rb +7 -0
- data/spec/amo_compliance_spec.rb +7 -0
- data/spec/dm-active_model_spec.rb +25 -0
- data/spec/rails_compliance_spec.rb +50 -0
- data/spec/rcov.opts +6 -0
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +52 -0
- data/tasks/changelog.rake +20 -0
- data/tasks/ci.rake +1 -0
- data/tasks/metrics.rake +36 -0
- data/tasks/spec.rake +25 -0
- data/tasks/yard.rake +9 -0
- data/tasks/yardstick.rake +19 -0
- metadata +110 -0
data/.document
ADDED
data/CHANGELOG
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
[fb2fe87 | Sun Dec 20 19:59:22 UTC 2009] snusnu <gamsnjaga@gmail.com>
|
2
|
+
|
3
|
+
* Thx to jeweler this is now a gem
|
4
|
+
|
5
|
+
[53df775 | Thu Sep 24 03:06:19 UTC 2009] snusnu <gamsnjaga@gmail.com>
|
6
|
+
|
7
|
+
* All lint and rails_compliance specs pass.
|
8
|
+
|
9
|
+
[64c47dc | Thu Sep 24 02:53:17 UTC 2009] snusnu <gamsnjaga@gmail.com>
|
10
|
+
|
11
|
+
* Simplified #errors default implementation
|
12
|
+
|
13
|
+
[03beebe | Thu Sep 24 02:29:53 UTC 2009] snusnu <gamsnjaga@gmail.com>
|
14
|
+
|
15
|
+
* Only rely on active_model/lint for amo compliance specs
|
16
|
+
|
17
|
+
[f45713a | Thu Sep 24 02:29:33 UTC 2009] snusnu <gamsnjaga@gmail.com>
|
18
|
+
|
19
|
+
* Refactored rails_compliance_spec a bit
|
20
|
+
|
21
|
+
[755a48c | Thu Sep 24 02:20:57 UTC 2009] snusnu <gamsnjaga@gmail.com>
|
22
|
+
|
23
|
+
* Make it easy to move rails compliance specs to rails_datamapper
|
24
|
+
|
25
|
+
active_model/lint itself isn't really strict about what exact
|
26
|
+
String it gets back from either of the following methods that
|
27
|
+
are supported by the object returned from #class.model_name
|
28
|
+
|
29
|
+
#singular
|
30
|
+
#plural
|
31
|
+
#element
|
32
|
+
#human
|
33
|
+
#collection
|
34
|
+
#partial_path
|
35
|
+
|
36
|
+
All lint cares about, is that these methods return Strings
|
37
|
+
|
38
|
+
Therefore it's probably best to push specs that test for
|
39
|
+
rails's own implementation of those active_model strings
|
40
|
+
down to something like rails_datamapper.
|
41
|
+
|
42
|
+
Currently the rails compliance specs for #collection and
|
43
|
+
#partial_path fail. Need to investigate this.
|
44
|
+
|
45
|
+
[31d28fd | Thu Sep 24 00:23:40 UTC 2009] snusnu <gamsnjaga@gmail.com>
|
46
|
+
|
47
|
+
* All specs pass, changed dm-core dependency to '~>0.10'
|
48
|
+
|
49
|
+
[5cb1320 | Wed Sep 23 23:27:42 UTC 2009] snusnu <gamsnjaga@gmail.com>
|
50
|
+
|
51
|
+
* Also run active_model/lint when running the specsuite
|
52
|
+
|
53
|
+
Currently, if dm-validations are not required, all specs
|
54
|
+
pass. If dm-validations are required, 1 spec fails because
|
55
|
+
DataMapper::Validate::ValidationErrors seems to implement
|
56
|
+
#[](field) in an incompatible way. This will need more
|
57
|
+
investigation.
|
58
|
+
|
59
|
+
If this can be fixed upstream, all specs should pass
|
60
|
+
|
61
|
+
[4b1ccd0 | Wed Sep 23 22:37:59 UTC 2009] snusnu <gamsnjaga@gmail.com>
|
62
|
+
|
63
|
+
* Added implementation and initial specs
|
64
|
+
|
65
|
+
The final goal is to rely solely on active_model/lint.rb
|
66
|
+
to perform the compliance tests. However, lint.rb still
|
67
|
+
needs to be updated to cover the intended behavior more
|
68
|
+
precisely.
|
69
|
+
|
70
|
+
Nevertheless, next step is to include active_model as a
|
71
|
+
development dependency and run both lint.rb and our own
|
72
|
+
specs for the time being.
|
73
|
+
|
74
|
+
[2eb914c | Wed Sep 23 18:23:27 UTC 2009] snusnu <gamsnjaga@gmail.com>
|
75
|
+
|
76
|
+
* Initial commit to dm-active_model.
|
77
|
+
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Martin Gamsjaeger (snusnu)
|
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,18 @@
|
|
1
|
+
= dm-active_model
|
2
|
+
|
3
|
+
This plugin makes datamapper compliant with active_model conventions and thus compatible with rails3.
|
4
|
+
|
5
|
+
== Note on Patches/Pull Requests
|
6
|
+
|
7
|
+
* Fork the project.
|
8
|
+
* Make your feature addition or bug fix.
|
9
|
+
* Add tests for it. This is important so I don't break it in a
|
10
|
+
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)
|
14
|
+
* Send me a pull request. Bonus points for topic branches.
|
15
|
+
|
16
|
+
== Copyright
|
17
|
+
|
18
|
+
Copyright (c) 2009 Martin Gamsjaeger (snusnu). See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
require File.expand_path('../lib/dm-active_model/version', __FILE__)
|
5
|
+
|
6
|
+
FileList['tasks/**/*.rake'].each { |task| load task }
|
7
|
+
|
8
|
+
begin
|
9
|
+
|
10
|
+
gem 'jeweler', '~> 1.4'
|
11
|
+
require 'jeweler'
|
12
|
+
|
13
|
+
Jeweler::Tasks.new do |gem|
|
14
|
+
|
15
|
+
gem.version = DataMapper::ActiveModel::VERSION
|
16
|
+
|
17
|
+
gem.name = 'dm-active_model'
|
18
|
+
gem.summary = 'active_model compliance for datamapper'
|
19
|
+
gem.description = 'A datamapper plugin for active_model compliance and thus rails 3 compatibility.'
|
20
|
+
gem.email = 'gamsnjaga [a] gmail [d] com'
|
21
|
+
gem.homepage = 'http://github.com/snusnu/dm-active_model'
|
22
|
+
gem.authors = [ 'Martin Gamsjaeger (snusnu)' ]
|
23
|
+
|
24
|
+
gem.add_dependency 'dm-core', '~> 0.10'
|
25
|
+
|
26
|
+
gem.add_development_dependency 'rspec', '~> 1.2.9'
|
27
|
+
gem.add_development_dependency 'yard', '~> 0.4.0'
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
Jeweler::GemcutterTasks.new
|
32
|
+
|
33
|
+
rescue LoadError
|
34
|
+
puts 'Jeweler (or a dependency) not available. Install it with: gem install jeweler'
|
35
|
+
end
|
data/TODO
ADDED
File without changes
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{dm-active_model}
|
8
|
+
s.version = "0.0.2"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Martin Gamsjaeger (snusnu)"]
|
12
|
+
s.date = %q{2009-12-20}
|
13
|
+
s.description = %q{A datamapper plugin for active_model compliance and thus rails 3 compatibility.}
|
14
|
+
s.email = %q{gamsnjaga [a] gmail [d] com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.rdoc",
|
18
|
+
"TODO"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
".document",
|
22
|
+
".gitignore",
|
23
|
+
"CHANGELOG",
|
24
|
+
"LICENSE",
|
25
|
+
"README.rdoc",
|
26
|
+
"Rakefile",
|
27
|
+
"TODO",
|
28
|
+
"dm-active_model.gemspec",
|
29
|
+
"lib/dm-active_model.rb",
|
30
|
+
"lib/dm-active_model/version.rb",
|
31
|
+
"spec/amo_compliance_spec.rb",
|
32
|
+
"spec/dm-active_model_spec.rb",
|
33
|
+
"spec/rails_compliance_spec.rb",
|
34
|
+
"spec/rcov.opts",
|
35
|
+
"spec/spec.opts",
|
36
|
+
"spec/spec_helper.rb",
|
37
|
+
"tasks/changelog.rake",
|
38
|
+
"tasks/ci.rake",
|
39
|
+
"tasks/metrics.rake",
|
40
|
+
"tasks/spec.rake",
|
41
|
+
"tasks/yard.rake",
|
42
|
+
"tasks/yardstick.rake"
|
43
|
+
]
|
44
|
+
s.homepage = %q{http://github.com/snusnu/dm-active_model}
|
45
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
46
|
+
s.require_paths = ["lib"]
|
47
|
+
s.rubygems_version = %q{1.3.5}
|
48
|
+
s.summary = %q{active_model compliance for datamapper}
|
49
|
+
s.test_files = [
|
50
|
+
"spec/amo_compliance_spec.rb",
|
51
|
+
"spec/dm-active_model_spec.rb",
|
52
|
+
"spec/rails_compliance_spec.rb",
|
53
|
+
"spec/spec_helper.rb"
|
54
|
+
]
|
55
|
+
|
56
|
+
if s.respond_to? :specification_version then
|
57
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
58
|
+
s.specification_version = 3
|
59
|
+
|
60
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
61
|
+
s.add_runtime_dependency(%q<dm-core>, ["~> 0.10"])
|
62
|
+
s.add_development_dependency(%q<rspec>, ["~> 1.2.9"])
|
63
|
+
s.add_development_dependency(%q<yard>, ["~> 0.4.0"])
|
64
|
+
else
|
65
|
+
s.add_dependency(%q<dm-core>, ["~> 0.10"])
|
66
|
+
s.add_dependency(%q<rspec>, ["~> 1.2.9"])
|
67
|
+
s.add_dependency(%q<yard>, ["~> 0.4.0"])
|
68
|
+
end
|
69
|
+
else
|
70
|
+
s.add_dependency(%q<dm-core>, ["~> 0.10"])
|
71
|
+
s.add_dependency(%q<rspec>, ["~> 1.2.9"])
|
72
|
+
s.add_dependency(%q<yard>, ["~> 0.4.0"])
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module DataMapper
|
2
|
+
module ActiveModel
|
3
|
+
|
4
|
+
# This is mostly copied from active_model and adapted to use extlib under the hood.
|
5
|
+
# see http://github.com/rails/rails/blob/master/activemodel/lib/active_model/naming.rb
|
6
|
+
class Name < String
|
7
|
+
|
8
|
+
attr_reader :singular, :plural, :element, :collection, :partial_path, :human
|
9
|
+
alias_method :cache_key, :collection
|
10
|
+
|
11
|
+
def initialize(name)
|
12
|
+
super
|
13
|
+
@singular = Extlib::Inflection.underscore(self).tr('/', '_').freeze
|
14
|
+
@plural = Extlib::Inflection.pluralize(@singular).freeze
|
15
|
+
@element = Extlib::Inflection.underscore(Extlib::Inflection.demodulize(self)).freeze
|
16
|
+
@human = @element.gsub(/_/, " ")
|
17
|
+
@collection = Extlib::Inflection.pluralize(Extlib::Inflection.underscore(self)).freeze
|
18
|
+
@partial_path = "#{@collection}/#{@element}".freeze
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
module ClassMethods
|
24
|
+
|
25
|
+
# Returns an ActiveModel::Name object for module. It can be
|
26
|
+
# used to retrieve all kinds of naming-related information.
|
27
|
+
def model_name
|
28
|
+
@_model_name ||= DataMapper::ActiveModel::Name.new(name)
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
module InstanceMethods
|
34
|
+
|
35
|
+
|
36
|
+
def self.included(host)
|
37
|
+
host.class_eval do
|
38
|
+
alias :new_record? :new?
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def to_model
|
43
|
+
self
|
44
|
+
end
|
45
|
+
|
46
|
+
# Define the minimum requirements if the resource
|
47
|
+
# has no concept of validation baked in, which
|
48
|
+
# happens if dm-validations is not required.
|
49
|
+
unless respond_to?(:validatable?)
|
50
|
+
|
51
|
+
def valid?
|
52
|
+
true
|
53
|
+
end
|
54
|
+
|
55
|
+
def errors
|
56
|
+
obj = Object.new
|
57
|
+
def obj.[](key) [] end
|
58
|
+
def obj.full_messages() [] end
|
59
|
+
obj
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
Model.append_extensions(ActiveModel::ClassMethods)
|
69
|
+
Model.append_inclusions(ActiveModel::InstanceMethods)
|
70
|
+
|
71
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'An active_model compliant DataMapper::Resource' do
|
4
|
+
|
5
|
+
before :all do
|
6
|
+
|
7
|
+
module ComplianceTest
|
8
|
+
class ProfileInfo
|
9
|
+
include DataMapper::Resource
|
10
|
+
property :id, Serial
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
DataMapper.setup(:default, 'sqlite3::memory:')
|
15
|
+
DataMapper.auto_migrate!
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
before :each do
|
20
|
+
@object = ComplianceTest::ProfileInfo.create.to_model
|
21
|
+
end
|
22
|
+
|
23
|
+
it_should_behave_like 'every active_model compliant object'
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# TODO move these specs into rails_datamapper
|
2
|
+
require 'active_model/naming'
|
3
|
+
|
4
|
+
describe 'An active_model compliant DataMapper::Resource that is compatible with rails3' do
|
5
|
+
|
6
|
+
before :all do
|
7
|
+
|
8
|
+
module ComplianceTest
|
9
|
+
class ProfileInfo
|
10
|
+
include DataMapper::Resource
|
11
|
+
property :id, Serial
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
DataMapper.setup(:default, 'sqlite3::memory:')
|
16
|
+
DataMapper.auto_migrate!
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
before :each do
|
21
|
+
@object = ComplianceTest::ProfileInfo.create.to_model
|
22
|
+
end
|
23
|
+
|
24
|
+
it_should_behave_like 'every active_model compliant object'
|
25
|
+
|
26
|
+
it '#class.model_name.singular should follow active_model conventions' do
|
27
|
+
@object.class.model_name.singular.should == ActiveModel::Name.new(@object.class.name).singular
|
28
|
+
end
|
29
|
+
|
30
|
+
it '#class.model_name.plural should follow active_model conventions' do
|
31
|
+
@object.class.model_name.plural.should == ActiveModel::Name.new(@object.class.name).plural
|
32
|
+
end
|
33
|
+
|
34
|
+
it '#class.model_name.element should follow active_model conventions' do
|
35
|
+
@object.class.model_name.element.should == ActiveModel::Name.new(@object.class.name).element
|
36
|
+
end
|
37
|
+
|
38
|
+
it '#class.model_name.human should follow active_model conventions' do
|
39
|
+
@object.class.model_name.human.should == ActiveModel::Name.new(@object.class.name).human
|
40
|
+
end
|
41
|
+
|
42
|
+
it '#class.model_name.collection should follow active_model conventions' do
|
43
|
+
@object.class.model_name.collection.should == ActiveModel::Name.new(@object.class.name).collection
|
44
|
+
end
|
45
|
+
|
46
|
+
it '#class.model_name.partial_path should follow active_model conventions' do
|
47
|
+
@object.class.model_name.partial_path.should == ActiveModel::Name.new(@object.class.name).partial_path
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
data/spec/rcov.opts
ADDED
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'rubygems'
|
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')
|
10
|
+
|
11
|
+
require 'dm-active_model'
|
12
|
+
|
13
|
+
# test with official active_model lint
|
14
|
+
require 'active_model/lint'
|
15
|
+
|
16
|
+
# run our own specs for the time being. lint still needs to be updated
|
17
|
+
require 'amo_compliance_spec'
|
18
|
+
|
19
|
+
def load_driver(name, default_uri)
|
20
|
+
return false if ENV['ADAPTER'] != name.to_s
|
21
|
+
|
22
|
+
begin
|
23
|
+
DataMapper.setup(name, ENV["#{name.to_s.upcase}_SPEC_URI"] || default_uri)
|
24
|
+
DataMapper::Repository.adapters[:default] = DataMapper::Repository.adapters[name]
|
25
|
+
true
|
26
|
+
rescue LoadError => e
|
27
|
+
warn "Could not load do_#{name}: #{e}"
|
28
|
+
false
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
ENV['ADAPTER'] ||= 'sqlite3'
|
33
|
+
|
34
|
+
HAS_SQLITE3 = load_driver(:sqlite3, 'sqlite3::memory:')
|
35
|
+
HAS_MYSQL = load_driver(:mysql, 'mysql://localhost/dm_core_test')
|
36
|
+
HAS_POSTGRES = load_driver(:postgres, 'postgres://postgres@localhost/dm_core_test')
|
37
|
+
|
38
|
+
|
39
|
+
Spec::Runner.configure do |config|
|
40
|
+
|
41
|
+
config.before(:all) do
|
42
|
+
|
43
|
+
# Support testing with(out)
|
44
|
+
# dm-validations enabled
|
45
|
+
|
46
|
+
if ENV['USE_DM_VALIDATIONS'] == 'true'
|
47
|
+
require 'dm-validations'
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'time'
|
2
|
+
|
3
|
+
desc 'update changelog'
|
4
|
+
task :changelog do
|
5
|
+
File.open('CHANGELOG', 'w+') do |changelog|
|
6
|
+
`git log -z --abbrev-commit`.split("\0").each do |commit|
|
7
|
+
next if commit =~ /^Merge: \d*/
|
8
|
+
ref, author, time, _, title, _, message = commit.split("\n", 7)
|
9
|
+
ref = ref[/commit ([0-9a-f]+)/, 1]
|
10
|
+
author = author[/Author: (.*)/, 1].strip
|
11
|
+
time = Time.parse(time[/Date: (.*)/, 1]).utc
|
12
|
+
title.strip!
|
13
|
+
|
14
|
+
changelog.puts "[#{ref} | #{time}] #{author}"
|
15
|
+
changelog.puts '', " * #{title}"
|
16
|
+
changelog.puts '', message.rstrip if message
|
17
|
+
changelog.puts
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/tasks/ci.rake
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
task :ci => [ :verify_measurements, 'metrics:all' ]
|
data/tasks/metrics.rake
ADDED
@@ -0,0 +1,36 @@
|
|
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
|
data/tasks/spec.rake
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec/rake/spectask'
|
2
|
+
require 'spec/rake/verify_rcov'
|
3
|
+
|
4
|
+
spec_defaults = lambda do |spec|
|
5
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
6
|
+
spec.libs << 'lib' << 'spec'
|
7
|
+
spec.spec_opts << '--options' << 'spec/spec.opts'
|
8
|
+
end
|
9
|
+
|
10
|
+
Spec::Rake::SpecTask.new(:spec, &spec_defaults)
|
11
|
+
|
12
|
+
Spec::Rake::SpecTask.new(:rcov) do |rcov|
|
13
|
+
spec_defaults.call(rcov)
|
14
|
+
rcov.rcov = true
|
15
|
+
rcov.rcov_opts = File.read('spec/rcov.opts').split(/\s+/)
|
16
|
+
end
|
17
|
+
|
18
|
+
RCov::VerifyTask.new(:verify_rcov => :rcov) do |rcov|
|
19
|
+
rcov.threshold = 100
|
20
|
+
end
|
21
|
+
|
22
|
+
task :spec => :check_dependencies
|
23
|
+
task :rcov => :check_dependencies
|
24
|
+
|
25
|
+
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,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dm-active_model
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Martin Gamsjaeger (snusnu)
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-12-20 00:00:00 +01:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: dm-core
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ~>
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0.10"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rspec
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.2.9
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: yard
|
37
|
+
type: :development
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 0.4.0
|
44
|
+
version:
|
45
|
+
description: A datamapper plugin for active_model compliance and thus rails 3 compatibility.
|
46
|
+
email: gamsnjaga [a] gmail [d] com
|
47
|
+
executables: []
|
48
|
+
|
49
|
+
extensions: []
|
50
|
+
|
51
|
+
extra_rdoc_files:
|
52
|
+
- LICENSE
|
53
|
+
- README.rdoc
|
54
|
+
- TODO
|
55
|
+
files:
|
56
|
+
- .document
|
57
|
+
- .gitignore
|
58
|
+
- CHANGELOG
|
59
|
+
- LICENSE
|
60
|
+
- README.rdoc
|
61
|
+
- Rakefile
|
62
|
+
- TODO
|
63
|
+
- dm-active_model.gemspec
|
64
|
+
- lib/dm-active_model.rb
|
65
|
+
- lib/dm-active_model/version.rb
|
66
|
+
- spec/amo_compliance_spec.rb
|
67
|
+
- spec/dm-active_model_spec.rb
|
68
|
+
- spec/rails_compliance_spec.rb
|
69
|
+
- spec/rcov.opts
|
70
|
+
- spec/spec.opts
|
71
|
+
- spec/spec_helper.rb
|
72
|
+
- tasks/changelog.rake
|
73
|
+
- tasks/ci.rake
|
74
|
+
- tasks/metrics.rake
|
75
|
+
- tasks/spec.rake
|
76
|
+
- tasks/yard.rake
|
77
|
+
- tasks/yardstick.rake
|
78
|
+
has_rdoc: true
|
79
|
+
homepage: http://github.com/snusnu/dm-active_model
|
80
|
+
licenses: []
|
81
|
+
|
82
|
+
post_install_message:
|
83
|
+
rdoc_options:
|
84
|
+
- --charset=UTF-8
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: "0"
|
92
|
+
version:
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: "0"
|
98
|
+
version:
|
99
|
+
requirements: []
|
100
|
+
|
101
|
+
rubyforge_project:
|
102
|
+
rubygems_version: 1.3.5
|
103
|
+
signing_key:
|
104
|
+
specification_version: 3
|
105
|
+
summary: active_model compliance for datamapper
|
106
|
+
test_files:
|
107
|
+
- spec/amo_compliance_spec.rb
|
108
|
+
- spec/dm-active_model_spec.rb
|
109
|
+
- spec/rails_compliance_spec.rb
|
110
|
+
- spec/spec_helper.rb
|