dm-ambition 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use @$(basename `pwd`) --create
data/.travis.yml ADDED
@@ -0,0 +1,83 @@
1
+ bundler_args: --without guard metrics
2
+ script: "bundle exec rake spec"
3
+ rvm:
4
+ - 1.8.7
5
+ - 1.9.2
6
+ - 1.9.3
7
+ - ruby-head
8
+ - ree
9
+ - jruby
10
+ - rbx
11
+ env:
12
+ -
13
+ - JRUBY_OPTS="--1.8"
14
+ - JRUBY_OPTS="--1.9"
15
+ - RBXOPT="-X18"
16
+ # - RBXOPT="-X19" # uncomment when rbx 1.9 mode is more stable
17
+ matrix:
18
+ exclude:
19
+ # exclude 1.8.7
20
+ - rvm: 1.8.7
21
+ env: JRUBY_OPTS="--1.8"
22
+ - rvm: 1.8.7
23
+ env: JRUBY_OPTS="--1.9"
24
+ - rvm: 1.8.7
25
+ env: RBXOPT="-X18"
26
+ - rvm: 1.8.7
27
+ env: RBXOPT="-X19"
28
+
29
+ # exclude 1.9.2
30
+ - rvm: 1.9.2
31
+ env: JRUBY_OPTS="--1.8"
32
+ - rvm: 1.9.2
33
+ env: JRUBY_OPTS="--1.9"
34
+ - rvm: 1.9.2
35
+ env: RBXOPT="-X18"
36
+ - rvm: 1.9.2
37
+ env: RBXOPT="-X19"
38
+
39
+ # exclude 1.9.3
40
+ - rvm: 1.9.3
41
+ env: JRUBY_OPTS="--1.8"
42
+ - rvm: 1.9.3
43
+ env: JRUBY_OPTS="--1.9"
44
+ - rvm: 1.9.3
45
+ env: RBXOPT="-X18"
46
+ - rvm: 1.9.3
47
+ env: RBXOPT="-X19"
48
+
49
+ # exclude ruby-head
50
+ - rvm: ruby-head
51
+ env: JRUBY_OPTS="--1.8"
52
+ - rvm: ruby-head
53
+ env: JRUBY_OPTS="--1.9"
54
+ - rvm: ruby-head
55
+ env: RBXOPT="-X18"
56
+ - rvm: ruby-head
57
+ env: RBXOPT="-X19"
58
+
59
+ # exclude ree
60
+ - rvm: ree
61
+ env: JRUBY_OPTS="--1.8"
62
+ - rvm: ree
63
+ env: JRUBY_OPTS="--1.9"
64
+ - rvm: ree
65
+ env: RBXOPT="-X18"
66
+ - rvm: ree
67
+ env: RBXOPT="-X19"
68
+
69
+ # exclude jruby
70
+ - rvm: jruby
71
+ env:
72
+ - rvm: jruby
73
+ env: RBXOPT="-X18"
74
+ - rvm: jruby
75
+ env: RBXOPT="-X19"
76
+
77
+ # exclude rbx
78
+ - rvm: rbx
79
+ env:
80
+ - rvm: rbx
81
+ env: JRUBY_OPTS="--1.8"
82
+ - rvm: rbx
83
+ env: JRUBY_OPTS="--1.9"
data/Gemfile CHANGED
@@ -1,41 +1,49 @@
1
- source 'http://rubygems.org'
1
+ source :rubygems
2
2
 
3
3
  SOURCE = ENV.fetch('SOURCE', :git).to_sym
4
4
  REPO_POSTFIX = SOURCE == :path ? '' : '.git'
5
5
  DATAMAPPER = SOURCE == :path ? Pathname(__FILE__).dirname.parent : 'http://github.com/datamapper'
6
- DM_VERSION = '~> 1.1.0'
7
- DO_VERSION = '~> 0.10.2'
6
+ DM_VERSION = '~> 1.2'
7
+ DO_VERSION = '~> 0.10.6'
8
8
  DM_DO_ADAPTERS = %w[ sqlite postgres mysql oracle sqlserver ]
