Skip to content

Commit

Permalink
drop outdated ruby versions (#107)
Browse files Browse the repository at this point in the history
* drop outdated ruby versions

* linter

* update ruby versions
  • Loading branch information
beanieboi authored Mar 31, 2024
1 parent 1269e1f commit 55810e2
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
ruby-version: [2.7, 3.0, 3.1]
ruby-version: [3.1, 3.2, 3.3]
runs-on: ${{ matrix.os }}
continue-on-error: ${{ endsWith(matrix.ruby, 'head') }}
steps:
Expand Down
9 changes: 9 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,14 @@ group :test do
gem 'sorbet'
end

group :development do
gem 'minitest', '~> 5'
gem 'rake', '~> 13.0'
gem 'rubocop', '~> 1'
gem 'rubocop-minitest'
gem 'rubocop-packaging'
gem 'rubocop-sorbet'
end

# Specify your gem's dependencies in ffprober.gemspec
gemspec
7 changes: 0 additions & 7 deletions ffprober.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ Gem::Specification.new do |spec|

spec.add_runtime_dependency 'sorbet-runtime'

spec.add_development_dependency 'minitest', '~> 5'
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rubocop', '~> 1'
spec.add_development_dependency 'rubocop-minitest'
spec.add_development_dependency 'rubocop-packaging'
spec.add_development_dependency 'rubocop-sorbet'
spec.add_development_dependency 'simplecov', '~> 0.19'
spec.metadata = {
'rubygems_mfa_required' => 'true'
}
Expand Down
4 changes: 2 additions & 2 deletions lib/ffprober/ffmpeg/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ def initialize(ffprobe_exec = Ffprober::Ffmpeg::Exec.new)
@parse_version = T.let(nil, T.nilable(T::Array[Integer]))
end

VERSION_REGEX = T.let(/^(ffprobe|avprobe|ffmpeg) version (\d+)\.?(\d+)\.?(\d+)*/, Regexp)
NIGHTLY_REGEX = T.let(/^(ffprobe|avprobe|ffmpeg) version (N|git)-/, Regexp)
VERSION_REGEX = T.let(/^(ffprobe|avprobe|ffmpeg) version (\d+)\.?(\d+)\.?(\d+)*/.freeze, Regexp)
NIGHTLY_REGEX = T.let(/^(ffprobe|avprobe|ffmpeg) version (N|git)-/.freeze, Regexp)
VERSION_FALLBACK = T.let([0, 0, 0].freeze, T::Array[Integer])

sig { returns(Gem::Version) }
Expand Down
2 changes: 1 addition & 1 deletion lib/ffprober/ffmpeg/version_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def valid?

sig { returns(T::Boolean) }
def version_requirement_statisfied?
MIN_VERSION <= ffmpeg_version.version
ffmpeg_version.version >= MIN_VERSION
end

sig { returns(Ffprober::Ffmpeg::Version) }
Expand Down
2 changes: 1 addition & 1 deletion lib/ffprober/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Parser
def self.from_file(file_to_parse)
check_version

raise EmptyInput, file_to_parse if File.zero?(file_to_parse)
raise EmptyInput, file_to_parse if File.empty?(file_to_parse)

file_parser = Parsers::FileParser.new(file_to_parse)
json_parser = file_parser.load
Expand Down
2 changes: 1 addition & 1 deletion lib/ffprober/parsers/url.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
module Ffprober
module Parsers
class UrlParser
VALID_URI_REGEX = /\A#{URI::DEFAULT_PARSER.make_regexp}\z/
VALID_URI_REGEX = /\A#{URI::DEFAULT_PARSER.make_regexp}\z/.freeze

def initialize(url_to_parse, exec = Ffprober::Ffmpeg::Exec.new)
raise ArgumentError, "#{url_to_parse} is not a valid URL" unless valid_url?(url_to_parse)
Expand Down
3 changes: 3 additions & 0 deletions test/ffmpeg/exec_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,23 @@ def test_output_without_ffmpeg
finder = FakeFinder.new
finder.path = nil
exec = Ffprober::Ffmpeg::Exec.new(finder)

assert_equal '', exec.ffprobe_version_output
end

def test_output_with_ffmpeg
finder = FakeFinder.new
finder.path = fake_ffprobe_version_path
exec = Ffprober::Ffmpeg::Exec.new(finder)

assert_equal "fake_version_output\n", exec.ffprobe_version_output
end

def test_json_output
finder = FakeFinder.new
finder.path = fake_ffprobe_output_path
exec = Ffprober::Ffmpeg::Exec.new(finder)

assert_equal "fake_version_output\n", exec.json_output('')
end
end
Expand Down
6 changes: 3 additions & 3 deletions test/ffprober_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_json_input

# rubocop:disable Minitest/MultipleAssertions
def test_file_input
return unless Ffprober::FfprobeVersion.valid?
skip unless Ffprober::FfprobeVersion.valid?

ffprobe = Ffprober::Parser.from_file(
'test/assets/301 extracting a ruby gem.m4v'
Expand All @@ -60,7 +60,7 @@ def test_file_input

# rubocop:disable Minitest/MultipleAssertions
def test_url_input
return unless Ffprober::FfprobeVersion.valid?
skip unless Ffprober::FfprobeVersion.valid?

path = File.join(assets_path, '301 extracting a ruby gem.m4v')
url = "file://#{path}"
Expand All @@ -84,7 +84,7 @@ def test_url_input
# rubocop:enable Minitest/MultipleAssertions

def test_error_response
return unless Ffprober::FfprobeVersion.valid?
skip unless Ffprober::FfprobeVersion.valid?

err = assert_raises Ffprober::FfprobeError do
Ffprober::Parser.from_url('http://localhost/notarealfile.mp4')
Expand Down
3 changes: 3 additions & 0 deletions test/parsers/url_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,23 @@ def test_with_a_http_url
fake_exec = FakeExec.new
http_url = VALID_HTTP_URL
url = UrlParser.new(http_url, fake_exec)

assert_instance_of JsonParser, url.load
end

def test_with_unescaped_url
fake_exec = FakeExec.new
http_url = UNESCAPED_URL
url = UrlParser.new(http_url, fake_exec)

assert_instance_of JsonParser, url.load
end

def test_with_a_file_url
fake_exec = FakeExec.new
file_url = VALID_FILE_URL
url = UrlParser.new(file_url, fake_exec)

assert_instance_of JsonParser, url.load
end
end
Expand Down

0 comments on commit 55810e2

Please sign in to comment.