scrivener-contrib 0.0.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4b0e0e8bb3edbf786a2685077c97975d6678df8c
4
- data.tar.gz: 39770c59910b79b739c68f4dd10e8f73e10ccf93
3
+ metadata.gz: 9909e7ad08610ce637d73a6e7042ed1c78f3f520
4
+ data.tar.gz: b70b640e41ae7dcf0ba642d827314328242eca79
5
5
  SHA512:
6
- metadata.gz: da15d0649cdb1cbc2b2ee774f58340b9d745974bad89bfe63603b51be6be0f2fd071add0cdda26ba738ae5879297e743d8af652807bf51d225ebd09b80cd38ff
7
- data.tar.gz: 63de9e003fcaa2240068522e53a274221b601709d3760ede9358805cff8bcb29d73379a77d6eb8621649c0ae8e412fbd5046bab8b97db5504a537ff720a698bb
6
+ metadata.gz: 0df8f451f9f037e8be147685fd321bad834ffe953f0f3c705574db80815ef666f7e473c57fc9b0bab699e28fbbb275bca70d6cdd229577a52032698b59d37124
7
+ data.tar.gz: ac08a267c75050c979b435369339855b79c3553c774613868aae654cfa4d01910e7ba9f6c08d4bdc05a26815180e231937bb6b75645ca8e0c9d251431711b933
data/.gems CHANGED
@@ -1,3 +1,3 @@
1
1
  cutest -v 1.2.1
2
- ohm -v 2.0.0.rc1
2
+ ohm -v 2.0.1
3
3
  scrivener -v 0.2.0
data/.gitignore CHANGED
@@ -1 +1 @@
1
- /pkg
1
+ *.gem
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2014 Francesco Rodríguez, Mayn Kjær
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.md CHANGED
@@ -2,3 +2,47 @@ scrivener-contrib
2
2
  =================
3
3
 
4
4
  Extra validations for Scrivener
5
+
6
+ Usage
7
+ -----
8
+
9
+ The extra validations are:
10
+
11
+ ```ruby
12
+ assert_confirmation(:password)
13
+ assert_minimum_length(:password, 6)
14
+ assert_maximum_length(:name, 50)
15
+ assert_exact_length(:idnum, 8)
16
+ ```
17
+
18
+ This is a basic example:
19
+
20
+ ```ruby
21
+ require "scrivener"
22
+ require "scrivener/contrib"
23
+
24
+ class Signup < Scrivener
25
+ attr_accessor :username
26
+ attr_accessor :name
27
+ attr_accessor :idnum
28
+ attr_accessor :password
29
+ attr_accessor :password_confirmation
30
+
31
+ def validate
32
+ if assert_present(:password)
33
+ assert_confirmation(:password)
34
+ assert_minimum_length(:password, 6)
35
+ end
36
+
37
+ assert_maximum_length(:name, 50)
38
+ assert_exact_length(:idnum, 8)
39
+ end
40
+ end
41
+ ```
42
+
43
+ Installation
44
+ ------------
45
+
46
+ ```
47
+ $ gem install scrivener-contrib
48
+ ```
@@ -3,11 +3,7 @@ require_relative "ohm" if defined?(Ohm)
3
3
  class Scrivener
4
4
  module Validations
5
5
  def assert_confirmation(att, error = [att, :not_confirmed])
6
- confirmation = :"#{att}_confirmation"
7
-
8
- if assert_present(confirmation, error)
9
- assert(send(confirmation) == send(att), error)
10
- end
6
+ assert(send(:"#{att}_confirmation") == send(att), error)
11
7
  end
12
8
 
13
9
  def assert_minimum_length(att, val, error = [att, :too_short])
@@ -1,12 +1,12 @@
1
1
  Gem::Specification.new do |s|
2
- s.name = "scrivener-contrib"
3
- s.version = "0.0.1"
4
- s.summary = "Extra validation helpers for Scrivener."
2
+ s.name = "scrivener-contrib"
3
+ s.version = "1.0.0"
4
+ s.summary = "Extra validation helpers for Scrivener."
5
5
  s.description = s.summary
