Skip to content

Commit 90e06f7

Browse files
authored
ruby update + q2 maint. (#848)
* update the gems to the latest version - stage 1 * require faraday/rack to fix rack adapter issue * params removed form cancel and restart spec * rubocop stage1 * rubocop stage2 * faraday-rack up to 2.0 * Default API endpoint switched * activesupport 7.0
1 parent 8372ee3 commit 90e06f7

File tree

157 files changed

+3468
-2899
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

157 files changed

+3468
-2899
lines changed

.rubocop.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
require: rubocop-performance
2+
require: rubocop-rspec
3+
4+
Documentation:
5+
Enabled: false
6+
Metrics/ClassLength:
7+
Enabled: false
8+
Style/ClassAndModuleChildren:
9+
Enabled: false
10+
Metrics/LineLength:
11+
Enabled: false
12+
Metrics/MethodLength:
13+
Max: 40
14+
Style/AsciiComments:
15+
Enabled: false
16+
Metrics/AbcSize:
17+
Enabled: false
18+
Style/GuardClause:
19+
Enabled: false
20+
Style/FormatStringToken:
21+
Enabled: false
22+
Lint/AssignmentInCondition:
23+
Enabled: false
24+
Style/IfUnlessModifier:
25+
Enabled: false
26+
Naming/MemoizedInstanceVariableName:
27+
EnforcedStyleForLeadingUnderscores: required
28+
Style/MultilineBlockChain:
29+
Enabled: false
30+
Lint/ConstantDefinitionInBlock:
31+
Enabled: false
32+
Naming/VariableNumber:
33+
Enabled: false
34+
Metrics/BlockLength:
35+
Enabled: false
36+
Lint/ImplicitStringConcatenation:
37+
Enabled: false
38+
Metrics/MethodLength:
39+
Enabled: false
40+
Style/StructInheritance:
41+
Enabled: false
42+
Lint/RescueException:
43+
Enabled: false
44+
Lint/SuppressedException:
45+
Enabled: false
46+
Naming/MemoizedInstanceVariableName:
47+
Enabled: false
48+
Style/SymbolProc:
49+
Enabled: false
50+
RSpec/MultipleMemoizedHelpers:
51+
Enabled: false

.travis.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
11
language: ruby
22
cache: bundler
3+
dist: bionic
34

45
os:
56
- linux
67

78
rvm:
8-
- jruby
9-
- "2.4"
10-
- "2.5"
11-
- "2.6"
12-
- "2.7"
9+
- "3.2"
1310

1411
jobs:
1512
include:
16-
- rvm: "2.3"
13+
- rvm: "3.2"
1714
before_script:
1815
- gem install faraday -v 1.0.1
1916
- os: osx
20-
rvm: "2.5"
17+
rvm: "3.2"
2118
- os: osx
22-
rvm: "2.6"
19+
rvm: "3.2"
2320
- stage: deploy
2421
if: repo = travis-ci/travis.rb and branch = master and type = push
2522
os: linux
26-
rvm: "2.6"
23+
rvm: "3.2"
2724
deploy:
2825
provider: rubygems
2926
api_key:

Gemfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1+
# frozen_string_literal: true
2+
13
source 'https://rubygems.org'
24
gemspec
35

6+
gem 'gh', git: 'https://github.com/travis-ci/gh', branch: 'prd-ruby-upgrade-dev'
47
gem 'rake'
8+
gem 'activesupport', '~> 7.0.6'
9+
10+
group :development, :test do
11+
gem 'rubocop'
12+
gem 'rubocop-performance'
13+
gem 'rubocop-rspec'
14+
gem 'simplecov-console'
15+
end

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2066,6 +2066,12 @@ See https://github.com/travis-ci/travis.rb/issues/768#issuecomment-700220351 for
20662066

20672067
## Version History
20682068

2069+
### 1.12.0
2070+
2071+
* Upgraded ruby version to 3.2 https://github.com/travis-ci/travis.rb/pull/848
2072+
* Added API Key Reset Capabilities https://github.com/travis-ci/travis.rb/pull/842
2073+
* Fix travis lint issues https://github.com/travis-ci/travis.rb/pull/840
2074+
20692075
### 1.11.1
20702076

20712077
* Fix `travis sshkey --generate` https://github.com/travis-ci/travis.rb/pull/820

Rakefile

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
1-
# encoding: utf-8
2-
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
1+
# frozen_string_literal: true
2+
3+
$LOAD_PATH.unshift File.expand_path('lib', __dir__)
34
windows = RUBY_PLATFORM =~ /mswin|mingw/
45

56
require 'bundler/gem_tasks'
67

7-
desc "run specs"
8-
task(:spec) { ruby "-S rspec spec#{" -c" unless windows}" }
8+
desc 'run specs'
9+
task(:spec) { ruby "-S rspec spec#{' -c' unless windows}" }
910

10-
desc "generate gemspec, update readme"
11-
task :update => :completion do
11+
desc 'generate gemspec, update readme'
12+
task update: :completion do
1213
require 'travis/version'
1314
content = File.read('travis.gemspec')
1415

1516
# fetch data
1617
fields = {
17-
:authors => sort_by_commits_alpha(`git shortlog -sn`.b, /[^\d\s].*/).uniq,
18-
:email => sort_by_commits_alpha(`git shortlog -sne`.b, /[^<]+@[^>]+/).uniq,
19-
:files => `git ls-files`.b.split("\n").reject { |f| f =~ /^(\.|Gemfile)/ }
18+
authors: sort_by_commits_alpha(`git shortlog -sn`.b, /[^\d\s].*/).uniq,
19+
email: sort_by_commits_alpha(`git shortlog -sne`.b, /[^<]+@[^>]+/).uniq,
20+
files: `git ls-files`.b.split("\n").reject { |f| f =~ /^(\.|Gemfile)/ }
2021
}
2122

2223
# :(
23-
fields[:email].delete("[email protected]")
24+
fields[:email].delete('[email protected]')
2425

2526
# insert data
2627
fields.each do |field, values|
@@ -31,20 +32,21 @@ task :update => :completion do
3132
end
3233

3334
# set version
34-
content.sub! /(s\.version.*=\s+).*/, "\\1\"#{Travis::VERSION}\""
35+
content.sub!(/(s\.version.*=\s+).*/, "\\1\"#{Travis::VERSION}\"")
3536

3637
# escape unicode
3738
content.gsub!(/./) { |c| c.bytesize > 1 ? "\\u{#{c.codepoints.first.to_s(16)}}" : c }
3839

3940
File.open('travis.gemspec', 'w') { |f| f << content }
4041

4142
readme = File.read('README.md').b
42-
readme.gsub! /^(\s+\$ travis version\n\s+).*$/, "\\1#{Travis::VERSION}"
43-
readme.gsub! /(gem install travis -v )\S+/, "\\1#{Travis::VERSION}"
44-
readme.gsub! /^\*\*#{Regexp.escape(Travis::VERSION)}\*\* \(not yet released?\)\n/i, "**#{Travis::VERSION}** (#{Time.now.strftime("%B %-d, %Y")})\n"
43+
readme.gsub!(/^(\s+\$ travis version\n\s+).*$/, "\\1#{Travis::VERSION}")
44+
readme.gsub!(/(gem install travis -v )\S+/, "\\1#{Travis::VERSION}")
45+
readme.gsub!(/^\*\*#{Regexp.escape(Travis::VERSION)}\*\* \(not yet released?\)\n/i,
46+
"**#{Travis::VERSION}** (#{Time.now.strftime('%B %-d, %Y')})\n")
4547

4648
Travis::CLI.commands.each do |c|
47-
readme.sub! /^( \* \[\`#{c.command_name}\`\]\(##{c.command_name}\)).*$/, "\\1 - #{c.description}"
49+
readme.sub!(/^( \* \[`#{c.command_name}`\]\(##{c.command_name}\)).*$/, "\\1 - #{c.description}")
4850
end
4951

5052
File.write('README.md', readme)
@@ -58,13 +60,13 @@ end
5860
task 'travis.gemspec' => :update
5961
task 'README.md' => :update
6062

61-
task :gemspec => :update
62-
task :default => :spec
63-
task :default => :gemspec unless windows or RUBY_VERSION < '2.0'
64-
task :test => :spec
63+
task gemspec: :update
64+
task default: :spec
65+
task default: :gemspec unless windows || (RUBY_VERSION < '2.0')
66+
task test: :spec
6567

6668
def sort_by_commits_alpha(shortlog_output, patt)
67-
shortlog_output.split("\n").sort do |a,b|
69+
shortlog_output.split("\n").sort do |a, b|
6870
a_comm, a_name = a.strip.split(/\t/)
6971
b_comm, b_name = b.strip.split(/\t/)
7072

bin/travis

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
24
# :(
35
Encoding.default_external = Encoding::UTF_8 if defined? Encoding
46

57
# load travis library
6-
require 'bundler/setup' if File.exist? File.expand_path('../../Gemfile', __FILE__)
8+
require 'bundler/setup' if File.exist? File.expand_path('../Gemfile', __dir__)
79
require 'travis/cli'
810

911
# load plugins
10-
TRAVIS_PLUGINS = []
12+
TRAVIS_PLUGINS = [].freeze
1113
config_path = ENV.fetch('TRAVIS_CONFIG_PATH') { File.expand_path('.travis', Dir.home) }
1214
Dir.glob(File.expand_path('*/init.rb', config_path)) do |file|
13-
TRAVIS_PLUGINS << file.sub(config_path + '/', '').sub(/\/init\.rb$/, '')
15+
TRAVIS_PLUGINS << file.sub("#{config_path}/", '').sub(%r{/init\.rb$}, '')
1416
load(file)
1517
end
1618

examples/org_overview.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'travis'
24
repos = Travis::Repository.find_all(owner_name: 'travis-ci')
35
repos.each { |repo| puts "#{repo.slug} #{repo.last_build_state}" }

examples/pro_auth.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
# frozen_string_literal: true
2+
13
require 'travis/pro'
24
require 'travis/tools/github'
35
require 'highline/import' # so we can hide the password
46

5-
github_token = ask("GitHub token: ")
7+
github_token = ask('GitHub token: ')
68

79
# Set up GitHub tool for doing the login handshake.
810
github = Travis::Tools::Github.new(drop_token: true) do |g|

examples/stream.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
# frozen_string_literal: true
2+
13
require 'travis'
24

35
Travis.listen do |listener|
4-
listener.on("job:started") { |e| puts "job started for #{e.repository.slug}" }
5-
listener.on("job:finished") { |e| puts "job finished for #{e.repository.slug}" }
6-
end
6+
listener.on('job:started') { |e| puts "job started for #{e.repository.slug}" }
7+
listener.on('job:finished') { |e| puts "job finished for #{e.repository.slug}" }
8+
end

lib/travis.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
# frozen_string_literal: true
2+
13
module Travis
24
autoload :Client, 'travis/client'
35
autoload :CLI, 'travis/cli'
46
autoload :Pro, 'travis/pro'
57
autoload :Version, 'travis/version'
68

7-
include Client::Namespace.new(Client::ORG_URI)
9+
include Client::Namespace.new(Client::COM_URI)
810
end

0 commit comments

Comments
 (0)