tag_uri 0.0.5 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 19bb65c0d8a14948185e0fadc188e04a900d7a26
4
+ data.tar.gz: dcdb15b0187e493727831aa16c6d91d58cfde638
5
+ SHA512:
6
+ metadata.gz: c55c9f423772b21719f7fe786981d80825ae53d78ed334228e3a0e52688624b12d15522916b52116c9825d6e4fc7d9a047399d5c6b04a92bc38527bef65cf2c1
7
+ data.tar.gz: f61f707f740513cba94276f300a65668d7d18b4162d2c770809e655fbf88bd9480ce11490732c5d6da932056d274f89134c3d601ef8a5a501b8c2f036e6a4f6d
data/.gitignore CHANGED
@@ -17,3 +17,6 @@ test/version_tmp
17
17
  tmp
18
18
  .rspec
19
19
  .rbx/
20
+ bin/
21
+ vendor/
22
+ vendor.noindex/
@@ -1,14 +1,19 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.2
4
- - 1.9.3
5
- - 2.0.0
3
+ - 2.1.0
4
+ - 2.2.2
5
+ - rbx
6
6
  - ruby-head
7
- - jruby-19mode
8
- - rbx-19mode
7
+ - jruby-head
9
8
 
10
9
  # whitelist
11
10
  branches:
12
11
  only:
13
12
  - master
14
13
  - develop
14
+
15
+ matrix:
16
+ allow_failures:
17
+ - rvm: jruby-head
18
+ - rvm: ruby-head
19
+ - rvm: rbx
data/CHANGES.md CHANGED
@@ -1,12 +1,17 @@
1
1
  # CH CH CH CHANGES #
2
2
 
3
- ## v0.0.3 ##
3
+ ## Sunday the 14th of June, 2015 v1.0.0 ##
4
4
 
5
- * Since the Github repo is called tag-uri (because a hypen is clearer in a URL) I've added tag-uri.rb and taguri.rb to the lib to require the library in case anyone uses the wrong name.
5
+ * Updated to use Ruby v2's keywords.
6
+ * Bumped to v1.0.0 as a semver release.
7
+
8
+ ----
6
9
 
7
- ## v0.0.2 ##
10
+ ### v0.0.3 ###
11
+
12
+ * Since the Github repo is called tag-uri (because a hypen is clearer in a URL) I've added tag-uri.rb and taguri.rb to the lib to require the library in case anyone uses the wrong name.
8
13
 
9
- ### 27th of February 2013 ###
14
+ ### 27th of February, 2013 v0.0.2 ###
10
15
 
11
16
  * Changed to be a class method, as if it's mixed in to a model then the model will likely want to use that name for the field.
12
17
  * Changed the module name, it should all be uppercase so now it is.
data/Gemfile CHANGED
@@ -1,16 +1,21 @@
1
+ RUBY_ENGINE = 'ruby' unless defined? RUBY_ENGINE
1
2
  source 'https://rubygems.org'
2
3
 
3
4
  # Specify your gem's dependencies in tag_uri.gemspec
4
5
  gemspec
5
6
 
7
+ gem "rake"
8
+
6
9
  group :development do
7
- gem "rake"
8
10
  gem "yard"
9
11
  gem "maruku"
10
- gem "wirble"
12
+ unless RUBY_ENGINE == 'jruby' || RUBY_ENGINE == "rbx"
13
+ gem "pry-byebug"
14
+ end
11
15
  end
12
16
 
13
17
  group :test do
14
18
  gem "rspec"
19
+ gem "rspec-its"
15
20
  gem "simplecov"
16
21
  end
data/README.md CHANGED
@@ -6,7 +6,7 @@ See http://tools.ietf.org/html/rfc4151
6
6
  ### Build status ###
7
7
 
8
8
  Master branch:
