httpdisk 0.5.2 → 1.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 534d055da653551f2dbf23db1c323c6858fcaa0bab09354491c175bffadf6d54
4
- data.tar.gz: 825a6779fec3c5ce2828363e9022da231017ae2d13aa8fa88acff9692d8cd7fe
3
+ metadata.gz: a35e463161cc63ce5dd053c02f0d8b517259e4652728a5683b155e9b524d9363
4
+ data.tar.gz: 121bb5943d1777edab3a2de4afeac45fc115b09c8611f5e9e3ec45b1715f7d96
5
5
  SHA512:
6
- metadata.gz: 750eaaca6bba23b1a8af351d916c79e470928c23cb3f6517662d6e99a7278c963cfe9dbbde564282d1367dd0f6bb34c166066b2babdb29d1c29f398fe9498245
7
- data.tar.gz: 951f2f668018872bd4a970be506e4fc4c9dce302b4fa03e310eb0269dba428216bdd23a4da1a6fa86ad75f2e75b5d3fbe9988e1018cd328c6bbf6eb790d3406c
6
+ metadata.gz: 7af2b847f020f2a15ca729106702eb08cc577760603d996fe7053977538005bee054aad1a143b9a8aadc1dcb5003ae50e281c115b52647a54fc8395514458da1
7
+ data.tar.gz: fac9ff5f3cb745e267dd7a8f508599c3a5e83ddb6f0924d4c3ca078845c99146808eb7af55c6173ff98be397b5f349ea94b3046c83dfae9ad52498ada6b0b855
@@ -1,12 +1,11 @@
1
1
  name: test
2
2
 
3
3
  on:
4
- push:
5
- paths-ignore:
6
- - '**.md'
7
4
  pull_request:
8
- paths-ignore:
9
- - '**.md'
5
+ paths-ignore: ["**.md"]
6
+ push:
7
+ branches: [main]
8
+ paths-ignore: ["**.md"]
10
9
  workflow_dispatch:
11
10
 
12
11
  jobs:
@@ -15,12 +14,17 @@ jobs:
15
14
  max-parallel: 3
16
15
  matrix:
17
16
  os: [ubuntu, macos]
18
- ruby-version: [head, 3.0, 2.7]
17
+ ruby-version: [4, 3.4, 3.2]
19
18
  runs-on: ${{ matrix.os }}-latest
20
19
  steps:
21
- - uses: actions/checkout@v2
22
- - uses: ruby/setup-ruby@v1
20
+ - uses: actions/checkout@v6
21
+ - uses: jdx/mise-action@v3
23
22
  with:
24
- ruby-version: ${{ matrix.ruby-version }}
25
- - run: bundle install
26
- - run: bundle exec rake test
23
+ experimental: true # required for post-install and binary rubies
24
+ mise_toml: |
25
+ [hooks]
26
+ postinstall = ['bundle install']
27
+ [tools]
28
+ just = "latest"
29
+ ruby = "${{ matrix.ruby-version }}"
30
+ - run: just check
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
- .ruby-version
2
1
  .vscode
3
2
  *.gem
