Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore support for Ruby 2.3 #790

Closed
wants to merge 5 commits into from
Closed
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
2 changes: 1 addition & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
test-ubuntu:
strategy:
matrix:
ruby: [2.4.0, 2.4, 2.5, 2.6, 2.7, "3.0", jruby-9.2]
ruby: [2.3.0, 2.3, 2.4, 2.5, 2.6, 2.7, "3.0", jruby-9.2]

runs-on: ubuntu-latest

Expand Down
18 changes: 15 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require:
- rubocop-packaging
- rubocop-performance
- rubocop-rspec

Expand All @@ -8,8 +7,7 @@ AllCops:
- tmp/**/*
- vendor/**/*
DisplayCopNames: true
NewCops: enable
TargetRubyVersion: 2.4
TargetRubyVersion: 2.3

# Spec blocks can be any size
Metrics/BlockLength:
Expand Down Expand Up @@ -39,4 +37,18 @@ Style/FrozenStringLiteralComment:
Layout/LineLength:
Max: 94


# New cops to enable. Needed for RuboCop 0.81.0 since it does not support AllCops/NewCops option

Lint/RaiseException:
Enabled: true
Lint/StructNewOverride:
Enabled: true
Style/HashEachMethods:
Enabled: true
Style/HashTransformKeys:
Enabled: true
Style/HashTransformValues:
Enabled: true

inherit_from: .rubocop_todo.yml
69 changes: 18 additions & 51 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,49 @@
# This configuration was generated by
# `rubocop --auto-gen-config --no-offense-counts --no-auto-gen-timestamp`
# using RuboCop version 1.9.0.
# using RuboCop version 0.81.0.
# 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.

# Configuration parameters: Include.
# Include: **/*.gemspec
Gemspec/RequiredRubyVersion:
Exclude:
- 'fixtures/cli-app/cli-app.gemspec'
- 'fixtures/empty-app/cli-app.gemspec'

Lint/AmbiguousBlockAssociation:
Exclude:
- 'lib/aruba/platforms/announcer.rb'

# Configuration parameters: AllowComments.
Lint/EmptyClass:
Exclude:
- 'spec/event_bus_spec.rb'

Lint/MissingSuper:
Exclude:
- 'lib/aruba/contracts/enum.rb'
- 'lib/aruba/matchers/collection/include_an_object.rb'

# Configuration parameters: CheckForMethodsWithNoSideEffects.
Lint/Void:
Exclude:
- 'lib/aruba/platforms/announcer.rb'
- 'lib/aruba/platforms/unix_environment_variables.rb'

# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
# Configuration parameters: IgnoredMethods.
Metrics/AbcSize:
Max: 118
Max: 116

# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
# IgnoredMethods: refine
# Configuration parameters: CountComments, ExcludedMethods.
# ExcludedMethods: refine
Metrics/BlockLength:
Max: 68

# Configuration parameters: CountComments, CountAsOne.
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 158

# Configuration parameters: IgnoredMethods.
Metrics/CyclomaticComplexity:
Max: 13
Max: 12

# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
# Configuration parameters: CountComments, ExcludedMethods.
Metrics/MethodLength:
Max: 59

# Configuration parameters: CountComments, CountAsOne.
# Configuration parameters: CountComments.
Metrics/ModuleLength:
Max: 198

# Configuration parameters: IgnoredMethods.
Metrics/PerceivedComplexity:
Max: 14
Max: 13

Naming/ConstantName:
Exclude:
Expand All @@ -79,7 +62,7 @@ Naming/MemoizedInstanceVariableName:
- 'lib/aruba/api/core.rb'

# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
# AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to
# AllowedNames: io, id, to, by, on, in, at, ip, db, os, pp
Naming/MethodParameterName:
Exclude:
- 'lib/aruba/aruba_path.rb'
Expand All @@ -88,7 +71,6 @@ Naming/MethodParameterName:
- 'lib/aruba/platforms/aruba_logger.rb'
- 'lib/aruba/platforms/unix_platform.rb'

# Cop supports --auto-correct.
Performance/Caller:
Exclude:
- 'lib/aruba/platforms/unix_platform.rb'
Expand All @@ -106,7 +88,6 @@ RSpec/ContextWording:
- 'spec/aruba/platform/windows_environment_variables_spec.rb'
- 'spec/support/shared_contexts/aruba.rb'

# Configuration parameters: IgnoredMetadata.
RSpec/DescribeClass:
Exclude:
- 'spec/aruba/api/runtime_spec.rb'
Expand All @@ -118,6 +99,7 @@ RSpec/DescribeClass:
- 'spec/aruba/matchers/file_spec.rb'
- 'spec/aruba/matchers/path_spec.rb'
- 'spec/aruba/platform/simple_table_spec.rb'
- 'spec/aruba/rspec_spec.rb'