9
9
 
10
10
  gem 'dm-core', DM_VERSION, SOURCE => "#{DATAMAPPER}/dm-core#{REPO_POSTFIX}"
11
11
  gem 'ParseTree', '~> 3.0.7', :platforms => :mri_18
12
- gem 'ruby2ruby', '~> 1.2.5'
13
- gem 'sourcify', '~> 0.4.2'
12
+ gem 'ruby2ruby', '~> 1.3.1'
13
+ gem 'sourcify', '~> 0.5.0'
14
14
 
15
15
  group :development do
16
+ gem 'jeweler', '~> 1.6.4'
17
+ gem 'rake', '~> 0.9.2'
18
+ gem 'rspec', '~> 1.3.2'
19
+ gem 'yard', '~> 0.7.2'
20
+ end
16
21
 
17
- gem 'dm-migrations', DM_VERSION, SOURCE => "#{DATAMAPPER}/dm-migrations#{REPO_POSTFIX}"
18
- gem 'jeweler', '~> 1.5.2'
19
- gem 'rake', '~> 0.8.7'
20
- gem 'rspec', '~> 1.3.1'
21
-
22
+ group :guard do
23
+ gem 'guard', '~> 0.7.0'
24
+ gem 'guard-bundler', '~> 0.1.3'
25
+ gem 'guard-rspec', '~> 0.4.5'
22
26
  end
23
27
 
24
28
  platforms :mri_18 do
25
- group :quality do
26
-
27
- gem 'metric_fu', '~> 2.1.0'
28
- gem 'rcov', '~> 0.9.9'
29
- gem 'reek', '~> 1.2.8'
30
- gem 'roodi', '~> 2.1.0'
31
- gem 'yard', '~> 0.6.5'
32
- gem 'yardstick', '~> 0.3.0'
33
-
29
+ group :metrics do
30
+ gem 'arrayfields', '~> 4.7.4'
31
+ gem 'fattr', '~> 2.2.0'
32
+ gem 'flay', '~> 1.4.2'
33
+ gem 'flog', '~> 2.5.3'
34
+ gem 'heckle', '~> 1.4.3'
35
+ gem 'json', '~> 1.6.1'
36
+ gem 'map', '~> 4.4.0'
37
+ gem 'metric_fu', '~> 2.1.1'
38
+ gem 'mspec', '~> 1.5.17'
39
+ gem 'rcov', '~> 0.9.9'
40
+ gem 'reek', '~> 1.2.8', :git => 'git://github.com/dkubb/reek.git'
41
+ gem 'roodi', '~> 2.1.0'
42
+ gem 'yardstick', '~> 0.4.0'
34
43
  end
35
44
  end
36
45
 
37
46
  group :datamapper do
38
-
39
47
  adapters = ENV['ADAPTER'] || ENV['ADAPTERS']
40
48
  adapters = adapters.to_s.tr(',', ' ').split.uniq - %w[ in_memory ]
41
49
 
@@ -63,5 +71,4 @@ group :datamapper do
63
71
  plugins.each do |plugin|
64
72
  gem plugin, DM_VERSION, SOURCE => "#{DATAMAPPER}/#{plugin}#{REPO_POSTFIX}"
65
73
  end
66
-
67
74
  end