3
+ # gems don't need to include this since the gemspec is enough
4
+ Gemfile.lock
data/.justfile ADDED
@@ -0,0 +1,51 @@
1
+ default:
2
+ just --list
3
+
4
+ #
5
+ # dev
6
+ #
7
+
8
+ check: lint test
9
+
10
+ fmt:
11
+ rubocop -a
12
+
13
+ lint:
14
+ rubocop
15
+
16
+ pry:
17
+ pry -I lib -r httpdisk.rb
18
+
19
+ test:
20
+ rake test
21
+
22
+ test-watch:
23
+ watchexec --stop-timeout=0 --clear=clear just test
24
+
25
+
26
+ #
27
+ # gem tasks
28
+ #
29
+
30
+ gemver := `cat lib/httpdisk/version.rb | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+"`
31
+
32
+ gem-push: check-git-status
33
+ just banner gem build...
34
+ gem build httpdisk.gemspec
35
+ just banner tag...
36
+ git tag -a "v{{gemver}}" -m "Tagging {{gemver}}"
37
+ git push --tags
38
+ just banner gem push...
39
+ gem push "httpdisk-{{gemver}}.gem"
40
+
41
+ #
42
+ # util
43
+ #
44
+
45
+ set quiet
46
+
47
+ banner +args:
48
+ printf '\e[38;5;231;48;2;64;160;43;m{{BOLD}}[%s] %-72s {{NORMAL}}\n' "$(date +%H:%M:%S)" "{{args}}"
49
+
50
+ check-git-status:
51
+ if [ ! -z "$(git status --porcelain)" ]; then echo "git status is dirty, bailing."; exit 1; fi
data/.rubocop.yml CHANGED
@@ -1,28 +1,63 @@
1
+ require:
2
+ - standard
3
+
4
+ inherit_gem:
5
+ standard: config/ruby-3.3.yml
6
+ standard-custom: config/base.yml
7
+ standard-performance: config/base.yml
8
+
9
+ plugins:
10
+ - standard-custom
11
+ - standard-performance
12
+ - rubocop-performance
13
+
1
14
  AllCops:
15
+ # We completely override Exclude rather than using `inherit_mode: merge` because
16
+ # we want to undo the exclusion of `bin/*` from rubocop-rails. So we must recreate the
17
+ # full exclusion list from all of our parent configs.
18
+ Exclude:
19
+ - .git/**/*
20
+ - tmp/**/*
21
+ - vendor/**/*
2
22
  NewCops: enable
3
23
  SuggestExtensions: false
4
24
 
5
- # this is buggy in 2.7.0
6
- Style/HashTransformValues: { Enabled: false }
25
+ #
26
+ # fight with standardrb!
27
+ #
28
+
29
+ Bundler/OrderedGems: { Enabled: true } # sort Gemfile
30
+ Lint/MissingSuper: { Enabled: true } # must call `super`
31
+ Lint/NonLocalExitFromIterator: { Enabled: false } # allow return in iterators
32
+ Lint/RedundantDirGlobSort: { Enabled: true } # glob already sorted
33
+ Naming/FileName: { Enabled: true } # duh
34
+ Naming/MemoizedInstanceVariableName: { Enabled: true } # clean memo ivars
35
+ Naming/MethodName: { Enabled: true } # keep method names conventional
36
+ Performance/MapCompact: { Enabled: true } # filter_map-ish style
37
+ Performance/RegexpMatch: { Enabled: false } # local style is fine
38
+ Performance/SelectMap: { Enabled: true } # filter_map-ish style
39
+ Style/BlockDelimiters: { Enabled: true } # do/end vs braces
40
+ Style/ClassMethodsDefinitions: { Enabled: true } # avoid "class << self"
41
+ Style/CollectionCompact: { Enabled: true } # compact over reject
42
+ Style/CollectionMethods: { Enabled: true } # modern collection helpers
43
+ Style/FrozenStringLiteralComment: { Enabled: true, EnforcedStyle: never } # nope
44
+ Style/HashEachMethods: { Enabled: true } # each_key/value helpers
45
+ Style/HashSyntax: { EnforcedShorthandSyntax: always } # modern hash syntax
46
+ Style/HashTransformKeys: { Enabled: true } # transform_keys
47
+ Style/HashTransformValues: { Enabled: true } # transform_values
48
+ Style/MinMax: { Enabled: true } # minmax when fitting
49
+ Style/NestedTernaryOperator: { Enabled: false } # we do this sometimes
50
+ Style/NonNilCheck: { Enabled: false } # allow x != nil for clarity
51
+ Style/PreferredHashMethods: { Enabled: true } # modern hash helpers
52
+ Style/RedundantAssignment: { Enabled: false } # allows s=xxx;s=yyy;s
53
+ Style/RedundantInitialize: { Enabled: true } # remove pointless initialize
54
+ Style/RedundantReturn: { Enabled: false } # sometimes we do this while working on something
55
+ Style/SelectByRegexp: { Enabled: true } # grep-like selection
56
+ Style/StringConcatenation: { Enabled: true } # interpolation
57
+ Style/SymbolArray: { Enabled: true } # %i for symbol arrays
58
+ Style/TrailingCommaInArrayLiteral: { EnforcedStyleForMultiline: consistent_comma } # commas!!
59
+ Style/TrailingCommaInHashLiteral: { EnforcedStyleForMultiline: consistent_comma } # commas!!
60
+ Style/WordArray: { Enabled: true } # %w for word arrays
7
61
 
