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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e6133fdf40c180092996247c0206ff5278ff0166
4
- data.tar.gz: b608da7b494052e5b256c79430a0e981cd44fcb4
3
+ metadata.gz: 95b4a7463baf2b1727fa3a4d7cef198dbab3eb62
4
+ data.tar.gz: aa448ecb6a763756efdaa0285f7ac897b1b838c8
5
5
  SHA512:
6
- metadata.gz: 64c4fe6d1b26abef7503887f555df388c36cb9045f7002406c3e3072fa5d08d261884c94de93a703aa81c05e881a8b6520f522d9cdcca3eecc190704fe66bfda
7
- data.tar.gz: 0252c0c7438670edc38276a9c1e232ddf02ef15debbbf512611f4ef09cc4ad4d27b5253616f67fe4a0a6189df74e4aacca6660bab7d27603c3d9d9ace1d9be04
6
+ metadata.gz: 253b3557cbf75fd7679dc9a0e37f90e549cba3e96812ddd771db46b57ac937052c6118da53224f84704a19c465cd3a49b21ed3a28f79b9b3b2fcd07b1974479f
7
+ data.tar.gz: 1a1ebe0650e871f944e1b103ad5ec459d84d9a976d837143d8ea57121f7c71de288db778b975ca6a6818094814b161fbb701830735e255a9fbe3d0f9b8871080
data/.gitignore CHANGED
@@ -12,3 +12,5 @@
12
12
  *.o
13
13
  *.a
14
14
  mkmf.log
15
+ .DS_Store
16
+ .byebug_history
data/.rspec CHANGED
@@ -1,2 +1,4 @@
1
1
  --color
2
- --require spec_helper
2
+ --warnings
3
+ --format documentation
4
+ --profile
@@ -3,7 +3,7 @@ module Spare
3
3
  def columns
4
4
  @columns ||= stored_procedure[:param_list].map do |col|
5
5
  col = col.dup
6
- col.primary = false
6
+ col.primary = false if ActiveRecord::VERSION::MAJOR == 3
7
7
  col
8
8
  end
9
9
  end
@@ -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
- column = new_column(field_name, nil, sql_type, false, collation)
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
@@ -47,7 +47,7 @@ module ActiveRecord
47
47
  def inout_sql
48
48
  sql = []
49
49
  inout_params.each do |param|
50
- sql << "SET @#{param.name} = #{connection.quote(send(param.name))}"
50
+ sql << "SET @#{param.name} = #{self.class.connection.quote(send(param.name))}"
51
51
  end
52
52
  sql
53
53
  end
data/lib/spare/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Spare
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
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', '~> 3.2.0' #,'>= 3.0', '< 5.0'
21
+ spec.add_runtime_dependency 'activerecord', '>= 3.0', '< 5.0'
22
22
 
23
- spec.add_development_dependency "bundler", "~> 1.7"
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.3
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: 2015-03-05 00:00:00.000000000 Z
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.2.0
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: '1.7'
34
- type: :development
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: '1.7'
32
+ version: '5.0'
41
33
  - !ruby/object:Gem::Dependency
42
- name: rake
34
+ name: rspec
43
35
  requirement: !ruby/object:Gem::Requirement
44
36
  requirements:
45
37
  - - "~>"
46
38
  - !ruby/object:Gem::Version
47
- version: '10.0'
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: '10.0'
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.4.3
152
+ rubygems_version: 2.5.1
175
153
  signing_key:
176
154
  specification_version: 4
177
155
  summary: StoredProcedure models for ActiveRecord.