ninja-model 0.6.2 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -1
- data/.rvmrc +1 -0
- data/Gemfile +5 -0
- data/Guardfile +19 -0
- data/Rakefile +12 -22
- data/lib/ninja_model/associations/association_proxy.rb +1 -1
- data/lib/ninja_model/associations/has_many_association.rb +2 -0
- data/lib/ninja_model/attribute_methods.rb +2 -2
- data/lib/ninja_model/base.rb +52 -3
- data/lib/ninja_model/identity.rb +1 -1
- data/lib/ninja_model/rails_ext/active_record.rb +48 -11
- data/lib/ninja_model/railtie.rb +4 -2
- data/lib/ninja_model/reflection.rb +3 -9
- data/lib/ninja_model/relation.rb +5 -2
- data/lib/ninja_model/version.rb +1 -1
- data/ninja-model.gemspec +9 -6
- data/spec/ninja_model/adapters/adapter_pool_spec.rb +10 -14
- data/spec/ninja_model/base_spec.rb +2 -0
- data/spec/ninja_model/reflection_spec.rb +0 -5
- data/spec/ninja_model_spec.rb +2 -0
- data/spec/spec_helper.rb +6 -2
- metadata +99 -106
data/.gitignore
CHANGED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use 1.9.2@ninja-model
|
data/Gemfile
CHANGED
data/Guardfile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard 'rspec', :version => 2 do
|
5
|
+
watch(%r{^spec/.+_spec\.rb$})
|
6
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
|
+
watch('spec/spec_helper.rb') { "spec" }
|
8
|
+
|
9
|
+
# Rails example
|
10
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
11
|
+
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
12
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
13
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
14
|
+
watch('config/routes.rb') { "spec/routing" }
|
15
|
+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
16
|
+
# Capybara request specs
|
17
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
|
18
|
+
end
|
19
|
+
|
data/Rakefile
CHANGED
@@ -1,31 +1,21 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
3
7
|
|
4
|
-
require 'rake'
|
5
|
-
require 'rake/rdoctask'
|
6
8
|
require 'rspec/core/rake_task'
|
9
|
+
require 'yard'
|
7
10
|
|
8
|
-
RSpec::Core::RakeTask.new(:spec) do |t|
|
9
|
-
t.verbose = false
|
10
|
-
end
|
11
11
|
|
12
|
-
|
13
|
-
RSpec::Core::RakeTask.new(:specd) do |t|
|
12
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
14
13
|
t.verbose = false
|
15
|
-
t.
|
14
|
+
t.pattern = 'spec/**/*_spec.rb'
|
16
15
|
end
|
17
16
|
|
18
|
-
Rake::
|
19
|
-
|
20
|
-
r.main = "README.md"
|
21
|
-
r.rdoc_files.include('README.md', 'lib/**/*.rb')
|
22
|
-
r.rdoc_files.exclude('lib/generators/**/*')
|
17
|
+
YARD::Rake::YardocTask.new do |t|
|
18
|
+
t.options = ['--exclude', 'generators']
|
23
19
|
end
|
24
20
|
|
25
|
-
|
26
|
-
RSpec::Core::RakeTask.new(:rcov) do |t|
|
27
|
-
t.rcov = true
|
28
|
-
t.rcov_opts = %w{--text-report --sort coverage}
|
29
|
-
t.rcov_opts << %w{--exclude gems\/,spec\/}
|
30
|
-
end
|
31
|
-
end
|
21
|
+
Bundler::GemHelper.install_tasks
|
@@ -4,8 +4,8 @@ module NinjaModel
|
|
4
4
|
include ActiveModel::AttributeMethods
|
5
5
|
include ActiveModel::Dirty
|
6
6
|
|
7
|
-
|
8
|
-
self.model_attributes = []
|
7
|
+
#class_attribute :model_attributes
|
8
|
+
#self.model_attributes = []
|
9
9
|
attribute_method_suffix('', '=', '_before_type_cast')
|
10
10
|
|
11
11
|
class << self
|
data/lib/ninja_model/base.rb
CHANGED
@@ -32,10 +32,21 @@ module NinjaModel
|
|
32
32
|
|
33
33
|
define_model_callbacks :initialize, :find, :touch, :only => :after
|
34
34
|
|
35
|
-
class_inheritable_accessor :default_scoping, :instance_writer => false
|
36
|
-
self.default_scoping = []
|
37
|
-
|
38
35
|
class << self
|
36
|
+
def inherited(subclass)
|
37
|
+
subclass.class_attribute :model_attributes
|
38
|
+
if self.respond_to?(:model_attributes)
|
39
|
+
subclass.model_attributes = self.model_attributes.dup
|
40
|
+
else
|
41
|
+
subclass.model_attributes = []
|
42
|
+
end
|
43
|
+
subclass.class_attribute :default_scoping
|
44
|
+
if self.respond_to?(:default_scoping)
|
45
|
+
subclass.default_scoping = self.default_scoping.dup
|
46
|
+
else
|
47
|
+
subclass.default_scoping = []
|
48
|
+
end
|
49
|
+
end
|
39
50
|
|
40
51
|
delegate :find, :first, :last, :all, :exists?, :to => :scoped
|
41
52
|
delegate :where, :order, :limit, :to => :scoped
|
@@ -62,6 +73,10 @@ module NinjaModel
|
|
62
73
|
self.default_scoping << build_finder_relation(options, default_scoping.pop)
|
63
74
|
end
|
64
75
|
|
76
|
+
def current_scope
|
77
|
+
current_scoped_methods
|
78
|
+
end
|
79
|
+
|
65
80
|
def current_scoped_methods
|
66
81
|
last = scoped_methods.last
|
67
82
|
last.is_a?(Proc) ? unscoped(&last) : last
|
@@ -78,6 +93,31 @@ module NinjaModel
|
|
78
93
|
relation = scope.merge(relation) if scope
|
79
94
|
relation
|
80
95
|
end
|
96
|
+
|
97
|
+
def compute_type(type_name)
|
98
|
+
if type_name.match(/^::/)
|
99
|
+
# If the type is prefixed with a scope operator then we assume that
|
100
|
+
# the type_name is an absolute reference.
|
101
|
+
ActiveSupport::Dependencies.constantize(type_name)
|
102
|
+
else
|
103
|
+
# Build a list of candidates to search for
|
104
|
+
candidates = []
|
105
|
+
name.scan(/::|$/) { candidates.unshift "#{$`}::#{type_name}" }
|
106
|
+
candidates << type_name
|
107
|
+
|
108
|
+
candidates.each do |candidate|
|
109
|
+
begin
|
110
|
+
constant = ActiveSupport::Dependencies.constantize(candidate)
|
111
|
+
return constant if candidate == constant.to_s
|
112
|
+
rescue NameError => e
|
113
|
+
# We don't want to swallow NoMethodError < NameError errors
|
114
|
+
raise e unless e.instance_of?(NameError)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
raise NameError, "uninitialized constant #{candidates.first}"
|
119
|
+
end
|
120
|
+
end
|
81
121
|
end
|
82
122
|
|
83
123
|
def attributes
|
@@ -90,6 +130,8 @@ module NinjaModel
|
|
90
130
|
|
91
131
|
def initialize(attributes = nil)
|
92
132
|
@attributes = attributes_from_model_attributes
|
133
|
+
@association_cache = {}
|
134
|
+
@aggregation_cache = {}
|
93
135
|
@persisted = false
|
94
136
|
@readonly = true
|
95
137
|
@destroyed = false
|
@@ -115,6 +157,13 @@ module NinjaModel
|
|
115
157
|
self
|
116
158
|
end
|
117
159
|
|
160
|
+
def derive_class(association_id)
|
161
|
+
klass = association_id.to_s.camelize
|
162
|
+
klass = klass.singularize
|
163
|
+
compute_type(klass)
|
164
|
+
end
|
165
|
+
|
166
|
+
|
118
167
|
private
|
119
168
|
|
120
169
|
def populate_with_current_scope_attributes
|
data/lib/ninja_model/identity.rb
CHANGED
@@ -4,14 +4,31 @@ module ActiveRecord
|
|
4
4
|
class Base
|
5
5
|
class << self
|
6
6
|
def has_one_with_ninja_model(association_id, options = {})
|
7
|
-
|
8
|
-
|
7
|
+
klass = options[:class_name] || association_id
|
8
|
+
klass = klass.to_s.camelize
|
9
|
+
klass = klass.singularize
|
10
|
+
klass = compute_type(klass)
|
11
|
+
if NinjaModel.ninja_model?(klass)
|
12
|
+
ninja_proxy.handle_association(:has_one, association_id, options.merge({:class_name => klass.name}))
|
9
13
|
else
|
10
14
|
has_one_without_ninja_model(association_id, options)
|
11
15
|
end
|
12
16
|
end
|
13
17
|
alias_method_chain :has_one, :ninja_model
|
14
18
|
|
19
|
+
def has_many_with_ninja_model(association_id, options = {})
|
20
|
+
klass = options[:class_name] || association_id
|
21
|
+
klass = klass.to_s.camelize
|
22
|
+
klass = klass.singularize
|
23
|
+
klass = compute_type(klass)
|
24
|
+
if NinjaModel.ninja_model?(klass)
|
25
|
+
ninja_proxy.handle_association(:has_many, association_id, options.merge({:class_name => klass.name}))
|
26
|
+
else
|
27
|
+
has_many_without_ninja_model(association_id, options)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
alias_method_chain :has_many, :ninja_model
|
31
|
+
|
15
32
|
def reflect_on_association_with_ninja_model(association)
|
16
33
|
if read_inheritable_attribute(:ninja_proxy) && ninja_proxy.proxy_klass.reflections.include?(association)
|
17
34
|
ninja_proxy.proxy_klass.reflect_on_association(association)
|
@@ -47,8 +64,11 @@ module NinjaModel
|
|
47
64
|
class Base
|
48
65
|
class << self
|
49
66
|
def has_one_with_active_record(association_id, options = {})
|
50
|
-
|
51
|
-
|
67
|
+
klass = options[:class_name] || association_id
|
68
|
+
klass = klass.to_s.camelize
|
69
|
+
klass = compute_type(klass)
|
70
|
+
if NinjaModel.ninja_model?(klass)
|
71
|
+
has_one_without_active_record(association_id, options.merge(:class_name => klass.name.underscore))
|
52
72
|
else
|
53
73
|
proxy.handle_association(:has_one, association_id, options)
|
54
74
|
end
|
@@ -57,8 +77,11 @@ module NinjaModel
|
|
57
77
|
alias_method_chain :has_one, :active_record
|
58
78
|
|
59
79
|
def belongs_to_with_active_record(association_id, options = {})
|
60
|
-
|
61
|
-
|
80
|
+
klass = options[:class_name] || association_id
|
81
|
+
klass = klass.to_s.camelize
|
82
|
+
klass = compute_type(klass)
|
83
|
+
if NinjaModel.ninja_model?(klass)
|
84
|
+
belongs_to_without_active_record(association_id, options.merge(:class_name => klass.name.underscore))
|
62
85
|
else
|
63
86
|
proxy.handle_association(:belongs_to, association_id, options)
|
64
87
|
end
|
@@ -67,8 +90,11 @@ module NinjaModel
|
|
67
90
|
alias_method_chain :belongs_to, :active_record
|
68
91
|
|
69
92
|
def has_many_with_active_record(association_id, options = {})
|
70
|
-
|
71
|
-
|
93
|
+
klass = options[:class_name] || association_id
|
94
|
+
klass = klass.to_s.camelize.singularize
|
95
|
+
klass = compute_type(klass)
|
96
|
+
if NinjaModel.ninja_model?(klass)
|
97
|
+
has_many_without_active_record(association_id, options.merge(:class_name => klass.name.underscore))
|
72
98
|
else
|
73
99
|
proxy.handle_association(:has_many, association_id, options)
|
74
100
|
end
|
@@ -120,6 +146,17 @@ module NinjaModel
|
|
120
146
|
def self.column(name, sql_type = nil, default = nil)
|
121
147
|
self.columns << ActiveRecord::ConnectionAdapters::Column.new(name, nil, sql_type.to_s, default)
|
122
148
|
end
|
149
|
+
|
150
|
+
def self.columns_hash
|
151
|
+
h = {}
|
152
|
+
self.columns.each do |c|
|
153
|
+
h[c.name] = c
|
154
|
+
end
|
155
|
+
h
|
156
|
+
end
|
157
|
+
def self.column_defaults
|
158
|
+
self.columns_hash
|
159
|
+
end
|
123
160
|
end
|
124
161
|
|
125
162
|
@klass.model_attributes.each do |attr|
|
@@ -145,7 +182,7 @@ module NinjaModel
|
|
145
182
|
private
|
146
183
|
|
147
184
|
def derive_foreign_key
|
148
|
-
"#{@klass.name.underscore}_id".to_sym
|
185
|
+
"#{@klass.name.demodulize.underscore}_id".to_sym
|
149
186
|
end
|
150
187
|
end
|
151
188
|
|
@@ -163,7 +200,7 @@ module NinjaModel
|
|
163
200
|
end
|
164
201
|
end
|
165
202
|
|
166
|
-
@proxy_klass = active_record.parent.const_set("#{@klass.model_name}Proxy", Class.new(NinjaModel::Base))
|
203
|
+
@proxy_klass = active_record.parent.const_set("#{@klass.model_name.demodulize}Proxy", Class.new(NinjaModel::Base))
|
167
204
|
|
168
205
|
@klass.columns_hash.each_pair do |k,v|
|
169
206
|
@proxy_klass.send :attribute, k, v.type, v.default, @proxy_klass
|
@@ -188,7 +225,7 @@ module NinjaModel
|
|
188
225
|
private
|
189
226
|
|
190
227
|
def derive_foreign_key
|
191
|
-
"#{@klass.name.underscore}_id".to_sym
|
228
|
+
"#{@klass.name.demodulize.underscore}_id".to_sym
|
192
229
|
end
|
193
230
|
end
|
194
231
|
end
|
data/lib/ninja_model/railtie.rb
CHANGED
@@ -7,7 +7,9 @@ module NinjaModel
|
|
7
7
|
"NinjaModel::Adapters::AdapterManagement"
|
8
8
|
|
9
9
|
initializer 'ninja_model.logger' do |app|
|
10
|
-
NinjaModel
|
10
|
+
if NinjaModel.logger.nil?
|
11
|
+
NinjaModel::set_logger(Rails.logger)
|
12
|
+
end
|
11
13
|
end
|
12
14
|
|
13
15
|
initializer 'ninja_model_extend_active_record' do |app|
|
@@ -17,7 +19,7 @@ module NinjaModel
|
|
17
19
|
end
|
18
20
|
|
19
21
|
initializer 'ninja_model_load_specs' do |app|
|
20
|
-
config_path = File.join(app.paths
|
22
|
+
config_path = File.join(app.paths['config'].to_a.first, "ninja_model.yml")
|
21
23
|
if File.exists?(config_path)
|
22
24
|
require 'erb'
|
23
25
|
require 'yaml'
|
@@ -10,13 +10,6 @@ module NinjaModel
|
|
10
10
|
reflection
|
11
11
|
end
|
12
12
|
|
13
|
-
def ninja_model?(macro, association)
|
14
|
-
klass = association.to_s.camelize
|
15
|
-
klass = klass.singularize unless [:has_one, :belongs_to].include?(macro)
|
16
|
-
klass = klass.constantize
|
17
|
-
defined?(klass) && klass.ancestors.include?(NinjaModel::Base)
|
18
|
-
end
|
19
|
-
|
20
13
|
def reflections
|
21
14
|
read_inheritable_attribute(:reflections) || write_inheritable_attribute(:reflections, {})
|
22
15
|
end
|
@@ -37,7 +30,7 @@ module NinjaModel
|
|
37
30
|
attr_reader :ninja_model, :name, :macro, :options
|
38
31
|
|
39
32
|
def klass
|
40
|
-
@klass ||= class_name.constantize
|
33
|
+
@klass ||= class_name.camelize.constantize
|
41
34
|
end
|
42
35
|
|
43
36
|
def class_name
|
@@ -71,6 +64,7 @@ module NinjaModel
|
|
71
64
|
|
72
65
|
def primary_key_name
|
73
66
|
@primary_key_name ||= options[:foreign_key] || derive_primary_key_name
|
67
|
+
@primary_key_name
|
74
68
|
end
|
75
69
|
|
76
70
|
def association_foreign_key
|
@@ -103,7 +97,7 @@ module NinjaModel
|
|
103
97
|
elsif options[:as]
|
104
98
|
"#{options[:as]}_id"
|
105
99
|
else
|
106
|
-
ninja_model.name.foreign_key
|
100
|
+
ninja_model.name.demodulize.foreign_key
|
107
101
|
end
|
108
102
|
end
|
109
103
|
end
|
data/lib/ninja_model/relation.rb
CHANGED
@@ -11,6 +11,8 @@ module NinjaModel
|
|
11
11
|
attr_reader :klass, :loaded
|
12
12
|
|
13
13
|
attr_accessor :ordering, :predicates, :limit_value, :offset_value
|
14
|
+
attr_accessor :default_scoped
|
15
|
+
alias :default_scoped? :default_scoped
|
14
16
|
|
15
17
|
alias :loaded? :loaded
|
16
18
|
|
@@ -20,6 +22,7 @@ module NinjaModel
|
|
20
22
|
def initialize(klass)
|
21
23
|
@klass = klass
|
22
24
|
@loaded = false
|
25
|
+
@default_scoped = false
|
23
26
|
|
24
27
|
SINGLE_VALUE_ATTRS.each do |v|
|
25
28
|
instance_variable_set("@#{v}_value".to_sym, nil)
|
@@ -87,8 +90,8 @@ module NinjaModel
|
|
87
90
|
def method_missing(method, *args, &block)
|
88
91
|
if Array.method_defined?(method)
|
89
92
|
to_a.send(method, *args, &block)
|
90
|
-
elsif @klass.
|
91
|
-
merge(@klass.send(method, *args, &block))
|
93
|
+
elsif @klass.singleton_class.respond_to?(method)
|
94
|
+
merge(@klass.singleton_class.send(method, *args, &block))
|
92
95
|
elsif @klass.respond_to?(method)
|
93
96
|
scoping { @klass.send(method, *args, &block) }
|
94
97
|
else
|
data/lib/ninja_model/version.rb
CHANGED
data/ninja-model.gemspec
CHANGED
@@ -18,11 +18,14 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
21
|
-
s.add_dependency 'activerecord',
|
21
|
+
s.add_dependency 'activerecord', '~> 3.1.0'
|
22
|
+
s.add_dependency 'rake', '~> 0.9.2'
|
22
23
|
|
23
|
-
s.add_development_dependency 'rspec',
|
24
|
-
s.add_development_dependency 'mocha',
|
25
|
-
s.add_development_dependency '
|
26
|
-
s.add_development_dependency '
|
27
|
-
s.add_development_dependency '
|
24
|
+
s.add_development_dependency 'rspec', '~> 2.8.0'
|
25
|
+
s.add_development_dependency 'mocha', '~> 0.10.0'
|
26
|
+
s.add_development_dependency 'nokogiri', '~> 1.5.0'
|
27
|
+
s.add_development_dependency 'guard-rspec', '~> 0.5.10'
|
28
|
+
s.add_development_dependency 'libnotify', '~> 0.6.0'
|
29
|
+
s.add_development_dependency 'yard', '~> 0.7.4'
|
30
|
+
s.add_development_dependency 'redcarpet', '~> 2.0.0'
|
28
31
|
end
|
@@ -59,24 +59,20 @@ describe NinjaModel::Adapters::AdapterPool do
|
|
59
59
|
end
|
60
60
|
|
61
61
|
describe 'clear_stale_cached_instances!' do
|
62
|
+
let(:thread) { mock('Thread') }
|
63
|
+
before { Thread.stubs(:list).returns([thread]) }
|
62
64
|
it 'should reap any instances for dead threads' do
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
Thread.stubs(:list).returns([@thread])
|
68
|
-
@inst = subject.instance
|
69
|
-
subject.expects(:checkin).with(@inst)
|
65
|
+
thread.stubs(:alive?).returns(false)
|
66
|
+
inst = subject.instance
|
67
|
+
subject.instance_variable_set("@assigned_instances".to_sym, {thread.object_id => inst})
|
68
|
+
subject.expects(:checkin).with(inst)
|
70
69
|
subject.send :clear_stale_cached_instances!
|
71
70
|
end
|
72
71
|
it 'should not reap instances for live threads' do
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
Thread.stubs(:list).returns([@thread])
|
78
|
-
@inst = subject.instance
|
79
|
-
subject.expects(:checkin).with(@inst).never
|
72
|
+
thread.stubs(:alive?).returns(true)
|
73
|
+
inst = subject.instance
|
74
|
+
subject.instance_variable_set("@assigned_instances".to_sym, {thread.object_id => inst})
|
75
|
+
subject.expects(:checkin).with(inst).never
|
80
76
|
subject.send :clear_stale_cached_instances!
|
81
77
|
end
|
82
78
|
end
|
@@ -12,11 +12,6 @@ describe NinjaModel::Reflection do
|
|
12
12
|
subject { ReflectionModel }
|
13
13
|
it { should respond_to(:create_reflection) }
|
14
14
|
|
15
|
-
describe 'ninja_model?' do
|
16
|
-
specify { NinjaModel::Base.ninja_model?(:has_one, :bare_model).should be_false }
|
17
|
-
specify { NinjaModel::Base.ninja_model?(:has_one, :reflection_model).should be_true }
|
18
|
-
end
|
19
|
-
|
20
15
|
describe 'create_reflection' do
|
21
16
|
it 'should store the reflections on the class' do
|
22
17
|
@klass = Class.new(NinjaModel::Base)
|
data/spec/ninja_model_spec.rb
CHANGED
@@ -4,8 +4,10 @@ describe NinjaModel do
|
|
4
4
|
it { NinjaModel.should respond_to(:logger) }
|
5
5
|
|
6
6
|
it 'should accept a logger' do
|
7
|
+
orig_logger = NinjaModel.logger
|
7
8
|
logger = mock('logger')
|
8
9
|
NinjaModel.set_logger(logger)
|
9
10
|
NinjaModel.logger.should eql(logger)
|
11
|
+
NinjaModel.set_logger(orig_logger)
|
10
12
|
end
|
11
13
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
-
require '
|
2
|
-
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start do
|
3
|
+
add_filter 'spec'
|
4
|
+
end
|
5
|
+
#Bundler.require(:default)
|
3
6
|
require 'rspec/core'
|
7
|
+
require 'ninja-model'
|
4
8
|
|
5
9
|
Dir[File.join(File.expand_path('../', __FILE__), 'support/**/*.rb')].each { |f| require f }
|
6
10
|
|
metadata
CHANGED
@@ -1,129 +1,125 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ninja-model
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.7.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 6
|
9
|
-
- 2
|
10
|
-
version: 0.6.2
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Josh Williams
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-01-08 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: activerecord
|
16
|
+
requirement: &18010860 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.1.0
|
22
|
+
type: :runtime
|
22
23
|
prerelease: false
|
23
|
-
|
24
|
+
version_requirements: *18010860
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rake
|
27
|
+
requirement: &18009460 !ruby/object:Gem::Requirement
|
24
28
|
none: false
|
25
|
-
requirements:
|
29
|
+
requirements:
|
26
30
|
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 3
|
31
|
-
- 0
|
32
|
-
- 3
|
33
|
-
version: 3.0.3
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.9.2
|
34
33
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: rspec
|
38
34
|
prerelease: false
|
39
|
-
|
35
|
+
version_requirements: *18009460
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
requirement: &18008360 !ruby/object:Gem::Requirement
|
40
39
|
none: false
|
41
|
-
requirements:
|
40
|
+
requirements:
|
42
41
|
- - ~>
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
segments:
|
46
|
-
- 2
|
47
|
-
- 2
|
48
|
-
- 0
|
49
|
-
version: 2.2.0
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 2.8.0
|
50
44
|
type: :development
|
51
|
-
|
52
|
-
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *18008360
|
47
|
+
- !ruby/object:Gem::Dependency
|
53
48
|
name: mocha
|
49
|
+
requirement: &18007400 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.10.0
|
55
|
+
type: :development
|
54
56
|
prerelease: false
|
55
|
-
|
57
|
+
version_requirements: *18007400
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: nokogiri
|
60
|
+
requirement: &18006220 !ruby/object:Gem::Requirement
|
56
61
|
none: false
|
57
|
-
requirements:
|
62
|
+
requirements:
|
58
63
|
- - ~>
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
|
61
|
-
segments:
|
62
|
-
- 0
|
63
|
-
- 9
|
64
|
-
- 8
|
65
|
-
version: 0.9.8
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 1.5.0
|
66
66
|
type: :development
|
67
|
-
version_requirements: *id003
|
68
|
-
- !ruby/object:Gem::Dependency
|
69
|
-
name: rcov
|
70
67
|
prerelease: false
|
71
|
-
|
68
|
+
version_requirements: *18006220
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: guard-rspec
|
71
|
+
requirement: &18005500 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
|
-
requirements:
|
73
|
+
requirements:
|
74
74
|
- - ~>
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 0.5.10
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *18005500
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: libnotify
|
82
|
+
requirement: &18004480 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ~>
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 0.6.0
|
82
88
|
type: :development
|
83
|
-
version_requirements: *id004
|
84
|
-
- !ruby/object:Gem::Dependency
|
85
|
-
name: nokogiri
|
86
89
|
prerelease: false
|
87
|
-
|
90
|
+
version_requirements: *18004480
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: yard
|
93
|
+
requirement: &17959740 !ruby/object:Gem::Requirement
|
88
94
|
none: false
|
89
|
-
requirements:
|
95
|
+
requirements:
|
90
96
|
- - ~>
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
|
93
|
-
segments:
|
94
|
-
- 1
|
95
|
-
- 4
|
96
|
-
- 4
|
97
|
-
version: 1.4.4
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 0.7.4
|
98
99
|
type: :development
|
99
|
-
version_requirements: *id005
|
100
|
-
- !ruby/object:Gem::Dependency
|
101
|
-
name: autotest
|
102
100
|
prerelease: false
|
103
|
-
|
101
|
+
version_requirements: *17959740
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: redcarpet
|
104
|
+
requirement: &17958800 !ruby/object:Gem::Requirement
|
104
105
|
none: false
|
105
|
-
requirements:
|
106
|
+
requirements:
|
106
107
|
- - ~>
|
107
|
-
- !ruby/object:Gem::Version
|
108
|
-
|
109
|
-
segments:
|
110
|
-
- 4
|
111
|
-
- 4
|
112
|
-
- 6
|
113
|
-
version: 4.4.6
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 2.0.0
|
114
110
|
type: :development
|
115
|
-
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: *17958800
|
116
113
|
description: Pseudo-ORM for Ruby/Rails with an ActiveRecord-like interface
|
117
114
|
email: theprime@codingprime.com
|
118
115
|
executables: []
|
119
|
-
|
120
116
|
extensions: []
|
121
|
-
|
122
117
|
extra_rdoc_files: []
|
123
|
-
|
124
|
-
files:
|
118
|
+
files:
|
125
119
|
- .gitignore
|
120
|
+
- .rvmrc
|
126
121
|
- Gemfile
|
122
|
+
- Guardfile
|
127
123
|
- README.md
|
128
124
|
- Rakefile
|
129
125
|
- autotest/discover.rb
|
@@ -182,38 +178,35 @@ files:
|
|
182
178
|
- spec/support/matchers/convert.rb
|
183
179
|
homepage: http://github.com/t3hpr1m3/ninja-model.git
|
184
180
|
licenses: []
|
185
|
-
|
186
181
|
post_install_message:
|
187
182
|
rdoc_options: []
|
188
|
-
|
189
|
-
require_paths:
|
183
|
+
require_paths:
|
190
184
|
- lib
|
191
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
185
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
192
186
|
none: false
|
193
|
-
requirements:
|
194
|
-
- -
|
195
|
-
- !ruby/object:Gem::Version
|
196
|
-
|
197
|
-
segments:
|
187
|
+
requirements:
|
188
|
+
- - ! '>='
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: '0'
|
191
|
+
segments:
|
198
192
|
- 0
|
199
|
-
|
200
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
|
+
hash: 1842853919456186236
|
194
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
201
195
|
none: false
|
202
|
-
requirements:
|
203
|
-
- -
|
204
|
-
- !ruby/object:Gem::Version
|
205
|
-
|
206
|
-
segments:
|
196
|
+
requirements:
|
197
|
+
- - ! '>='
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: '0'
|
200
|
+
segments:
|
207
201
|
- 0
|
208
|
-
|
202
|
+
hash: 1842853919456186236
|
209
203
|
requirements: []
|
210
|
-
|
211
204
|
rubyforge_project: ninja-model
|
212
|
-
rubygems_version: 1.
|
205
|
+
rubygems_version: 1.8.10
|
213
206
|
signing_key:
|
214
207
|
specification_version: 3
|
215
208
|
summary: Pseudo-ORM for Ruby
|
216
|
-
test_files:
|
209
|
+
test_files:
|
217
210
|
- spec/ninja_model/adapters/abstract_adapter_spec.rb
|
218
211
|
- spec/ninja_model/adapters/adapter_manager_spec.rb
|
219
212
|
- spec/ninja_model/adapters/adapter_pool_spec.rb
|