spare 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rspec +3 -1
- data/lib/spare/attributes.rb +1 -1
- data/lib/spare/mysql_abstract_adapter.rb +12 -1
- data/lib/spare/stored_procedure.rb +1 -1
- data/lib/spare/version.rb +1 -1
- data/spare.gemspec +3 -5
- data/spec/lib/spare/stored_procedure_spec.rb +3 -3
- metadata +15 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95b4a7463baf2b1727fa3a4d7cef198dbab3eb62
|
4
|
+
data.tar.gz: aa448ecb6a763756efdaa0285f7ac897b1b838c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 253b3557cbf75fd7679dc9a0e37f90e549cba3e96812ddd771db46b57ac937052c6118da53224f84704a19c465cd3a49b21ed3a28f79b9b3b2fcd07b1974479f
|
7
|
+
data.tar.gz: 1a1ebe0650e871f944e1b103ad5ec459d84d9a976d837143d8ea57121f7c71de288db778b975ca6a6818094814b161fbb701830735e255a9fbe3d0f9b8871080
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/lib/spare/attributes.rb
CHANGED
@@ -4,6 +4,10 @@ module ActiveRecord
|
|
4
4
|
module ConnectionAdapters
|
5
5
|
class AbstractMysqlAdapter < AbstractAdapter
|
6
6
|
|
7
|
+
unless ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR > 1
|
8
|
+
NATIVE_DATABASE_TYPES[:primary_key] = "int(11) auto_increment PRIMARY KEY"
|
9
|
+
end
|
10
|
+
|
7
11
|
# Returns hash describing the stored procedure.
|
8
12
|
def stored_procedure(name)#:nodoc:
|
9
13
|
sp_name = name.split('.').reverse
|
@@ -33,7 +37,14 @@ module ActiveRecord
|
|
33
37
|
param_type = param[0].upcase
|
34
38
|
field_name = param[1].to_s.underscore #set_field_encoding(param[1])
|
35
39
|
sql_type = param[2]
|
36
|
-
|
40
|
+
|
41
|
+
if ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR > 1
|
42
|
+
cast_type = lookup_cast_type(sql_type)
|
43
|
+
column = new_column(field_name, nil, cast_type, sql_type, true, collation, nil)
|
44
|
+
else
|
45
|
+
column = new_column(field_name, nil, sql_type, false, collation)
|
46
|
+
end
|
47
|
+
|
37
48
|
column.param_type = param_type
|
38
49
|
params << column
|
39
50
|
end
|
data/lib/spare/version.rb
CHANGED
data/spare.gemspec
CHANGED
@@ -18,13 +18,11 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_runtime_dependency 'activerecord', '
|
21
|
+
spec.add_runtime_dependency 'activerecord', '>= 3.0', '< 5.0'
|
22
22
|
|
23
|
-
spec.add_development_dependency "
|
24
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
-
spec.add_development_dependency "rspec"
|
23
|
+
spec.add_development_dependency "rspec", '~> 3.0'
|
26
24
|
spec.add_development_dependency "rspec-autotest"
|
27
25
|
spec.add_development_dependency "autotest"
|
28
26
|
spec.add_development_dependency "factory_girl"
|
29
|
-
spec.add_development_dependency "mysql2"
|
27
|
+
spec.add_development_dependency "mysql2"#, '~> 0.3.10'
|
30
28
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
|
2
|
+
require 'byebug'
|
3
3
|
class SpInsert < ActiveRecord::StoredProcedure;end
|
4
4
|
|
5
5
|
class Foo < ActiveRecord::Base;end
|
@@ -15,8 +15,8 @@ describe ActiveRecord::StoredProcedure do
|
|
15
15
|
|
16
16
|
describe '#execute' do
|
17
17
|
let (:sp_insert) {SpInsert.new(:p_name => "foo",:p_deci => 2.0, :p_date => Date.today, :in_out_add => 4)}
|
18
|
-
it {expect(sp_insert).to be_valid}
|
19
|
-
it {expect(sp_insert.execute).to eql(true)}
|
18
|
+
it { expect(sp_insert).to be_valid}
|
19
|
+
it { expect(sp_insert.execute).to eql(true) }
|
20
20
|
it "should work" do
|
21
21
|
expect {
|
22
22
|
sp_insert.execute
|
metadata
CHANGED
@@ -1,71 +1,49 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spare
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua Mckinney
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.
|
19
|
+
version: '3.0'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5.0'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 3.2.0
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: bundler
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
27
|
+
- - ">="
|
32
28
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
34
|
-
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
29
|
+
version: '3.0'
|
30
|
+
- - "<"
|
39
31
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
32
|
+
version: '5.0'
|
41
33
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
34
|
+
name: rspec
|
43
35
|
requirement: !ruby/object:Gem::Requirement
|
44
36
|
requirements:
|
45
37
|
- - "~>"
|
46
38
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
39
|
+
version: '3.0'
|
48
40
|
type: :development
|
49
41
|
prerelease: false
|
50
42
|
version_requirements: !ruby/object:Gem::Requirement
|
51
43
|
requirements:
|
52
44
|
- - "~>"
|
53
45
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rspec
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
46
|
+
version: '3.0'
|
69
47
|
- !ruby/object:Gem::Dependency
|
70
48
|
name: rspec-autotest
|
71
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -171,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
149
|
version: '0'
|
172
150
|
requirements: []
|
173
151
|
rubyforge_project:
|
174
|
-
rubygems_version: 2.
|
152
|
+
rubygems_version: 2.5.1
|
175
153
|
signing_key:
|
176
154
|
specification_version: 4
|
177
155
|
summary: StoredProcedure models for ActiveRecord.
|