enforce_schema_rules 0.0.16 → 0.0.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/README +38 -38
  3. data/lib/enforce_schema_rules.rb +1 -0
  4. metadata +69 -56
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a2a1d83f9252628116c2859454e08bf48e11085d
4
+ data.tar.gz: 4f5bf1d8b25690b6e9ad5e23f7ac8264130e09e4
5
+ SHA512:
6
+ metadata.gz: aaaba5d5afb50945bb160d65b431a6743c6b62f265217492fe1910fc1e098edde211270fedd84148f4517189d8153ae85344ebfe6e9bff6035eb544f9db16ece
7
+ data.tar.gz: 4bb07639e23b6cf0afb44496ce4601e6d14e9ed67ffdf52097375b3ce1260e425359ae94d2ee8c578f4640834736117d71d6b86cd4a987218f31b0ebc42d4682
data/README CHANGED
@@ -1,9 +1,9 @@
1
1
  Enforce Schema Rules
2
2
  =====================
3
3
 
4
- This plugin provides a way to validate your model against databse rules
5
- you've already created in your schema, including column lengths for
6
- strings, "not null" designations, unique index constraints, and
4
+ This plugin provides a way to validate your model against database rules
5
+ you've already created in your schema, including column lengths for
6
+ strings, "not null" designations, unique index constraints, and
7
7
  ensuring integer input for integer columns.
8
8
 
9
9
  The four methods currently supported are:
@@ -13,18 +13,18 @@ The four methods currently supported are:
13
13
  enforce_not_null
14
14
  enforce_unique_indexes
15
15
 
16
- You can also just call <tt>enforce_schema_rules</tt> to enforce all the
16
+ You can also just call <tt>enforce_schema_rules</tt> to enforce all the
17
17
  above.
18
18
 
19
19
  Accepts the relevant validates_length_of options (i.e. :on and :message)
20
20
  and these assume the usual defaults.
21
21
 
22
- In addition to the regular options, you can also have an
23
- <tt>:except</tt> list enumerating the column that you don't want to
22
+ In addition to the regular options, you can also have an
23
+ <tt>:except</tt> list enumerating the column that you don't want to
24
24
  validate.
25
25
 
26
- By default, magic columns (_at, _on, _id, id, position, etc) are
27
- skipped. If you'd like to override that behavior, you can define your
26
+ By default, magic columns (_at, _on, _id, id, position, etc) are
27
+ skipped. If you'd like to override that behavior, you can define your
28
28
  own <tt>:exclusion_regexp</tt>
29
29
 
30
30
  Examples:
@@ -41,41 +41,41 @@ Examples:
41
41
 
42
42
 
43
43
  Download
44
- --------
45
-
46
- Development is done at:
47
-
48
- http://github.com/twinge/enforce_schema_rules
49
-
50
- You can install as a gem with:
51
-
44
+ --------
45
+
46
+ Development is done at:
47
+
48
+ http://github.com/twinge/enforce_schema_rules
49
+
50
+ You can install as a gem with:
51
+
52
52
  gem install enforce_schema_rules
53
53
 
54
54
  Bugs & feedback
55
55
  ---------------
56
56
  Please send bug reports, patches and feedback to the GitHub project.
57
57
 
