berkeley_library-util 0.1.4 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- 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 +161 -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 +15 -19
- data/lib/berkeley_library/util/uris/requester.rb +40 -13
- data/lib/berkeley_library/util/uris.rb +68 -3
- 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 +79 -0
- data/spec/berkeley_library/util/uris_spec.rb +157 -14
- 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: a17e4e3e2e6e03e0dda795450e724650a0a7f7ae44db3b7a558bc371d8bed1b7
|
4
|
+
data.tar.gz: 106ff7e21c1e9568f4bdabc116023c292878f4fd629e5ee3ada934b2c2a10b43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4fbde8aa9e43a7ad7c414b92b488c5d2af1ae29c7f28a7ecd8f6ceb308e42c3c27a2256994362b15cba5133ec00feb32d5fe76f0b774577b292be6c2ba08528
|
7
|
+
data.tar.gz: 23c41cbed1b0befc458c8989792c45cf7429905b06e2deec72a88478f8eb7676a6e3be96dae5fa308239bb4f70b19acae421593711c20dd22d305f55262b0f64
|
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.2
|
12
|
-
<orderEntry type="library" scope="PROVIDED" name="actionview (v7.0.2
|
13
|
-
<orderEntry type="library" scope="PROVIDED" name="activesupport (v7.0.2
|
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.2
|
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
@@ -55,6 +55,10 @@ Style/CommentedKeyword:
|
|
55
55
|
Style/Documentation:
|
56
56
|
Enabled: false
|
57
57
|
|
58
|
+
# You say "cryptic", I say "compact"
|
59
|
+
Style/FormatString:
|
60
|
+
EnforcedStyle: percent
|
61
|
+
|
58
62
|
# Adding more line noise to format strings will not improve them
|
59
63
|
Style/FormatStringToken:
|
60
64
|
Enabled: false
|
@@ -328,7 +332,162 @@ Style/SwapValues: # (new in 1.1)
|
|
328
332
|
############################################################
|
329
333
|
# Added in RuboCop 1.10
|
330
334
|
|
331
|
-
Gemspec/DateAssignment: # (new in 1.10)
|
332
|
-
Enabled: true
|
333
335
|
Style/HashConversion: # (new in 1.10)
|
334
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.6 (2023-03-09)
|
2
|
+
|
3
|
+
- Fix issue in `Requester` where query parameters would not be appended properly
|
4
|
+
to URLs that already included a query string.
|
5
|
+
- Fix issue in `URIs#append` (and `Appender`) where `?` would not be accepted in
|
6
|
+
query strings or fragments, contrary to RFC 3986 §3.
|
7
|
+
- Fix documentation for `Arrays#find_indices`.
|
8
|
+
- Fix issue where `Arrays#find_index` would raise a confusing `NameError`
|
9
|
+
instead of a helpful `ArgumentError` if passed too many arguments.
|
10
|
+
|
11
|
+
# 0.1.5 (2022-09-16)
|
12
|
+
|
13
|
+
- Adds `URIs#path_escape` to escape URL path segments
|
14
|
+
- Adds `URIs#head` and `URIs#head_response`, to make a HEAD request and return the HTTP status code
|
15
|
+
and raw response object, respectively
|
16
|
+
- Clarifies documentation for `URIs#get` and `URIs#get_response` regarding unsuccessful requests
|
17
|
+
|
1
18
|
# 0.1.4 (2022-07-20)
|
2
19
|
|
3
20
|
- Adds `URIs#safe_parse_uri`, which returns `nil` for invalid URLs (unlike `URIs#uri_or_nil`, which
|
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.6'.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
|
|
@@ -44,6 +41,16 @@ module BerkeleyLibrary
|
|
44
41
|
|
45
42
|
private
|
46
43
|
|
44
|
+
def handle_element(element, elem_index)
|
45
|
+
h_index = element.index('#')
|
46
|
+
q_index = element.index('?')
|
47
|
+
# per RFC 3986 §3, fragment (or query) can contain '?', but query can't contain '#'
|
48
|
+
return start_fragment_at(elem_index) if h_index && (q_index.nil? || h_index < q_index)
|
49
|
+
return start_query_at(elem_index) if q_index && !(in_query? || in_fragment?)
|
50
|
+
|
51
|
+
add_element(element)
|
52
|
+
end
|
53
|
+
|
47
54
|
def state
|
48
55
|
@state ||= :path
|
49
56
|
end
|
@@ -77,24 +84,21 @@ module BerkeleyLibrary
|
|
77
84
|
end
|
78
85
|
|
79
86
|
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
87
|
handle_query_start(elem_index)
|
84
88
|
@state = :query
|
85
89
|
end
|
86
90
|
|
87
91
|
def start_fragment_at(elem_index)
|
88
92
|
raise URI::InvalidComponentError, err_too_many_fragments(elem_index) unless fragment_elements.empty?
|
89
|
-
raise URI::InvalidComponentError,
|
93
|
+
raise URI::InvalidComponentError, err_too_many_fragments(elem_index) if too_many_fragments?(elem_index)
|
90
94
|
|
91
95
|
handle_fragment_start(elem_index)
|
92
96
|
@state = :fragment
|
93
97
|
end
|
94
98
|
|
95
|
-
def
|
99
|
+
def too_many_fragments?(elem_index)
|
96
100
|
e = elements[elem_index]
|
97
|
-
e.index('
|
101
|
+
e.index('#', 1 + e.index('#'))
|
98
102
|
end
|
99
103
|
|
100
104
|
def add_element(e)
|
@@ -122,7 +126,7 @@ module BerkeleyLibrary
|
|
122
126
|
return q_start unless (f_index = q_start.index('#'))
|
123
127
|
|
124
128
|
next_index = elem_index + 1
|
125
|
-
q_start, q_next = split_around(q_start, f_index)
|
129
|
+
q_start, q_next = split_around(q_start, f_index) # NOTE: this doesn't return the '#'
|
126
130
|
elements[next_index] = "##{q_next}#{elements[next_index]}" # so we prepend one here
|
127
131
|
q_start
|
128
132
|
end
|
@@ -146,14 +150,6 @@ module BerkeleyLibrary
|
|
146
150
|
[s[0...i], s[(i + 1)..]]
|
147
151
|
end
|
148
152
|
|
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
153
|
def err_too_many_fragments(elem_index)
|
158
154
|
"#{elements[elem_index].inspect}: URI already has a fragment: #{fragment.inspect}"
|
159
155
|
end
|