8
- # minimal personal preference
9
- Layout/CaseIndentation: { Enabled: false }
10
- Layout/EndAlignment: { EnforcedStyleAlignWith: variable }
11
- Lint/AssignmentInCondition: { Enabled: false }
12
- Lint/NonLocalExitFromIterator: { Enabled: false }
13
- Metrics: { Enabled: false }
14
- Naming/MethodParameterName: { Enabled: false }
15
- Naming/VariableNumber: { Enabled: false }
16
- Style/Documentation: { Enabled: false }
17
- Style/DoubleNegation: { Enabled: false }
18
- Style/EmptyCaseCondition: { Enabled: false }
19
- Style/FrozenStringLiteralComment: { Enabled: false }
20
- Style/GuardClause: { Enabled: false }
21
- Style/IfUnlessModifier: { Enabled: false }
22
- Style/NegatedIf: { Enabled: false }
23
- Style/NumericPredicate: { Enabled: false }
24
- Style/ParallelAssignment: { Enabled: false }
25
- Style/SoleNestedConditional: { Enabled: false }
26
- Style/StderrPuts: { Enabled: false }
27
- Style/TrailingCommaInArrayLiteral: { EnforcedStyleForMultiline: consistent_comma }
28
- Style/TrailingCommaInHashLiteral: { EnforcedStyleForMultiline: consistent_comma }
62
+ # dup w/ standardrb?
63
+ # Layout/EmptyLineBetweenDefs: { AllowAdjacentOneLineDefs: true } # allow compact one-liners
data/AGENTS.md ADDED
@@ -0,0 +1,56 @@
1
+ # AGENTS
2
+
3
+ ## Workflow
4
+
5
+ - Prefer `just` recipes vs raw cli
6
+ - After code changes, run `just check`
7
+ - Do not run rubocop or prettier directly; use `just fmt` or `just lint`
8
+ - Don't be overly defensive, fail fast
9
+ - Keep commit messages under 80 chars
10
+
11
+ ## Layout
12
+
13
+ - Executables in `bin/`
14
+ - Support code and domain logic in `lib/`
15
+
16
+ ## Coding Style
17
+
18
+ - Be concise, we value that highly
19
+ - Favor early returns, functional/immutable helpers, minimal, golden path
20
+ - Keep code small, direct, and easy to scan
21
+ - Prefer symbol-keyed hashes
22
+ - Prefer `hash[:key]` over `fetch`; use `fetch` when a missing key should fail fast
23
+ - Avoid `to_s` / `to_sym` churn unless it solves a real boundary problem
24
+ - Methods with >=3 args are a code smell, esp. when forwarded; prefer context:, options:, or refactor
25
+ - When using a shell, use argv arrays to avoid escaping issues
26
+ - Avoid compatibility class aliases
27
+
28
+ ## Formatting
29
+
30
+ - Trivial methods can be one-liners, only if <100 chars
31
+ - If a file has several one-liners, group them under `# one-liners` at bottom and alphabetize
32
+ - Use `_1` / `_2` for simple blocks when clear
33
+ - Add a short top-level comment to each source file
34
+ - A single line comment above complex code sections can be helpful
35
+
36
+ ## Bin Scripts
37
+
38
+ - `Main` is a fine class name for things in bin/
39
+ - Scripts in bin/ always use BinMain, Sloppier and TableTennis
40
+ - Nice output with `ap` or writing CSVs to /tmp
41
+ - Use `delegate:` for `options` with sloppier
42
+
43
+ ## Tests
44
+
45
+ - New behavior should usually come with tests
46
+ - Bug fixes should usually add or update a test
47
+ - Keep tests small and deterministic
48
+ - Avoid dependency injection, Ruby doesn't use that. Mock/stub
49
+
50
+ ## Defaults
51
+
52
+ - Match the repo's existing test style
53
+ - Prefer existing repo patterns over new abstractions
54
+ - Prefer straightforward over clever
55
+ - Keep comments light and useful
56
+ - Be conservative about adding deps, core ext, or globals
data/Gemfile CHANGED
@@ -1,11 +1,11 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
  gemspec