data/README.md ADDED
@@ -0,0 +1,120 @@
1
+ # dm-ambition
2
+
3
+ DataMapper::Ambition is a plugin that provides an Ambition-like API for
4
+ accessing DataMapper models.
5
+
6
+ ## Installation
7
+
8
+ With Rubygems:
9
+
10
+ ```bash
11
+ $ gem install dm-ambition
12
+ $ irb -rubygems
13
+ >> require 'dm-ambition'
14
+ => true
15
+ ```
16
+
17
+ With git and local working copy:
18
+
19
+ ```bash
20
+ $ git clone git://github.com/dkubb/dm-ambition.git
21
+ $ cd dm-ambition
22
+ $ rake install
23
+ $ irb -rubygems
24
+ >> require 'dm-ambition'
25
+ => true
26
+ ```
27
+
28
+ ## Testing
29
+
30
+ The simplest way to test is with Bundler since it handles all dependencies:
31
+
32
+ ```bash
33
+ $ rake local_gemfile
34
+ $ BUNDLE_GEMFILE="Gemfile.local" ADAPTER="in_memory" bundle
35
+ $ BUNDLE_GEMFILE="Gemfile.local" ADAPTER="in_memory" bundle exec rake spec
36
+ ```
37
+
38
+ ## Examples
39
+
40
+ The standard Enumerable methods `select`, `detect`, `reject`, `find_all`, and
41
+ `find` may be used with dm-ambition. These methods may be applied to the Model
42
+ or Collection object.
43
+
44
+ ```ruby
45
+ # with == operator
46
+ model_or_collection.select { |u| u.name == 'Dan Kubb' }
47
+
48
+ # with =~ operator
49
+ model_or_collection.select { |u| u.name =~ /Dan Kubb/ }
50
+
51
+ # with > operator
52
+ model_or_collection.select { |u| u.id > 1 }
53
+
54
+ # with >= operator
55
+ model_or_collection.select { |u| u.id >= 1 }
56
+
57
+ # with < operator
58
+ model_or_collection.select { |u| u.id < 1 }
59
+
60
+ # with <= operator
61
+ model_or_collection.select { |u| u.id <= 1 }
62
+
63
+ # with < operator
64
+ model_or_collection.select { |u| u.id < 1 }
65
+
66
+ # with receiver.attribute.nil?
67
+ model_or_collection.select { |u| u.id.nil? }
68
+
69
+ # with nil bind value
70
+ model_or_collection.select { |u| u.id == nil }
71
+
72
+ # with true bind value
73
+ model_or_collection.select { |u| u.admin == true }
74
+
75
+ # with false bind value
76
+ model_or_collection.select { |u| u.admin == false }
77
+
78
+ # with AND conditions
79
+ model_or_collection.select { |u| u.id == 1 && u.name == 'Dan Kubb' }
80
+
81
+ # with negated conditions
82
+ model_or_collection.select { |u| !(u.id == 1) }
83
+
84
+ # with double-negated conditions
85
+ model_or_collection.select { |u| !(!(u.id == 1)) }
86
+
87
+ # with matching from receiver
88
+ model_or_collection.select { |u| u == user }
89
+
90
+ # with matching to receiver
91
+ model_or_collection.select { |u| user == u }
92
+
93
+ # using send on receiver
94
+ model_or_collection.select { |u| u.send(:name) == 'Dan Kubb' }
95
+
96
+ # with Array#include?
97
+ model_or_collection.select { |u| user_ids.include?(u.id) }
98
+
99
+ # with Range#include?
100
+ model_or_collection.select { |u| (1..10).include?(u.id) }
101
+
102
+ # with Hash#key?
103
+ model_or_collection.select { |u| { 1 => 'Dan Kubb' }.key?(u.id) }
104
+
105
+ # with Hash#value?
106
+ model_or_collection.select { |u| { 'Dan Kubb' => 1 }.value?(u.id) }
107
+
108
+ # with receiver and Array#include?
109
+ model_or_collection.select { |u| users.include?(u) }
110
+
111
+ # with receiver and Hash#key?
112
+ model_or_collection.select { |u| { user => 'Dan Kubb' }.key?(u) }
113
+
114
+ # with receiver and Hash#value?
115
+ model_or_collection.select { |u| { 'Dan Kubb' => user }.value?(u) }
116
+ ```
117
+
118
+ ## Copyright
119
+
120
+ Copyright &copy; 2009-2011 Dan Kubb. See LICENSE for details.
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require 'rake'
4
4
  require File.expand_path('../lib/dm-ambition/version', __FILE__)
