Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 9 additions & 47 deletions .github/workflows/ci_steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,70 +10,32 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ['2.6']
ruby: ['3.3.10']

env:
QT_SELECT: qt5
OPENSSL_CONF: /dev/null
LANG: C.UTF-8
LC_ALL: C.UTF-8

steps:
- name: Fix APT for EOL Debian
run: |
if grep -q buster /etc/apt/sources.list 2>/dev/null; then
echo "deb [trusted=yes] http://archive.debian.org/debian buster main" > /etc/apt/sources.list
echo "deb [trusted=yes] http://archive.debian.org/debian-security buster/updates main" >> /etc/apt/sources.list
fi
echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99archive
echo 'Acquire::AllowInsecureRepositories "true";' >> /etc/apt/apt.conf.d/99archive

- name: Install system packages
run: |
apt-get update -qq
apt-get install -y --no-install-recommends \
git ca-certificates curl bzip2 \
build-essential g++ make \
qt5-qmake qtbase5-dev libqt5webkit5-dev qtchooser \
xvfb xauth libfontconfig1 libfreetype6 libxrender1 libxext6 libx11-6 \
git ca-certificates curl \
build-essential \
chromium chromium-driver \
libssl-dev zlib1g-dev

- name: Setup qmake
run: |
mkdir -p /usr/share/qtchooser
echo "/usr/lib/x86_64-linux-gnu/qt5/bin" > /usr/share/qtchooser/qt5.conf
echo "/usr/lib/x86_64-linux-gnu" >> /usr/share/qtchooser/qt5.conf
ln -sf /usr/lib/x86_64-linux-gnu/qt5/bin/qmake /usr/bin/qmake 2>/dev/null || true
qmake --version

- name: Install PhantomJS
run: |
curl -L -o phantomjs.tar.bz2 "https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2"
tar xf phantomjs.tar.bz2 --wildcards '*/bin/phantomjs' --strip-components=2
mv phantomjs /usr/local/bin/
rm phantomjs.tar.bz2
phantomjs --version || echo "PhantomJS installed"

- name: Checkout
uses: actions/checkout@v4

- name: Install Bundler
run: gem install bundler -v '< 2'
run: gem install bundler

- name: Bundle install
run: |
bundle config set force_ruby_platform true
echo "gem 'ffi', '~> 1.15.0'" >> Gemfile
echo "gem 'regexp_parser', '~> 1.8'" >> Gemfile
echo "gem 'public_suffix', '~> 4.0'" >> Gemfile
echo "gem 'capybara', '~> 3.35.0'" >> Gemfile
echo "gem 'addressable', '~> 2.7.0'" >> Gemfile
echo "gem 'nokogiri', '~> 1.12.0'" >> Gemfile
echo "gem 'mini_mime', '~> 1.1.0'" >> Gemfile
echo "gem 'rack', '~> 2.2.0'" >> Gemfile
bundle install --jobs 4 --retry 3
env:
QMAKE: /usr/bin/qmake
run: bundle install --jobs 4 --retry 3

- name: Run tests
run: xvfb-run -a bundle exec rspec spec
run: bundle exec rspec spec
env:
CHROME_BIN: /usr/bin/chromium
5 changes: 5 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
plugins:
- rubocop-rspec
- rubocop-capybara

inherit_from: .rubocop_todo.yml
248 changes: 248 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2026-02-26 07:29:32 UTC using RuboCop version 1.84.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
# Configuration parameters: AllowComments, AllowNil.
Lint/SuppressedException:
Exclude:
- 'lib/billy/browsers/capybara.rb'

# Offense count: 1
# Configuration parameters: AllowKeywordBlockArguments.
Lint/UnderscorePrefixedVariableName:
Exclude:
- 'lib/billy/cache.rb'

# Offense count: 16
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 54

# Offense count: 1
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
# AllowedMethods: refine
Metrics/BlockLength:
Max: 69

# Offense count: 2
# Configuration parameters: CountBlocks, CountModifierForms.
Metrics/BlockNesting:
Max: 4

# Offense count: 2
# Configuration parameters: CountComments, CountAsOne.
Metrics/ClassLength:
Max: 121