6
- s.authors = ["Francesco Rodríguez"]
7
- s.email = ["lrodriguezsanc@gmail.com"]
8
- s.homepage = "https://github.com/frodsan/scrivener-contrib"
9
- s.license = "Unlicense"
6
+ s.authors = ["Francesco Rodríguez", "Mayn Kjær"]
7
+ s.email = ["frodsan@me.com", "mayn.kjaer@gmail.com"]
8
+ s.homepage = "https://github.com/harmoni-io/scrivener-contrib"
9
+ s.license = "MIT"
10
10
 
11
11
  s.files = `git ls-files`.split("\n")
12
12
 
data/test/confirmation.rb CHANGED
@@ -9,13 +9,6 @@ class Signup < Scrivener
9
9
  end
10
10
  end
11
11
 
12
- test "invalid if confirmation is nil" do
13
- signup = Signup.new({})
14
-
15
- assert !(signup.valid?)
16
- assert_equal [:not_confirmed], signup.errors[:password]
17
- end
18
-
19
12
  test "invalid if confirmation and attribute are not equal" do
20
13
  signup = Signup.new(password: "!", password_confirmation: "?")
21
14
 
data/test/ohm.rb CHANGED
@@ -1,7 +1,8 @@
1
1
  require "ohm"
2
2
  require_relative "helper"
3
3
 
4
- Ohm.redis = Redic.new("redis://localhost:6379/30")
4
+ Ohm.redis = Redic.new("redis://localhost:6379")
5
+ Ohm.redis.call("SELECT", "30")
5
6
 
6
7
  class User < Ohm::Model
7
8
  attribute :email
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scrivener-contrib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francesco Rodríguez
8
+ - Mayn Kjær
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-01-13 00:00:00.000000000 Z
12
+ date: 2014-08-28 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: cutest
@@ -26,15 +27,16 @@ dependencies:
26
27
  version: '0'
27
28
  description: Extra validation helpers for Scrivener.
28
29
  email:
29
- - lrodriguezsanc@gmail.com
30
+ - frodsan@me.com
31
+ - mayn.kjaer@gmail.com
30
32
  executables: []
31
33
  extensions: []
32
34
  extra_rdoc_files: []
33
35
  files:
34
36
  - ".gems"
35
37
  - ".gitignore"
38
+ - LICENSE
36
39
  - README.md
37
- - UNLICENSE
38
40
  - lib/scrivener/contrib.rb
39
41
  - lib/scrivener/ohm.rb
40
42
  - makefile
@@ -43,9 +45,9 @@ files:
43
45
  - test/helper.rb
44
46
  - test/length.rb
45
47
  - test/ohm.rb
46
- homepage: https://github.com/frodsan/scrivener-contrib
48
+ homepage: https://github.com/harmoni-io/scrivener-contrib
47
49
  licenses:
48
- - Unlicense
50
+ - MIT
49
51
  metadata: {}
50
52
  post_install_message:
51
53
  rdoc_options: []
@@ -63,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
65
  version: '0'
64
66
  requirements: []
65
67
  rubyforge_project:
66
- rubygems_version: 2.2.0
68
+ rubygems_version: 2.2.2
67
69
  signing_key:
68
70
  specification_version: 4
69
71
  summary: Extra validation helpers for Scrivener.
data/UNLICENSE DELETED
@@ -1,24 +0,0 @@
1
- This is free and unencumbered software released into the public domain.
2
-
3
- Anyone is free to copy, modify, publish, use, compile, sell, or
4
- distribute this software, either in source code form or as a compiled
5
- binary, for any purpose, commercial or non-commercial, and by any
6
- means.
7
-
8
- In jurisdictions that recognize copyright laws, the author or authors
9
- of this software dedicate any and all copyright interest in the
10
- software to the public domain. We make this dedication for the benefit
11
- of the public at large and to the detriment of our heirs and
12
- successors. We intend this dedication to be an overt act of
13
- relinquishment in perpetuity of all present and future rights to this
14
- software under copyright law.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
- IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20
- OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
- ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
- OTHER DEALINGS IN THE SOFTWARE.
23
-
24
- For more information, please refer to <http://unlicense.org/>