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

Drop Ruby 2.2 support #616

Merged
merged 12 commits into from
May 23, 2019
10 changes: 9 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
require:
- rubocop-performance

AllCops:
Exclude:
- tmp/**/*
- vendor/**/*
DisplayCopNames: true
TargetRubyVersion: 2.2
TargetRubyVersion: 2.3

# Use older RuboCop default
Style/PercentLiteralDelimiters:
PreferredDelimiters:
'%w': ()

# Code is currently broken with frozen string literal comments applied.
# TODO: Enable and fix build
Style/FrozenStringLiteralComment:
Enabled: false

inherit_from: .rubocop_todo.yml
43 changes: 10 additions & 33 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,11 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2019-05-06 11:32:53 +0200 using RuboCop version 0.66.0.
# on 2019-05-19 17:25:35 +0200 using RuboCop version 0.69.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.

# Offense count: 5
# Configuration parameters: Include.
# Include: **/*.gemfile, **/Gemfile, **/gems.rb
Bundler/DuplicatedGem:
Exclude:
- 'Gemfile'

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, IndentationWidth.
# SupportedStyles: with_first_parameter, with_fixed_indentation
Layout/AlignParameters:
Exclude:
- 'lib/aruba/api/commands.rb'
- 'lib/aruba/processes/basic_process.rb'

# Offense count: 5
# Cop supports --auto-correct.
Layout/ClosingHeredocIndentation:
Expand All @@ -39,7 +23,7 @@ Layout/DotPosition:
# Offense count: 5
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
# SupportedStyles: squiggly, active_support, powerpack, unindent
Layout/IndentHeredoc:
Exclude:
- 'lib/aruba/initializer.rb'
Expand All @@ -61,11 +45,6 @@ Lint/MissingCopEnableDirective:
- 'lib/aruba/configuration.rb'
- 'lib/aruba/processes/spawn_process.rb'

# Offense count: 1
Lint/UselessAssignment:
Exclude:
- 'lib/aruba/platforms/unix_environment_variables.rb'

# Offense count: 2
# Configuration parameters: CheckForMethodsWithNoSideEffects.
Lint/Void:
Expand All @@ -86,7 +65,7 @@ Metrics/BlockLength:
# Offense count: 2
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 131
Max: 135

# Offense count: 19
# Configuration parameters: CountComments, ExcludedMethods.
Expand All @@ -112,13 +91,12 @@ Naming/ConstantName:
Exclude:
- 'lib/aruba/platform.rb'

# Offense count: 8
# Offense count: 5
# Configuration parameters: Blacklist.
# Blacklist: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
Naming/HeredocDelimiterNaming:
Exclude:
- 'lib/aruba/initializer.rb'
- 'spec/aruba/matchers/command_spec.rb'

# Offense count: 1
# Configuration parameters: EnforcedStyleForLeadingUnderscores.
Expand All @@ -127,14 +105,13 @@ Naming/MemoizedInstanceVariableName:
Exclude:
- 'lib/aruba/api/core.rb'

# Offense count: 18
# Offense count: 16
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
# AllowedNames: io, id, to, by, on, in, at, ip, db
Naming/UncommunicativeMethodParamName:
Exclude:
- 'lib/aruba/aruba_path.rb'
- 'lib/aruba/config_wrapper.rb'
- 'lib/aruba/event_bus/name_resolver.rb'
- 'lib/aruba/matchers/base/object_formatter.rb'
- 'lib/aruba/platforms/announcer.rb'
- 'lib/aruba/platforms/aruba_logger.rb'
Expand Down Expand Up @@ -231,7 +208,7 @@ Style/ExpandPathArguments:
- 'fixtures/empty-app/lib/cli/app.rb'
- 'fixtures/getting-started-app/Gemfile'