# Offense count: 2
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/CyclomaticComplexity:
Max: 11

# Offense count: 15
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 45

# Offense count: 1
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
Metrics/ParameterLists:
Max: 9

# Offense count: 2
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/PerceivedComplexity:
Max: 14

# Offense count: 1
Naming/AccessorMethodName:
Exclude:
- 'spec/support/test_server.rb'

# Offense count: 1
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
# CheckDefinitionPathHierarchyRoots: lib, spec, test, src
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
Naming/FileName:
Exclude:
- 'Rakefile.rb'
- 'lib/puffing-billy.rb'

# Offense count: 1
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros, UseSorbetSigs.
# NamePrefix: is_, has_, have_, does_
# ForbiddenPrefixes: is_, has_, have_, does_
# AllowedMethods: is_a?
# MethodDefinitionMacros: define_method, define_singleton_method
Naming/PredicatePrefix:
Exclude:
- 'spec/**/*'
- 'lib/billy/proxy_request_stub.rb'

# Offense count: 4
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
# SupportedStyles: snake_case, normalcase, non_integer
# AllowedIdentifiers: TLS1_1, TLS1_2, capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
Naming/VariableNumber:
Exclude:
- 'spec/lib/proxy_spec.rb'

# Offense count: 23
RSpec/Be:
Exclude:
- 'spec/lib/billy/proxy_request_stub_spec.rb'

# Offense count: 29
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
RSpec/ContextWording:
Exclude:
- 'spec/lib/billy/cache_spec.rb'
- 'spec/lib/billy/handlers/cache_handler_spec.rb'
- 'spec/lib/billy/handlers/proxy_handler_spec.rb'
- 'spec/lib/billy/proxy_request_stub_spec.rb'
- 'spec/lib/proxy_spec.rb'

# Offense count: 50
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:
Max: 22

# Offense count: 7
RSpec/ExpectInHook:
Exclude:
- 'spec/lib/billy/handlers/proxy_handler_spec.rb'

# Offense count: 8
# Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns.
RSpec/IndexedLet:
Exclude:
- 'spec/lib/billy/cache_spec.rb'
- 'spec/lib/billy/ssl/authority_spec.rb'
- 'spec/lib/billy/ssl/certificate_chain_spec.rb'
- 'spec/lib/billy/ssl/certificate_spec.rb'

# Offense count: 20
# Configuration parameters: AssignmentOnly.
RSpec/InstanceVariable:
Exclude:
- 'spec/lib/billy/watir/watir_spec.rb'
- 'spec/lib/proxy_spec.rb'

# Offense count: 15
RSpec/LetSetup:
Exclude:
- 'spec/lib/billy/handlers/stub_handler_spec.rb'
- 'spec/lib/proxy_spec.rb'

# Offense count: 62
# Configuration parameters: .
# SupportedStyles: have_received, receive
RSpec/MessageSpies:
EnforcedStyle: receive

# Offense count: 41
RSpec/MultipleExpectations:
Max: 11

# Offense count: 10
# Configuration parameters: AllowSubject.
RSpec/MultipleMemoizedHelpers:
Max: 15

# Offense count: 79
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
# SupportedStyles: always, named_only
RSpec/NamedSubject:
Exclude:
- 'spec/lib/billy/handlers/proxy_handler_spec.rb'
- 'spec/lib/billy/handlers/request_handler_spec.rb'
- 'spec/lib/billy/proxy_connection_spec.rb'
- 'spec/lib/billy/proxy_request_stub_spec.rb'

# Offense count: 12
# Configuration parameters: AllowedGroups.
RSpec/NestedGroups:
Max: 5

# Offense count: 2
RSpec/RepeatedExampleGroupBody:
Exclude:
- 'spec/lib/billy/handlers/request_handler_spec.rb'