5
5
 
6
6
  begin
7
- gem 'jeweler', '~> 1.5.2'
7
+ gem 'jeweler', '~> 1.6.4'
8
8
  require 'jeweler'
9
9
 
10
10
  Jeweler::Tasks.new do |gem|
data/dm-ambition.gemspec CHANGED
@@ -4,25 +4,27 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{dm-ambition}
8
- s.version = "1.1.0"
7
+ s.name = "dm-ambition"
8
+ s.version = "1.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Dan Kubb"]
12
- s.date = %q{2011-04-06}
13
- s.description = %q{DataMapper plugin providing an Ambition-like API}
14
- s.email = %q{dan.kubb@gmail.com}
12
+ s.date = "2011-10-25"
13
+ s.description = "DataMapper plugin providing an Ambition-like API"
14
+ s.email = "dan.kubb@gmail.com"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
- "README.rdoc",
17
+ "README.md",
18
18
  "TODO"
19
19
  ]
20
20
  s.files = [
21
21
  ".document",
22
+ ".rvmrc",
23
+ ".travis.yml",
22
24
  "Gemfile",
23
25
  "LICENSE",
24
26
  "Manifest.txt",
25
- "README.rdoc",
27
+ "README.md",
26
28
  "Rakefile",
27
29
  "TODO",
28
30
  "dm-ambition.gemspec",
@@ -48,51 +50,44 @@ Gem::Specification.new do |s|
48
50
  "tasks/yard.rake",
49
51
  "tasks/yardstick.rake"
50
52
  ]