3
3
 
4
4
  group :development, :test do
5
- gem 'minitest'
6
- gem 'mocha'
7
- gem 'pry'
8
- gem 'rake'
9
- gem 'rubocop', '~> 1.13.0'
10
- gem 'webmock'
5
+ gem "minitest"
6
+ gem "mocha"
7
+ gem "pry"
8
+ gem "rake"
9
+ gem "standard", require: false
10
+ gem "webmock"
11
11
  end
data/README.md CHANGED
@@ -128,10 +128,12 @@ httpdisk will honor the `Content-Type` from responses. Unfortunately, it is enti
128
128
  httpdisk supports a few options:
129
129
 
130
130
  - `dir:` location for disk cache, defaults to `~/httpdisk`
131
+ - `compress:` if false, write plain cache files instead of gzip
131
132
  - `expires:` when to expire cached requests, default is nil (never expire)
132
133
  - `force:` don't read anything from cache (but still write)
133
134
  - `force_errors:` don't read errors from cache (but still write)
134
135
  - `ignore_params:` array of query params to ignore when calculating cache_key
136
+ - `key_transform:` proc that can mutate the `HTTPDisk::CacheKey`
135
137
  - `logger`: log requests to stderr, or pass your own logger
136
138
  - `utf8`: if true, force text response bodies to valid UTF-8
137
139
 
@@ -171,8 +173,9 @@ Specific to httpdisk:
171
173
 
172
174
  ## Goodies: httpdisk-grep
173
175
 