# Offense count: 10
# Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata, InflectorPath, EnforcedInflector.
# SupportedInflectors: default, active_support
RSpec/SpecFilePathFormat:
Exclude:
- '**/spec/routing/**/*'
- 'spec/lib/billy/handlers/cache_handler_spec.rb'
- 'spec/lib/billy/handlers/handler_spec.rb'
- 'spec/lib/billy/handlers/proxy_handler_spec.rb'
- 'spec/lib/billy/handlers/request_handler_spec.rb'
- 'spec/lib/billy/handlers/request_log_spec.rb'
- 'spec/lib/billy/handlers/stub_handler_spec.rb'
- 'spec/lib/billy/resource_utils_spec.rb'
- 'spec/lib/billy/ssl/authority_spec.rb'
- 'spec/lib/billy/ssl/certificate_chain_spec.rb'
- 'spec/lib/billy/ssl/certificate_spec.rb'

# Offense count: 42
RSpec/StubbedMock:
Exclude:
- 'spec/lib/billy/handlers/cache_handler_spec.rb'
- 'spec/lib/billy/handlers/proxy_handler_spec.rb'
- 'spec/lib/billy/handlers/request_handler_spec.rb'
- 'spec/lib/billy/handlers/stub_handler_spec.rb'

# Offense count: 4
RSpec/SubjectDeclaration:
Exclude:
- 'spec/lib/billy/proxy_connection_spec.rb'
- 'spec/lib/billy/proxy_request_stub_spec.rb'

# Offense count: 3
RSpec/SubjectStub:
Exclude:
- 'spec/lib/billy/handlers/proxy_handler_spec.rb'
- 'spec/lib/billy/handlers/request_handler_spec.rb'

# Offense count: 6
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
RSpec/VerifiedDoubles:
Exclude:
- 'spec/lib/billy/handlers/proxy_handler_spec.rb'
- 'spec/lib/billy/handlers/request_handler_spec.rb'
- 'spec/lib/billy/handlers/stub_handler_spec.rb'

# Offense count: 19
# Configuration parameters: AllowedConstants.
Style/Documentation:
Enabled: false

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Style/IfUnlessModifier:
Exclude:
- 'lib/billy/handlers/proxy_handler.rb'

# Offense count: 4
# Configuration parameters: AllowedMethods.
# AllowedMethods: respond_to_missing?
Style/OptionalBooleanParameter:
Exclude:
- 'lib/billy/cache.rb'
- 'lib/billy/proxy.rb'
- 'spec/support/test_server.rb'

# Offense count: 22
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
# URISchemes: http, https
Layout/LineLength:
Max: 158
20 changes: 11 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
FROM ruby:1.9.3
FROM ruby:3.3.10

RUN apt-get update -qq && \
apt-get install -y --no-install-recommends \
git ca-certificates curl \
build-essential \
chromium chromium-driver \
libssl-dev zlib1g-dev && \
rm -rf /var/lib/apt/lists/*

ENV CHROME_BIN=/usr/bin/chromium

RUN apt-get update -y
RUN apt-get install -y qt5-default libqt5webkit5-dev gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x
RUN gem install bundler
RUN \
export PHANTOMJS_VERSION='2.1.1' && \
export PHANTOMJS_URL='https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2' && \
wget -q ${PHANTOMJS_URL} && \
tar xfv phantomjs-${PHANTOMJS_VERSION}-linux-x86_64.tar.bz2 \
-C /usr/bin --wildcards */bin/phantomjs --strip-components=2
RUN mkdir -p /app
COPY . /app
RUN cd /app && bundle install
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source 'https://rubygems.org'

# Specify your gem's dependencies in puffing-billy.gemspec
Expand Down
10 changes: 8 additions & 2 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# A sample Guardfile
# More info at https://github.com/guard/guard#readme

Expand All @@ -9,7 +11,9 @@ guard 'rspec', version: 2 do
# Rails example
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) do |m|
["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"]
end
watch(%r{^spec/support/(.+)\.rb$}) { 'spec' }
watch('config/routes.rb') { 'spec/routing' }
watch('app/controllers/application_controller.rb') { 'spec/controllers' }
Expand All @@ -19,5 +23,7 @@ guard 'rspec', version: 2 do

# Turnip features and steps
watch(%r{^spec/acceptance/(.+)\.feature$})
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance'
end
end
Loading
Loading