51
- s.homepage = %q{http://github.com/dkubb/dm-ambition}
53
+ s.homepage = "http://github.com/dkubb/dm-ambition"
52
54
  s.require_paths = ["lib"]
53
55
  s.required_ruby_version = Gem::Requirement.new("~> 1.8.7")
54
- s.rubyforge_project = %q{dm-ambition}
55
- s.rubygems_version = %q{1.7.2}
56
- s.summary = %q{DataMapper plugin providing an Ambition-like API}
57
- s.test_files = [
58
- "spec/public/collection_spec.rb",
59
- "spec/public/model_spec.rb",
60
- "spec/public/shared/filter_shared_spec.rb",
61
- "spec/semipublic/query_spec.rb",
62
- "spec/spec_helper.rb"
63
- ]
56
+ s.rubyforge_project = "dm-ambition"
57
+ s.rubygems_version = "1.8.11"
58
+ s.summary = "DataMapper plugin providing an Ambition-like API"
64
59
 
65
60
  if s.respond_to? :specification_version then
66
61
  s.specification_version = 3
67
62
 
68
63
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
69
- s.add_runtime_dependency(%q<dm-core>, ["~> 1.1.0"])
64
+ s.add_runtime_dependency(%q<dm-core>, ["~> 1.2"])
70
65
  s.add_runtime_dependency(%q<ParseTree>, ["~> 3.0.7"])
71
- s.add_runtime_dependency(%q<ruby2ruby>, ["~> 1.2.5"])
72
- s.add_runtime_dependency(%q<sourcify>, ["~> 0.4.2"])
73
- s.add_development_dependency(%q<dm-migrations>, ["~> 1.1.0"])
74
- s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
75
- s.add_development_dependency(%q<rake>, ["~> 0.8.7"])
76
- s.add_development_dependency(%q<rspec>, ["~> 1.3.1"])
66
+ s.add_runtime_dependency(%q<ruby2ruby>, ["~> 1.3.1"])
67
+ s.add_runtime_dependency(%q<sourcify>, ["~> 0.5.0"])
68
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
69
+ s.add_development_dependency(%q<rake>, ["~> 0.9.2"])
70
+ s.add_development_dependency(%q<rspec>, ["~> 1.3.2"])
71
+ s.add_development_dependency(%q<yard>, ["~> 0.7.2"])
77
72
  else
78
- s.add_dependency(%q<dm-core>, ["~> 1.1.0"])
73
+ s.add_dependency(%q<dm-core>, ["~> 1.2"])
79
74
  s.add_dependency(%q<ParseTree>, ["~> 3.0.7"])
80
- s.add_dependency(%q<ruby2ruby>, ["~> 1.2.5"])
81
- s.add_dependency(%q<sourcify>, ["~> 0.4.2"])
82
- s.add_dependency(%q<dm-migrations>, ["~> 1.1.0"])
83
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
84
- s.add_dependency(%q<rake>, ["~> 0.8.7"])
85
- s.add_dependency(%q<rspec>, ["~> 1.3.1"])
75
+ s.add_dependency(%q<ruby2ruby>, ["~> 1.3.1"])
76
+ s.add_dependency(%q<sourcify>, ["~> 0.5.0"])
77
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
78
+ s.add_dependency(%q<rake>, ["~> 0.9.2"])
79
+ s.add_dependency(%q<rspec>, ["~> 1.3.2"])
80
+ s.add_dependency(%q<yard>, ["~> 0.7.2"])
86
81
  end
87
82
  else
88
- s.add_dependency(%q<dm-core>, ["~> 1.1.0"])
83
+ s.add_dependency(%q<dm-core>, ["~> 1.2"])
89
84
  s.add_dependency(%q<ParseTree>, ["~> 3.0.7"])
90
- s.add_dependency(%q<ruby2ruby>, ["~> 1.2.5"])
91
- s.add_dependency(%q<sourcify>, ["~> 0.4.2"])
92
- s.add_dependency(%q<dm-migrations>, ["~> 1.1.0"])
93
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
94
- s.add_dependency(%q<rake>, ["~> 0.8.7"])
95
- s.add_dependency(%q<rspec>, ["~> 1.3.1"])
85
+ s.add_dependency(%q<ruby2ruby>, ["~> 1.3.1"])
86
+ s.add_dependency(%q<sourcify>, ["~> 0.5.0"])
87
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
88
+ s.add_dependency(%q<rake>, ["~> 0.9.2"])
89
+ s.add_dependency(%q<rspec>, ["~> 1.3.2"])
90
+ s.add_dependency(%q<yard>, ["~> 0.7.2"])
96
91
  end
97
92
  end
98
93
 
@@ -1,20 +1,29 @@
1
1
  module DataMapper
2
2
  module Ambition
3
3
  module Query
4
- @@sexps = {}
5
4
 
6
5
  # TODO: spec and document this
7
6
  # @api semipublic
8
7
  def filter(&block)
9
- # TODO: benchmark Marshal versus just building the sexp on demand
8
+ processor = FilterProcessor.new(block.binding, model)
9
+ processor.process(sexp_for(block))
10
+ self.class.new(repository, model, options.merge(:conditions => conditions & processor.conditions))
11
+ end
10
12
 
11
- # deep clone the sexp for multiple re-use
12
- sexp = Marshal.load(@@sexps[block.to_s] ||= Marshal.dump(block.to_sexp))
13
+ private
13
14
 
14
- processor = FilterProcessor.new(block.binding, model)
15
- processor.process(sexp)
15
+ if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
16
+ # do not deep clone sexp
17
+ def sexp_for(block)
18
+ block.to_sexp
19
+ end
20
+ else
21
+ @@sexps = {}
16
22
 
17
- self.class.new(repository, model, options.merge(:conditions => conditions & processor.conditions))
23
+ # deep clone the sexp for multiple re-use
24
+ def sexp_for(block)
25
+ Marshal.load(@@sexps[block.to_s] ||= Marshal.dump(block.to_sexp))
26
+ end
18
27
  end
19
28
 
20
29
  end # module Query
@@ -4,6 +4,8 @@ module DataMapper
4
4
  class FilterProcessor < SexpProcessor
5
5
  attr_reader :conditions
6
6
 
7
+ SEND_METHODS = [ :send, :__send__ ].freeze
8
+
7
9
  def initialize(binding, model)
8
10
  super()
9
11
 
@@ -32,7 +34,7 @@ module DataMapper
32
34
  operator = exp.shift
33
35
  rhs = process(exp.shift)
34
36
 
35
- while [ :send, :__send__ ].include?(operator)
37
+ while SEND_METHODS.include?(operator)
36
38
  operator = rhs.shift
37
39
  end
38
40
 
@@ -1,5 +1,5 @@
1
1
  module DataMapper
2
2
  module Ambition
3
- VERSION = '1.1.0'
3
+ VERSION = '1.2.0'
4
4
  end
5
5
  end
@@ -18,6 +18,8 @@ describe DataMapper::Ambition::Query do
18
18
  property :last_name, String, :key => true
19
19
  end
20
20
 
21
+ DataMapper.finalize
22
+
21
23
  if DataMapper.respond_to?(:auto_migrate!)
22
24
  DataMapper.auto_migrate!
23
25
  end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ ENV['ADAPTER'] ||= 'in_memory'
2
+
1
3
  require 'dm-ambition'
2
4
 
3
5
  require 'dm-core/spec/setup'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-ambition
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 1.1.0
10
+ version: 1.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dan Kubb
@@ -15,25 +15,26 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-06 00:00:00 Z
18
+ date: 2011-10-25 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
+ type: :runtime
22
+ prerelease: false
21
23
  requirement: &id001 !ruby/object:Gem::Requirement
22
24
  none: false
23
25
  requirements:
24
26
  - - ~>
25
27
  - !ruby/object:Gem::Version
26
- hash: 19
28
+ hash: 11
27
29
  segments:
28
30
  - 1
29
- - 1
30
- - 0
31
- version: 1.1.0
31
+ - 2
32
+ version: "1.2"
32
33
  version_requirements: *id001
33
34
  name: dm-core
34
- prerelease: false
35
- type: :runtime
36
35
  - !ruby/object:Gem::Dependency
36
+ type: :runtime
37
+ prerelease: false
37
38
  requirement: &id002 !ruby/object:Gem::Requirement
38
39
  none: false
39
40
  requirements:
@@ -47,25 +48,25 @@ dependencies:
47
48
  version: 3.0.7
48
49
  version_requirements: *id002
49
50
  name: ParseTree
50
- prerelease: false
51
- type: :runtime
52
51
  - !ruby/object:Gem::Dependency
52
+ type: :runtime
53
+ prerelease: false
53
54
  requirement: &id003 !ruby/object:Gem::Requirement
54
55
  none: false
55
56
  requirements:
56
57
  - - ~>
57
58
  - !ruby/object:Gem::Version
58
- hash: 21
59
+ hash: 25
59
60
  segments:
60
61
  - 1
61
- - 2
62
- - 5
63
- version: 1.2.5
62
+ - 3
63
+ - 1
64
+ version: 1.3.1
64
65
  version_requirements: *id003
65
66
  name: ruby2ruby
66
- prerelease: false
67
- type: :runtime
68
67
  - !ruby/object:Gem::Dependency
68
+ type: :runtime
69
+ prerelease: false
69
70
  requirement: &id004 !ruby/object:Gem::Requirement
70
71
  none: false
71
72
  requirements:
@@ -74,77 +75,75 @@ dependencies:
74
75
  hash: 11
75
76
  segments:
76
77
  - 0
77
- - 4
78
- - 2
79
- version: 0.4.2
78
+ - 5
79
+ - 0
80
+ version: 0.5.0
80
81
  version_requirements: *id004
81
82
  name: sourcify
82
- prerelease: false
83
- type: :runtime
84
83
  - !ruby/object:Gem::Dependency
84
+ type: :development
85
+ prerelease: false
85
86
  requirement: &id005 !ruby/object:Gem::Requirement
86
87
  none: false
87
88
  requirements:
88
89
  - - ~>
89
90
  - !ruby/object:Gem::Version
90
- hash: 19
91
+ hash: 7
91
92
  segments:
92
93
  - 1
93
- - 1
94
- - 0
95
- version: 1.1.0
94
+ - 6
95
+ - 4
96
+ version: 1.6.4
96
97
  version_requirements: *id005
97
- name: dm-migrations
98
- prerelease: false
99
- type: :development
98
+ name: jeweler
100
99
  - !ruby/object:Gem::Dependency
100
+ type: :development
101
+ prerelease: false
101
102
  requirement: &id006 !ruby/object:Gem::Requirement
102
103
  none: false
103
104
  requirements:
104
105
  - - ~>
105
106
  - !ruby/object:Gem::Version
106
- hash: 7
107
+ hash: 63
107
108
  segments:
108
- - 1
109
- - 5
109
+ - 0
110
+ - 9
110
111
  - 2
111
- version: 1.5.2
112
+ version: 0.9.2
112
113
  version_requirements: *id006
113
- name: jeweler
114
- prerelease: false
115
- type: :development
114
+ name: rake
116
115
  - !ruby/object:Gem::Dependency
116
+ type: :development
117
+ prerelease: false
117
118
  requirement: &id007 !ruby/object:Gem::Requirement
118
119
  none: false
119
120
  requirements:
120
121
  - - ~>
121
122
  - !ruby/object:Gem::Version
122
- hash: 49
123
+ hash: 31
123
124
  segments:
124
- - 0
125
- - 8
126
- - 7
127
- version: 0.8.7
125
+ - 1
126
+ - 3
127
+ - 2
128
+ version: 1.3.2
128
129
  version_requirements: *id007
129
- name: rake
130
- prerelease: false
131
- type: :development
130
+ name: rspec
132
131
  - !ruby/object:Gem::Dependency
132
+ type: :development
133
+ prerelease: false
133
134
  requirement: &id008 !ruby/object:Gem::Requirement
134
135
  none: false
135
136
  requirements:
136
137
  - - ~>
137
138
  - !ruby/object:Gem::Version
138
- hash: 25
139
+ hash: 7
139
140
  segments:
140
- - 1
141
- - 3
142
- - 1
143
- version: 1.3.1
141
+ - 0
142
+ - 7
143
+ - 2
144
+ version: 0.7.2
144
145
  version_requirements: *id008
145
- name: rspec
146
- prerelease: false
147
- type: :development
146
+ name: yard
148
147
  description: DataMapper plugin providing an Ambition-like API
149
148
  email: dan.kubb@gmail.com
150
149
  executables: []
@@ -153,14 +152,16 @@ extensions: []
153
152
 
154
153
  extra_rdoc_files:
155
154
  - LICENSE
156
- - README.rdoc
155
+ - README.md
157
156
  - TODO
158
157
  files:
159
158
  - .document
159
+ - .rvmrc
160
+ - .travis.yml
160
161
  - Gemfile
161
162
  - LICENSE
162
163
  - Manifest.txt
163
- - README.rdoc
164
+ - README.md
164
165
  - Rakefile
165
166
  - TODO
166
167
  - dm-ambition.gemspec
@@ -216,13 +217,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
216
217
  requirements: []
217
218
 
218
219
  rubyforge_project: dm-ambition
219
- rubygems_version: 1.7.2
220
+ rubygems_version: 1.8.11
220
221
  signing_key:
221
222
  specification_version: 3
222
223
  summary: DataMapper plugin providing an Ambition-like API
223
- test_files:
224
- - spec/public/collection_spec.rb
225
- - spec/public/model_spec.rb
226
- - spec/public/shared/filter_shared_spec.rb
227
- - spec/semipublic/query_spec.rb
228
- - spec/spec_helper.rb
224
+ test_files: []
225
+
data/README.rdoc DELETED
@@ -1,127 +0,0 @@
1
- = dm-ambition
2
-
3
- DataMapper::Ambition is a plugin that provides an Ambition-like API for
4
- accessing DataMapper models.
5
-
6
- == Installation
7
-
8
- With Rubygems:
9
-
10
- $ gem install dm-ambition
11
- $ irb -rubygems
12
- >> require 'dm-ambition'
13
- => true
14
-
15
- With git and local working copy:
16
-
17
- $ git clone git://github.com/dkubb/dm-ambition.git
18
- $ cd dm-ambition
19
- $ rake install
20
- $ irb -rubygems
21
- >> require 'dm-ambition'
22
- => true
23
-
24
- == Testing
25
-
26
- The simplest way to test is with Bundler since it handles all dependencies:
27
-
28
- $ rake local_gemfile
29
- $ BUNDLE_GEMFILE="Gemfile.local" ADAPTER="in_memory" bundle install --without=quality --relock
30
- $ BUNDLE_GEMFILE="Gemfile.local" ADAPTER="in_memory" bundle exec rake spec
31
-
32
- == Examples
33
-
34
- # with == operator
35
- User.select { |u| u.name == 'Dan Kubb' }
36
-
37
- # with =~ operator
38
- User.select { |u| u.name =~ /Dan Kubb/ }
39
-
40
- # with > operator
41
- User.select { |u| u.id > 1 }
42
-
43
- # with >= operator
44
- User.select { |u| u.id >= 1 }
45
-
46
- # with < operator
47
- User.select { |u| u.id < 1 }
48
-
49
- # with <= operator
50
- User.select { |u| u.id <= 1 }
51
-
52
- # with < operator
53
- User.select { |u| u.id < 1 }
54
-
55
- # with receiver.attribute.nil?
56
- User.select { |u| u.id.nil? }
57
-
58
- # with nil bind value
59
- User.select { |u| u.id == nil }
60
-
61
- # with true bind value
62
- User.select { |u| u.admin == true }
63
-
64
- # with false bind value
65
- User.select { |u| u.admin == false }
66
-
67
- # with AND conditions
68
- User.select { |u| u.id == 1 && u.name == 'Dan Kubb' }
69
-
70
- # with negated conditions
71
- User.select { |u| !(u.id == 1) }
72
-
73
- # with double-negated conditions
74
- User.select { |u| !(!(u.id == 1)) }
75
-
76
- # with matching from receiver
77
- User.select { |u| u == user }
78
-
79
- # with matching to receiver
80
- User.select { |u| user == u }
81
-
82
- # using send on receiver
83
- User.select { |u| u.send(:name) == 'Dan Kubb' }
84
-
85
- # with Array#include?
86
- User.select { |u| user_ids.include?(u.id) }
87
-
88
- # with Range#include?
89
- User.select { |u| (1..10).include?(u.id) }
90
-
91
- # with Hash#key?
92
- User.select { |u| { 1 => 'Dan Kubb' }.key?(u.id) }
93
-
94
- # with Hash#value?
95
- User.select { |u| { 'Dan Kubb' => 1 }.value?(u.id) }
96
-
97
- # with receiver and Array#include?
98
- User.select { |u| users.include?(u) }
99
-
100
- # with receiver and Hash#key?
101
- User.select { |u| { user => 'Dan Kubb' }.key?(u) }
102
-
103
- # with receiver and Hash#value?
104
- User.select { |u| { 'Dan Kubb' => user }.value?(u) }
105
-
106
- == License
107
-
108
- Copyright (c) 2011 Dan Kubb
109
-
110
- Permission is hereby granted, free of charge, to any person obtaining
111
- a copy of this software and associated documentation files (the
112
- "Software"), to deal in the Software without restriction, including
113
- without limitation the rights to use, copy, modify, merge, publish,
114
- distribute, sublicense, and/or sell copies of the Software, and to
115
- permit persons to whom the Software is furnished to do so, subject to
116
- the following conditions:
117
-
118
- The above copyright notice and this permission notice shall be
119
- included in all copies or substantial portions of the Software.
120
-
121
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
122
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
123
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
124
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
125
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
126
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
127
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.