# Configuration parameters: Max.
RSpec/ExampleLength:
Expand All @@ -127,8 +109,7 @@ RSpec/ExampleLength:
- 'spec/aruba/aruba_path_spec.rb'
- 'spec/aruba/matchers/collection_spec.rb'

# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
# Include: **/*_spec*rb*, **/spec/**/*
# Configuration parameters: CustomTransform, IgnoreMethods.
RSpec/FilePath:
Exclude:
- 'spec/aruba/platform/windows_environment_variables_spec.rb'
Expand All @@ -154,13 +135,10 @@ RSpec/InstanceVariable:
- 'spec/event_bus_spec.rb'
- 'spec/support/shared_contexts/aruba.rb'

# Configuration parameters: AggregateFailuresByDefault.
RSpec/MultipleExpectations:
Max: 5

# Configuration parameters: AllowSubject.
RSpec/MultipleMemoizedHelpers:
Max: 11

RSpec/NestedGroups:
Max: 6

Expand All @@ -174,8 +152,6 @@ Style/AccessModifierDeclarations:
Exclude:
- 'lib/aruba/matchers/collection/all.rb'

# Cop supports --auto-correct.
# Configuration parameters: AllowOnConstant.
Style/CaseEquality:
Exclude:
- 'lib/aruba/matchers/base/object_formatter.rb'
Expand All @@ -192,20 +168,11 @@ Style/Documentation:
- 'lib/aruba/platforms/command_monitor.rb'
- 'lib/aruba/setup.rb'

# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, IgnoredMethods.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: annotated, template, unannotated
Style/FormatStringToken:
EnforcedStyle: unannotated

# Configuration parameters: MinBranchesCount.
Style/HashLikeCase:
Exclude:
- 'lib/aruba/cucumber/command.rb'
Enabled: false

# Configuration parameters: AllowedMethods.
# AllowedMethods: respond_to_missing?
Style/OptionalBooleanParameter:
Style/MethodMissingSuper:
Exclude:
- 'lib/aruba/api/core.rb'
- 'lib/aruba/platforms/aruba_file_creator.rb'
- 'lib/aruba/setup.rb'
- 'lib/aruba/platforms/command_monitor.rb'
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# ------------
#
# This Dockerfile will always target the lowest version of Ruby supported by
# Aruba. This is currently version 2.4.0.
# Aruba. This is currently version 2.3.0.
#
# Build the Docker image using:
#
Expand All @@ -16,7 +16,7 @@
# The `-v $PWD:/aruba` will make the container pick up any changes to the
# code, so you can edit and re-run the tests.

FROM ruby:2.4
FROM ruby:2.3

# Create aruba user
RUN useradd -m -s /bin/bash aruba
Expand Down
8 changes: 8 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ source "https://rubygems.org"
# Use dependencies from gemspec
gemspec

group :development do
if RUBY_VERSION >= "2.4.0"
gem "license_finder", "~> 6.0"
gem "rake-manifest", "~> 0.2.0"
gem "simplecov", [">= 0.18.0", "< 0.22.0"]
end
end

