media_types 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +10 -10
- data/.travis.yml +20 -20
- data/CHANGELOG.md +4 -0
- data/Gemfile +6 -6
- data/Gemfile.lock +1 -1
- data/Rakefile +12 -12
- data/lib/media_types/scheme/output_empty_guard.rb +5 -1
- data/lib/media_types/scheme.rb +1 -1
- data/lib/media_types/version.rb +1 -1
- data/lib/media_types.rb +37 -37
- data/media_types.gemspec +33 -33
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: faf9748b5c2757571da930bcebbf8216c9f639ca
|
4
|
+
data.tar.gz: 5918fdae5f969af80f14687214edbf396a8f3a22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3168ce3f29ef159acb44c9abc5944b3cd3bb859b547760588a3b778edfb17f7ff2062a9ae64d76224a6fbbaf7286133e21b73b080904c15a773b399a9f15265f
|
7
|
+
data.tar.gz: 604fdfbd5753e3c1e6656e8e124be298e34402edab4dfa006bffe4ab7e19848824e2a09a9787175a333da5ab2fd7efd3fee849036ca09c85ded1ded2ced6cfdd
|
data/.gitignore
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
/.bundle/
|
2
|
-
/.yardoc
|
3
|
-
/_yardoc/
|
4
|
-
/coverage/
|
5
|
-
/doc/
|
6
|
-
/pkg/
|
7
|
-
/spec/reports/
|
8
|
-
/tmp/
|
9
|
-
|
10
|
-
.idea/
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/_yardoc/
|
4
|
+
/coverage/
|
5
|
+
/doc/
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/tmp/
|
9
|
+
|
10
|
+
.idea/
|
data/.travis.yml
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
sudo: false
|
2
|
-
language: ruby
|
3
|
-
cache: bundler
|
4
|
-
rvm:
|
5
|
-
- 2.3.0
|
6
|
-
- 2.4
|
7
|
-
- 2.5
|
8
|
-
- 2.6
|
9
|
-
- rbx-3
|
10
|
-
- ruby-head
|
11
|
-
matrix:
|
12
|
-
allow_failures:
|
13
|
-
- rvm: ruby-head
|
14
|
-
- rvm: rbx-3
|
15
|
-
- rvm: 2.6
|
16
|
-
before_install:
|
17
|
-
- gem update --system
|
18
|
-
- gem --version
|
19
|
-
install:
|
20
|
-
- bundle install --with development --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle}
|
1
|
+
sudo: false
|
2
|
+
language: ruby
|
3
|
+
cache: bundler
|
4
|
+
rvm:
|
5
|
+
- 2.3.0
|
6
|
+
- 2.4
|
7
|
+
- 2.5
|
8
|
+
- 2.6
|
9
|
+
- rbx-3
|
10
|
+
- ruby-head
|
11
|
+
matrix:
|
12
|
+
allow_failures:
|
13
|
+
- rvm: ruby-head
|
14
|
+
- rvm: rbx-3
|
15
|
+
- rvm: 2.6
|
16
|
+
before_install:
|
17
|
+
- gem update --system
|
18
|
+
- gem --version
|
19
|
+
install:
|
20
|
+
- bundle install --with development --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle}
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
4
|
-
|
5
|
-
# Specify your gem's dependencies in media_types.gemspec
|
6
|
-
gemspec
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in media_types.gemspec
|
6
|
+
gemspec
|
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'bundler/gem_tasks'
|
4
|
-
require 'rake/testtask'
|
5
|
-
|
6
|
-
Rake::TestTask.new(:test) do |t|
|
7
|
-
t.libs << 'test'
|
8
|
-
t.libs << 'lib'
|
9
|
-
t.test_files = FileList['test/**/*_test.rb']
|
10
|
-
end
|
11
|
-
|
12
|
-
task default: :test
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rake/testtask'
|
5
|
+
|
6
|
+
Rake::TestTask.new(:test) do |t|
|
7
|
+
t.libs << 'test'
|
8
|
+
t.libs << 'lib'
|
9
|
+
t.test_files = FileList['test/**/*_test.rb']
|
10
|
+
end
|
11
|
+
|
12
|
+
task default: :test
|
@@ -33,7 +33,11 @@ module MediaTypes
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def raise_empty!(backtrace:)
|
36
|
-
raise EmptyOutputError, format(
|
36
|
+
raise EmptyOutputError, format(
|
37
|
+
'Expected output, got empty at %<backtrace>s. Required are: %<required>s.',
|
38
|
+
backtrace: backtrace.join('->'),
|
39
|
+
required: rules.required.keys
|
40
|
+
)
|
37
41
|
end
|
38
42
|
end
|
39
43
|
end
|
data/lib/media_types/scheme.rb
CHANGED
@@ -150,7 +150,7 @@ module MediaTypes
|
|
150
150
|
#
|
151
151
|
def attribute(key, type = String, optional: false, **opts, &block)
|
152
152
|
if block_given?
|
153
|
-
return collection(key, expected_type: ::Hash, **opts, &block)
|
153
|
+
return collection(key, expected_type: ::Hash, optional: optional, **opts, &block)
|
154
154
|
end
|
155
155
|
|
156
156
|
if type.is_a?(Scheme)
|
data/lib/media_types/version.rb
CHANGED
data/lib/media_types.rb
CHANGED
@@ -1,37 +1,37 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'delegate'
|
4
|
-
|
5
|
-
require 'media_types/version'
|
6
|
-
require 'media_types/hash'
|
7
|
-
require 'media_types/object'
|
8
|
-
require 'media_types/scheme'
|
9
|
-
require 'media_types/dsl'
|
10
|
-
|
11
|
-
module MediaTypes
|
12
|
-
# Shortcut used by #collection to #view('collection')
|
13
|
-
COLLECTION_VIEW = 'collection'
|
14
|
-
|
15
|
-
# Shortcut used by #index to #view('index')
|
16
|
-
INDEX_VIEW = 'index'
|
17
|
-
|
18
|
-
# Shortcut used by #create to #view('create')
|
19
|
-
CREATE_VIEW = 'create'
|
20
|
-
|
21
|
-
module_function
|
22
|
-
|
23
|
-
##
|
24
|
-
# Called when Registerar#register is called
|
25
|
-
# @param [Registerable] registerable
|
26
|
-
def register(registerable)
|
27
|
-
require 'action_dispatch/http/mime_type'
|
28
|
-
|
29
|
-
mime_type = registerable.to_s
|
30
|
-
symbol = registerable.to_sym
|
31
|
-
synonyms = registerable.aliases
|
32
|
-
|
33
|
-
Mime::Type.register(mime_type, symbol, synonyms)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'delegate'
|
4
|
+
|
5
|
+
require 'media_types/version'
|
6
|
+
require 'media_types/hash'
|
7
|
+
require 'media_types/object'
|
8
|
+
require 'media_types/scheme'
|
9
|
+
require 'media_types/dsl'
|
10
|
+
|
11
|
+
module MediaTypes
|
12
|
+
# Shortcut used by #collection to #view('collection')
|
13
|
+
COLLECTION_VIEW = 'collection'
|
14
|
+
|
15
|
+
# Shortcut used by #index to #view('index')
|
16
|
+
INDEX_VIEW = 'index'
|
17
|
+
|
18
|
+
# Shortcut used by #create to #view('create')
|
19
|
+
CREATE_VIEW = 'create'
|
20
|
+
|
21
|
+
module_function
|
22
|
+
|
23
|
+
##
|
24
|
+
# Called when Registerar#register is called
|
25
|
+
# @param [Registerable] registerable
|
26
|
+
def register(registerable)
|
27
|
+
require 'action_dispatch/http/mime_type'
|
28
|
+
|
29
|
+
mime_type = registerable.to_s
|
30
|
+
symbol = registerable.to_sym
|
31
|
+
synonyms = registerable.aliases
|
32
|
+
|
33
|
+
Mime::Type.register(mime_type, symbol, synonyms)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
|
data/media_types.gemspec
CHANGED
@@ -1,33 +1,33 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
lib = File.expand_path('lib', __dir__)
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require 'media_types/version'
|
6
|
-
|
7
|
-
Gem::Specification.new do |spec|
|
8
|
-
spec.name = 'media_types'
|
9
|
-
spec.version = MediaTypes::VERSION
|
10
|
-
spec.authors = ['Derk-Jan Karrenbeld']
|
11
|
-
spec.email = ['derk-jan+github@karrenbeld.info']
|
12
|
-
|
13
|
-
spec.summary = 'Library to create media type definitions, schemes and validations'
|
14
|
-
spec.description = 'Media Types as mime types are not easily supported by frameworks such as rails. '
|
15
|
-
spec.homepage = 'https://github.com/SleeplessByte/media-types-ruby'
|
16
|
-
|
17
|
-
# Specify which files should be added to the gem when it is released.
|
18
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
20
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
-
end
|
22
|
-
spec.bindir = 'exe'
|
23
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
-
spec.require_paths = ['lib']
|
25
|
-
|
26
|
-
spec.add_development_dependency 'awesome_print'
|
27
|
-
spec.add_development_dependency 'bundler', '~> 1.16'
|
28
|
-
spec.add_development_dependency 'minitest', '~> 5.0'
|
29
|
-
spec.add_development_dependency 'minitest-ci'
|
30
|
-
spec.add_development_dependency 'minitest-reporters'
|
31
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
32
|
-
spec.add_development_dependency 'simplecov'
|
33
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'media_types/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = 'media_types'
|
9
|
+
spec.version = MediaTypes::VERSION
|
10
|
+
spec.authors = ['Derk-Jan Karrenbeld']
|
11
|
+
spec.email = ['derk-jan+github@karrenbeld.info']
|
12
|
+
|
13
|
+
spec.summary = 'Library to create media type definitions, schemes and validations'
|
14
|
+
spec.description = 'Media Types as mime types are not easily supported by frameworks such as rails. '
|
15
|
+
spec.homepage = 'https://github.com/SleeplessByte/media-types-ruby'
|
16
|
+
|
17
|
+
# Specify which files should be added to the gem when it is released.
|
18
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
20
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
end
|
22
|
+
spec.bindir = 'exe'
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
+
spec.require_paths = ['lib']
|
25
|
+
|
26
|
+
spec.add_development_dependency 'awesome_print'
|
27
|
+
spec.add_development_dependency 'bundler', '~> 1.16'
|
28
|
+
spec.add_development_dependency 'minitest', '~> 5.0'
|
29
|
+
spec.add_development_dependency 'minitest-ci'
|
30
|
+
spec.add_development_dependency 'minitest-reporters'
|
31
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
32
|
+
spec.add_development_dependency 'simplecov'
|
33
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: media_types
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Derk-Jan Karrenbeld
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|