58
- Todo
59
- ----
60
- The main goal was recent updates was to get it to work in Rails 3. Some
61
- cleanup was just a side-effect. If anybody is interested, additional
62
- cleanup items include:
63
-
64
- * Make sure we don't need better test coverage. The upgrades to
65
- Rails 3 caused some test fixes but I am not sure we have coverage so
66
- a good eye towards that would be good.
67
- * The smallest number of changes were done to get things working under
68
- Rails 3. This plugin was written a while back. It might could be
69
- refactored using some new goodness that comes with a more recent
70
- ActiveRecord/Rails implementation.
71
- * I most likely dropped support for Rails 2.x. The old version works
72
- fine for those still on Rails 2.x so I say we just drop Rails 2.x
73
- support (there are some warnings but they can be fixed fairly easily
74
- and don't need to be fixed).
58
+ Todo
59
+ ----
60
+ The main goal was recent updates was to get it to work in Rails 3. Some
61
+ cleanup was just a side-effect. If anybody is interested, additional
62
+ cleanup items include:
63
+
64
+ * Make sure we don't need better test coverage. The upgrades to
65
+ Rails 3 caused some test fixes but I am not sure we have coverage so
66
+ a good eye towards that would be good.
67
+ * The smallest number of changes were done to get things working under
68
+ Rails 3. This plugin was written a while back. It might could be
69
+ refactored using some new goodness that comes with a more recent
70
+ ActiveRecord/Rails implementation.
71
+ * I most likely dropped support for Rails 2.x. The old version works
72
+ fine for those still on Rails 2.x so I say we just drop Rails 2.x
73
+ support (there are some warnings but they can be fixed fairly easily
74
+ and don't need to be fixed).
75
75
 
76
76
  Credit
77
- ------
78
- The plugin was written by Josh Starcher <josh.starcher@gmail.com>. It
79
- was updated to Rails 3 by Eric Anderson <eric@pixelwareinc.com>. This
80
- plugin is basically an extension of David Easley's enforce-limits
81
- plugin. Michael Schuerig provided contributed a patch and a syle lesson.
77
+ ------
78
+ The plugin was written by Josh Starcher <josh.starcher@gmail.com>. It
79
+ was updated to Rails 3 by Eric Anderson <eric@pixelwareinc.com>. This
80
+ plugin is basically an extension of David Easley's enforce-limits
81
+ plugin. Michael Schuerig provided contributed a patch and a syle lesson.
@@ -11,6 +11,7 @@ module Jls
11
11
  module ClassMethods
12
12
  # Call all enforcement methods
13
13
  def enforce_schema_rules(options = {})
14
+ return unless connected?
14
15
  return unless table_exists?
15
16
  enforce_column_limits(options.dup)
16
17
  enforce_integer_columns(options.dup)
metadata CHANGED
@@ -1,15 +1,9 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: enforce_schema_rules
3
- version: !ruby/object:Gem::Version
4
- hash: 63
5
- prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 16
10
- version: 0.0.16
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.17
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Josh Starcher
14
8
  - David Easley
15
9
  - Michael Schuerig
@@ -17,71 +11,90 @@ authors:
17
11
  autorequire:
18
12
  bindir: bin
19
13
  cert_chain: []
20
-
21
- date: 2011-04-27 00:00:00 Z
22
- dependencies:
23
- - !ruby/object:Gem::Dependency
14
+ date: 2013-07-18 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
24
17
  name: activerecord
25
- prerelease: false
26
- requirement: &id001 !ruby/object:Gem::Requirement
27
- none: false
28
- requirements:
29
- - - ">="
30
- - !ruby/object:Gem::Version
31
- hash: 3
32
- segments:
33
- - 0
34
- version: "0"
18
+ requirement: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
35
23
  type: :runtime
36
- version_requirements: *id001
37
- description: " A macro-style method that will automatically read the database\n contraints (null requirements, string length, etc) and enforce those\n at the model level to keep validation more DRY. Provides many\n options to customize how automatic it is and what columns it affects.\n"
38
- email:
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: sqlite3
32
+ requirement: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - '>='
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ type: :development
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ - !ruby/object:Gem::Dependency
45
+ name: test-unit
46
+ requirement: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - '>='
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ type: :development
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ description: |2
59
+ A macro-style method that will automatically read the database
60
+ contraints (null requirements, string length, etc) and enforce those
61
+ at the model level to keep validation more DRY. Provides many
62
+ options to customize how automatic it is and what columns it affects.
63
+ email:
39
64
  - josh.starcher@gmail.com
40
65
  -
41
66
  -
42
67
  - eric@saveyourcall.com
43
68
  executables: []
44
-
45
69
  extensions: []
46
-
47
- extra_rdoc_files:
70
+ extra_rdoc_files:
48
71
  - README
49
- files:
72
+ files:
50
73
  - lib/enforce_schema_rules.rb
51
74
  - README
52
75
  homepage:
53
76
  licenses: []
54
-
77
+ metadata: {}
55
78
  post_install_message:
56
- rdoc_options:
79
+ rdoc_options:
57
80
  - --main
58
81
  - README
59
- require_paths:
82
+ require_paths:
60
83
  - lib
61
- required_ruby_version: !ruby/object:Gem::Requirement
62
- none: false
63
- requirements:
64
- - - ">="
65
- - !ruby/object:Gem::Version
66
- hash: 3
67
- segments:
68
- - 0
69
- version: "0"
70
- required_rubygems_version: !ruby/object:Gem::Requirement
71
- none: false
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- hash: 3
76
- segments:
77
- - 0
78
- version: "0"
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
79
94
  requirements: []
80
-
81
95
  rubyforge_project:
82
- rubygems_version: 1.7.2
96
+ rubygems_version: 2.0.3
83
97
  signing_key:
84
- specification_version: 3
98
+ specification_version: 4
85
99
  summary: An ActiveRecord plugin to automatically enforce database contraints
86
100
  test_files: []
87
-