berkeley_library-util 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +17 -5
- data/.idea/inspectionProfiles/Project_Default.xml +1 -0
- data/.idea/util.iml +48 -51
- data/.rubocop.yml +157 -2
- data/.simplecov +5 -6
- data/CHANGES.md +17 -0
- data/Rakefile +2 -2
- data/berkeley_library-util.gemspec +5 -6
- data/lib/berkeley_library/util/arrays.rb +3 -3
- data/lib/berkeley_library/util/files.rb +2 -2
- data/lib/berkeley_library/util/module_info.rb +1 -1
- data/lib/berkeley_library/util/uris/appender.rb +23 -19
- data/lib/berkeley_library/util/uris/requester.rb +97 -42
- data/lib/berkeley_library/util/uris.rb +15 -11
- data/rakelib/.rubocop.yml +4 -0
- data/spec/.rubocop.yml +89 -0
- data/spec/berkeley_library/util/arrays_spec.rb +10 -1
- data/spec/berkeley_library/util/files_spec.rb +1 -0
- data/spec/berkeley_library/util/stringios_spec.rb +7 -0
- data/spec/berkeley_library/util/strings_spec.rb +4 -0
- data/spec/berkeley_library/util/times_spec.rb +4 -0
- data/spec/berkeley_library/util/uris/requester_spec.rb +121 -0
- data/spec/berkeley_library/util/uris_spec.rb +62 -10
- data/spec/spec_helper.rb +2 -2
- metadata +16 -54
- data/rakelib/bundle.rake +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71143c349265481e222ad5c0330ad1f995697139d114f9b9a2615c8d9cb8ea4b
|
4
|
+
data.tar.gz: 3ad66018de9e3ff7efe0d5637c9c79ea616da7510aff3c6f8f9bc07ed83cbb59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0563b8e84cdeff86055d4423ddf57a6559c7e9a80527b643fe9cf4c10db2a62cbd8e122fc0045da56778b00ac6486ebff8ab00a5452721f385a93e9f8fc6e12
|
7
|
+
data.tar.gz: c19e2f817542e98ec80b9e05faf6bdaad821ab8f6589638c3790611de8231cd7bbf2a68f3d0a520fb7b96a8b0c16ac06685ae547ad6c5b7023468bea50ec4f01
|
data/.github/workflows/build.yml
CHANGED
@@ -1,18 +1,30 @@
|
|
1
1
|
name: Build
|
2
|
-
on: [ push, pull_request ]
|
2
|
+
on: [ push, pull_request, workflow_dispatch ]
|
3
3
|
jobs:
|
4
4
|
test:
|
5
5
|
strategy:
|
6
6
|
fail-fast: false
|
7
7
|
matrix:
|
8
8
|
os: [ ubuntu-latest, macos-latest ]
|
9
|
-
ruby: [ '2.7', '3.0' ]
|
9
|
+
ruby: [ '2.7', '3.0', '3.1' ]
|
10
10
|
runs-on: ${{ matrix.os }}
|
11
11
|
|
12
12
|
steps:
|
13
|
-
-
|
14
|
-
|
13
|
+
- name: Check out repository
|
14
|
+
uses: actions/checkout@v2
|
15
|
+
|
16
|
+
- name: Set up Ruby
|
17
|
+
uses: ruby/setup-ruby@v1
|
15
18
|
with:
|
16
19
|
ruby-version: ${{ matrix.ruby }}
|
17
20
|
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
18
|
-
|
21
|
+
|
22
|
+
- name: Run checks
|
23
|
+
run: bundle exec rake
|
24
|
+
|
25
|
+
- name: Upload artifacts
|
26
|
+
if: ${{ always() }}
|
27
|
+
uses: actions/upload-artifact@v3
|
28
|
+
with:
|
29
|
+
name: artifacts
|
30
|
+
path: artifacts/**
|
@@ -11,6 +11,7 @@
|
|
11
11
|
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
12
12
|
<inspection_tool class="Rubocop" enabled="false" level="WARNING" enabled_by_default="false" />
|
13
13
|
<inspection_tool class="RubyCaseWithoutElseBlockInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
14
|
+
<inspection_tool class="RubyMismatchedArgumentType" enabled="true" level="INFORMATION" enabled_by_default="true" />
|
14
15
|
<inspection_tool class="RubyMismatchedReturnType" enabled="true" level="WARNING" enabled_by_default="true">
|
15
16
|
<option name="myCheckNilability" value="false" />
|
16
17
|
</inspection_tool>
|
data/.idea/util.iml
CHANGED
@@ -5,83 +5,83 @@
|
|
5
5
|
</component>
|
6
6
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
7
7
|
<exclude-output />
|
8
|
-
<content url="file://$MODULE_DIR$"
|
8
|
+
<content url="file://$MODULE_DIR$">
|
9
|
+
<excludeFolder url="file://$MODULE_DIR$/artifacts" />
|
10
|
+
</content>
|
9
11
|
<orderEntry type="jdk" jdkName="RVM: ruby-2.7.4" jdkType="RUBY_SDK" />
|
10
12
|
<orderEntry type="sourceFolder" forTests="false" />
|
11
|
-
<orderEntry type="library" scope="PROVIDED" name="actionpack (v7.0.
|
12
|
-
<orderEntry type="library" scope="PROVIDED" name="actionview (v7.0.
|
13
|
-
<orderEntry type="library" scope="PROVIDED" name="activesupport (v7.0.
|
14
|
-
<orderEntry type="library" scope="PROVIDED" name="addressable (v2.8.
|
13
|
+
<orderEntry type="library" scope="PROVIDED" name="actionpack (v7.0.4.2, RVM: ruby-2.7.4) [gem]" level="application" />
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="actionview (v7.0.4.2, RVM: ruby-2.7.4) [gem]" level="application" />
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="activesupport (v7.0.4.2, RVM: ruby-2.7.4) [gem]" level="application" />
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="addressable (v2.8.1, RVM: ruby-2.7.4) [gem]" level="application" />
|
15
17
|
<orderEntry type="library" scope="PROVIDED" name="amazing_print (v1.4.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
16
18
|
<orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, RVM: ruby-2.7.4) [gem]" level="application" />
|
17
|
-
<orderEntry type="library" scope="PROVIDED" name="berkeley_library-logging (v0.2.
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="berkeley_library-logging (v0.2.7, RVM: ruby-2.7.4) [gem]" level="application" />
|
18
20
|
<orderEntry type="library" scope="PROVIDED" name="builder (v3.2.4, RVM: ruby-2.7.4) [gem]" level="application" />
|
19
|
-
<orderEntry type="library" scope="PROVIDED" name="bundle-audit (v0.1.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
20
21
|
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.2.31, RVM: ruby-2.7.4) [gem]" level="application" />
|
21
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
22
|
-
<orderEntry type="library" scope="PROVIDED" name="ci_reporter (v2.0.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
22
|
+
<orderEntry type="library" scope="PROVIDED" name="ci_reporter (v2.1.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
23
23
|
<orderEntry type="library" scope="PROVIDED" name="ci_reporter_rspec (v1.0.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
24
24
|
<orderEntry type="library" scope="PROVIDED" name="colorize (v0.8.1, RVM: ruby-2.7.4) [gem]" level="application" />
|
25
|
-
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.
|
25
|
+
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.2.2, RVM: ruby-2.7.4) [gem]" level="application" />
|
26
26
|
<orderEntry type="library" scope="PROVIDED" name="crack (v0.4.5, RVM: ruby-2.7.4) [gem]" level="application" />
|
27
27
|
<orderEntry type="library" scope="PROVIDED" name="crass (v1.0.6, RVM: ruby-2.7.4) [gem]" level="application" />
|
28
28
|
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.5.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
29
29
|
<orderEntry type="library" scope="PROVIDED" name="docile (v1.4.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
30
30
|
<orderEntry type="library" scope="PROVIDED" name="domain_name (v0.5.20190701, RVM: ruby-2.7.4) [gem]" level="application" />
|
31
|
-
<orderEntry type="library" scope="PROVIDED" name="dotenv (v2.
|
32
|
-
<orderEntry type="library" scope="PROVIDED" name="erubi (v1.
|
31
|
+
<orderEntry type="library" scope="PROVIDED" name="dotenv (v2.8.1, RVM: ruby-2.7.4) [gem]" level="application" />
|
32
|
+
<orderEntry type="library" scope="PROVIDED" name="erubi (v1.12.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
33
33
|
<orderEntry type="library" scope="PROVIDED" name="hashdiff (v1.0.1, RVM: ruby-2.7.4) [gem]" level="application" />
|
34
34
|
<orderEntry type="library" scope="PROVIDED" name="http-accept (v1.7.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
35
|
-
<orderEntry type="library" scope="PROVIDED" name="http-cookie (v1.0.
|
36
|
-
<orderEntry type="library" scope="PROVIDED" name="i18n (v1.
|
35
|
+
<orderEntry type="library" scope="PROVIDED" name="http-cookie (v1.0.5, RVM: ruby-2.7.4) [gem]" level="application" />
|
36
|
+
<orderEntry type="library" scope="PROVIDED" name="i18n (v1.12.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
37
|
+
<orderEntry type="library" scope="PROVIDED" name="json (v2.6.3, RVM: ruby-2.7.4) [gem]" level="application" />
|
37
38
|
<orderEntry type="library" scope="PROVIDED" name="lograge (v0.12.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
38
|
-
<orderEntry type="library" scope="PROVIDED" name="loofah (v2.
|
39
|
+
<orderEntry type="library" scope="PROVIDED" name="loofah (v2.19.1, RVM: ruby-2.7.4) [gem]" level="application" />
|
39
40
|
<orderEntry type="library" scope="PROVIDED" name="method_source (v1.0.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
40
41
|
<orderEntry type="library" scope="PROVIDED" name="mime-types (v3.4.1, RVM: ruby-2.7.4) [gem]" level="application" />
|
41
|
-
<orderEntry type="library" scope="PROVIDED" name="mime-types-data (v3.
|
42
|
-
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.
|
42
|
+
<orderEntry type="library" scope="PROVIDED" name="mime-types-data (v3.2023.0218.1, RVM: ruby-2.7.4) [gem]" level="application" />
|
43
|
+
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.18.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
43
44
|
<orderEntry type="library" scope="PROVIDED" name="netrc (v0.11.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
44
|
-
<orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.
|
45
|
-
<orderEntry type="library" scope="PROVIDED" name="oj (v3.
|
45
|
+
<orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.14.2, RVM: ruby-2.7.4) [gem]" level="application" />
|
46
|
+
<orderEntry type="library" scope="PROVIDED" name="oj (v3.14.2, RVM: ruby-2.7.4) [gem]" level="application" />
|
46
47
|
<orderEntry type="library" scope="PROVIDED" name="ougai (v1.9.1, RVM: ruby-2.7.4) [gem]" level="application" />
|
47
48
|
<orderEntry type="library" scope="PROVIDED" name="parallel (v1.22.1, RVM: ruby-2.7.4) [gem]" level="application" />
|
48
|
-
<orderEntry type="library" scope="PROVIDED" name="parser (v3.1.
|
49
|
-
<orderEntry type="library" scope="PROVIDED" name="public_suffix (
|
50
|
-
<orderEntry type="library" scope="PROVIDED" name="racc (v1.6.
|
51
|
-
<orderEntry type="library" scope="PROVIDED" name="rack (v2.2.3, RVM: ruby-2.7.4) [gem]" level="application" />
|
52
|
-
<orderEntry type="library" scope="PROVIDED" name="rack-test (
|
49
|
+
<orderEntry type="library" scope="PROVIDED" name="parser (v3.2.1.1, RVM: ruby-2.7.4) [gem]" level="application" />
|
50
|
+
<orderEntry type="library" scope="PROVIDED" name="public_suffix (v5.0.1, RVM: ruby-2.7.4) [gem]" level="application" />
|
51
|
+
<orderEntry type="library" scope="PROVIDED" name="racc (v1.6.2, RVM: ruby-2.7.4) [gem]" level="application" />
|
52
|
+
<orderEntry type="library" scope="PROVIDED" name="rack (v2.2.6.3, RVM: ruby-2.7.4) [gem]" level="application" />
|
53
|
+
<orderEntry type="library" scope="PROVIDED" name="rack-test (v2.0.2, RVM: ruby-2.7.4) [gem]" level="application" />
|
53
54
|
<orderEntry type="library" scope="PROVIDED" name="rails-dom-testing (v2.0.3, RVM: ruby-2.7.4) [gem]" level="application" />
|
54
|
-
<orderEntry type="library" scope="PROVIDED" name="rails-html-sanitizer (v1.
|
55
|
-
<orderEntry type="library" scope="PROVIDED" name="railties (v7.0.
|
55
|
+
<orderEntry type="library" scope="PROVIDED" name="rails-html-sanitizer (v1.5.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
56
|
+
<orderEntry type="library" scope="PROVIDED" name="railties (v7.0.4.2, RVM: ruby-2.7.4) [gem]" level="application" />
|
56
57
|
<orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, RVM: ruby-2.7.4) [gem]" level="application" />
|
57
58
|
<orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, RVM: ruby-2.7.4) [gem]" level="application" />
|
58
|
-
<orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.
|
59
|
+
<orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.7.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
59
60
|
<orderEntry type="library" scope="PROVIDED" name="request_store (v1.5.1, RVM: ruby-2.7.4) [gem]" level="application" />
|
60
61
|
<orderEntry type="library" scope="PROVIDED" name="rest-client (v2.1.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
61
62
|
<orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.5, RVM: ruby-2.7.4) [gem]" level="application" />
|
62
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.
|
63
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.
|
64
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.
|
65
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.
|
66
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.
|
67
|
-
<orderEntry type="library" scope="PROVIDED" name="rubocop (v1.
|
68
|
-
<orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.
|
63
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.12.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
64
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.12.1, RVM: ruby-2.7.4) [gem]" level="application" />
|
65
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.12.2, RVM: ruby-2.7.4) [gem]" level="application" />
|
66
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.12.3, RVM: ruby-2.7.4) [gem]" level="application" />
|
67
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.12.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
68
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop (v1.39.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
69
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.27.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
69
70
|
<orderEntry type="library" scope="PROVIDED" name="rubocop-rake (v0.6.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
70
71
|
<orderEntry type="library" scope="PROVIDED" name="rubocop-rspec (v2.4.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
71
72
|
<orderEntry type="library" scope="PROVIDED" name="ruby-prof (v0.17.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
72
|
-
<orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.
|
73
|
-
<orderEntry type="library" scope="PROVIDED" name="simplecov (v0.
|
73
|
+
<orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.13.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
74
|
+
<orderEntry type="library" scope="PROVIDED" name="simplecov (v0.22.0, RVM: ruby-2.7.4) [gem]" level="application" />
|
74
75
|
<orderEntry type="library" scope="PROVIDED" name="simplecov-html (v0.12.3, RVM: ruby-2.7.4) [gem]" level="application" />
|
75
|
-
<orderEntry type="library" scope="PROVIDED" name="simplecov-rcov (v0.3.1, RVM: ruby-2.7.4) [gem]" level="application" />
|
76
76
|
<orderEntry type="library" scope="PROVIDED" name="simplecov_json_formatter (v0.1.4, RVM: ruby-2.7.4) [gem]" level="application" />
|
77
77
|
<orderEntry type="library" scope="PROVIDED" name="thor (v1.2.1, RVM: ruby-2.7.4) [gem]" level="application" />
|
78
|
-
<orderEntry type="library" scope="PROVIDED" name="typesafe_enum (v0.3.
|
79
|
-
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v2.0.
|
78
|
+
<orderEntry type="library" scope="PROVIDED" name="typesafe_enum (v0.3.1, RVM: ruby-2.7.4) [gem]" level="application" />
|
79
|
+
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v2.0.6, RVM: ruby-2.7.4) [gem]" level="application" />
|
80
80
|
<orderEntry type="library" scope="PROVIDED" name="unf (v0.1.4, RVM: ruby-2.7.4) [gem]" level="application" />
|
81
|
-
<orderEntry type="library" scope="PROVIDED" name="unf_ext (v0.0.8.
|
82
|
-
<orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.
|
83
|
-
<orderEntry type="library" scope="PROVIDED" name="webmock (v3.
|
84
|
-
<orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.
|
81
|
+
<orderEntry type="library" scope="PROVIDED" name="unf_ext (v0.0.8.2, RVM: ruby-2.7.4) [gem]" level="application" />
|
82
|
+
<orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.4.2, RVM: ruby-2.7.4) [gem]" level="application" />
|
83
|
+
<orderEntry type="library" scope="PROVIDED" name="webmock (v3.18.1, RVM: ruby-2.7.4) [gem]" level="application" />
|
84
|
+
<orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.6.7, RVM: ruby-2.7.4) [gem]" level="application" />
|
85
85
|
</component>
|
86
86
|
<component name="RModuleSettingsStorage">
|
87
87
|
<LOAD_PATH number="2" string0="$MODULE_DIR$/lib" string1="$MODULE_DIR$/spec" />
|
@@ -91,19 +91,16 @@
|
|
91
91
|
<option name="myRootTask">
|
92
92
|
<RakeTaskImpl id="rake">
|
93
93
|
<subtasks>
|
94
|
-
<RakeTaskImpl id="bundle">
|
95
|
-
<subtasks>
|
96
|
-
<RakeTaskImpl description="Updates the ruby-advisory-db then runs bundle-audit" fullCommand="bundle:audit" id="audit" />
|
97
|
-
</subtasks>
|
98
|
-
</RakeTaskImpl>
|
99
94
|
<RakeTaskImpl description="Run all specs in spec directory, with coverage" fullCommand="coverage" id="coverage" />
|
100
|
-
<RakeTaskImpl description="Run tests, check test coverage, check code style,
|
101
|
-
<RakeTaskImpl description="Build berkeley_library-util.gemspec as berkeley_library-util-0.1.
|
95
|
+
<RakeTaskImpl description="Run tests, check test coverage, check code style, build gem" fullCommand="default" id="default" />
|
96
|
+
<RakeTaskImpl description="Build berkeley_library-util.gemspec as berkeley_library-util-0.1.6.gem" fullCommand="gem" id="gem" />
|
102
97
|
<RakeTaskImpl description="Run RuboCop with auto-correct, and output results to console" fullCommand="ra" id="ra" />
|
103
98
|
<RakeTaskImpl description="Run rubocop with HTML output" fullCommand="rubocop" id="rubocop" />
|
104
99
|
<RakeTaskImpl id="rubocop">
|
105
100
|
<subtasks>
|
106
|
-
<RakeTaskImpl description="
|
101
|
+
<RakeTaskImpl description="Autocorrect RuboCop offenses (only when it's safe)" fullCommand="rubocop:autocorrect" id="autocorrect" />
|
102
|
+
<RakeTaskImpl description="Autocorrect RuboCop offenses (safe and unsafe)" fullCommand="rubocop:autocorrect_all" id="autocorrect_all" />
|
103
|
+
<RakeTaskImpl description="" fullCommand="rubocop:auto_correct" id="auto_correct" />
|
107
104
|
</subtasks>
|
108
105
|
</RakeTaskImpl>
|
109
106
|
<RakeTaskImpl description="Run RSpec code examples" fullCommand="spec" id="spec" />
|
data/.rubocop.yml
CHANGED
@@ -332,7 +332,162 @@ Style/SwapValues: # (new in 1.1)
|
|
332
332
|
############################################################
|
333
333
|
# Added in RuboCop 1.10
|
334
334
|
|
335
|
-
Gemspec/DateAssignment: # (new in 1.10)
|
336
|
-
Enabled: true
|
337
335
|
Style/HashConversion: # (new in 1.10)
|
338
336
|
Enabled: true
|
337
|
+
|
338
|
+
############################################################
|
339
|
+
# Added in RuboCop 1.12
|
340
|
+
|
341
|
+
Style/StringChars: # (new in 1.12)
|
342
|
+
Enabled: true
|
343
|
+
|
344
|
+
############################################################
|
345
|
+
# Added in RuboCop 1.16
|
346
|
+
|
347
|
+
Lint/EmptyInPattern: # (new in 1.16)
|
348
|
+
Enabled: true
|
349
|
+
Style/InPatternThen: # (new in 1.16)
|
350
|
+
Enabled: true
|
351
|
+
Style/MultilineInPatternThen: # (new in 1.16)
|
352
|
+
Enabled: true
|
353
|
+
Style/QuotedSymbols: # (new in 1.16)
|
354
|
+
Enabled: true
|
355
|
+
|
356
|
+
############################################################
|
357
|
+
# Added in RuboCop 1.18
|
358
|
+
|
359
|
+
Layout/LineEndStringConcatenationIndentation: # (new in 1.18)
|
360
|
+
Enabled: true
|
361
|
+
|
362
|
+
############################################################
|
363
|
+
# Added in RuboCop 1.19
|
364
|
+
|
365
|
+
Lint/AmbiguousRange: # (new in 1.19)
|
366
|
+
Enabled: true
|
367
|
+
Style/RedundantSelfAssignmentBranch: # (new in 1.19)
|
368
|
+
Enabled: true
|
369
|
+
|
370
|
+
############################################################
|
371
|
+
# Added in RuboCop 1.21
|
372
|
+
|
373
|
+
Lint/AmbiguousOperatorPrecedence: # (new in 1.21)
|
374
|
+
Enabled: true
|
375
|
+
Lint/IncompatibleIoSelectWithFiberScheduler: # (new in 1.21)
|
376
|
+
Enabled: true
|
377
|
+
|
378
|
+
############################################################
|
379
|
+
# Added in RuboCop 1.22
|
380
|
+
|
381
|
+
Lint/RequireRelativeSelfPath: # (new in 1.22)
|
382
|
+
Enabled: true
|
383
|
+
Security/IoMethods: # (new in 1.22)
|
384
|
+
Enabled: true
|
385
|
+
Style/NumberedParameters: # (new in 1.22)
|
386
|
+
Enabled: true
|
387
|
+
Style/NumberedParametersLimit: # (new in 1.22)
|
388
|
+
Enabled: true
|
389
|
+
Style/SelectByRegexp: # (new in 1.22)
|
390
|
+
Enabled: true
|
391
|
+
|
392
|
+
############################################################
|
393
|
+
# Added in RuboCop 1.23
|
394
|
+
|
395
|
+
Gemspec/RequireMFA: # (new in 1.23)
|
396
|
+
Enabled: true
|
397
|
+
Lint/UselessRuby2Keywords: # (new in 1.23)
|
398
|
+
Enabled: true
|
399
|
+
Style/OpenStructUse: # (new in 1.23)
|
400
|
+
Enabled: true
|
401
|
+
|
402
|
+
############################################################
|
403
|
+
# Added in RuboCop 1.24
|
404
|
+
|
405
|
+
Naming/BlockForwarding: # (new in 1.24)
|
406
|
+
Enabled: true
|
407
|
+
Style/FileRead: # (new in 1.24)
|
408
|
+
Enabled: true
|
409
|
+
Style/FileWrite: # (new in 1.24)
|
410
|
+
Enabled: true
|
411
|
+
Style/MapToHash: # (new in 1.24)
|
412
|
+
Enabled: true
|
413
|
+
|
414
|
+
############################################################
|
415
|
+
# Added in RuboCop 1.26
|
416
|
+
|
417
|
+
Style/NestedFileDirname: # (new in 1.26)
|
418
|
+
Enabled: true
|
419
|
+
|
420
|
+
############################################################
|
421
|
+
# Added in RuboCop 1.27
|
422
|
+
|
423
|
+
Lint/RefinementImportMethods: # (new in 1.27)
|
424
|
+
Enabled: true
|
425
|
+
Style/RedundantInitialize: # (new in 1.27)
|
426
|
+
Enabled: true
|
427
|
+
|
428
|
+
############################################################
|
429
|
+
# Added in RuboCop 1.28
|
430
|
+
|
431
|
+
Security/CompoundHash: # (new in 1.28)
|
432
|
+
Enabled: true
|
433
|
+
Style/FetchEnvVar: # (new in 1.28)
|
434
|
+
Enabled: true
|
435
|
+
Style/ObjectThen: # (new in 1.28)
|
436
|
+
Enabled: true
|
437
|
+
|
438
|
+
############################################################
|
439
|
+
# Added in RuboCop 1.29
|
440
|
+
|
441
|
+
Style/EnvHome: # (new in 1.29)
|
442
|
+
Enabled: true
|
443
|
+
|
444
|
+
############################################################
|
445
|
+
# Added in RuboCop 1.30
|
446
|
+
|
447
|
+
Gemspec/DeprecatedAttributeAssignment: # (new in 1.30)
|
448
|
+
Enabled: true
|
449
|
+
Style/MapCompactWithConditionalBlock: # (new in 1.30)
|
450
|
+
Enabled: true
|
451
|
+
|
452
|
+
############################################################
|
453
|
+
# Added in RuboCop 1.31
|
454
|
+
|
455
|
+
Layout/LineContinuationLeadingSpace: # (new in 1.31)
|
456
|
+
Enabled: true
|
457
|
+
Layout/LineContinuationSpacing: # (new in 1.31)
|
458
|
+
Enabled: true
|
459
|
+
Lint/ConstantOverwrittenInRescue: # (new in 1.31)
|
460
|
+
Enabled: true
|
461
|
+
Lint/NonAtomicFileOperation: # (new in 1.31)
|
462
|
+
Enabled: true
|
463
|
+
|
464
|
+
############################################################
|
465
|
+
# Added in RuboCop 1.32
|
466
|
+
|
467
|
+
Lint/RequireRangeParentheses: # (new in 1.32)
|
468
|
+
Enabled: true
|
469
|
+
Style/EmptyHeredoc: # (new in 1.32)
|
470
|
+
Enabled: true
|
471
|
+
|
472
|
+
############################################################
|
473
|
+
# Added in RuboCop 1.35
|
474
|
+
|
475
|
+
Style/MagicCommentFormat: # (new in 1.35)
|
476
|
+
Enabled: true
|
477
|
+
|
478
|
+
############################################################
|
479
|
+
# Added in RuboCop 1.37
|
480
|
+
|
481
|
+
Lint/DuplicateMagicComment: # (new in 1.37)
|
482
|
+
Enabled: true
|
483
|
+
Style/OperatorMethodCall: # (new in 1.37)
|
484
|
+
Enabled: true
|
485
|
+
Style/RedundantStringEscape: # (new in 1.37)
|
486
|
+
Enabled: true
|
487
|
+
|
488
|
+
############################################################
|
489
|
+
# Added in RuboCop 1.38
|
490
|
+
|
491
|
+
Style/RedundantEach: # (new in 1.38)
|
492
|
+
Enabled: true
|
493
|
+
|
data/.simplecov
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
SimpleCov.start 'rails' do
|
1
|
+
SimpleCov.start do
|
4
2
|
add_filter 'module_info.rb'
|
5
|
-
coverage_dir 'artifacts'
|
6
|
-
|
7
|
-
|
3
|
+
coverage_dir 'artifacts/coverage'
|
4
|
+
|
5
|
+
enable_coverage :branch
|
6
|
+
minimum_coverage line: 100, branch: 100
|
8
7
|
end
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
# 0.1.7 (2023-03-15)
|
2
|
+
|
3
|
+
- Allow passing `log: false` to `Requester` methods (and corresponding `URIs` convenience
|
4
|
+
methods) to suppress logging of each request URL and response code.
|
5
|
+
- Allow constructing `Requester` instances with delayed execution
|
6
|
+
- Fix documentation for `get_response` and `head_response` in `URIs` and `Requester`
|
7
|
+
|
8
|
+
# 0.1.6 (2023-03-09)
|
9
|
+
|
10
|
+
- Fix issue in `Requester` where query parameters would not be appended properly
|
11
|
+
to URLs that already included a query string.
|
12
|
+
- Fix issue in `URIs#append` (and `Appender`) where `?` would not be accepted in
|
13
|
+
query strings or fragments, contrary to RFC 3986 §3.
|
14
|
+
- Fix documentation for `Arrays#find_indices`.
|
15
|
+
- Fix issue where `Arrays#find_index` would raise a confusing `NameError`
|
16
|
+
instead of a helpful `ArgumentError` if passed too many arguments.
|
17
|
+
|
1
18
|
# 0.1.5 (2022-09-16)
|
2
19
|
|
3
20
|
- Adds `URIs#path_escape` to escape URL path segments
|
data/Rakefile
CHANGED
@@ -16,5 +16,5 @@ ENV['RAILS_ENV'] = 'test' if ENV['CI']
|
|
16
16
|
# ------------------------------------------------------------
|
17
17
|
# Custom tasks
|
18
18
|
|
19
|
-
desc 'Run tests, check test coverage, check code style,
|
20
|
-
task default: %i[coverage rubocop
|
19
|
+
desc 'Run tests, check test coverage, check code style, build gem'
|
20
|
+
task default: %i[coverage rubocop gem]
|
@@ -17,7 +17,6 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.homepage = BerkeleyLibrary::Util::ModuleInfo::HOMEPAGE
|
18
18
|
|
19
19
|
spec.files = `git ls-files -z`.split("\x0")
|
20
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
20
|
spec.require_paths = ['lib']
|
22
21
|
|
23
22
|
spec.required_ruby_version = ruby_version
|
@@ -26,17 +25,17 @@ Gem::Specification.new do |spec|
|
|
26
25
|
spec.add_dependency 'rest-client', '~> 2.1'
|
27
26
|
spec.add_dependency 'typesafe_enum', '~> 0.3'
|
28
27
|
|
29
|
-
spec.add_development_dependency 'bundle-audit', '~> 0.1'
|
30
28
|
spec.add_development_dependency 'ci_reporter_rspec', '~> 1.0'
|
31
29
|
spec.add_development_dependency 'colorize', '~> 0.8'
|
32
30
|
spec.add_development_dependency 'dotenv', '~> 2.7'
|
33
31
|
spec.add_development_dependency 'rake', '~> 13.0'
|
34
32
|
spec.add_development_dependency 'rspec', '~> 3.10'
|
35
|
-
spec.add_development_dependency 'rubocop', '= 1.
|
36
|
-
spec.add_development_dependency 'rubocop-rake', '
|
37
|
-
spec.add_development_dependency 'rubocop-rspec', '
|
33
|
+
spec.add_development_dependency 'rubocop', '= 1.39'
|
34
|
+
spec.add_development_dependency 'rubocop-rake', '= 0.6.0'
|
35
|
+
spec.add_development_dependency 'rubocop-rspec', '= 2.4.0'
|
38
36
|
spec.add_development_dependency 'ruby-prof', '~> 0.17.0'
|
39
37
|
spec.add_development_dependency 'simplecov', '~> 0.21'
|
40
|
-
spec.add_development_dependency 'simplecov-rcov', '~> 0.2'
|
41
38
|
spec.add_development_dependency 'webmock', '~> 3.12'
|
39
|
+
|
40
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
42
41
|
end
|
@@ -45,7 +45,7 @@ module BerkeleyLibrary
|
|
45
45
|
# returns an array the length of the subset, containing for each element in
|
46
46
|
# the subset the index of the corresponding element in the superset.
|
47
47
|
#
|
48
|
-
# @overload
|
48
|
+
# @overload find_indices(for_array:, in_array:)
|
49
49
|
# For each value in `for_array`, finds the index of the first equal value
|
50
50
|
# in `in_array` after the previously matched value.
|
51
51
|
# @param in_array [Array] the list of values to look in
|
@@ -53,7 +53,7 @@ module BerkeleyLibrary
|
|
53
53
|
# @return [Array<Integer>, nil] the indices in `in_array` of each value in `for_array`,
|
54
54
|
# or `nil` if not all values could be found
|
55
55
|
#
|
56
|
-
# @overload
|
56
|
+
# @overload find_indices(for_array:, in_array:)
|
57
57
|
# For each value in `for_array`, finds the index of the first value
|
58
58
|
# in `in_array` after the previously matched value that matches
|
59
59
|
# the specified match function.
|
@@ -90,7 +90,7 @@ module BerkeleyLibrary
|
|
90
90
|
# @param start_index [Integer] the index to start with
|
91
91
|
# @return [Enumerator] a new enumerator
|
92
92
|
def find_index(*args, in_array:, start_index: 0, &block)
|
93
|
-
raise ArgumentError, "wrong number of arguments (given #{
|
93
|
+
raise ArgumentError, "wrong number of arguments (given #{args.length}, expected 0..1" if args.size > 1
|
94
94
|
return Enumerator.new { |y| find_index(in_array: in_array, start_index: start_index, &y) } if args.empty? && !block_given?
|
95
95
|
return unless (relative_index = in_array[start_index..].find_index(*args, &block))
|
96
96
|
|
@@ -11,8 +11,8 @@ module BerkeleyLibrary
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def parent_exists?(path)
|
14
|
-
path.respond_to?(:parent) && path.parent.exist? ||
|
15
|
-
path.respond_to?(:to_str) && Pathname.new(path).parent.exist?
|
14
|
+
(path.respond_to?(:parent) && path.parent.exist?) ||
|
15
|
+
(path.respond_to?(:to_str) && Pathname.new(path).parent.exist?)
|
16
16
|
end
|
17
17
|
|
18
18
|
# Returns true if `obj` is close enough to an IO object for Nokogiri
|
@@ -7,7 +7,7 @@ module BerkeleyLibrary
|
|
7
7
|
SUMMARY = 'Miscellaneous Ruby utilities for the UC Berkeley Library'.freeze
|
8
8
|
DESCRIPTION = 'A collection of miscellaneous Ruby routines for the UC Berkeley Library.'.freeze
|
9
9
|
LICENSE = 'MIT'.freeze
|
10
|
-
VERSION = '0.1.
|
10
|
+
VERSION = '0.1.7'.freeze
|
11
11
|
HOMEPAGE = 'https://github.com/BerkeleyLibrary/util'.freeze
|
12
12
|
end
|
13
13
|
end
|
@@ -22,10 +22,7 @@ module BerkeleyLibrary
|
|
22
22
|
|
23
23
|
@elements = elements.map(&:to_s)
|
24
24
|
@elements.each_with_index do |element, elem_index|
|
25
|
-
|
26
|
-
next start_fragment_at(elem_index) if element.include?('#')
|
27
|
-
|
28
|
-
add_element(element)
|
25
|
+
handle_element(element, elem_index)
|
29
26
|
end
|
30
27
|
end
|
31
28
|
|
@@ -42,8 +39,26 @@ module BerkeleyLibrary
|
|
42
39
|
end
|
43
40
|
end
|
44
41
|
|
42
|
+
# Returns the new URI as a string.
|
43
|
+
#
|
44
|
+
# @return [String] a new URI appending the joined path elements, as a string.
|
45
|
+
# @raise URI::InvalidComponentError if appending the specified elements would create an invalid URI
|
46
|
+
def to_url_str
|
47
|
+
to_uri.to_s
|
48
|
+
end
|
49
|
+
|
45
50
|
private
|
46
51
|
|
52
|
+
def handle_element(element, elem_index)
|
53
|
+
h_index = element.index('#')
|
54
|
+
q_index = element.index('?')
|
55
|
+
# per RFC 3986 §3, fragment (or query) can contain '?', but query can't contain '#'
|
56
|
+
return start_fragment_at(elem_index) if h_index && (q_index.nil? || h_index < q_index)
|
57
|
+
return start_query_at(elem_index) if q_index && !(in_query? || in_fragment?)
|
58
|
+
|
59
|
+
add_element(element)
|
60
|
+
end
|
61
|
+
|
47
62
|
def state
|
48
63
|
@state ||= :path
|
49
64
|
end
|
@@ -77,24 +92,21 @@ module BerkeleyLibrary
|
|
77
92
|
end
|
78
93
|
|
79
94
|
def start_query_at(elem_index)
|
80
|
-
raise URI::InvalidComponentError, err_query_after_fragment(elem_index) if in_fragment?
|
81
|
-
raise URI::InvalidComponentError, err_too_many_queries(elem_index) unless query_elements.empty?
|
82
|
-
|
83
95
|
handle_query_start(elem_index)
|
84
96
|
@state = :query
|
85
97
|
end
|
86
98
|
|
87
99
|
def start_fragment_at(elem_index)
|
88
100
|
raise URI::InvalidComponentError, err_too_many_fragments(elem_index) unless fragment_elements.empty?
|
89
|
-
raise URI::InvalidComponentError,
|
101
|
+
raise URI::InvalidComponentError, err_too_many_fragments(elem_index) if too_many_fragments?(elem_index)
|
90
102
|
|
91
103
|
handle_fragment_start(elem_index)
|
92
104
|
@state = :fragment
|
93
105
|
end
|
94
106
|
|
95
|
-
def
|
107
|
+
def too_many_fragments?(elem_index)
|
96
108
|
e = elements[elem_index]
|
97
|
-
e.index('
|
109
|
+
e.index('#', 1 + e.index('#'))
|
98
110
|
end
|
99
111
|
|
100
112
|
def add_element(e)
|
@@ -122,7 +134,7 @@ module BerkeleyLibrary
|
|
122
134
|
return q_start unless (f_index = q_start.index('#'))
|
123
135
|
|
124
136
|
next_index = elem_index + 1
|
125
|
-
q_start, q_next = split_around(q_start, f_index)
|
137
|
+
q_start, q_next = split_around(q_start, f_index) # NOTE: this doesn't return the '#'
|
126
138
|
elements[next_index] = "##{q_next}#{elements[next_index]}" # so we prepend one here
|
127
139
|
q_start
|
128
140
|
end
|
@@ -146,14 +158,6 @@ module BerkeleyLibrary
|
|
146
158
|
[s[0...i], s[(i + 1)..]]
|
147
159
|
end
|
148
160
|
|
149
|
-
def err_too_many_queries(elem_index)
|
150
|
-
"#{elements[elem_index].inspect}: URI already has a query string: #{query.inspect}"
|
151
|
-
end
|
152
|
-
|
153
|
-
def err_query_after_fragment(elem_index)
|
154
|
-
"#{elements[elem_index].inspect}: Query delimiter '?' cannot follow fragment delimeter '#'"
|
155
|
-
end
|
156
|
-
|
157
161
|
def err_too_many_fragments(elem_index)
|
158
162
|
"#{elements[elem_index].inspect}: URI already has a fragment: #{fragment.inspect}"
|
159
163
|
end
|