174
- The `httpdisk-grep` command makes it easy to search your cache directory.
175
- It can be challenging to use grep/ripgrep because cache files are compressed and JSON bodies often lack newlines. httpdisk-grep is the right tool for the job. See `httpdisk-grep --help`.
176
+ The `httpdisk-grep` command makes it easy to search your cache directory. It can be challenging to use grep/ripgrep because cache files are compressed and JSON bodies often lack newlines. httpdisk-grep is the right tool for the job. See `httpdisk-grep --help`.
177
+
178
+ An alternative is to use [ripgrep-all](https://github.com/phiresky/ripgrep-all) with the `--rga-accurate` flag. Ripgrep-all works well for large caches, though it lacks some of the niceties of `httpdisk-grep`.
176
179
 
177
180
  ## Limitations & Gotchas
178
181
 
@@ -184,6 +187,18 @@ It can be challenging to use grep/ripgrep because cache files are compressed and
184
187
 
185
188
  ## Changelog
186
189
 
190
+ #### 1.0.1
191
+
192
+ - added `compress: false` to disable compression (#9, thx `@aspiers`)
193
+ - added key_transform for cache key customization
194
+ - moved to Mise
195
+ - deps
196
+
197
+ #### 1.0
198
+
199
+ - support faraday 2, minimum Ruby is 3.1 now
200
+ - moved to Justfile and Standard
201
+
187
202
  #### 0.5
188
203
 
189
204
  - honor Content-Type
data/Rakefile CHANGED
@@ -1,58 +1,5 @@
1
- require 'bundler/setup'
2
- require 'rake/testtask'
1
+ require "bundler/setup"
2
+ require "rake/testtask"
3
3
 
4
- # load the spec, we use it below
5
- spec = Gem::Specification.load('httpdisk.gemspec')
6
-
7
- #
8
- # testing
9
- # don't forget about TESTOPTS="--verbose" rake
10
- #
11
-
12
- # test (default)
13
- Rake::TestTask.new do
14
- _1.libs << 'test'
15
- _1.warning = false # https://github.com/lostisland/faraday/issues/1285
16
- end
4
+ Rake::TestTask.new
17
5
  task default: :test
18
-
19
- # Watch rb files, run tests whenever something changes
20
- task :watch do
21
- sh "find . -name '*.rb' | entr -c rake"
22
- end
23
-
24
- #
25
- # pry
26
- #
27
-
28
- task :pry do
29
- sh 'pry -I lib -r httpdisk.rb'
30
- end
31
-
32
- #
33
- # rubocop
34
- #
35
-
36
- task :rubocop do
37
- sh 'bundle exec rubocop -A .'
38
- end
39
-
40
- #
41
- # gem
42
- #
43
-
44
- task :build do
45
- sh 'gem build --quiet httpdisk.gemspec'
46
- end
47
-
48
- task install: :build do
49
- sh "gem install --quiet httpdisk-#{spec.version}.gem"
50
- end
51
-
52
- task release: %i[rubocop test build] do
53
- raise "looks like git isn't clean" unless `git status --porcelain`.empty?
54
-
55
- sh "git tag -a #{spec.version} -m 'Tagging #{spec.version}'"
56
- sh 'git push --tags'
57
- sh "gem push httpdisk-#{spec.version}.gem"
58
- end
data/bin/httpdisk CHANGED
@@ -4,23 +4,23 @@
4
4
  # Main bin. Most of the interesting stuff is in HTTPDisk, for ease of testing.
5
5
  #
6
6
 
7
- $LOAD_PATH.unshift(File.join(__dir__, '../lib'))
7
+ $LOAD_PATH.unshift(File.join(__dir__, "../lib"))
8
8
 
9
9
  BIN = File.basename($PROGRAM_NAME)
10
10
 
11
11
  def puts_error(s)
12
- $stderr.puts "#{BIN}: #{s}"
12
+ warn "#{BIN}: #{s}"
13
13
  end
14
14
 
15
15
  #
16
16
  # Load the bare minimum and parse args with slop. We do this separately for speed.
17
17
  #
18
18
 
19
- require 'httpdisk/cli/args'
19
+ require "httpdisk/cli/args"
20
20
  begin
21
21
  slop = HTTPDisk::Cli::Args.slop(ARGV)
22
22
  rescue Slop::Error => e
23
- puts_error(e) if e.message != ''
23
+ puts_error(e) if e.message != ""
24
24
  puts_error("try '#{BIN} --help' for more information")
25
25
  exit 1
26
26
  end
@@ -29,15 +29,15 @@ end
29
29
  # now load everything and run
30
30
  #
31
31
 
32
- require 'httpdisk'
32
+ require "httpdisk"
33
33
  main = HTTPDisk::Cli::Main.new(slop)
34
34
  begin
35
35
  main.run
36
- rescue StandardError => e
36
+ rescue => e
37
37
  puts_error(e) if !main.options[:silent]
38
- if ENV['HTTPDISK_DEBUG']
38
+ if ENV["HTTPDISK_DEBUG"]
39
39
  $stderr.puts
40
- $stderr.puts e.backtrace.join("\n")
40
+ warn e.backtrace.join("\n")
41
41
  end
42
42
  exit 1
43
43
  end
data/bin/httpdisk-grep CHANGED
@@ -4,23 +4,23 @@
4
4
  # Search an HTTPDisk cache, similar to grep.
5
5
  #
6
6
 
7
- $LOAD_PATH.unshift(File.join(__dir__, '../lib'))
7
+ $LOAD_PATH.unshift(File.join(__dir__, "../lib"))
8
8
 
9
9
  BIN = File.basename($PROGRAM_NAME)
10
10
 
11
11
  def puts_error(s)
12
- $stderr.puts "#{BIN}: #{s}"
12
+ warn "#{BIN}: #{s}"
13
13
  end
14
14
 
15
15
  #
16
16
  # Load the bare minimum and parse args with slop. We do this separately for speed.
17
17
  #
18
18
 
19
- require 'httpdisk/grep/args'
19
+ require "httpdisk/grep/args"
20
20
  begin
21
21
  slop = HTTPDisk::Grep::Args.slop(ARGV)
22
22
  rescue Slop::Error => e
23
- puts_error(e) if e.message != ''
23
+ puts_error(e) if e.message != ""
24
24
  puts_error("try '#{BIN} --help' for more information")
25
25
  exit 1
26
26
  end
@@ -29,18 +29,18 @@ end
29
29
  # now load everything and run
30
30
  #
31
31
 
32
- require 'httpdisk'
32
+ require "httpdisk"
33
33
 
34
34
  main = HTTPDisk::Grep::Main.new(slop)
35
35
  begin
36
36
  success = main.run
37
37
  exit 1 if !success
38
- rescue StandardError => e
38
+ rescue => e
39
39
  puts_error(e)
40
- if ENV['HTTPDISK_DEBUG']
40
+ if ENV["HTTPDISK_DEBUG"]
41
41
  $stderr.puts
42
- $stderr.puts e.class
43
- $stderr.puts e.backtrace.join("\n")
42
+ warn e.class
43
+ warn e.backtrace.join("\n")
44
44
  end
45
45
  exit 2
46
46
  end
data/examples.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- $LOAD_PATH.unshift(File.join(__dir__, 'lib'))
3
+ $LOAD_PATH.unshift(File.join(__dir__, "lib"))
4
4
 
5
- require 'httpdisk'
6
- require 'json'
5
+ require "httpdisk"
6
+ require "json"
7
7
 
8
8
  class Examples
9
9
  #
@@ -15,12 +15,12 @@ class Examples
15
15
  _1.use :httpdisk, force: true
16
16
  end
17
17
 
18
- faraday.get('http://www.google.com', nil, { "User-Agent": 'test-agent' })
19
- faraday.get('http://www.google.com', { q: 'ruby' })
20
- faraday.post('http://httpbin.org/post', 'name=hello')
18
+ faraday.get("http://www.google.com", nil, {"User-Agent": "test-agent"})
19
+ faraday.get("http://www.google.com", {q: "ruby"})
20
+ faraday.post("http://httpbin.org/post", "name=hello")
21
21
 
22
22
  3.times { puts }
23
- response = faraday.get('http://httpbingo.org/get')
23
+ response = faraday.get("http://httpbingo.org/get")
24
24
  puts response.env.url
25
25
  puts JSON.pretty_generate(JSON.parse(response.body))
26
26
  end
@@ -33,8 +33,8 @@ class Examples
33
33
  def better
34
34
  faraday = Faraday.new do
35
35
  # options
36
- _1.headers['User-Agent'] = 'HTTPDisk'
37
- _1.params.update(hello: 'world')
36
+ _1.headers["User-Agent"] = "HTTPDisk"
37
+ _1.params.update(hello: "world")
38
38
  _1.options.timeout = 10
39
39
 
40
40
  # middleware
@@ -51,25 +51,25 @@ class Examples
51
51
  methods: %w[delete get head options patch post put trace],
52
52
  retry_statuses: (400..600).to_a,
53
53
  retry_if: ->(_env, _err) { true },
54
- }.freeze
54
+ }
55
55
  _1.request :retry, retry_options
56
56
  end
57
57
 
58
58
  # get w/ params
59
59
  3.times { puts }
60
- response = faraday.get('http://httpbingo.org/get', { q: 'query' })
60
+ response = faraday.get("http://httpbingo.org/get", {q: "query"})
61
61
  puts response.env.url
62
62
  puts JSON.pretty_generate(response.body)
63
63
 
64
64
  # post w/ encoded form body
65
65
  3.times { puts }
66
- response = faraday.post('http://httpbingo.org/post', 'a=1&b=2')
66
+ response = faraday.post("http://httpbingo.org/post", "a=1&b=2")
67
67
  puts response.env.url
68
68
  puts JSON.pretty_generate(response.body)
69
69
 
70
70
  # post w/ auto-encoded form hash
71
71
  3.times { puts }
72
- response = faraday.post('http://httpbingo.org/post', { input: 'body' })
72
+ response = faraday.post("http://httpbingo.org/post", {input: "body"})
73
73
  puts response.env.url
74
74
  puts JSON.pretty_generate(response.body)
75
75
  end
@@ -82,8 +82,8 @@ class Examples
82
82
  def json
83
83
  faraday = Faraday.new do
84
84
  # options
85
- _1.headers['User-Agent'] = 'HTTPDisk'
86
- _1.params.update(hello: 'world')
85
+ _1.headers["User-Agent"] = "HTTPDisk"
86
+ _1.params.update(hello: "world")
87
87
  _1.options.timeout = 10
