sqlserver-sequence 0.1.1 → 0.2.0

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: 1800e27d0be2182006ce8cb44a390166bbd65a75
4
- data.tar.gz: 903fa72b718ce18b42bc17e99c9d645efa5d5711
3
+ metadata.gz: ea055f44adbc2fdc216305cab3d9fca8d158f947
4
+ data.tar.gz: 648a4d03260ab26bc7437bc61196687d8142e638
5
5
  SHA512:
6
- metadata.gz: 73bcf06d490f8198323c0f1c393ab819e2f78c4d9c9b0a51f461a8abd21d8d4b0053d2fd70db029a00faadcf973aa729809f96cc12d1725244155f38747cb908
7
- data.tar.gz: a8aaa98d8c45ad6bcf75534fd7133c18a8afe5d81a0b1317021fd4513cf482bad9595a3a4051f0627a26267fdcd8b5ae7441061e16c377e040e609bd1f0c003d
6
+ metadata.gz: fd6eabfe7c6a303167b62fadf6af2caf87d42ee3564187657b627dd7ea5b50a1196a8d97fe573186832a6ab175d296c45a3f8814dec6400d5c53c39f4e91627e
7
+ data.tar.gz: 158697f35073a7f5068307cbf03706643f7e51d6136bbda21154d5a50434c8dd275650921e84bddc9ba71b7b859df480bdbf147d53dffbea16e1a56559ea0591
data/README.md CHANGED
@@ -1,4 +1,8 @@
1
- # Sqlserver::Sequence [![Gem Version](https://badge.fury.io/rb/sqlserver-sequence.svg)](https://badge.fury.io/rb/sqlserver-sequence)
1
+ # Sqlserver::Sequence
2
+
3
+ [![Code Climate](https://codeclimate.com/github/zacharywelch/sqlserver-sequence/badges/gpa.svg)](https://codeclimate.com/github/zacharywelch/sqlserver-sequence)
4
+ [![Issue Count](https://codeclimate.com/github/zacharywelch/sqlserver-sequence/badges/issue_count.svg)](https://codeclimate.com/github/zacharywelch/sqlserver-sequence)
5
+ [![Gem Version](https://badge.fury.io/rb/sqlserver-sequence.svg)](https://badge.fury.io/rb/sqlserver-sequence)
2
6
 
3
7
  A Rails plugin for SQL Server sequences.
4
8
 
@@ -7,13 +11,17 @@ A Rails plugin for SQL Server sequences.
7
11
  Add this line to your application's Gemfile:
8
12
 
9
13
  ```ruby
10
- gem 'sqlserver-sequence', git: 'git@cagit.careerbuilder.com:CorpAppsCB/sqlserver-sequence.git'
14
+ gem 'sqlserver-sequence'
11
15
  ```
12
16
 
13
17
  And then execute:
14
18
 
15
19
  $ bundle
16
20
 
21
+ Or install it yourself as:
22
+
23
+ $ gem install sqlserver-sequence
24
+
17
25
  ## Usage
18
26
 
19
27
  Specify the attribute you'd like to sequence
@@ -47,7 +55,7 @@ end
47
55
 
48
56
  ###### name
49
57
 
50
- By default `sqlserver-sequence` will look for a row in `sys.sequences` with the same `name` as the attribute. You can use the `name` option if the sequence is named differently.
58
+ By default `sqlserver-sequence` will look for a row in `sys.sequences` with the same `sequence_name` as the attribute. You can use the `name` option if the sequence is named differently.
51
59
 
52
60
  ```ruby
53
61
  class Supplier < ActiveRecord::Base
@@ -73,16 +81,17 @@ end
73
81
 
74
82
  ###### format
75
83
 
76
- Pass a lambda to the `format` option if you need more control over the assigned sequence value.
84
+ Pass a lambda to the `format` option if you need more control over the assigned sequence value, for example to assign a fixed length string.
77
85
 
78
86
  ```ruby
79
87
  class Supplier < ActiveRecord::Base
80
- sequence :number, format: lambda { |num| num.rjust(10, 0) }
88
+ sequence :number, prefix: 'S-',
89
+ format: lambda { |num| num.rjust(10, 0) }
81
90
  end
82
91
  ```
83
92
  $ supplier = Supplier.create
84
93
  $ supplier.number
85
- > 0000000010
94
+ > S-0000000010
86
95
 
87
96
  ## Testing with SQLite
88
97
 
@@ -96,10 +105,10 @@ end
96
105
 
97
106
  ## Contributing
98
107
 
99
- 1. Fork it ( https://github.com/CorpAppsCB/sqlserver-sequence/fork )
108
+ 1. Fork it ( https://github.com/zacharywelch/sqlserver-sequence/fork )
100
109
  2. Create your feature branch (`git checkout -b my-new-feature`)
101
110
  3. Commit your changes (`git commit -am 'Add some feature'`)
102
111
  4. Push to the branch (`git push origin my-new-feature`)
103
112
  5. Create a new Pull Request
104
113
 
105
- See the [Running Tests](RUNNING_TESTS.md) guide for details on how to run the test suite on SQL Server.
114
+ See the [Running Tests](RUNNING_TESTS.md) guide for details on how to run the test suite on SQL Server.
@@ -37,7 +37,7 @@ module Sqlserver
37
37
  prefix = options[:prefix]
38
38
  format = options[:format]
39
39
 
40
- value = next_sequence_value(name)
40
+ value = next_sequence_value(name).to_s
41
41
  value = format.call(value) if format.respond_to?(:call)
42
42
  send "#{field}=", [prefix, value].join
43
43
  end
@@ -1,5 +1,5 @@
1
1
  module Sqlserver
2
2
  module Sequence
3
- VERSION = "0.1.1"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -91,7 +91,7 @@ describe Sqlserver::Sequence do
91
91
  before do
92
92
  allow_any_instance_of(Supplier).to receive(:next_sequence_value).
93
93
  with('sequence').
94
- and_return('1234567')
94
+ and_return(1234567)
95
95
  end
96
96
 
97
97
  subject(:supplier) { Supplier.create }
@@ -6,9 +6,9 @@ require 'sqlserver/sequence/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "sqlserver-sequence"
8
8
  spec.version = Sqlserver::Sequence::VERSION
9
- spec.authors = ["Ram","Zac"]
10
- spec.email = ["ramanathan.tirunellaisubramanian@careerbuilder.com",
11
- "zachary.welch@careerbuilder.com"]
9
+ spec.authors = ["Zac", "Ram"]
10
+ spec.email = ["zachary.welch@careerbuilder.com",
11
+ "ramanathan.tirunellaisubramanian@careerbuilder.com"]
12
12
 
13
13
  spec.summary = %q{Sequence number generation in Rails}
14
14
  spec.description = %q{Sequence number generation in Rails}
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqlserver-sequence
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
- - Ram
8
7
  - Zac
8
+ - Ram
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-07-09 00:00:00.000000000 Z
12
+ date: 2016-07-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -111,8 +111,8 @@ dependencies:
111
111
  version: '0'
112
112
  description: Sequence number generation in Rails
113
113
  email:
114
- - ramanathan.tirunellaisubramanian@careerbuilder.com
115
114
  - zachary.welch@careerbuilder.com
115
+ - ramanathan.tirunellaisubramanian@careerbuilder.com
116
116
  executables: []
117
117
  extensions: []
118
118
  extra_rdoc_files: []