clocale 0.0.5.alpha.170.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.appveyor.yml +31 -0
- data/.rspec +1 -0
- data/.rubocop.yml +24 -0
- data/.travis.yml +33 -0
- data/Gemfile +5 -0
- data/LICENSE +21 -0
- data/README.md +20 -0
- data/Rakefile +25 -0
- data/clocale.gemspec +41 -0
- data/ext/clocale/clocale.c +157 -0
- data/ext/clocale/extconf.rb +15 -0
- data/lib/clocale.rb +17 -0
- data/spec/c_locale_spec.rb +33 -0
- data/spec/spec_helper.rb +110 -0
- metadata +157 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 689cdd1ee899f195efc8e8f49cbef83d68855589345456dd0df84d0fd4e8654c
|
4
|
+
data.tar.gz: ca71f3df2575941738cd37233d2805e5f6443baf03ba2f805a6390646d85323c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cbec1365b08469054b4a96c3e64ada6e9e300f991f387b229122ef551e0c5b23d4d71c3e79587e24b81ec70d82603709fb11bcf0f700252c5b60933fe2d8a976
|
7
|
+
data.tar.gz: 7356762f7fbf7dcbf49f0add898e493195ae0ca4a967eb72db215a02e21ad22351787cba1ce89a9e77da77b0d8f81cfd81ce6b41587094d7d29a94b6f626d865
|
data/.appveyor.yml
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
image: Visual Studio 2019
|
3
|
+
|
4
|
+
version: "{build}"
|
5
|
+
|
6
|
+
environment:
|
7
|
+
matrix:
|
8
|
+
- RUBY_VERSION: 24
|
9
|
+
- RUBY_VERSION: 24-x64
|
10
|
+
- RUBY_VERSION: 25-x64
|
11
|
+
- RUBY_VERSION: 26-x64
|
12
|
+
- RUBY_VERSION: 27-x64
|
13
|
+
|
14
|
+
cache:
|
15
|
+
- vendor/bundle
|
16
|
+
|
17
|
+
init:
|
18
|
+
- set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
|
19
|
+
|
20
|
+
install:
|
21
|
+
- bundle install --path vendor/bundle
|
22
|
+
|
23
|
+
build: off
|
24
|
+
|
25
|
+
before_test:
|
26
|
+
- ruby -v
|
27
|
+
- gem -v
|
28
|
+
- bundle -v
|
29
|
+
|
30
|
+
test_script:
|
31
|
+
- bundle exec rake -rdevkit
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require: rubocop-rspec
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
Exclude:
|
5
|
+
- 'vendor/**/*'
|
6
|
+
DisplayCopNames: true
|
7
|
+
NewCops: enable
|
8
|
+
TargetRubyVersion: 2.4
|
9
|
+
|
10
|
+
Layout/LineLength:
|
11
|
+
Max: 100
|
12
|
+
|
13
|
+
Metrics/AbcSize:
|
14
|
+
Max: 20
|
15
|
+
|
16
|
+
Style/BlockComments:
|
17
|
+
Exclude:
|
18
|
+
- 'spec/spec_helper.rb'
|
19
|
+
|
20
|
+
Layout/EndOfLine:
|
21
|
+
EnforcedStyle: lf # enforce LF line endings on all platforms
|
22
|
+
|
23
|
+
Style/BlockDelimiters:
|
24
|
+
EnforcedStyle: braces_for_chaining
|
data/.travis.yml
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
dist: xenial
|
2
|
+
|
3
|
+
conditions: v1
|
4
|
+
|
5
|
+
if: branch = master OR tag IS present
|
6
|
+
|
7
|
+
os:
|
8
|
+
- linux
|
9
|
+
- osx
|
10
|
+
|
11
|
+
language: ruby
|
12
|
+
|
13
|
+
rvm:
|
14
|
+
- '2.4'
|
15
|
+
- '2.5'
|
16
|
+
- '2.6'
|
17
|
+
- '2.7'
|
18
|
+
|
19
|
+
before_install:
|
20
|
+
- gem --version
|
21
|
+
|
22
|
+
script:
|
23
|
+
- bundle exec rake
|
24
|
+
|
25
|
+
deploy:
|
26
|
+
provider: rubygems
|
27
|
+
api_key:
|
28
|
+
secure: J+HH5P6HdF1+vqsyDzUiKmiqmyvHXSqaTX8CvLNu6ulAQ2XbRCIWbBxCwyhZGryMz55n4ubk5QJkOViNFEjwcaG/yCUBKOCtoYrH8HnEMnd4HH69UO7RaW4LOIa67bRTQm48F2gNcoV9Z5NsuU5W0f3d3IQ8LVbP11gTxSoXpWF7tISjcFJglcmIvFLrF8UICUOOtYeXJXgTmE4GRrylG4dLuo0RJ9wZPiwvqg/3i/KswfAQ5834sFTc5SrcghGqlbVPds+RhAY/OU+b/WF8Ld8dd1TKGCaDKqvrclWbXHPnn1gKGwgDAlVYB8iIW4wn8WGNOdvAYP5DNdERRJbxEnfCMMN3St6jP9n51X5Bwa76Ueh7PUDU3AjgEO4huNers6NfVMp4ruhZdsCNHgqr81/cAiWwsnRXN/Fk+VxhnzUCWpVRWCEyLPNJOk3WjcR2VhLoiAywm+RKiiHPZUmSRezbxwgh9dhrOHwh27LHPwA731KtaoOMJ9r9gHHLOgwiAj7jLhiobLY+3i7Ussz8hsZ6L0fgdE0tawm9L7CIrsqwZ5SPjlFj/oDRGOiw7bQzBwMLEzlKspefrS6JQaF62QTIuV8ccdfn3CXoDoG1ljqv0l+gcbcx+GDhoR/B6L+h0OZj9Pcy20saoMUCIYMx8bvdErL5crhbf225UApDvP4=
|
29
|
+
gem: clocale
|
30
|
+
on:
|
31
|
+
repo: avdv/clocale
|
32
|
+
rvm: '2.5'
|
33
|
+
os: linux
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2017 Claudio Bley
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# clocale [![rubygem-badge][]][rubygem] [![travis-badge][]][travis] [![appveyor-badge][]][appveyor] [![codecov-badge][]][codecov] [![dependabot-b][]][dependabot]
|
2
|
+
|
3
|
+
[rubygem]: https://badge.fury.io/rb/clocale
|
4
|
+
[rubygem-badge]: https://badge.fury.io/rb/clocale.svg
|
5
|
+
[travis]: https://www.travis-ci.com/avdv/clocale
|
6
|
+
[travis-badge]: https://www.travis-ci.com/avdv/clocale.svg?branch=master
|
7
|
+
[appveyor]: https://ci.appveyor.com/project/avdv/clocale/branch/master
|
8
|
+
[appveyor-badge]: https://ci.appveyor.com/api/projects/status/l7pp3mjqvocb2n9r/branch/master?svg=true
|
9
|
+
[codecov]: https://codecov.io/gh/avdv/clocale
|
10
|
+
[codecov-badge]: https://codecov.io/gh/avdv/clocale/branch/master/graph/badge.svg
|
11
|
+
[dependabot]: https://dependabot.com
|
12
|
+
[dependabot-b]: https://api.dependabot.com/badges/status?host=github&repo=avdv/clocale
|
13
|
+
|
14
|
+
This Ruby extension provides access to the C library's `setlocale`, `strxfrm`
|
15
|
+
and `strcoll` functions which are inherently useful for proper sorting
|
16
|
+
(collation) of strings.
|
17
|
+
|
18
|
+
This extension is quite similar to https://github.com/k3rni/ffi-locale but
|
19
|
+
does not use FFI because the `LC_*` constants are not stable across different C
|
20
|
+
libraries.
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rake/extensiontask'
|
4
|
+
require 'rubygems/tasks'
|
5
|
+
|
6
|
+
Gem::Tasks.new
|
7
|
+
|
8
|
+
require 'rspec/core/rake_task'
|
9
|
+
RSpec::Core::RakeTask.new
|
10
|
+
|
11
|
+
require 'rubocop/rake_task'
|
12
|
+
RuboCop::RakeTask.new
|
13
|
+
|
14
|
+
Rake::ExtensionTask.new 'clocale' do |ext|
|
15
|
+
ext.lib_dir = 'lib/clocale'
|
16
|
+
end
|
17
|
+
|
18
|
+
# simple sanity check:
|
19
|
+
|
20
|
+
task test: %w[compile] do
|
21
|
+
ruby '-Ilib', '-rclocale', '-e', 'p CLocale.setlocale(CLocale::LC_ALL, "")'
|
22
|
+
end
|
23
|
+
|
24
|
+
task spec: :compile
|
25
|
+
task default: %i[spec rubocop]
|
data/clocale.gemspec
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
CLOCALE_VERSION = '0.0.4'
|
5
|
+
|
6
|
+
is_tagged = ENV['TRAVIS_TAG'] == "v#{CLOCALE_VERSION}"
|
7
|
+
is_origin = ENV['TRAVIS_REPO_SLUG'] == 'avdv/clocale'
|
8
|
+
job_number = ENV['TRAVIS_JOB_NUMBER']
|
9
|
+
|
10
|
+
spec.name = 'clocale'
|
11
|
+
spec.version = if job_number && is_origin && !is_tagged
|
12
|
+
# Prereleasing on Travis CI
|
13
|
+
digits = CLOCALE_VERSION.to_s.split '.'
|
14
|
+
digits[-1] = digits[-1].to_s.succ
|
15
|
+
|
16
|
+
digits.join('.') + ".alpha.#{ENV['TRAVIS_JOB_NUMBER']}"
|
17
|
+
else
|
18
|
+
CLOCALE_VERSION
|
19
|
+
end
|
20
|
+
spec.authors = ['Claudio Bley']
|
21
|
+
spec.email = ['claudio.bley@gmail.com']
|
22
|
+
spec.summary = 'A Ruby gem that wraps C locale functions.'
|
23
|
+
spec.homepage = 'https://github.com/avdv/clocale'
|
24
|
+
spec.license = 'MIT'
|
25
|
+
|
26
|
+
spec.required_ruby_version = '>= 2.4'
|
27
|
+
|
28
|
+
spec.extensions = %w[ext/clocale/extconf.rb]
|
29
|
+
|
30
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
31
|
+
f.match(/^.gitignore/)
|
32
|
+
end
|
33
|
+
|
34
|
+
spec.add_development_dependency 'codecov', '~> 0.2.0'
|
35
|
+
spec.add_development_dependency 'rake', '~> 13.0.0'
|
36
|
+
spec.add_development_dependency 'rake-compiler', '~> 1.1.0'
|
37
|
+
spec.add_development_dependency 'rspec', '~> 3.9.0'
|
38
|
+
spec.add_development_dependency 'rubocop', '~> 0.87.0'
|
39
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 1.42.0'
|
40
|
+
spec.add_development_dependency 'rubygems-tasks', '~> 0.2.4'
|
41
|
+
end
|
@@ -0,0 +1,157 @@
|
|
1
|
+
#include <ruby.h>
|
2
|
+
#include <locale.h>
|
3
|
+
#include <string.h>
|
4
|
+
|
5
|
+
/*
|
6
|
+
* Changes or queries the locale for a specific category.
|
7
|
+
*
|
8
|
+
* @param category [Integer] one of the constants defined in the CLocale module
|
9
|
+
* @param locale [String, nil] Possible values for `locale`:
|
10
|
+
*
|
11
|
+
* <tt>nil</tt>:: query the current setting, does not change the programs locale
|
12
|
+
*
|
13
|
+
* <tt>""</tt>:: specifies an implementation defined native environment
|
14
|
+
*
|
15
|
+
* <tt>"C"</tt>:: specifies a minimal "portable" locale
|
16
|
+
*
|
17
|
+
* @return [String] the value associated with the category
|
18
|
+
*
|
19
|
+
* @raise [RuntimeError] if setting the locale fails
|
20
|
+
*
|
21
|
+
* Calls the <tt>setlocale()</tt> C library function, see
|
22
|
+
* http://pubs.opengroup.org/onlinepubs/009695399/functions/setlocale.html.
|
23
|
+
*/
|
24
|
+
static VALUE
|
25
|
+
lc_setlocale(VALUE self, VALUE category, VALUE locale) {
|
26
|
+
const char* loc = NULL;
|
27
|
+
int cat = FIX2INT(category);
|
28
|
+
|
29
|
+
if (!NIL_P(locale)) {
|
30
|
+
loc = StringValueCStr(locale);
|
31
|
+
}
|
32
|
+
char* ret = setlocale(cat, loc);
|
33
|
+
|
34
|
+
if (ret == NULL) {
|
35
|
+
VALUE sym = rb_funcall(self, rb_intern("lookup_const"), 1, category);
|
36
|
+
|
37
|
+
if (NIL_P(sym)) {
|
38
|
+
rb_raise(rb_eRuntimeError, "error calling `setlocale(%d, \"%s\")`", cat, loc);
|
39
|
+
} else {
|
40
|
+
rb_raise(rb_eRuntimeError, "error calling `setlocale(%" PRIsVALUE ", \"%s\")`", sym, loc);
|
41
|
+
}
|
42
|
+
} else {
|
43
|
+
return rb_str_new2(ret);
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
/*
|
48
|
+
* Compares two Strings using the current locale.
|
49
|
+
*
|
50
|
+
* @param s1 [String]
|
51
|
+
* @param s2 [String]
|
52
|
+
*
|
53
|
+
* @return [Integer] -1, 0, +1 if s1 is less than, equal to, or greater than s2 respectively
|
54
|
+
*
|
55
|
+
* Calls the <tt>strcoll()</tt> C library function, see
|
56
|
+
* http://pubs.opengroup.org/onlinepubs/009695399/functions/strcoll.html.
|
57
|
+
*/
|
58
|
+
static VALUE
|
59
|
+
lc_strcoll(VALUE self, VALUE s1, VALUE s2) {
|
60
|
+
int ret = strcoll(StringValueCStr(s1), StringValueCStr(s2));
|
61
|
+
|
62
|
+
// clamp ret to range [-1; 1]
|
63
|
+
if (ret < 0) ret = -1;
|
64
|
+
if (ret > 0) ret = 1;
|
65
|
+
|
66
|
+
return INT2FIX(ret);
|
67
|
+
}
|
68
|
+
|
69
|
+
/*
|
70
|
+
* Transform the given String into a canonical form for char comparison.
|
71
|
+
*
|
72
|
+
* This is useful for sorting a list using Enumerable#sort_by which does a
|
73
|
+
* Schwartzian transform.
|
74
|
+
*
|
75
|
+
* @param s [String]
|
76
|
+
*
|
77
|
+
* @return [String] transformed according to the current <tt>LC_COLLATE</tt> locale setting
|
78
|
+
*
|
79
|
+
* Calls the <tt>strxfrm</tt> C library function, see
|
80
|
+
* http://pubs.opengroup.org/onlinepubs/009695399/functions/strxfrm.html.
|
81
|
+
*/
|
82
|
+
static VALUE
|
83
|
+
lc_strxfrm(VALUE self, VALUE str) {
|
84
|
+
VALUE ret;
|
85
|
+
char* c_str = StringValueCStr(str);
|
86
|
+
size_t size = 0;
|
87
|
+
char* buf = NULL;
|
88
|
+
|
89
|
+
for (;;) {
|
90
|
+
size_t needed = strxfrm(buf, c_str, size);
|
91
|
+
|
92
|
+
if (needed == 0) {
|
93
|
+
ret = str;
|
94
|
+
break;
|
95
|
+
} else if (needed < size) {
|
96
|
+
ret = rb_str_new2(buf);
|
97
|
+
break;
|
98
|
+
} else {
|
99
|
+
size = needed + 1;
|
100
|
+
buf = realloc(buf, size);
|
101
|
+
|
102
|
+
if (buf == NULL) rb_raise(rb_eNoMemError, "could not allocate %zu bytes", size);
|
103
|
+
}
|
104
|
+
}
|
105
|
+
|
106
|
+
free(buf);
|
107
|
+
|
108
|
+
return ret;
|
109
|
+
}
|
110
|
+
|
111
|
+
/*
|
112
|
+
* Initialize the extension by defining the CLocale module.
|
113
|
+
*/
|
114
|
+
|
115
|
+
void
|
116
|
+
Init_clocale(void) {
|
117
|
+
VALUE module = rb_define_module("CLocale");
|
118
|
+
|
119
|
+
#define constant(LC) rb_define_const(module, #LC, INT2FIX(LC))
|
120
|
+
|
121
|
+
/* categories defined by POSIX */
|
122
|
+
constant(LC_ALL);
|
123
|
+
constant(LC_COLLATE);
|
124
|
+
constant(LC_CTYPE);
|
125
|
+
# ifdef LC_MESSAGES
|
126
|
+
constant(LC_MESSAGES);
|
127
|
+
# endif
|
128
|
+
constant(LC_MONETARY);
|
129
|
+
constant(LC_NUMERIC);
|
130
|
+
constant(LC_TIME);
|
131
|
+
|
132
|
+
/* GNU extensions */
|
133
|
+
# ifdef LC_ADDRESS
|
134
|
+
constant(LC_ADDRESS);
|
135
|
+
# endif
|
136
|
+
# ifdef LC_IDENTIFICATION
|
137
|
+
constant(LC_IDENTIFICATION);
|
138
|
+
# endif
|
139
|
+
# ifdef LC_MEASUREMENT
|
140
|
+
constant(LC_MEASUREMENT);
|
141
|
+
# endif
|
142
|
+
# ifdef LC_NAME
|
143
|
+
constant(LC_NAME);
|
144
|
+
# endif
|
145
|
+
# ifdef LC_PAPER
|
146
|
+
constant(LC_PAPER);
|
147
|
+
# endif
|
148
|
+
# ifdef LC_TELEPHONE
|
149
|
+
constant(LC_TELEPHONE);
|
150
|
+
# endif
|
151
|
+
|
152
|
+
#undef constant
|
153
|
+
|
154
|
+
rb_define_module_function(module, "setlocale", lc_setlocale, 2);
|
155
|
+
rb_define_module_function(module, "strcoll", lc_strcoll, 2);
|
156
|
+
rb_define_module_function(module, "strxfrm", lc_strxfrm, 1);
|
157
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'mkmf'
|
4
|
+
|
5
|
+
def check_functions
|
6
|
+
%w[setlocale strcoll strxfrm].each do |func|
|
7
|
+
abort "missing function `#{func}``" unless have_func func
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
abort 'missing `locale.h`' unless have_header 'locale.h'
|
12
|
+
|
13
|
+
check_functions
|
14
|
+
|
15
|
+
create_makefile 'clocale/clocale'
|
data/lib/clocale.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This module defines the `LC_*` constants and locale functions from the linked
|
4
|
+
# C library of the current Ruby interpreter.
|
5
|
+
#
|
6
|
+
# @author Claudio Bley <claudio.bley@gmail.com>
|
7
|
+
module CLocale
|
8
|
+
# Looks up the constant corresponding to the given integer value.
|
9
|
+
#
|
10
|
+
# @param int [Integer]
|
11
|
+
# @return [Symbol,nil] the <tt>LC_*</tt> constant as Symbol if found, nil otherwise
|
12
|
+
def self.lookup_const(int)
|
13
|
+
CLocale.constants.find { |s| CLocale.const_get(s) == int }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
require 'clocale/clocale'
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'clocale'
|
4
|
+
|
5
|
+
RSpec.describe CLocale do
|
6
|
+
subject(:clocale) { ::CLocale }
|
7
|
+
|
8
|
+
%i[LC_ALL LC_COLLATE LC_CTYPE LC_MONETARY LC_NUMERIC LC_TIME].each do |const|
|
9
|
+
it "has #{const} defined" do
|
10
|
+
expect(clocale.const_defined?(const)).to be(true)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'lookup' do
|
15
|
+
described_class.constants.each do |const|
|
16
|
+
it "returns corresponding symbol for #{const}" do
|
17
|
+
int = described_class.const_get const
|
18
|
+
|
19
|
+
expect(described_class.lookup_const(int)).to eq(const)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'can call setlocale' do
|
25
|
+
expect { described_class.setlocale(CLocale::LC_ALL, '') }.not_to raise_error
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'raises an error with invalid locales' do
|
29
|
+
expect {
|
30
|
+
described_class.setlocale(CLocale::LC_COLLATE, 'FOOBAR')
|
31
|
+
}.to raise_error(RuntimeError, /LC_COLLATE/)
|
32
|
+
end
|
33
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'simplecov'
|
4
|
+
SimpleCov.start
|
5
|
+
|
6
|
+
if ENV['CI']
|
7
|
+
require 'codecov'
|
8
|
+
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
9
|
+
end
|
10
|
+
|
11
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
12
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
13
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
14
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
15
|
+
# files.
|
16
|
+
#
|
17
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
18
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
19
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
20
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
21
|
+
# a separate helper file that requires the additional dependencies and performs
|
22
|
+
# the additional setup, and require it from the spec files that actually need
|
23
|
+
# it.
|
24
|
+
#
|
25
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
26
|
+
RSpec.configure do |config|
|
27
|
+
# rspec-expectations config goes here. You can use an alternate
|
28
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
29
|
+
# assertions if you prefer.
|
30
|
+
config.expect_with :rspec do |expectations|
|
31
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
32
|
+
# and `failure_message` of custom matchers include text for helper methods
|
33
|
+
# defined using `chain`, e.g.:
|
34
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
35
|
+
# # => "be bigger than 2 and smaller than 4"
|
36
|
+
# ...rather than:
|
37
|
+
# # => "be bigger than 2"
|
38
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
39
|
+
end
|
40
|
+
|
41
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
42
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
43
|
+
config.mock_with :rspec do |mocks|
|
44
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
45
|
+
# a real object. This is generally recommended, and will default to
|
46
|
+
# `true` in RSpec 4.
|
47
|
+
mocks.verify_partial_doubles = true
|
48
|
+
end
|
49
|
+
|
50
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
51
|
+
# have no way to turn it off -- the option exists only for backwards
|
52
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
53
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
54
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
55
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
56
|
+
|
57
|
+
# The settings below are suggested to provide a good initial experience
|
58
|
+
# with RSpec, but feel free to customize to your heart's content.
|
59
|
+
=begin
|
60
|
+
# This allows you to limit a spec run to individual examples or groups
|
61
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
62
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
63
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
64
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
65
|
+
config.filter_run_when_matching :focus
|
66
|
+
|
67
|
+
# Allows RSpec to persist some state between runs in order to support
|
68
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
69
|
+
# you configure your source control system to ignore this file.
|
70
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
71
|
+
|
72
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
73
|
+
# recommended. For more details, see:
|
74
|
+
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
75
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
76
|
+
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
77
|
+
config.disable_monkey_patching!
|
78
|
+
|
79
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
80
|
+
# be too noisy due to issues in dependencies.
|
81
|
+
config.warnings = true
|
82
|
+
|
83
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
84
|
+
# file, and it's useful to allow more verbose output when running an
|
85
|
+
# individual spec file.
|
86
|
+
if config.files_to_run.one?
|
87
|
+
# Use the documentation formatter for detailed output,
|
88
|
+
# unless a formatter has already been configured
|
89
|
+
# (e.g. via a command-line flag).
|
90
|
+
config.default_formatter = "doc"
|
91
|
+
end
|
92
|
+
|
93
|
+
# Print the 10 slowest examples and example groups at the
|
94
|
+
# end of the spec run, to help surface which specs are running
|
95
|
+
# particularly slow.
|
96
|
+
config.profile_examples = 10
|
97
|
+
|
98
|
+
# Run specs in random order to surface order dependencies. If you find an
|
99
|
+
# order dependency and want to debug it, you can fix the order by providing
|
100
|
+
# the seed, which is printed after each run.
|
101
|
+
# --seed 1234
|
102
|
+
config.order = :random
|
103
|
+
|
104
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
105
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
106
|
+
# test failures related to randomization by passing the same `--seed` value
|
107
|
+
# as the one that triggered the failure.
|
108
|
+
Kernel.srand config.seed
|
109
|
+
=end
|
110
|
+
end
|
metadata
ADDED
@@ -0,0 +1,157 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: clocale
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.5.alpha.170.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Claudio Bley
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-07-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: codecov
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.2.0
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.2.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 13.0.0
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 13.0.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake-compiler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.1.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.1.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.9.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 3.9.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.87.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.87.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop-rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.42.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.42.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubygems-tasks
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.2.4
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.2.4
|
111
|
+
description:
|
112
|
+
email:
|
113
|
+
- claudio.bley@gmail.com
|
114
|
+
executables: []
|
115
|
+
extensions:
|
116
|
+
- ext/clocale/extconf.rb
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- ".appveyor.yml"
|
120
|
+
- ".rspec"
|
121
|
+
- ".rubocop.yml"
|
122
|
+
- ".travis.yml"
|
123
|
+
- Gemfile
|
124
|
+
- LICENSE
|
125
|
+
- README.md
|
126
|
+
- Rakefile
|
127
|
+
- clocale.gemspec
|
128
|
+
- ext/clocale/clocale.c
|
129
|
+
- ext/clocale/extconf.rb
|
130
|
+
- lib/clocale.rb
|
131
|
+
- spec/c_locale_spec.rb
|
132
|
+
- spec/spec_helper.rb
|
133
|
+
homepage: https://github.com/avdv/clocale
|
134
|
+
licenses:
|
135
|
+
- MIT
|
136
|
+
metadata: {}
|
137
|
+
post_install_message:
|
138
|
+
rdoc_options: []
|
139
|
+
require_paths:
|
140
|
+
- lib
|
141
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '2.4'
|
146
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - ">"
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: 1.3.1
|
151
|
+
requirements: []
|
152
|
+
rubyforge_project:
|
153
|
+
rubygems_version: 2.7.7
|
154
|
+
signing_key:
|
155
|
+
specification_version: 4
|
156
|
+
summary: A Ruby gem that wraps C locale functions.
|
157
|
+
test_files: []
|