# Offense count: 85
# Offense count: 84
# Configuration parameters: EnforcedStyle.
# SupportedStyles: annotated, template, unannotated
Style/FormatStringToken:
Expand All @@ -242,11 +219,10 @@ Style/IdenticalConditionalBranches:
Exclude:
- 'lib/aruba/hooks.rb'

# Offense count: 10
# Offense count: 8
# Cop supports --auto-correct.
Style/IfUnlessModifier:
Exclude:
- 'Gemfile'
- 'features/support/env.rb'
- 'lib/aruba/cucumber/command.rb'
- 'lib/aruba/matchers/collection/include_an_object.rb'
Expand Down Expand Up @@ -357,8 +333,9 @@ Style/StderrPuts:
Style/SymbolArray:
EnforcedStyle: brackets

# Offense count: 411
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# Offense count: 417
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Metrics/LineLength:
Max: 174
4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ jobs:
os: linux
- rvm: 2.3.8
os: osx
- rvm: 2.2
os: linux
- rvm: 2.2
os: osx
- rvm: jruby
os: linux
- rvm: jruby-9.2.7.0
Expand Down
18 changes: 5 additions & 13 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@ load File.expand_path('../Gemfile.local', __FILE__) if File.file? File.expand_pa
# Debug aruba
group :debug do
unless RUBY_PLATFORM.include?('java')
if RUBY_VERSION >= '2.3.0'
gem 'byebug', '~> 11.0'
else
gem 'byebug', '~> 10.0'
end

gem 'byebug', '~> 11.0'
gem 'pry-byebug', '~> 3.4'
end

Expand All @@ -24,9 +19,7 @@ end
# Tools to run during development
group :development do
# Needed for lint:yard:junk task
if RUBY_VERSION >= '2.3.0'
gem 'yard-junk', '~> 0'
end
gem 'yard-junk', '~> 0.0.7'
end

group :development, :test do
Expand All @@ -50,12 +43,11 @@ group :development, :test do
gem 'rspec', '~> 3.4'

# Make aruba compliant to ruby community guide
gem 'rubocop', '~> 0.64.0'
gem 'rubocop', '~> 0.69.0'
gem 'rubocop-performance', '~> 1.1'

# License compliance
if RUBY_VERSION >= '2.3'
gem 'license_finder', '~> 5.0'
end
gem 'license_finder', '~> 5.0'

gem 'minitest', '~> 5.8'

Expand Down
12 changes: 2 additions & 10 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,12 @@ namespace :lint do

desc 'Lint our code with "rubocop"'
task :coding_guidelines do
if RUBY_VERSION >= '2'
sh 'bundle exec rubocop --fail-level E'
else
warn 'Your ruby version is not supported for code linting'
end
sh 'bundle exec rubocop --fail-level E'
end

desc 'Check for relevant licenses in project'
task :licenses do
if RUBY_VERSION >= '2.3'
sh 'bundle exec license_finder'
else
warn 'Your ruby version is not supported for license checking'
end
sh 'bundle exec license_finder'
end

begin
Expand Down
6 changes: 2 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: "{build}"

# This will build all PRs targetting matching branches.
# This will build all PRs targeting matching branches.
# Without this, each PR builds twice -- once for the PR branch HEAD,
# and once for the merge commit that github creates for each mergable PR.
# and once for the merge commit that github creates for each mergeable PR.
branches:
only:
- master
Expand All @@ -24,9 +24,7 @@ test_script:

environment:
matrix:
- ruby_version: '22'
- ruby_version: '23'
- ruby_version: '24'
- ruby_version: '25'
- ruby_version: '26'

2 changes: 1 addition & 1 deletion aruba.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|

spec.add_development_dependency 'bundler', ['>= 1.7.0', '< 3.0']
spec.rubygems_version = '>= 1.6.1'
spec.required_ruby_version = '>= 2.2'
spec.required_ruby_version = '>= 2.3'

