urn 0.1.2 → 0.1.3

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: 1348466631313738939f294d838e6491c1e61ab5
4
- data.tar.gz: 1f0c592ffa2be75c74c2b3c90117b8ddf577691b
3
+ metadata.gz: 876d68aec7c174c18b549b705653e20e49b8c14a
4
+ data.tar.gz: 001402f4e00c733303f7631bdd6c1313750935ba
5
5
  SHA512:
6
- metadata.gz: 79a1f633b18ecb6c74bcd8ada65ca11d1725c30e925b1bbaaf406e0cd2b13fef84898207cda04122554cbb9c5c4a2a07f1d4f70baebfca5cf9d7a15b289eab98
7
- data.tar.gz: 07a824ef19612a4fd1c6bb603d955c9c303728427149ad280f97dbddb9b369be847dd806cb04e3ec9c48fede5422ac3a7c1fa7ea643a7a8a67e3e95ca5c11a22
6
+ metadata.gz: d69b2ea6ebb2c5b8b99165dbcbb626caef56fa3ee13260e09b320651dec79d655c085d2b71b72b6b13036ad534003c26d98f6ab4d2fa22fe2d640b21736a3544
7
+ data.tar.gz: 3b4ccc977ad5f9c41001afdff892f03a67bb68c948c0c4d45c2bff0f950b7380f1b8bde314e55fcf2875b1941ca94b2e81ae1bf0612c75768ba6fde8e643e093
@@ -2,7 +2,15 @@
2
2
  All notable changes to this project will be documented in this file. This
3
3
  project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
- ## [0.1.1] git - 2016-03-02
5
+ ## [0.1.3] - 2016-03-07
6
+ ### Fixed
7
+ - Explicitly require CGI standard library
8
+
9
+ ## [0.1.2] - 2016-03-02
10
+ ### Changed
11
+ - Extract the `URN` pattern to a separate variable, so that it's easier to use it in different Regex formats if needed.
12
+
13
+ ## [0.1.1] - 2016-03-02
6
14
  ### Changed
7
15
  - Stricter rules to validate a URN: it does not accept `urn` string as valid namespace identifier.
8
16
 
@@ -10,5 +18,7 @@ project adheres to [Semantic Versioning](http://semver.org/).
10
18
  ### Added
11
19
  - First version with basic implementation.
12
20
 
21
+ [0.1.3]: https://github.com/altmetric/urn/releases/tag/v0.1.3
22
+ [0.1.2]: https://github.com/altmetric/urn/releases/tag/v0.1.2
13
23
  [0.1.1]: https://github.com/altmetric/urn/releases/tag/v0.1.1
14
24
  [0.1.0]: https://github.com/altmetric/urn/releases/tag/v0.1.0
data/lib/urn.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'cgi'
2
+
1
3
  class URN
2
4
  PATTERN = 'urn:(?!urn:)[a-z0-9\-]{1,31}:[\S]+'.freeze
3
5
  REGEX = /^#{PATTERN}$/i
@@ -0,0 +1,18 @@
1
+ RSpec.configure do |config|
2
+ config.filter_run :focus
3
+ config.run_all_when_everything_filtered = true
4
+ config.example_status_persistence_file_path = "spec/examples.txt"
5
+ config.disable_monkey_patching!
6
+ config.warnings = true
7
+ config.order = :random
8
+ config.default_formatter = 'doc' if config.files_to_run.one?
9
+ Kernel.srand config.seed
10
+
11
+ config.expect_with :rspec do |expectations|
12
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
13
+ end
14
+
15
+ config.mock_with :rspec do |mocks|
16
+ mocks.verify_partial_doubles = true
17
+ end
18
+ end
@@ -0,0 +1,35 @@
1
+ require 'urn'
2
+
3
+ RSpec.describe URN do
4
+ describe '#valid?' do
5
+ context 'returns true' do
6
+ it 'if it is valid' do
7
+ expect(described_class.new('urn:namespace:specificstring')).to be_valid
8
+ end
9
+
10
+ it 'if namespace includes urn' do
11
+ expect(described_class.new('urn:urnnamespace:specificstring')).to be_valid
12
+ end
13
+ end
14
+
15
+ context 'returns false' do
16
+ it 'if it does not start with urn' do
17
+ expect(described_class.new('not-urn:namespace:specificstring')).not_to be_valid
18
+ end
19
+
20
+ it 'if namespace is urn' do
21
+ expect(described_class.new('urn:urn:specificstring')).not_to be_valid
22
+ end
23
+ end
24
+ end
25
+
26
+ describe '#normalize' do
27
+ it 'lowercases the urn and namespace identifier parts only' do
28
+ expect(described_class.new('URN:NameSpace:SpecificString').normalize).to eq('urn:namespace:SpecificString')
29
+ end
30
+
31
+ it 'returns nil if it is not valid' do
32
+ expect(described_class.new('urn:').normalize).to be_nil
33
+ end
34
+ end
35
+ end
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: urn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ana Castro
8
8
  - Jonathan Hernandez
9
+ - Paul Mucur
9
10
  autorequire:
10
11
  bindir: exe
11
12
  cert_chain: []
12
- date: 2016-03-02 00:00:00.000000000 Z
13
+ date: 2016-03-07 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: bundler
@@ -43,36 +44,29 @@ dependencies:
43
44
  name: rspec
44
45
  requirement: !ruby/object:Gem::Requirement
45
46
  requirements:
46
- - - ">="
47
+ - - "~>"
47
48
  - !ruby/object:Gem::Version
48
- version: '0'
49
+ version: '3.4'
49
50
  type: :development
50
51
  prerelease: false
51
52
  version_requirements: !ruby/object:Gem::Requirement
52
53
  requirements:
53
- - - ">="
54
+ - - "~>"
54
55
  - !ruby/object:Gem::Version
55
- version: '0'
56
- description: ''
57
- email:
58
- - support@altmetric.com
56
+ version: '3.4'
57
+ description:
58
+ email: support@altmetric.com
59
59
  executables: []
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
- - ".gitignore"
64
- - ".rspec"
65
- - ".travis.yml"
66
63
  - CHANGELOG.md
67
- - Gemfile
68
64
  - LICENSE.txt
69
65
  - README.md
70
- - Rakefile
71
- - bin/console
72
- - bin/setup
73
66
  - lib/urn.rb
74
- - urn.gemspec
75
- homepage: http://github.com/altmetric/urn
67
+ - spec/spec_helper.rb
68
+ - spec/urn_spec.rb
69
+ homepage: https://github.com/altmetric/urn
76
70
  licenses:
77
71
  - MIT
78
72
  metadata: {}
@@ -96,4 +90,6 @@ rubygems_version: 2.5.1
96
90
  signing_key:
97
91
  specification_version: 4
98
92
  summary: Utility methods to normalize and validate URNs
99
- test_files: []
93
+ test_files:
94
+ - spec/spec_helper.rb
95
+ - spec/urn_spec.rb
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --format documentation
2
- --color
@@ -1,6 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.1
4
- - 2.2
5
- - 2.3.0
6
- before_install: gem install bundler -v 1.10.6
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in urn.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "urn"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start
data/bin/setup DELETED
@@ -1,7 +0,0 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
-
5
- bundle install
6
-
7
- # Do any other automated setup that you need to do here
@@ -1,22 +0,0 @@
1
- # coding: utf-8
2
-
3
- Gem::Specification.new do |spec|
4
- spec.name = 'urn'
5
- spec.version = '0.1.2'
6
- spec.authors = ['Ana Castro', 'Jonathan Hernandez']
7
- spec.email = ['support@altmetric.com']
8
-
9
- spec.summary = 'Utility methods to normalize and validate URNs'
10
- spec.description = ''
11
- spec.homepage = 'http://github.com/altmetric/urn'
12
- spec.license = 'MIT'
13
-
14
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
15
- spec.bindir = 'exe'
16
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
17
- spec.require_paths = ['lib']
18
-
19
- spec.add_development_dependency 'bundler', '~> 1.10'
20
- spec.add_development_dependency 'rake', '~> 10.0'
21
- spec.add_development_dependency 'rspec'
22
- end