library_stdnums 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 64b7af58d62d20a1ff99b68af015614c53af9ff2
4
+ data.tar.gz: fcb1f9146bd02f860291116f1e99eb610ca78187
5
+ SHA512:
6
+ metadata.gz: 211779b362a5fadc4cfb5b2743ddf28eaea4f199fa53aecba82a4c4e19ef45ae8a33f14292054ebd407f21897314c773169ed2c6952bfadd54a9de6b14f35b83
7
+ data.tar.gz: e44854b87dc3c53c9cbc9d6825a11c343110aca5bb865ebf23c49f3d788df6f42adee5dea12156cedceb116fa2859d7b2ca7bbcb3ffbc5f9d4c73078ab0229f3
data/ChangeLog.md CHANGED
@@ -1,3 +1,6 @@
1
+ * 1.4.0 (2013.10.23)
2
+ * Simplified gemfile/spec process
3
+ * Fixed backwards logic for ISBN.at_least_trying? and added tests
1
4
  * 1.3.0 (2013.05.24)
2
5
  * Added #at_least_trying? to do a basic syntax check for ISSN/ISBN
3
6
  * Overload #valid? for ISBN/ISSN such that it returns 'nil' for bad syntax and
data/Gemfile CHANGED
@@ -1,14 +1,4 @@
1
- source :rubygems
1
+ source 'https://rubygems.org/'
2
2
 
3
3
  gemspec
4
4
 
5
- group :development do
6
- gem 'bundler', '~> 1.0'
7
- gem 'rake', '~> 0.8'
8
- gem 'minitest'
9
- end
10
-
11
- group :documentation do
12
- gem 'kramdown'
13
- gem 'yard', '~> 0.7'
14
- end
@@ -54,7 +54,7 @@ module StdNum
54
54
 
55
55
  # Does it even look like an ISBN?
56
56
  def self.at_least_trying? isbn
57
- return !(reduce_to_basics(isbn, [10,13]))
57
+ reduce_to_basics(isbn, [10,13]) ? true : false
58
58
  end
59
59
 
60
60
 
@@ -1,4 +1,4 @@
1
- module LibraryStdnums
1
+ module StdNum
2
2
  # library_stdnums version
3
- VERSION = "1.3.0"
3
+ VERSION = "1.4.0"
4
4
  end
@@ -1,60 +1,29 @@
1
1
  # encoding: utf-8
2
2
 
3
- require 'yaml'
4
-
5
- Gem::Specification.new do |gem|
6
- gemspec = YAML.load_file('gemspec.yml')
7
-
8
- gem.name = gemspec.fetch('name')
9
- gem.version = gemspec.fetch('version') do
10
- lib_dir = File.join(File.dirname(__FILE__),'lib')
11
- $LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
12
-
13
- require 'library_stdnums/version'
14
- LibraryStdnums::VERSION
15
- end
16
-
17
- gem.summary = gemspec['summary']
18
- gem.description = gemspec['description']
19
- gem.licenses = Array(gemspec['license'])
20
- gem.authors = Array(gemspec['authors'])
21
- gem.email = gemspec['email']
22
- gem.homepage = gemspec['homepage']
23
-
24
- glob = lambda { |patterns| gem.files & Dir[*patterns] }
25
-
26
- gem.files = `git ls-files`.split($/)
27
- gem.files = glob[gemspec['files']] if gemspec['files']
28
-
29
- gem.executables = gemspec.fetch('executables') do
30
- glob['bin/*'].map { |path| File.basename(path) }
31
- end
32
- gem.default_executable = gem.executables.first if Gem::VERSION < '1.7.'
33
-
34
- gem.extensions = glob[gemspec['extensions'] || 'ext/**/extconf.rb']
35
- gem.test_files = glob[gemspec['test_files'] || 'spec/{**/}*_spec.rb}']
36
- gem.extra_rdoc_files = glob[gemspec['extra_doc_files'] || '*.{txt,md}']
37
-
38
- gem.require_paths = Array(gemspec.fetch('require_paths') {
39
- %w[ext lib].select { |dir| File.directory?(dir) }
40
- })
41
-
42
- gem.requirements = gemspec['requirements']
43
- gem.required_ruby_version = gemspec['required_ruby_version']
44
- gem.required_rubygems_version = gemspec['required_rubygems_version']
45
- gem.post_install_message = gemspec['post_install_message']
46
-
47
- split = lambda { |string| string.split(/,\s*/) }
48
-
49
- if gemspec['dependencies']
50
- gemspec['dependencies'].each do |name,versions|
51
- gem.add_dependency(name,split[versions])
52
- end
53
- end
54
-
55
- if gemspec['development_dependencies']
56
- gemspec['development_dependencies'].each do |name,versions|
57
- gem.add_development_dependency(name,split[versions])
58
- end
59
- end
3
+
4
+ lib = File.expand_path('../lib', __FILE__)
5
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
+ require 'library_stdnums/version'
7
+
8
+ Gem::Specification.new do |spec|
9
+ spec.name = "library_stdnums"
10
+ spec.version = StdNum::VERSION
11
+ spec.authors = ["Bill Dueber"]
12
+ spec.email = ["none@nowhere.org"]
13
+ spec.summary = "A simple set of module functions to normalize, validate, and convert common library standard numbers"
14
+ spec.homepage = "https://github.com/billdueber/library_stdnums"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files`.split($/)
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.extra_rdoc_files = spec.files.grep(%r{^doc/})
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.3"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "minitest"
26
+ spec.add_development_dependency "yard"
60
27
  end
28
+
29
+
@@ -64,6 +64,18 @@ describe "ISBN" do
64
64
  it "finds a good number valid" do
65
65
  StdNum::ISBN.valid?('9780306406157').must_equal true
66
66
  end
67
+
68
+ it "says a good number is trying" do
69
+ StdNum::ISBN.at_least_trying?('9780306406157').must_equal true
70
+ end
71
+
72
+ it "says bad data is not trying" do
73
+ StdNum::ISBN.at_least_trying?('978006406157').must_equal false
74
+ StdNum::ISBN.at_least_trying?('406157').must_equal false
75
+ StdNum::ISBN.at_least_trying?('$22').must_equal false
76
+ StdNum::ISBN.at_least_trying?('hello').must_equal false
77
+ end
78
+
67
79
 
68
80
  it "finds a bad number invalid" do
69
81
  StdNum::ISBN.valid?('9780306406154').must_equal false
metadata CHANGED
@@ -1,57 +1,77 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: library_stdnums
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
5
- prerelease:
4
+ version: 1.4.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Bill Dueber
9
- autorequire:
8
+ autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-05-24 00:00:00.000000000 Z
11
+ date: 2013-10-23 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
15
+ version_requirements: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
16
20
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
21
  requirements:
19
22
  - - ~>
20
23
  - !ruby/object:Gem::Version
21
- version: '1.0'
22
- type: :development
24
+ version: '1.3'
23
25
  prerelease: false
26
+ type: :development
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
24
29
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
30
  requirements:
27
- - - ~>
31
+ - - '>='
28
32
  - !ruby/object:Gem::Version
29
- version: '1.0'
30
- - !ruby/object:Gem::Dependency
31
- name: yard
33
+ version: '0'
32
34
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
35
  requirements:
35
- - - ~>
36
+ - - '>='
36
37
  - !ruby/object:Gem::Version
37
- version: '0.7'
38
+ version: '0'
39
+ prerelease: false
38
40
  type: :development
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
39
53
  prerelease: false
54
+ type: :development
55
+ - !ruby/object:Gem::Dependency
56
+ name: yard
40
57
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
58
  requirements:
43
- - - ~>
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirement: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - '>='
44
65
  - !ruby/object:Gem::Version
45
- version: '0.7'
46
- description: A simple set of module functions to normalize, validate, and convert
47
- common library standard numbers
48
- email: bill@dueber.com
66
+ version: '0'
67
+ prerelease: false
68
+ type: :development
69
+ description:
70
+ email:
71
+ - none@nowhere.org
49
72
  executables: []
50
73
  extensions: []
51
- extra_rdoc_files:
52
- - ChangeLog.md
53
- - LICENSE.txt
54
- - README.md
74
+ extra_rdoc_files: []
55
75
  files:
56
76
  - .gitignore
57
77
  - .travis.yml
@@ -61,7 +81,6 @@ files:
61
81
  - LICENSE.txt
62
82
  - README.md
63
83
  - Rakefile
64
- - gemspec.yml
65
84
  - lib/library_stdnums.rb
66
85
  - lib/library_stdnums/version.rb
67
86
  - library_stdnums.gemspec
@@ -70,27 +89,28 @@ files:
70
89
  homepage: https://github.com/billdueber/library_stdnums
71
90
  licenses:
72
91
  - MIT
73
- post_install_message:
92
+ metadata: {}
93
+ post_install_message:
74
94
  rdoc_options: []
75
95
  require_paths:
76
96
  - lib
77
97
  required_ruby_version: !ruby/object:Gem::Requirement
78
- none: false
79
98
  requirements:
80
- - - ! '>='
99
+ - - '>='
81
100
  - !ruby/object:Gem::Version
82
101
  version: '0'
83
102
  required_rubygems_version: !ruby/object:Gem::Requirement
84
- none: false
85
103
  requirements:
86
- - - ! '>='
104
+ - - '>='
87
105
  - !ruby/object:Gem::Version
88
106
  version: '0'
89
107
  requirements: []
90
- rubyforge_project:
91
- rubygems_version: 1.8.23
92
- signing_key:
93
- specification_version: 3
94
- summary: Normalize and validate ISBN / ISSN/ LCCN
95
- test_files: []
96
- has_rdoc:
108
+ rubyforge_project:
109
+ rubygems_version: 2.1.9
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: A simple set of module functions to normalize, validate, and convert common library standard numbers
113
+ test_files:
114
+ - spec/library_stdnums_spec.rb
115
+ - spec/spec_helper.rb
116
+ has_rdoc:
data/gemspec.yml DELETED
@@ -1,11 +0,0 @@
1
- name: library_stdnums
2
- summary: "Normalize and validate ISBN / ISSN/ LCCN"
3
- description: "A simple set of module functions to normalize, validate, and convert common library standard numbers"
4
- license: MIT
5
- authors: Bill Dueber
6
- email: bill@dueber.com
7
- homepage: https://github.com/billdueber/library_stdnums
8
-
9
- development_dependencies:
10
- bundler: ~> 1.0
11
- yard: ~> 0.7