locomotivecms_common 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +10 -3
- data/Gemfile.lock +62 -34
- data/MIT-LICENSE +1 -1
- data/Rakefile +2 -0
- data/lib/locomotive/common/attr_extras_ext.rb +2 -4
- data/lib/locomotive/common/configuration.rb +2 -2
- data/lib/locomotive/common/core_ext/boolean/false.rb +5 -1
- data/lib/locomotive/common/core_ext/boolean/true.rb +5 -1
- data/lib/locomotive/common/core_ext/hash.rb +3 -4
- data/lib/locomotive/common/core_ext/kernel.rb +2 -4
- data/lib/locomotive/common/core_ext/string.rb +11 -13
- data/lib/locomotive/common/core_ext.rb +2 -0
- data/lib/locomotive/common/exception.rb +15 -15
- data/lib/locomotive/common/logger.rb +17 -21
- data/lib/locomotive/common/notifier.rb +4 -4
- data/lib/locomotive/common/plugins/notifier.rb +1 -0
- data/lib/locomotive/common/version.rb +3 -1
- data/lib/locomotive/common.rb +2 -0
- data/locomotivecms_common.gemspec +9 -7
- data/spec/locomotive/exception_spec.rb +4 -4
- data/spec/spec_helper.rb +2 -0
- data/spec/unit/attr_extras_ext_spec.rb +2 -6
- data/spec/unit/core_ext/string_spec.rb +5 -13
- metadata +23 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce0bf374953b9a32cb70be9b2a8960f07f5a8fda1ca03371d0f783a2f0526aab
|
4
|
+
data.tar.gz: f96763cc09155116c603f3ee4fc0e39cef3da5aca29a256e511fb127d0aca13a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7d809a104c5bca0266e8dcd692608beb8152506e03df95f92fc48c8cdc79e45eb9fc1ffce053a337be86ed9be437b3498ea247acae72c861cd3acfea0909349
|
7
|
+
data.tar.gz: c7d9e9862da7984a30fc0761c60282658746345280edfb0d805c2c71e24323c3f1cea824ff00c1c2c78f4f3976fb23a5d8d557833f84eefe132f311e629479be
|
data/Gemfile
CHANGED
@@ -1,10 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source 'https://rubygems.org'
|
2
4
|
|
5
|
+
platform :ruby do
|
6
|
+
ruby File.read('.ruby-version').strip
|
7
|
+
end
|
8
|
+
|
3
9
|
# Specify your gem's dependencies in locomotivecms_common.gemspec
|
4
10
|
gemspec
|
5
11
|
|
6
|
-
|
7
|
-
gem 'rspec', '~> 3.7.0'
|
12
|
+
gem 'rubocop'
|
8
13
|
|
9
|
-
|
14
|
+
group :test do
|
15
|
+
gem 'coveralls', '~> 0.8.21', require: false
|
16
|
+
gem 'rspec', '~> 3.12.0'
|
10
17
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,71 +1,99 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
locomotivecms_common (0.
|
5
|
-
activesupport (>= 5
|
6
|
-
attr_extras (~>
|
4
|
+
locomotivecms_common (0.5.0)
|
5
|
+
activesupport (>= 5)
|
6
|
+
attr_extras (~> 7.1.0)
|
7
7
|
colorize
|
8
|
-
stringex (~> 2.8.
|
8
|
+
stringex (~> 2.8.5)
|
9
9
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
activesupport (
|
13
|
+
activesupport (7.0.4.2)
|
14
14
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
|
-
i18n (>=
|
16
|
-
minitest (
|
17
|
-
tzinfo (~>
|
18
|
-
|
15
|
+
i18n (>= 1.6, < 2)
|
16
|
+
minitest (>= 5.1)
|
17
|
+
tzinfo (~> 2.0)
|
18
|
+
ast (2.4.2)
|
19
|
+
attr_extras (7.1.0)
|
19
20
|
colorize (0.8.1)
|
20
|
-
concurrent-ruby (1.
|
21
|
+
concurrent-ruby (1.2.2)
|
21
22
|
coveralls (0.8.23)
|
22
23
|
json (>= 1.8, < 3)
|
23
24
|
simplecov (~> 0.16.1)
|
24
25
|
term-ansicolor (~> 1.3)
|
25
26
|
thor (>= 0.19.4, < 2.0)
|
26
27
|
tins (~> 1.6)
|
27
|
-
diff-lcs (1.
|
28
|
-
docile (1.
|
29
|
-
i18n (1.
|
28
|
+
diff-lcs (1.5.0)
|
29
|
+
docile (1.4.0)
|
30
|
+
i18n (1.12.0)
|
30
31
|
concurrent-ruby (~> 1.0)
|
31
|
-
json (2.
|
32
|
-
minitest (5.
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
rspec
|
32
|
+
json (2.6.3)
|
33
|
+
minitest (5.17.0)
|
34
|
+
parallel (1.22.1)
|
35
|
+
parser (3.2.1.0)
|
36
|
+
ast (~> 2.4.1)
|
37
|
+
rainbow (3.1.1)
|
38
|
+
rake (13.0.6)
|
39
|
+
regexp_parser (2.7.0)
|
40
|
+
rexml (3.2.5)
|
41
|
+
rspec (3.12.0)
|
42
|
+
rspec-core (~> 3.12.0)
|
43
|
+
rspec-expectations (~> 3.12.0)
|
44
|
+
rspec-mocks (~> 3.12.0)
|
45
|
+
rspec-core (3.12.1)
|
46
|
+
rspec-support (~> 3.12.0)
|
47
|
+
rspec-expectations (3.12.2)
|
41
48
|
diff-lcs (>= 1.2.0, < 2.0)
|
42
|
-
rspec-support (~> 3.
|
43
|
-
rspec-mocks (3.
|
49
|
+
rspec-support (~> 3.12.0)
|
50
|
+
rspec-mocks (3.12.3)
|
44
51
|
diff-lcs (>= 1.2.0, < 2.0)
|
45
|
-
rspec-support (~> 3.
|
46
|
-
rspec-support (3.
|
52
|
+
rspec-support (~> 3.12.0)
|
53
|
+
rspec-support (3.12.0)
|
54
|
+
rubocop (1.46.0)
|
55
|
+
json (~> 2.3)
|
56
|
+
parallel (~> 1.10)
|
57
|
+
parser (>= 3.2.0.0)
|
58
|
+
rainbow (>= 2.2.2, < 4.0)
|
59
|
+
regexp_parser (>= 1.8, < 3.0)
|
60
|
+
rexml (>= 3.2.5, < 4.0)
|
61
|
+
rubocop-ast (>= 1.26.0, < 2.0)
|
62
|
+
ruby-progressbar (~> 1.7)
|
63
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
64
|
+
rubocop-ast (1.26.0)
|
65
|
+
parser (>= 3.2.1.0)
|
66
|
+
ruby-progressbar (1.11.0)
|
47
67
|
simplecov (0.16.1)
|
48
68
|
docile (~> 1.1)
|
49
69
|
json (>= 1.8, < 3)
|
50
70
|
simplecov-html (~> 0.10.0)
|
51
71
|
simplecov-html (0.10.2)
|
52
72
|
stringex (2.8.5)
|
73
|
+
sync (0.5.0)
|
53
74
|
term-ansicolor (1.7.1)
|
54
75
|
tins (~> 1.0)
|
55
|
-
thor (
|
56
|
-
|
57
|
-
|
58
|
-
tzinfo (
|
59
|
-
|
76
|
+
thor (1.2.1)
|
77
|
+
tins (1.32.1)
|
78
|
+
sync
|
79
|
+
tzinfo (2.0.6)
|
80
|
+
concurrent-ruby (~> 1.0)
|
81
|
+
unicode-display_width (2.4.2)
|
60
82
|
|
61
83
|
PLATFORMS
|
62
84
|
ruby
|
85
|
+
x86_64-darwin-21
|
86
|
+
x86_64-darwin-22
|
63
87
|
|
64
88
|
DEPENDENCIES
|
65
89
|
coveralls (~> 0.8.21)
|
66
90
|
locomotivecms_common!
|
67
91
|
rake (~> 13.0.1)
|
68
|
-
rspec (~> 3.
|
92
|
+
rspec (~> 3.12.0)
|
93
|
+
rubocop
|
94
|
+
|
95
|
+
RUBY VERSION
|
96
|
+
ruby 2.7.4p191
|
69
97
|
|
70
98
|
BUNDLED WITH
|
71
|
-
2.
|
99
|
+
2.3.10
|
data/MIT-LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c)
|
3
|
+
Copyright (c) 2023 Joel AZEMAR, Arnaud Sellenet, NoCoffee
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
this software and associated documentation files (the "Software"), to deal in
|
data/Rakefile
CHANGED
@@ -1,21 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'attr_extras'
|
2
4
|
|
3
5
|
# https://github.com/barsoom/attr_extras/issues/18
|
4
6
|
module AttrExtrasExt
|
5
|
-
|
6
7
|
def self.mixin
|
7
8
|
self::Mixin
|
8
9
|
end
|
9
10
|
|
10
11
|
module Mixin
|
11
|
-
|
12
12
|
def attr_accessor_initialize(*names, &block)
|
13
13
|
attr_initialize(*names, &block)
|
14
14
|
attr_accessor(*AttrExtras::Utils.flat_names(names))
|
15
15
|
end
|
16
|
-
|
17
16
|
end
|
18
|
-
|
19
17
|
end
|
20
18
|
|
21
19
|
class Module
|
@@ -1,8 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Big thanks to Tim Ruffles (https://github.com/timruffles)
|
2
4
|
# https://gist.github.com/timruffles/2780508
|
3
5
|
module HashConverter
|
4
6
|
class << self
|
5
|
-
|
6
7
|
def to_underscore(hash)
|
7
8
|
convert(hash, :underscore)
|
8
9
|
end
|
@@ -23,10 +24,9 @@ module HashConverter
|
|
23
24
|
def convert(obj, *method)
|
24
25
|
case obj
|
25
26
|
when Hash
|
26
|
-
obj.
|
27
|
+
obj.each_with_object({}) do |(k, v), h|
|
27
28
|
v = convert(v, *method)
|
28
29
|
h[k.send(*method)] = v
|
29
|
-
h
|
30
30
|
end
|
31
31
|
when Array
|
32
32
|
obj.map { |m| convert(m, *method) }
|
@@ -34,6 +34,5 @@ module HashConverter
|
|
34
34
|
obj
|
35
35
|
end
|
36
36
|
end
|
37
|
-
|
38
37
|
end
|
39
38
|
end
|
@@ -1,5 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
+
module Kernel
|
3
4
|
def require_relative_all(paths, sub = nil)
|
4
5
|
main_path = File.dirname(caller.first.sub(/:\d+$/, ''))
|
5
6
|
main_path = File.join(main_path, sub) if sub
|
@@ -8,7 +9,4 @@ module Kernel
|
|
8
9
|
Dir[File.join(main_path, path, '*.rb')].each { |file| require file }
|
9
10
|
end
|
10
11
|
end
|
11
|
-
|
12
12
|
end
|
13
|
-
|
14
|
-
|
@@ -1,13 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
unless String.public_instance_methods.include?(:to_bool)
|
2
4
|
class String
|
3
|
-
|
4
5
|
def to_bool
|
5
6
|
return true if self == true || self =~ (/(true|t|yes|y|1)$/i)
|
6
|
-
return false if self == false ||
|
7
|
+
return false if self == false || blank? || self =~ (/(false|f|no|n|0)$/i)
|
7
8
|
|
8
|
-
raise ArgumentError
|
9
|
+
raise ArgumentError, "invalid value for Boolean: \"#{self}\""
|
9
10
|
end
|
10
|
-
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -15,23 +15,21 @@ unless String.public_instance_methods.include?(:permalink)
|
|
15
15
|
require 'stringex'
|
16
16
|
|
17
17
|
class String
|
18
|
-
|
19
18
|
def permalink(underscore = false)
|
20
19
|
# if the slug includes one "_" at least, we consider that the "_" is used instead of "-".
|
21
|
-
_permalink = if !
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
20
|
+
_permalink = if !index('_').nil?
|
21
|
+
to_url(replace_whitespace_with: '_')
|
22
|
+
else
|
23
|
+
to_url
|
24
|
+
end
|
26
25
|
|
27
26
|
underscore ? _permalink.underscore : _permalink
|
28
27
|
end
|
29
28
|
|
30
29
|
def permalink!(underscore = false)
|
31
|
-
replace(
|
30
|
+
replace(permalink(underscore))
|
32
31
|
end
|
33
32
|
|
34
|
-
alias
|
35
|
-
|
33
|
+
alias parameterize! permalink!
|
36
34
|
end
|
37
35
|
end
|
@@ -1,24 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Locomotive
|
2
4
|
module Common
|
3
|
-
|
4
|
-
class DefaultException < ::Exception
|
5
|
+
class DefaultException < StandardError
|
5
6
|
attr_accessor :notifier
|
6
7
|
|
7
8
|
def initialize(message = nil, parent_exception = nil)
|
8
9
|
self.notifier = Locomotive::Common.configuration.notifier
|
9
|
-
|
10
|
+
log_backtrace(parent_exception) if parent_exception
|
10
11
|
super(message)
|
11
12
|
init_plugins
|
12
13
|
end
|
13
14
|
|
14
15
|
def init_plugins
|
15
|
-
|
16
|
-
|
17
|
-
::Plugins.
|
18
|
-
@plugins << ::Plugins.const_get(name).new(self)
|
19
|
-
end
|
20
|
-
rescue NameError
|
16
|
+
@plugins = []
|
17
|
+
::Plugins.constants.each do |name|
|
18
|
+
@plugins << ::Plugins.const_get(name).new(self)
|
21
19
|
end
|
20
|
+
rescue NameError
|
22
21
|
end
|
23
22
|
|
24
23
|
protected
|
@@ -36,20 +35,21 @@ module Locomotive
|
|
36
35
|
attr_accessor :name, :template, :liquid_context
|
37
36
|
|
38
37
|
def initialize(exception, name, template, liquid_context)
|
39
|
-
self.name
|
40
|
-
self.
|
38
|
+
self.name = name
|
39
|
+
self.template = template
|
40
|
+
self.liquid_context = liquid_context
|
41
|
+
log_page_into_backtrace(exception)
|
41
42
|
super(exception.message)
|
42
|
-
|
43
|
+
set_backtrace(exception.backtrace)
|
43
44
|
end
|
44
45
|
|
45
46
|
def log_page_into_backtrace(exception)
|
46
|
-
line =
|
47
|
+
line = template.line_offset
|
47
48
|
line += (exception.respond_to?(:line) ? exception.line || 0 : 0) + 1
|
48
|
-
message = "#{
|
49
|
+
message = "#{template.filepath}:#{line}:in `#{name}'"
|
49
50
|
notifier.fatal "[ERROR] #{exception.message} - #{message}\n".red
|
50
51
|
exception.backtrace.unshift message
|
51
52
|
end
|
52
53
|
end
|
53
|
-
|
54
54
|
end
|
55
55
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'colorize'
|
2
4
|
|
3
5
|
module Locomotive
|
4
6
|
module Common
|
5
|
-
|
6
7
|
class Logger
|
7
|
-
|
8
8
|
attr_accessor :logger
|
9
9
|
|
10
10
|
def initialize
|
@@ -19,45 +19,41 @@ module Locomotive
|
|
19
19
|
def setup(log_file_full_path = nil)
|
20
20
|
require 'logger'
|
21
21
|
|
22
|
-
output =
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
28
|
-
end
|
22
|
+
output = if log_file_full_path
|
23
|
+
log_file_path log_file_full_path
|
24
|
+
else
|
25
|
+
$stdout
|
26
|
+
end
|
29
27
|
|
30
28
|
self.logger = ::Logger.new(output).tap do |log|
|
31
29
|
log.level = ::Logger::DEBUG
|
32
|
-
log.formatter = proc do |
|
30
|
+
log.formatter = proc do |_severity, _datetime, _progname, msg|
|
33
31
|
"#{msg}\n"
|
34
32
|
end
|
35
33
|
end
|
36
34
|
end
|
37
35
|
|
38
36
|
def self.instance
|
39
|
-
@@instance ||=
|
37
|
+
@@instance ||= new
|
40
38
|
end
|
41
39
|
|
42
40
|
def self.setup(*args)
|
43
41
|
if args.size > 1
|
44
|
-
puts
|
45
|
-
|
46
|
-
|
42
|
+
puts '[DEPRECATION] Logger.setup(path, stdout=false) is deprecated. ' \
|
43
|
+
'Please use Logger.setup(log_file_full_path) instead, ' \
|
44
|
+
'like: /home/locomotivecms/log/server.log'
|
47
45
|
end
|
48
|
-
|
46
|
+
instance.setup args.first
|
49
47
|
end
|
50
48
|
|
51
49
|
def self.close
|
52
|
-
|
50
|
+
instance.logger.close
|
53
51
|
end
|
54
52
|
|
55
53
|
class << self
|
56
|
-
%w
|
54
|
+
%w[debug info warn error fatal unknown].each do |name|
|
57
55
|
define_method(name) do |message|
|
58
|
-
|
59
|
-
self.instance.logger.send(name.to_sym, message)
|
60
|
-
end
|
56
|
+
instance.logger&.send(name.to_sym, message)
|
61
57
|
end
|
62
58
|
end
|
63
59
|
end
|
@@ -66,7 +62,7 @@ module Locomotive
|
|
66
62
|
|
67
63
|
def log_file_path(log_file_full_path)
|
68
64
|
if File.directory? log_file_full_path
|
69
|
-
puts
|
65
|
+
puts '[DEPRECATION] Please use fully log file path like: /home/locomotivecms/log/server.log'
|
70
66
|
File.expand_path(File.join(log_file_full_path, 'log', 'locomotivecms.log'))
|
71
67
|
else
|
72
68
|
log_file_full_path
|
data/lib/locomotive/common.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'lib/locomotive/common/version'
|
2
4
|
|
3
5
|
Gem::Specification.new do |spec|
|
@@ -5,23 +7,23 @@ Gem::Specification.new do |spec|
|
|
5
7
|
spec.version = Locomotive::Common::VERSION
|
6
8
|
spec.authors = ['Didier Lafforgue', 'Arnaud Sellenet', 'Joel Azemar']
|
7
9
|
spec.email = ['didier@nocoffee.fr', 'arnaud@sellenet.fr', 'joel.azemar@gmail.com']
|
8
|
-
spec.description =
|
9
|
-
spec.summary =
|
10
|
+
spec.description = 'The LocomotiveCMS Common is a shared libraries package'
|
11
|
+
spec.summary = 'The LocomotiveCMS Common is a shared libraries package for all LocomotiveCMS dependencies'
|
10
12
|
spec.homepage = 'http://www.locomotivecms.com'
|
11
13
|
spec.homepage = 'https://github.com/locomotivecms/common'
|
12
14
|
spec.license = 'MIT'
|
13
15
|
|
14
|
-
spec.files = `git ls-files`.split(
|
16
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
15
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
16
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
19
|
spec.require_paths = ['lib']
|
18
20
|
|
19
21
|
spec.add_development_dependency 'rake', '~> 13.0.1'
|
20
22
|
|
21
|
-
spec.add_dependency 'activesupport', '>= 5
|
22
|
-
spec.add_dependency '
|
23
|
-
spec.add_dependency 'attr_extras', '~> 5.2.0'
|
23
|
+
spec.add_dependency 'activesupport', '>= 5'
|
24
|
+
spec.add_dependency 'attr_extras', '~> 7.1.0'
|
24
25
|
spec.add_dependency 'colorize'
|
26
|
+
spec.add_dependency 'stringex', '~> 2.8.5'
|
25
27
|
|
26
|
-
spec.required_ruby_version = '
|
28
|
+
spec.required_ruby_version = ['>= 2.7']
|
27
29
|
end
|
@@ -1,11 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Locomotive::Common::DefaultException do
|
4
|
-
|
5
6
|
specify do
|
6
7
|
expect do
|
7
|
-
raise Locomotive::Common::DefaultException
|
8
|
+
raise Locomotive::Common::DefaultException
|
8
9
|
end.to raise_error(Locomotive::Common::DefaultException)
|
9
10
|
end
|
10
|
-
|
11
|
-
end
|
11
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,25 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe AttrExtrasExt do
|
4
|
-
|
5
6
|
subject { Person.new('Hank', 'Moody') }
|
6
7
|
|
7
8
|
describe 'reader' do
|
8
|
-
|
9
9
|
it { expect(subject.first_name).to eq 'Hank' }
|
10
10
|
it { expect(subject.last_name).to eq 'Moody' }
|
11
|
-
|
12
11
|
end
|
13
12
|
|
14
13
|
describe 'writer' do
|
15
|
-
|
16
14
|
before { subject.first_name = 'Karen' }
|
17
15
|
|
18
16
|
it { expect(subject.first_name).to eq 'Karen' }
|
19
|
-
|
20
17
|
end
|
21
18
|
|
22
|
-
|
23
19
|
class Person
|
24
20
|
attr_accessor_initialize :first_name, :last_name
|
25
21
|
end
|
@@ -1,44 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe String do
|
4
|
-
|
5
6
|
describe '#permalink!' do
|
6
|
-
|
7
|
-
let(:string) { 'foo bar' }
|
7
|
+
let(:string) { 'foo bar'.dup }
|
8
8
|
|
9
9
|
before { string.permalink! }
|
10
10
|
|
11
11
|
it { expect(string).to eq 'foo-bar' }
|
12
|
-
|
13
12
|
end
|
14
13
|
|
15
14
|
describe '#to_bool' do
|
16
|
-
|
17
15
|
subject { string.to_bool }
|
18
16
|
|
19
17
|
describe 'true values' do
|
20
|
-
|
21
|
-
%w(true t yes y 1).each do |val|
|
18
|
+
%w[true t yes y 1].each do |val|
|
22
19
|
let(:string) { val }
|
23
20
|
it { is_expected.to eq true }
|
24
21
|
end
|
25
|
-
|
26
22
|
end
|
27
23
|
|
28
24
|
describe 'false values' do
|
29
|
-
|
30
|
-
(%w(false f no n 0) + ['']).each do |val|
|
25
|
+
(%w[false f no n 0] + ['']).each do |val|
|
31
26
|
let(:string) { val }
|
32
27
|
it { is_expected.to eq false }
|
33
28
|
end
|
34
|
-
|
35
29
|
end
|
36
30
|
|
37
31
|
describe 'no truthy or falsy' do
|
38
32
|
let(:string) { 'foo' }
|
39
33
|
it { expect { subject }.to raise_error(%(invalid value for Boolean: "foo")) }
|
40
34
|
end
|
41
|
-
|
42
35
|
end
|
43
|
-
|
44
36
|
end
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: locomotivecms_common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Didier Lafforgue
|
8
8
|
- Arnaud Sellenet
|
9
9
|
- Joel Azemar
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2023-03-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
@@ -32,62 +32,56 @@ dependencies:
|
|
32
32
|
requirements:
|
33
33
|
- - ">="
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 5
|
36
|
-
- - "<"
|
37
|
-
- !ruby/object:Gem::Version
|
38
|
-
version: '6.0'
|
35
|
+
version: '5'
|
39
36
|
type: :runtime
|
40
37
|
prerelease: false
|
41
38
|
version_requirements: !ruby/object:Gem::Requirement
|
42
39
|
requirements:
|
43
40
|
- - ">="
|
44
41
|
- !ruby/object:Gem::Version
|
45
|
-
version: 5
|
46
|
-
- - "<"
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '6.0'
|
42
|
+
version: '5'
|
49
43
|
- !ruby/object:Gem::Dependency
|
50
|
-
name:
|
44
|
+
name: attr_extras
|
51
45
|
requirement: !ruby/object:Gem::Requirement
|
52
46
|
requirements:
|
53
47
|
- - "~>"
|
54
48
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
49
|
+
version: 7.1.0
|
56
50
|
type: :runtime
|
57
51
|
prerelease: false
|
58
52
|
version_requirements: !ruby/object:Gem::Requirement
|
59
53
|
requirements:
|
60
54
|
- - "~>"
|
61
55
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
56
|
+
version: 7.1.0
|
63
57
|
- !ruby/object:Gem::Dependency
|
64
|
-
name:
|
58
|
+
name: colorize
|
65
59
|
requirement: !ruby/object:Gem::Requirement
|
66
60
|
requirements:
|
67
|
-
- - "
|
61
|
+
- - ">="
|
68
62
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
63
|
+
version: '0'
|
70
64
|
type: :runtime
|
71
65
|
prerelease: false
|
72
66
|
version_requirements: !ruby/object:Gem::Requirement
|
73
67
|
requirements:
|
74
|
-
- - "
|
68
|
+
- - ">="
|
75
69
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
70
|
+
version: '0'
|
77
71
|
- !ruby/object:Gem::Dependency
|
78
|
-
name:
|
72
|
+
name: stringex
|
79
73
|
requirement: !ruby/object:Gem::Requirement
|
80
74
|
requirements:
|
81
|
-
- - "
|
75
|
+
- - "~>"
|
82
76
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
77
|
+
version: 2.8.5
|
84
78
|
type: :runtime
|
85
79
|
prerelease: false
|
86
80
|
version_requirements: !ruby/object:Gem::Requirement
|
87
81
|
requirements:
|
88
|
-
- - "
|
82
|
+
- - "~>"
|
89
83
|
- !ruby/object:Gem::Version
|
90
|
-
version:
|
84
|
+
version: 2.8.5
|
91
85
|
description: The LocomotiveCMS Common is a shared libraries package
|
92
86
|
email:
|
93
87
|
- didier@nocoffee.fr
|
@@ -128,24 +122,23 @@ homepage: https://github.com/locomotivecms/common
|
|
128
122
|
licenses:
|
129
123
|
- MIT
|
130
124
|
metadata: {}
|
131
|
-
post_install_message:
|
125
|
+
post_install_message:
|
132
126
|
rdoc_options: []
|
133
127
|
require_paths:
|
134
128
|
- lib
|
135
129
|
required_ruby_version: !ruby/object:Gem::Requirement
|
136
130
|
requirements:
|
137
|
-
- - "
|
131
|
+
- - ">="
|
138
132
|
- !ruby/object:Gem::Version
|
139
|
-
version: '2.
|
133
|
+
version: '2.7'
|
140
134
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
135
|
requirements:
|
142
136
|
- - ">="
|
143
137
|
- !ruby/object:Gem::Version
|
144
138
|
version: '0'
|
145
139
|
requirements: []
|
146
|
-
|
147
|
-
|
148
|
-
signing_key:
|
140
|
+
rubygems_version: 3.1.6
|
141
|
+
signing_key:
|
149
142
|
specification_version: 4
|
150
143
|
summary: The LocomotiveCMS Common is a shared libraries package for all LocomotiveCMS
|
151
144
|
dependencies
|