9
- [![Build Status](https://travis-ci.org/yb66/tag_uri.png?branch=master)](https://travis-ci.org/yb66/tag_uri)
9
+ [![Build Status](https://travis-ci.org/yb66/tag-uri.png?branch=master)](https://travis-ci.org/yb66/tag-uri)
10
10
 
11
11
  ## Why? ##
12
12
 
@@ -57,6 +57,10 @@ Although you'll probably do something more like this:
57
57
 
58
58
  or something like that.
59
59
 
60
+ ## Versioning ##
61
+
62
+ This library uses [semver](http://semver.org).
63
+
60
64
 
61
65
  ## Contributing
62
66
 
data/Rakefile CHANGED
@@ -5,23 +5,23 @@ task :default => "spec"
5
5
 
6
6
 
7
7
  desc "(Re-) generate documentation and place it in the docs/ dir."
8
- task :docs => :"docs:yard"
9
- namespace :docs do
8
+ task :doc => :"doc:yard"
9
+ namespace :doc do
10
10
  require 'yard'
11
11
  YARD::Rake::YardocTask.new do |t|
12
12
  t.files = ['lib/**/*.rb']
13
- t.options = ['-odocs/', '--no-private']
13
+ t.options = ['-odoc/', '--no-private']
14
14
  end
15
15
 
16
16
  desc "Docs including private methods."
17
17
  YARD::Rake::YardocTask.new(:all) do |t|
18
18
  t.files = ['lib/**/*.rb']
19
- t.options = ['-odocs/']
19
+ t.options = ['-odoc/']
20
20
  end
21
21
 
22
22
  desc "How to use the docs."
23
23
  task :usage do
24
- puts "Open the index.html file in the docs directory to read them. Does not include methods marked private unless you ran the 'all' version (you'll only need these if you plan to hack on the library itself)."
24
+ puts "Open the index.html file in the doc directory to read them. Does not include methods marked private unless you ran the 'all' version (you'll only need these if you plan to hack on the library itself)."
25
25
  end
26
26
  end
27
27
 
@@ -9,10 +9,6 @@ module TagURI
9
9
  class Error < StandardError; end
10
10
  class ArgumentError < Error; end
11
11
 
12
- DEFAULT_FAILURE_BLOCK = ->(x) {
13
- fail ArgumentError, "The TagUri#tag_uri method requires a host, a slug, and a created_at time to work. Please check they're provided, as #{x} was nil."
14
- }
15
-
16
12
  # @param [Hash] opts
17
13
  # @option opts [String] host The host portion e.g. http://example.com. If the host portion is not given then it is assumed that `self` will provide it.
18
14
  # @option opts [String] slug The slugged name e.g. this-is-my-first-post. If a slug is not given then it is assumed that `self` will provide it.
@@ -25,24 +21,14 @@ module TagURI
25
21
  # post = Post.create #…
26
22
  # post.slug # => "this-is-my-first-post"
27
23
  # TagURI.create host: "http://example.com", prefix: "posts", slug: post.slug, created_at: post.created_at
28
- def self.create( opts={}, &failure_block )
29
- opts = opts.dup
30
- opts[:created_at] ||= Time.now
31
- opts[:prefix] ||= ""
32
-
33
- # error checking
34
- failure_block ||= DEFAULT_FAILURE_BLOCK
35
- [:created_at,:prefix,:slug,:host].all?{|arg| opts.keys.include? arg }
36
- opts.each do |k,v|
37
- if v.nil?
38
- failure_block.call k.to_s
39
- end
40
- end
41
- opts[:host] = "https://#{opts[:host]}" unless opts[:host] =~ %r{^.+\://.+$} #
42
- url = File.join opts[:host], opts[:prefix], opts[:slug]
43
- uri = Addressable::URI.parse url
24
+ def self.create( created_at: Time.now, prefix:"", slug:, host: )
25
+ fail ArgumentError if host.nil? || host.empty?
26
+ fail ArgumentError if slug.nil? || slug.empty?
27
+
28
+ host = "https://#{host}" unless host =~ %r{^.+\://.+$}
29
+ uri = Addressable::URI.parse File.join( host, prefix, slug )
44
30
  uri.scheme = "tag"
45
- uri.host = "#{uri.host},#{opts[:created_at].strftime "%F"}:"
31
+ uri.host = "#{uri.host},#{created_at.strftime "%F"}:"
46
32
  uri.to_s.sub(%r{://}, ":")
47
33
  end
48
34
  end
@@ -1,3 +1,3 @@
1
1
  module TagURI
2
- VERSION = "0.0.5"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -1,6 +1,7 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  require 'rspec'
4
+ require 'rspec/its'
4
5
  Spec_dir = File.expand_path( File.dirname __FILE__ )
5
6
 
6
7
  unless Kernel.respond_to?(:require_relative)
@@ -14,7 +15,8 @@ end
14
15
  # code coverage
15
16
  require 'simplecov'
16
17
  SimpleCov.start do
17
- add_filter "/vendor/"
18
+ add_filter "/vendor.noindex/"
19
+ add_filter "/coverage/"
18
20
  add_filter "/bin/"
19
21
  end
20
22
 
@@ -23,6 +25,5 @@ Dir[ File.join( Spec_dir, "/support/**/*.rb")].each do |f|
23
25
  require f
24
26
  end
25
27
 
26
- RSpec.configure do |config|
27
- config.treat_symbols_as_metadata_keys_with_true_values = true
28
- end
28
+ # RSpec.configure do |config|
29
+ # end
@@ -18,4 +18,5 @@ Gem::Specification.new do |gem|
18
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
19
  gem.require_paths = ["lib"]
20
20
  gem.add_dependency("addressable")
21
+ gem.required_ruby_version = '~> 2.0'
21
22
  end
metadata CHANGED
@@ -1,41 +1,40 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tag_uri
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
5
- prerelease:
4
+ version: 1.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Iain Barnett
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-03-01 00:00:00.000000000 Z
11
+ date: 2015-06-14 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: addressable
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
- description: ! "An implementation of tag URI's.\n See http://tools.ietf.org/html/rfc4151"
27
+ description: |-
28
+ An implementation of tag URI's.
29
+ See http://tools.ietf.org/html/rfc4151
31
30
  email:
32
31
  - iainspeed@gmail.com
33
32
  executables: []
34
33
  extensions: []
35
34
  extra_rdoc_files: []
36
35
  files:
37
- - .gitignore
38
- - .travis.yml
36
+ - ".gitignore"
37
+ - ".travis.yml"
39
38
  - CHANGES.md
40
39
  - Gemfile
41
40
  - LICENCE.txt
@@ -50,27 +49,26 @@ files:
50
49
  - tag_uri.gemspec
51
50
  homepage: https://github.com/yb66/tag-uri
52
51
  licenses: []
52
+ metadata: {}
53
53
  post_install_message:
54
54
  rdoc_options: []
55
55
  require_paths:
56
56
  - lib
57
57
  required_ruby_version: !ruby/object:Gem::Requirement
58
- none: false
59
58
  requirements:
60
- - - ! '>='
59
+ - - "~>"
61
60
  - !ruby/object:Gem::Version
62
- version: '0'
61
+ version: '2.0'
63
62
  required_rubygems_version: !ruby/object:Gem::Requirement
64
- none: false
65
63
  requirements:
66
- - - ! '>='
64
+ - - ">="
67
65
  - !ruby/object:Gem::Version
68
66
  version: '0'
69
67
  requirements: []
70
68
  rubyforge_project:
71
- rubygems_version: 1.8.25
69
+ rubygems_version: 2.4.5
72
70
  signing_key:
73
- specification_version: 3
71
+ specification_version: 4
74
72
  summary: Instead of using a permalink as the id for an Atom feed entry, use a tag
75
73
  URI.
76
74
  test_files: