New Upstream Release - ruby-adsf
Ready changes
Summary
Merged new upstream version: 1.4.7+dfsg1 (was: 1.4.6+dfsg1).
Diff
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
new file mode 100644
index 0000000..2f6ff27
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE.md
@@ -0,0 +1,17 @@
+### Steps to reproduce
+
+1. [First step]
+2. [Second step]
+3. …
+
+### Expected behavior
+
+(Describe what you expected to happen.)
+
+### Actual behavior
+
+(Describe what actually happened instead.)
+
+### Details
+
+(Describe other details, if any, that you believe might be relevant.)
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 0000000..6ba47eb
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,16 @@
+### Detailed description
+
+(Describe the change in detail.)
+
+### To do
+
+(Include the to-do list for this PR to be finished here.)
+
+- [ ] Tests
+- [ ] Documentation
+- [ ] Feature flags
+- [ ] …
+
+### Related issues
+
+(Add issue IDs for related issues here.)
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000..6077d35
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,7 @@
+# Set update schedule for GitHub Actions
+version: 2
+updates:
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "weekly"
diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml
new file mode 100644
index 0000000..9d242bb
--- /dev/null
+++ b/.github/workflows/ruby.yml
@@ -0,0 +1,47 @@
+name: adsf
+
+on:
+ push:
+ branches:
+ - main
+ pull_request:
+
+permissions:
+ contents: read
+
+jobs:
+ test:
+ runs-on: ubuntu-latest
+
+ strategy:
+ fail-fast: false
+ matrix:
+ ruby-version: ["2.7", "3.0", "3.1", "3.2"]
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - uses: ruby/setup-ruby@v1
+ with:
+ ruby-version: ${{ matrix.ruby-version }}
+
+ - uses: actions/cache@v3
+ with:
+ path: vendor/bundle
+ key: bundler-b-${{ runner.os }}-${{ matrix.ruby-version }}-${{ hashFiles('Gemfile') }}
+
+ - run: |
+ bundle config set --local path 'vendor/bundle'
+ bundle install --jobs "$(nproc)"
+
+ - name: Test style
+ if: ${{ matrix.ruby-version == '3.1' }}
+ run: bundle exec rake rubocop
+
+ - name: Test adsf
+ run: bundle exec rake adsf:test
+ timeout-minutes: 3
+
+ - name: Test adsf-live
+ run: bundle exec rake adsf_live:test
+ timeout-minutes: 3
diff --git a/.rubocop.yml b/.rubocop.yml
index 8e4ffb3..5f241e0 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -66,6 +66,130 @@ Minitest/TestMethodName: # (new in 0.10)
Enabled: true
Minitest/UnspecifiedException: # (new in 0.10)
Enabled: true
+Gemspec/DeprecatedAttributeAssignment: # new in 1.30
+ Enabled: true
+Gemspec/DevelopmentDependencies: # new in 1.44
+ Enabled: true
+Gemspec/RequireMFA: # new in 1.23
+ Enabled: true
+Layout/LineContinuationLeadingSpace: # new in 1.31
+ Enabled: true
+Layout/LineContinuationSpacing: # new in 1.31
+ Enabled: true
+Layout/LineEndStringConcatenationIndentation: # new in 1.18
+ Enabled: true
+Lint/AmbiguousOperatorPrecedence: # new in 1.21
+ Enabled: true
+Lint/AmbiguousRange: # new in 1.19
+ Enabled: true
+Lint/ConstantOverwrittenInRescue: # new in 1.31
+ Enabled: true
+Lint/DeprecatedConstants: # new in 1.8
+ Enabled: true
+Lint/DuplicateMagicComment: # new in 1.37
+ Enabled: true
+Lint/EmptyInPattern: # new in 1.16
+ Enabled: true
+Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
+ Enabled: true
+Lint/LambdaWithoutLiteralBlock: # new in 1.8
+ Enabled: true
+Lint/NonAtomicFileOperation: # new in 1.31
+ Enabled: true
+Lint/NumberedParameterAssignment: # new in 1.9
+ Enabled: true
+Lint/OrAssignmentToConstant: # new in 1.9
+ Enabled: true
+Lint/RedundantDirGlobSort: # new in 1.8
+ Enabled: true
+Lint/RefinementImportMethods: # new in 1.27
+ Enabled: true
+Lint/RequireRangeParentheses: # new in 1.32
+ Enabled: true
+Lint/RequireRelativeSelfPath: # new in 1.22
+ Enabled: true
+Lint/SymbolConversion: # new in 1.9
+ Enabled: true
+Lint/TripleQuotes: # new in 1.9
+ Enabled: true
+Lint/UselessRescue: # new in 1.43
+ Enabled: true
+Lint/UselessRuby2Keywords: # new in 1.23
+ Enabled: true
+Naming/BlockForwarding: # new in 1.24
+ Enabled: true
+Security/CompoundHash: # new in 1.28
+ Enabled: true
+Security/IoMethods: # new in 1.22
+ Enabled: true
+Style/ArrayIntersect: # new in 1.40
+ Enabled: true
+Style/ComparableClamp: # new in 1.44
+ Enabled: true
+Style/ConcatArrayLiterals: # new in 1.41
+ Enabled: true
+Style/EmptyHeredoc: # new in 1.32
+ Enabled: true
+Style/EndlessMethod: # new in 1.8
+ Enabled: true
+Style/EnvHome: # new in 1.29
+ Enabled: true
+Style/FetchEnvVar: # new in 1.28
+ Enabled: true
+Style/FileRead: # new in 1.24
+ Enabled: true
+Style/FileWrite: # new in 1.24
+ Enabled: true
+Style/HashConversion: # new in 1.10
+ Enabled: true
+Style/IfWithBooleanLiteralBranches: # new in 1.9
+ Enabled: true
+Style/InPatternThen: # new in 1.16
+ Enabled: true
+Style/MagicCommentFormat: # new in 1.35
+ Enabled: true
+Style/MapCompactWithConditionalBlock: # new in 1.30
+ Enabled: true
+Style/MapToHash: # new in 1.24
+ Enabled: true
+Style/MapToSet: # new in 1.42
+ Enabled: true
+Style/MinMaxComparison: # new in 1.42
+ Enabled: true
+Style/MultilineInPatternThen: # new in 1.16
+ Enabled: true
+Style/NestedFileDirname: # new in 1.26
+ Enabled: true
+Style/NumberedParameters: # new in 1.22
+ Enabled: true
+Style/NumberedParametersLimit: # new in 1.22
+ Enabled: true
+Style/ObjectThen: # new in 1.28
+ Enabled: true
+Style/OpenStructUse: # new in 1.23
+ Enabled: true
+Style/OperatorMethodCall: # new in 1.37
+ Enabled: true
+Style/QuotedSymbols: # new in 1.16
+ Enabled: true
+Style/RedundantConstantBase: # new in 1.40
+ Enabled: true
+Style/RedundantDoubleSplatHashBraces: # new in 1.41
+ Enabled: true
+Style/RedundantEach: # new in 1.38
+ Enabled: true
+Style/RedundantHeredocDelimiterQuotes: # new in 1.45
+ Enabled: true
+Style/RedundantInitialize: # new in 1.27
+ Enabled: true
+Style/RedundantSelfAssignmentBranch: # new in 1.19
+ Enabled: true
+Style/RedundantStringEscape: # new in 1.37
+ Enabled: true
+Style/SelectByRegexp: # new in 1.22
+ Enabled: true
+Style/StringChars: # new in 1.12
+ Enabled: true
AllCops:
TargetRubyVersion: 2.5
diff --git a/Gemfile b/Gemfile
index ab7e32e..82707ed 100644
--- a/Gemfile
+++ b/Gemfile
@@ -6,7 +6,6 @@ gemspec path: 'adsf'
gemspec path: 'adsf-live'
group :development do
- gem 'codecov', require: false
gem 'faye-websocket'
gem 'm'
gem 'minitest'
@@ -15,5 +14,6 @@ group :development do
gem 'rubocop', '~> 1.7'
gem 'rubocop-minitest', '~> 0.10.2'
gem 'rubocop-rake', '~> 0.5.1'
+ gem 'simplecov', '~> 0.21.2'
gem 'webrick', '~> 1.7'
end
diff --git a/README.md b/README.md
index 83ce85a..33cb774 100644
--- a/README.md
+++ b/README.md
@@ -2,24 +2,24 @@
[![Gem downloads](https://img.shields.io/gem/dt/adsf.svg)](http://rubygems.org/gems/adsf)
[![Build status](https://img.shields.io/travis/ddfreyne/adsf.svg)](https://travis-ci.org/ddfreyne/adsf)
[![Code Climate](https://img.shields.io/codeclimate/github/ddfreyne/adsf.svg)](https://codeclimate.com/github/ddfreyne/adsf)
-[![Code Coverage](https://img.shields.io/codecov/c/github/ddfreyne/adsf.svg)](https://codecov.io/gh/ddfreyne/adsf)
-adsf
-====
+# adsf
_adsf_ (**A** **D**ead **S**imple **F**ileserver) is a tiny static web server that you can launch instantly in any directory, like this:
- ▸ ls -l
- total 0
- drwxr-xr-x 2 ddfreyne staff 68 May 29 10:04 about
- drwxr-xr-x 2 ddfreyne staff 68 May 29 10:04 contact
- -rw-r--r-- 1 ddfreyne staff 0 May 29 10:04 index.html
- drwxr-xr-x 2 ddfreyne staff 68 May 29 10:04 projects
-
- ▸ adsf
- [2017-11-19 11:49:20] INFO WEBrick 1.3.1
- [2017-11-19 11:49:20] INFO ruby 2.4.2 (2017-09-14) [x86_64-darwin17]
- [2017-11-19 11:49:20] INFO WEBrick::HTTPServer#start: pid=95218 port=3000
+```
+▸ ls -l
+total 0
+drwxr-xr-x 2 ddfreyne staff 68 May 29 10:04 about
+drwxr-xr-x 2 ddfreyne staff 68 May 29 10:04 contact
+-rw-r--r-- 1 ddfreyne staff 0 May 29 10:04 index.html
+drwxr-xr-x 2 ddfreyne staff 68 May 29 10:04 projects
+
+▸ adsf
+[2017-11-19 11:49:20] INFO WEBrick 1.3.1
+[2017-11-19 11:49:20] INFO ruby 2.4.2 (2017-09-14) [x86_64-darwin17]
+[2017-11-19 11:49:20] INFO WEBrick::HTTPServer#start: pid=95218 port=3000
+```
… and now you can go to http://localhost:3000/ and start browsing.
@@ -27,8 +27,7 @@ See `adsf --help` for details.
To use `adsf --live-reload`, please install the separate `adsf-live` gem. (The live-reload support is not part of adsf itself, because the dependencies of `adsf-live` make it difficult to install under some circumstances.)
-Using adsf programmatically
----------------------------
+## Using adsf programmatically
### IndexFileFinder
@@ -41,26 +40,26 @@ run Rack::File.new('public')
It takes the following options:
-* `root` (required): the path to the web root
+- `root` (required): the path to the web root
-* `index_filenames` (optional; defaults to `['index.html']`): contains the names of the index filenames that will be served when a directory containing an index file is requested. Usually, this will simply be `['index.html']`, but under different circumstances (when using IIS, for example), the array may have to be modified to include index filenames such as `default.html` or `index.xml`. Here’s an example middleware/application stack that uses custom index filenames:
+- `index_filenames` (optional; defaults to `['index.html']`): contains the names of the index filenames that will be served when a directory containing an index file is requested. Usually, this will simply be `['index.html']`, but under different circumstances (when using IIS, for example), the array may have to be modified to include index filenames such as `default.html` or `index.xml`. Here’s an example middleware/application stack that uses custom index filenames:
- ```ruby
- use Adsf::Rack::IndexFileFinder,
- root: 'public',
- index_filenames: %w[index.html index.xhtml]
- run Rack::File.new('public')
- ```
+ ```ruby
+ use Adsf::Rack::IndexFileFinder,
+ root: 'public',
+ index_filenames: %w[index.html index.xhtml]
+ run Rack::File.new('public')
+ ```
**Why not use `Rack::Static`?** Rack comes with `Rack::Static`, whose purpose is similar to, but not the same as, `Adsf::Rack::IndexFileFinder`. In particular:
-* `Adsf::Rack::IndexFileFinder` does not serve files, unlike `Rack::Static`. `IndexFileFinder` only rewrites the incoming request and passes it on (usually to `Rack::File`).
+- `Adsf::Rack::IndexFileFinder` does not serve files, unlike `Rack::Static`. `IndexFileFinder` only rewrites the incoming request and passes it on (usually to `Rack::File`).
-* `Adsf::Rack::IndexFileFinder` supports multiple index files, while `Rack::Static` only supports one (you could have multiple `Rack::Static` middlewares, one for each index filenames, though).
+- `Adsf::Rack::IndexFileFinder` supports multiple index files, while `Rack::Static` only supports one (you could have multiple `Rack::Static` middlewares, one for each index filenames, though).
-* `Rack::Static` will report the wrong filename on 404 pages: when requesting a directory without an index file, it will e.g. report “File not found: /index.html” rather than “File not found: /”.
+- `Rack::Static` will report the wrong filename on 404 pages: when requesting a directory without an index file, it will e.g. report “File not found: /index.html” rather than “File not found: /”.
-* When requesting a directory without specifying the trailing slash, `Adsf::Rack::IndexFileFinder` will redirect to the URL with a trailing slash, unlike `Rack::Static`. This mimics the behavior of typical HTTP servers. For example, when requesting `/foo`, when a `foo` directory exists and it contains `index.html`, `IndexFileFinder` will redirect to `/foo/`.
+- When requesting a directory without specifying the trailing slash, `Adsf::Rack::IndexFileFinder` will redirect to the URL with a trailing slash, unlike `Rack::Static`. This mimics the behavior of typical HTTP servers. For example, when requesting `/foo`, when a `foo` directory exists and it contains `index.html`, `IndexFileFinder` will redirect to `/foo/`.
### Server
@@ -78,16 +77,15 @@ server.run
It takes the following options:
-* `root` (required): the path to the web root
-* `index_filenames` (optional; defaults to `['index.html']`): (see above)
-* `host` (optional; defaults to `'127.0.0.1'`): the address of the network interface to listen on
-* `port` (optional; defaults to `3000`): the port ot listen on
-* `handler` (optional): the Rack handler to use
+- `root` (required): the path to the web root
+- `index_filenames` (optional; defaults to `['index.html']`): (see above)
+- `host` (optional; defaults to `'127.0.0.1'`): the address of the network interface to listen on
+- `port` (optional; defaults to `3000`): the port ot listen on
+- `handler` (optional): the Rack handler to use
-Contributors
-------------
+## Contributors
-* Ed Brannin
-* Larissa Reis
-* Mark Meves
-* Vipul Amler
+- Ed Brannin
+- Larissa Reis
+- Mark Meves
+- Vipul Amler
diff --git a/adsf-live/Rakefile b/adsf-live/Rakefile
index 8dd9aa5..841574a 100644
--- a/adsf-live/Rakefile
+++ b/adsf-live/Rakefile
@@ -4,7 +4,7 @@ require 'rake/testtask'
Rake::TestTask.new(:test) do |t|
t.test_files = Dir[__dir__ + '/test/**/test_*.rb']
- t.libs << __dir__ + '/test'
+ t.libs << (__dir__ + '/test')
t.verbose = false
t.warning = false # TODO: turn this back on when rack-livereload is fixed
end
diff --git a/adsf-live/adsf-live.gemspec b/adsf-live/adsf-live.gemspec
index 7f3c75d..50587ce 100644
--- a/adsf-live/adsf-live.gemspec
+++ b/adsf-live/adsf-live.gemspec
@@ -24,4 +24,5 @@ Gem::Specification.new do |s|
s.files = ['NEWS.md', 'README.md'] + Dir['lib/**/*.rb']
s.require_path = 'lib'
+ s.metadata['rubygems_mfa_required'] = 'true'
end
diff --git a/adsf-live/lib/adsf/live/version.rb b/adsf-live/lib/adsf/live/version.rb
index d225a59..92f6418 100644
--- a/adsf-live/lib/adsf/live/version.rb
+++ b/adsf-live/lib/adsf/live/version.rb
@@ -2,6 +2,6 @@
module Adsf
module Live
- VERSION = '1.4.6'
+ VERSION = '1.4.7'
end
end
diff --git a/adsf-live/test/helper.rb b/adsf-live/test/helper.rb
index 87f4c89..a1bc54d 100644
--- a/adsf-live/test/helper.rb
+++ b/adsf-live/test/helper.rb
@@ -2,14 +2,6 @@
require 'simplecov'
SimpleCov.start
-
-require 'codecov'
-SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(
- [
- SimpleCov::Formatter::HTMLFormatter,
- SimpleCov::Formatter::Codecov,
- ],
-)
SimpleCov.command_name 'test:adsf-live'
require 'faye/websocket'
diff --git a/adsf/NEWS.md b/adsf/NEWS.md
index 4bff0cd..f01ffc8 100644
--- a/adsf/NEWS.md
+++ b/adsf/NEWS.md
@@ -1,5 +1,11 @@
# Release notes for adsf
+## 1.4.7 (2023-03-18)
+
+Fixes:
+
+* Added Rack 3.0 compatibility
+
## 1.4.6 (2021-05-16)
Fixes:
diff --git a/adsf/Rakefile b/adsf/Rakefile
index 21982e8..2e28b3a 100644
--- a/adsf/Rakefile
+++ b/adsf/Rakefile
@@ -4,7 +4,7 @@ require 'rake/testtask'
Rake::TestTask.new(:test) do |t|
t.test_files = Dir[__dir__ + '/test/**/test_*.rb']
- t.libs << __dir__ + '/test'
+ t.libs << (__dir__ + '/test')
t.verbose = false
end
diff --git a/adsf/adsf.gemspec b/adsf/adsf.gemspec
index afa9d05..d346685 100644
--- a/adsf/adsf.gemspec
+++ b/adsf/adsf.gemspec
@@ -15,10 +15,12 @@ Gem::Specification.new do |s|
s.email = 'denis.defreyne@stoneship.org'
s.required_ruby_version = '>= 2.5'
- s.add_runtime_dependency('rack', '>= 1.0.0', '< 3.0.0')
+ s.add_runtime_dependency('rack', '>= 1.0.0', '< 4.0.0')
+ s.add_runtime_dependency('rackup', '~> 2.1')
s.files = ['NEWS.md', 'README.md'] + Dir['bin/**/*'] + Dir['lib/**/*.rb']
s.executables = ['adsf']
s.require_path = 'lib'
s.bindir = 'bin'
+ s.metadata['rubygems_mfa_required'] = 'true'
end
diff --git a/adsf/lib/adsf.rb b/adsf/lib/adsf.rb
index fbf8d37..d227a7e 100644
--- a/adsf/lib/adsf.rb
+++ b/adsf/lib/adsf.rb
@@ -1,6 +1,7 @@
# frozen_string_literal: true
require 'rack'
+require 'rackup'
module Adsf
end
diff --git a/adsf/lib/adsf/rack/caching.rb b/adsf/lib/adsf/rack/caching.rb
index 227b5ef..0073296 100644
--- a/adsf/lib/adsf/rack/caching.rb
+++ b/adsf/lib/adsf/rack/caching.rb
@@ -11,7 +11,7 @@ module Adsf::Rack
new_headers =
headers.merge(
- 'Cache-Control' => 'max-age=0, stale-if-error=0',
+ 'cache-control' => 'max-age=0, stale-if-error=0',
)
[status, new_headers, body]
diff --git a/adsf/lib/adsf/rack/cors.rb b/adsf/lib/adsf/rack/cors.rb
index 439a5b9..ce58b97 100644
--- a/adsf/lib/adsf/rack/cors.rb
+++ b/adsf/lib/adsf/rack/cors.rb
@@ -11,8 +11,8 @@ module Adsf::Rack
new_headers =
headers.merge(
- 'Access-Control-Allow-Origin' => '*',
- 'Access-Control-Allow-Headers' => 'Origin, X-Requested-With, Content-Type, Accept, Range',
+ 'access-control-allow-origin' => '*',
+ 'access-control-allow-headers' => 'Origin, X-Requested-With, Content-Type, Accept, Range',
)
[status, new_headers, body]
diff --git a/adsf/lib/adsf/rack/index_file_finder.rb b/adsf/lib/adsf/rack/index_file_finder.rb
index 020f0e8..a20fe64 100644
--- a/adsf/lib/adsf/rack/index_file_finder.rb
+++ b/adsf/lib/adsf/rack/index_file_finder.rb
@@ -18,7 +18,7 @@ module Adsf::Rack
new_path_info = env['PATH_INFO'] + '/'
return [
302,
- { 'Location' => new_path_info, 'Content-Type' => 'text/html' },
+ { 'location' => new_path_info, 'content-type' => 'text/html' },
["Redirecting you to #{new_path_info}…"],
]
end
diff --git a/adsf/lib/adsf/server.rb b/adsf/lib/adsf/server.rb
index 4ad8e54..c15c7f9 100644
--- a/adsf/lib/adsf/server.rb
+++ b/adsf/lib/adsf/server.rb
@@ -63,7 +63,7 @@ module Adsf
if is_live
require 'adsf/live'
- use ::Rack::LiveReload, source: :vendored
+ use ::Rack::LiveReload, no_swf: true, source: :vendored
end
run ::Rack::File.new(root)
@@ -72,9 +72,9 @@ module Adsf
def build_handler
if @handler
- ::Rack::Handler.get(@handler)
+ ::Rackup::Handler.get(@handler)
else
- ::Rack::Handler.default
+ ::Rackup::Handler.default
end
end
end
diff --git a/adsf/lib/adsf/version.rb b/adsf/lib/adsf/version.rb
index 9a604cc..208bfa2 100644
--- a/adsf/lib/adsf/version.rb
+++ b/adsf/lib/adsf/version.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
module Adsf
- VERSION = '1.4.6'
+ VERSION = '1.4.7'
end
diff --git a/adsf/test/fixtures/sample.html b/adsf/test/fixtures/sample.html
new file mode 100644
index 0000000..d00f6c1
--- /dev/null
+++ b/adsf/test/fixtures/sample.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html lang="en">
+
+ <head>
+ <meta charset="UTF-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Document</title>
+ </head>
+
+ <body>
+
+ </body>
+
+</html>
diff --git a/adsf/test/fixtures/sample.png b/adsf/test/fixtures/sample.png
new file mode 100644
index 0000000..081f158
Binary files /dev/null and b/adsf/test/fixtures/sample.png differ
diff --git a/adsf/test/helper.rb b/adsf/test/helper.rb
index e3b6ff9..b84e6a1 100644
--- a/adsf/test/helper.rb
+++ b/adsf/test/helper.rb
@@ -2,14 +2,6 @@
require 'simplecov'
SimpleCov.start
-
-require 'codecov'
-SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(
- [
- SimpleCov::Formatter::HTMLFormatter,
- SimpleCov::Formatter::Codecov,
- ],
-)
SimpleCov.command_name 'test:adsf'
require 'faye/websocket'
diff --git a/adsf/test/test_server.rb b/adsf/test/test_server.rb
index 3757bcd..21e28e2 100644
--- a/adsf/test/test_server.rb
+++ b/adsf/test/test_server.rb
@@ -19,7 +19,7 @@ class Adsf::Test::Server < MiniTest::Test
begin
Net::HTTP.get('127.0.0.1', '/', 50_386)
rescue Errno::ECONNREFUSED, Errno::ECONNRESET
- sleep(0.1 * 1.2**i)
+ sleep(0.1 * (1.2**i))
retry
end
break
@@ -33,7 +33,10 @@ class Adsf::Test::Server < MiniTest::Test
def setup
super
+
FileUtils.mkdir_p('output')
+ FileUtils.cp("#{__dir__}/fixtures/sample.html", 'output/sample.html')
+ FileUtils.cp("#{__dir__}/fixtures/sample.png", 'output/sample.png')
end
def test_default_config__serve_index_html
@@ -110,6 +113,20 @@ class Adsf::Test::Server < MiniTest::Test
end
end
+ def test_content_type_html
+ run_server do
+ response = Net::HTTP.get_response('127.0.0.1', '/sample.html', 50_386)
+ assert_equal 'text/html', response['Content-Type']
+ end
+ end
+
+ def test_content_type_png
+ run_server do
+ response = Net::HTTP.get_response('127.0.0.1', '/sample.png', 50_386)
+ assert_equal 'image/png', response['Content-Type']
+ end
+ end
+
def test_non_local_interfaces
addresses = Socket.getifaddrs.map(&:addr).select(&:ipv4?).map(&:ip_address)
non_local_addresses = addresses - ['127.0.0.1']
diff --git a/debian/changelog b/debian/changelog
index 87c626e..c2c9058 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+ruby-adsf (1.4.7+dfsg1-1) UNRELEASED; urgency=low
+
+ * New upstream release.
+ * Drop patch clean_test_helper.patch, present upstream.
+
+ -- Debian Janitor <janitor@jelmer.uk> Tue, 25 Apr 2023 18:11:40 -0000
+
ruby-adsf (1.4.6+dfsg1-1) unstable; urgency=medium
* Team upload.
diff --git a/debian/patches/adsf-test_version-require-adsf-live-version-explicit.patch b/debian/patches/adsf-test_version-require-adsf-live-version-explicit.patch
index 8334e53..95dee17 100644
--- a/debian/patches/adsf-test_version-require-adsf-live-version-explicit.patch
+++ b/debian/patches/adsf-test_version-require-adsf-live-version-explicit.patch
@@ -9,10 +9,10 @@ Forwarded: not-needed
adsf/test/test_version.rb | 1 +
1 file changed, 1 insertion(+)
-diff --git a/adsf/test/test_version.rb b/adsf/test/test_version.rb
-index 9ec4ae9..6083ae5 100644
---- a/adsf/test/test_version.rb
-+++ b/adsf/test/test_version.rb
+Index: ruby-adsf.git/adsf/test/test_version.rb
+===================================================================
+--- ruby-adsf.git.orig/adsf/test/test_version.rb
++++ ruby-adsf.git/adsf/test/test_version.rb
@@ -1,6 +1,7 @@
# frozen_string_literal: true
diff --git a/debian/patches/clean_test_helper.patch b/debian/patches/clean_test_helper.patch
deleted file mode 100644
index 1646aec..0000000
--- a/debian/patches/clean_test_helper.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-Description: remove simplecov/codecov from test helpers
-Forwarded: not-needed
-Last-Update: 2019-01-05
-Author: Cédric Boutillier <boutil@debian.org>
-
---- a/adsf-live/test/helper.rb
-+++ b/adsf-live/test/helper.rb
-@@ -1,17 +1,5 @@
- # frozen_string_literal: true
-
--require 'simplecov'
--SimpleCov.start
--
--require 'codecov'
--SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(
-- [
-- SimpleCov::Formatter::HTMLFormatter,
-- SimpleCov::Formatter::Codecov,
-- ],
--)
--SimpleCov.command_name 'test:adsf-live'
--
- require 'faye/websocket'
- require 'rack/test'
- require 'minitest/autorun'
---- a/adsf/test/helper.rb
-+++ b/adsf/test/helper.rb
-@@ -1,17 +1,5 @@
- # frozen_string_literal: true
-
--require 'simplecov'
--SimpleCov.start
--
--require 'codecov'
--SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(
-- [
-- SimpleCov::Formatter::HTMLFormatter,
-- SimpleCov::Formatter::Codecov,
-- ],
--)
--SimpleCov.command_name 'test:adsf'
--
- require 'faye/websocket'
- require 'rack/test'
- require 'minitest/autorun'
diff --git a/debian/patches/no_faye_websocket.patch b/debian/patches/no_faye_websocket.patch
index d8546f7..446bc0e 100644
--- a/debian/patches/no_faye_websocket.patch
+++ b/debian/patches/no_faye_websocket.patch
@@ -4,18 +4,23 @@ Last-Update: 2019-01-05
Author: Cédric Boutillier <boutil@debian.org>
---- a/adsf/test/helper.rb
-+++ b/adsf/test/helper.rb
-@@ -1,6 +1,5 @@
- # frozen_string_literal: true
+Index: ruby-adsf.git/adsf/test/helper.rb
+===================================================================
+--- ruby-adsf.git.orig/adsf/test/helper.rb
++++ ruby-adsf.git/adsf/test/helper.rb
+@@ -4,7 +4,6 @@ require 'simplecov'
+ SimpleCov.start
+ SimpleCov.command_name 'test:adsf'
-require 'faye/websocket'
require 'rack/test'
require 'minitest/autorun'
require 'net/http'
---- a/adsf/test/test_server.rb
-+++ b/adsf/test/test_server.rb
-@@ -129,7 +129,7 @@
+Index: ruby-adsf.git/adsf/test/test_server.rb
+===================================================================
+--- ruby-adsf.git.orig/adsf/test/test_server.rb
++++ ruby-adsf.git/adsf/test/test_server.rb
+@@ -146,7 +146,7 @@ class Adsf::Test::Server < MiniTest::Tes
run_server(live: true) { yield }
end
@@ -24,18 +29,23 @@ Author: Cédric Boutillier <boutil@debian.org>
run_live_server do
ws = Faye::WebSocket::Client.new('ws://127.0.0.1:35729/')
---- a/adsf-live/test/helper.rb
-+++ b/adsf-live/test/helper.rb
-@@ -1,6 +1,5 @@
- # frozen_string_literal: true
+Index: ruby-adsf.git/adsf-live/test/helper.rb
+===================================================================
+--- ruby-adsf.git.orig/adsf-live/test/helper.rb
++++ ruby-adsf.git/adsf-live/test/helper.rb
+@@ -4,7 +4,6 @@ require 'simplecov'
+ SimpleCov.start
+ SimpleCov.command_name 'test:adsf-live'
-require 'faye/websocket'
require 'rack/test'
require 'minitest/autorun'
require 'net/http'
---- a/adsf-live/test/test_watcher.rb
-+++ b/adsf-live/test/test_watcher.rb
-@@ -19,7 +19,7 @@
+Index: ruby-adsf.git/adsf-live/test/test_watcher.rb
+===================================================================
+--- ruby-adsf.git.orig/adsf-live/test/test_watcher.rb
++++ ruby-adsf.git/adsf-live/test/test_watcher.rb
+@@ -19,7 +19,7 @@ class Adsf::Live::WatcherTest < MiniTest
end
end
@@ -44,7 +54,7 @@ Author: Cédric Boutillier <boutil@debian.org>
run_watcher do
ws = Faye::WebSocket::Client.new('ws://127.0.0.1:35729/')
-@@ -50,7 +50,7 @@
+@@ -50,7 +50,7 @@ class Adsf::Live::WatcherTest < MiniTest
end
end
diff --git a/debian/patches/proxy-safe-tests.patch b/debian/patches/proxy-safe-tests.patch
index 5517acd..c5f37ee 100644
--- a/debian/patches/proxy-safe-tests.patch
+++ b/debian/patches/proxy-safe-tests.patch
@@ -7,9 +7,11 @@ Author: Steve Langasek <steve.langasek@ubuntu.com>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=921486
Forwarded: not-needed
---- a/adsf/test/test_server.rb
-+++ b/adsf/test/test_server.rb
-@@ -111,6 +111,7 @@
+Index: ruby-adsf.git/adsf/test/test_server.rb
+===================================================================
+--- ruby-adsf.git.orig/adsf/test/test_server.rb
++++ ruby-adsf.git/adsf/test/test_server.rb
+@@ -128,6 +128,7 @@ class Adsf::Test::Server < MiniTest::Tes
end
def test_non_local_interfaces
diff --git a/debian/patches/series b/debian/patches/series
index cab7152..8e98137 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,4 +1,3 @@
-clean_test_helper.patch
no_faye_websocket.patch
proxy-safe-tests.patch
adsf-test_version-require-adsf-live-version-explicit.patch