88
88
 
89
89
  # middleware
@@ -100,12 +100,12 @@ class Examples
100
100
  methods: %w[delete get head options patch post put trace],
101
101
  retry_statuses: (400..600).to_a,
102
102
  retry_if: ->(_env, _err) { true },
103
- }.freeze
103
+ }
104
104
  _1.request :retry, retry_options
105
105
  end
106
106
 
107
107
  3.times { puts }
108
- response = faraday.post('http://httpbingo.org/post', { this_is: ['json'] })
108
+ response = faraday.post("http://httpbingo.org/post", {this_is: ["json"]})
109
109
  puts response.env.url
110
110
  puts JSON.pretty_generate(response.body)
111
111
  end
data/httpdisk.gemspec CHANGED
@@ -1,29 +1,33 @@
1
- require_relative 'lib/httpdisk/version'
1
+ require_relative "lib/httpdisk/version"
2
2
 
3
3
  Gem::Specification.new do |s|
4
- s.name = 'httpdisk'
4
+ s.name = "httpdisk"
5
5
  s.version = HTTPDisk::VERSION
6
- s.authors = ['Adam Doppelt']
7
- s.email = 'amd@gurge.com'
6
+ s.authors = ["Adam Doppelt"]
7
+ s.email = "amd@gurge.com"
8
8
 
9
- s.summary = 'httpdisk - disk cache for faraday'
10
- s.description = 'httpdisk works with faraday to aggressively cache responses on disk.'
11
- s.homepage = 'http://github.com/gurgeous/httpdisk'
12
- s.license = 'MIT'
13
- s.required_ruby_version = '>= 2.7.0'
9
+ s.summary = "httpdisk - disk cache for faraday"
10
+ s.description = "httpdisk works with faraday to aggressively cache responses on disk."
11
+ s.homepage = "http://github.com/gurgeous/httpdisk"
12
+ s.license = "MIT"
13
+ s.required_ruby_version = ">= 3.2.0"
14
+ s.metadata["rubygems_mfa_required"] = "true"
14
15
 
15
16
  # what's in the gem?
16
17
  s.files = Dir.chdir(File.expand_path(__dir__)) do
17
18
  `git ls-files -z`.split("\x0").reject { _1.match(%r{^test/}) }
18
19
  end
19
- s.bindir = 'bin'
20
+ s.bindir = "bin"
20
21
  s.executables = s.files.grep(%r{^#{s.bindir}/}) { File.basename(_1) }
21
- s.require_paths = ['lib']
22
+ s.require_paths = ["lib"]
22
23
 
23
24
  # gem dependencies
24
- s.add_dependency 'content-type', '~> 0.0'
25
- s.add_dependency 'faraday', '~> 1.4'
26
- s.add_dependency 'faraday-cookie_jar', '~> 0.0'
27
- s.add_dependency 'faraday_middleware', '~> 1.0'
28
- s.add_dependency 'slop', '~> 4.8'
25
+ s.add_dependency "base64", "~> 0.3" # required for 3.4
26
+ s.add_dependency "cgi", "~> 0.5" # required for 4
27
+ s.add_dependency "content-type", "~> 0.0"
28
+ s.add_dependency "faraday", "~> 2.14"
29
+ s.add_dependency "faraday-cookie_jar", "~> 0.0"
30
+ s.add_dependency "faraday-follow_redirects", "~> 0.5"
31
+ s.add_dependency "ostruct", "~> 0.6" # required for 3.5
32
+ s.add_dependency "slop", "~> 4.10"
29
33
  end