# Load local Gemfile
if File.file? File.expand_path("Gemfile.local", __dir__)
load File.expand_path("Gemfile.local", __dir__)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ We try to comply with [Semantic Versioning 2.0.0](http://semver.org/spec/v2.0.0.

## Supported Ruby versions

Aruba is supported on Ruby 2.4 and up, and tested against CRuby 2.4, 2.5, 2.6
and 2.7, and JRuby 9.2.
Aruba is supported on Ruby 2.3 and up, and tested against CRuby 2.3, 2.4, 2.5,
2.6 and 2.7, and JRuby 9.2.

## Supported operating systems

Expand Down
23 changes: 14 additions & 9 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,23 @@ end
desc "Run all linters."
task lint: %w(lint:coding_guidelines lint:licenses)

# Also check the manifest as part of the linting
task lint: "manifest:check"

Bundler::GemHelper.install_tasks

require "rake/manifest/task"
begin
require "rake/manifest/task"

Rake::Manifest::Task.new do |t|
t.patterns = ["lib/**/*", "exe/*", "CHANGELOG.md", "CONTRIBUTING.md",
"LICENSE", "README.md"]
end
Rake::Manifest::Task.new do |t|
t.patterns = ["lib/**/*", "exe/*", "CHANGELOG.md", "CONTRIBUTING.md",
"LICENSE", "README.md"]
end

task build: "manifest:check"
# Check the manifest before building the gem
task build: "manifest:check"

# Also check the manifest as part of the linting
task lint: "manifest:check"
rescue LoadError
# skip
end

task default: :test
13 changes: 5 additions & 8 deletions aruba.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,18 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency "thor", "~> 1.0"

spec.add_development_dependency "json", "~> 2.1"
spec.add_development_dependency "license_finder", "~> 6.0"
spec.add_development_dependency "license_finder", [">= 5.3", "< 7.0"]
spec.add_development_dependency "minitest", "~> 5.10"
spec.add_development_dependency "pry-doc", "~> 1.0"
spec.add_development_dependency "rake", "~> 13.0"
spec.add_development_dependency "rake-manifest", "~> 0.2.0"
spec.add_development_dependency "rspec", "~> 3.10.0"
spec.add_development_dependency "rubocop", "~> 1.10.0"
spec.add_development_dependency "rubocop-packaging", "~> 0.5.0"
spec.add_development_dependency "rubocop-performance", "~> 1.9.0"
spec.add_development_dependency "rubocop-rspec", "~> 2.2.0"
spec.add_development_dependency "simplecov", [">= 0.18.0", "< 0.22.0"]
spec.add_development_dependency "rubocop", "~> 0.81.0"
spec.add_development_dependency "rubocop-performance", "~> 1.5.2"
spec.add_development_dependency "rubocop-rspec", "~> 1.38.0"
spec.add_development_dependency "yard-junk", "~> 0.0.7"

spec.rubygems_version = ">= 1.6.1"
spec.required_ruby_version = ">= 2.4"
spec.required_ruby_version = ">= 2.3"

spec.files = File.readlines("Manifest.txt", chomp: true)

Expand Down
6 changes: 5 additions & 1 deletion features/support/env.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
$LOAD_PATH.unshift File.expand_path("../../lib", __dir__)

# Has to be the first file required so that all other files show coverage information
require "simplecov" unless RUBY_PLATFORM.include?("java")
begin
require "simplecov" unless RUBY_PLATFORM.include?("java")
rescue LoadError
# skip
end

# Standard Library
require "fileutils"
Expand Down
14 changes: 9 additions & 5 deletions features/support/simplecov_setup.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# @note this file is loaded in env.rb to setup simplecov using RUBYOPTs for
# child processes and @in-process
unless RUBY_PLATFORM.include?("java")
require "simplecov"
root = File.expand_path("../..", __dir__)
SimpleCov.command_name(ENV["SIMPLECOV_COMMAND_NAME"])
SimpleCov.root(root)
load File.join(root, ".simplecov")
begin
require "simplecov"
root = File.expand_path("../..", __dir__)
SimpleCov.command_name(ENV["SIMPLECOV_COMMAND_NAME"])
SimpleCov.root(root)
load File.join(root, ".simplecov")
rescue LoadError
# skip
end
end
2 changes: 1 addition & 1 deletion lib/aruba/config/jruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

env["JRUBY_OPTS"] = jruby_opts

if /solaris|sunos/i.match?(RbConfig::CONFIG["host_os"])
if /solaris|sunos/i =~ RbConfig::CONFIG["host_os"]
java_opts = env["JAVA_OPTS"] || ""

# force jRuby to use client JVM for faster startup times
Expand Down
2 changes: 1 addition & 1 deletion lib/aruba/initializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def add_gem

content = if File.exist? file
file_ends_with_carriage_return =
File.open(file, "r").readlines.last.match(/.*\n$/)
File.open(file, "r").readlines.last =~ /.*\n$/

prefix = file_ends_with_carriage_return ? "" : "\n"

Expand Down
2 changes: 1 addition & 1 deletion lib/aruba/matchers/base/message_indenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module MessageIndenter
def indent_multiline_message(message)
message = message.sub(/\n+\z/, "")
message.lines.map do |line|
/\S/.match?(line) ? " #{line}" : line
/\S/ =~ line ? " #{line}" : line
end.join
end
end
Expand Down
4 changes: 3 additions & 1 deletion lib/aruba/platforms/determine_disk_usage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ module Platforms
# @private
class DetermineDiskUsage
def call(paths)
size = paths.flatten.sum { |path| minimum_disk_space_used path }
size = paths.flatten.map do |path|
minimum_disk_space_used path
end.inject(0, &:+)

FileSize.new(size)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/aruba/platforms/unix_environment_variables.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class UpdateAction
attr_reader :other_env, :block

def initialize(other_env, &block)
@other_env = other_env.to_h.transform_values(&:to_s)
@other_env = other_env.to_h.each_with_object({}) { |(k, v), a| a[k] = v.to_s }

@block = block
end
Expand Down
Loading