spec.files = `git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(test|spec|features)/})
Expand Down
10 changes: 0 additions & 10 deletions features/step_definitions/hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,6 @@
end
end

Before '@requires-ruby-version-2' do |scenario|
next if RUBY_VERSION >= '2'

if Cucumber::VERSION < '2'
scenario.skip_invoke!
else
skip_this_scenario
end
end

Before '@requires-ruby-platform-java' do |scenario|
# leave if java
next if RUBY_PLATFORM.include? 'java'
Expand Down
2 changes: 1 addition & 1 deletion lib/aruba/api/commands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def run_command(cmd, opts = {})

unless command.interactive?
raise NotImplementedError,
'Running interactively is not supported with this process launcher.'
'Running interactively is not supported with this process launcher.'
end

start_command(command)
Expand Down
2 changes: 1 addition & 1 deletion lib/aruba/in_config_wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def initialize(config)
end

def method_missing(name, *args)
fail ArgumentError, 'Options take no argument' if args.count > 0
fail ArgumentError, 'Options take no argument' if args.any?
fail UnknownOptionError, %(Option "#{name}" is unknown. Please use only earlier defined options) unless config.key? name

config[name]
Expand Down
12 changes: 2 additions & 10 deletions lib/aruba/platforms/simple_table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,8 @@ def to_s

name_size = longest_key.length

if RUBY_VERSION < '2'
rows = []

hash.each do |k, v|
rows << format("# %-#{name_size}s => %s", k, v)
end
else
rows = hash.each_with_object([]) do |(k, v), a|
a << format("# %-#{name_size}s => %s", k, v)
end
rows = hash.each_with_object([]) do |(k, v), a|
a << format("# %-#{name_size}s => %s", k, v)
end

if opts[:sort] == true
Expand Down
12 changes: 2 additions & 10 deletions lib/aruba/platforms/unix_environment_variables.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ class UpdateAction
attr_reader :other_env, :block

def initialize(other_env, &block)
@other_env = other_env

to_hash = RUBY_VERSION >= '2' ? :to_h : :to_hash

@other_env = @other_env.public_send(to_hash).each_with_object({}) { |(k, v), a| a[k] = v.to_s }
@other_env = other_env.to_h.each_with_object({}) { |(k, v), a| a[k] = v.to_s }

@block = if block_given?
block
Expand Down Expand Up @@ -56,11 +52,7 @@ def call(env)
def initialize(env = ENV)
@actions = []

@env = if RUBY_VERSION < '2.0'
env.to_hash
else
env.to_h
end
@env = env.to_h
end

# Update environment with other en
Expand Down
4 changes: 2 additions & 2 deletions lib/aruba/platforms/windows_command_string.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def to_a
private

def escaped_arguments
@arguments.map { |arg| arg.gsub(/"/, '"""') }.
map { |arg| arg =~ / / ? "\"#{arg}\"" : arg }
@arguments.map { |arg| arg.gsub(/"/, '"""') }
.map { |arg| arg =~ / / ? "\"#{arg}\"" : arg }
end

def escaped_command
Expand Down
2 changes: 1 addition & 1 deletion lib/aruba/processes/basic_process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module Processes
# @private
class BasicProcess
attr_reader :exit_status, :environment, :working_directory, :main_class,
:io_wait_timeout, :exit_timeout, :startup_wait_time, :stop_signal
:io_wait_timeout, :exit_timeout, :startup_wait_time, :stop_signal

def initialize(cmd, exit_timeout, io_wait_timeout, working_directory,
environment = Aruba.platform.environment_variables.hash_from_env,
Expand Down
2 changes: 1 addition & 1 deletion lib/aruba/rspec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# Modify PATH to include project/bin
prepend_environment_variable 'PATH',
aruba.config.command_search_paths.join(File::PATH_SEPARATOR) + File::PATH_SEPARATOR
aruba.config.command_search_paths.join(File::PATH_SEPARATOR) + File::PATH_SEPARATOR

# Use configured home directory as HOME
set_environment_variable 'HOME', aruba.config.home_directory
Expand Down
Loading