Skip to content

Commit 2c2613b

Browse files
authored
Modernize dev dependencies management (#348)
* Move prometheus_exporter bin to exe directory * Add binstub for Rubocop (it's shorter to type/remember) * Move dev dependencies in Gemfile * Add binstub for Rake (it's shorter to type/remember) * Don't rely on git to build bundler manifest * Add binstub for Appraisal (it's shorter to type/remember) * Drop support of AR 6.0 (not present in CI matrix) * Add AR 7.1 in Appraisals file * Add support for AR 8.0 * Drop support for Ruby 3.1 (EOL: 2025-03-26) * Add support for Ruby 3.4 * Ignore bundler project cache * Don't let bundler autoclean gems (Appraisal will fail later because of missing gems) * Use latest Appraisal version * Fix failing CI with AR 6.1/7.0 and Ruby 3.4 * Add binstub for syntax_tree (it's shorter to type/remember) * Fix failing CI with AR 6.1 and Ruby 3.4 * Fix Rubocop offense * Fix stree formatting
1 parent 908ee3d commit 2c2613b

File tree

18 files changed

+205
-48
lines changed

18 files changed

+205
-48
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ jobs:
2727
strategy:
2828
fail-fast: false
2929
matrix:
30-
ruby: ["3.1", "3.2", "3.3"]
31-
activerecord: [61, 70, 71]
30+
ruby: ["3.2", "3.3", "3.4"]
31+
activerecord: [61, 70, 71, 80]
3232

3333
steps:
3434
- uses: actions/checkout@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
/tmp/
99
Gemfile.lock
1010
/gemfiles/*.gemfile.lock
11+
/gemfiles/.bundle
1112

1213

1314
.rubocop-https---raw-githubusercontent-com-discourse-discourse-master--rubocop-yml

.rubocop.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ inherit_gem:
33

44
AllCops:
55
Exclude:
6+
- 'bin/*'
67
- 'gemfiles/**/*'
78
- 'vendor/**/*'
89

@@ -11,7 +12,7 @@ Discourse/Plugins/NoMonkeyPatching:
1112

1213
Discourse/Plugins/NamespaceMethods:
1314
Exclude:
14-
- bin/prometheus_exporter
15+
- exe/prometheus_exporter
1516

1617
Style/InvertibleUnlessCondition:
1718
Exclude:

Appraisals

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,32 @@
11
# frozen_string_literal: true
22

3-
appraise "ar-60" do
4-
gem "activerecord", "~> 6.0.0"
5-
end
6-
73
appraise "ar-61" do
84
gem "activerecord", "~> 6.1.1"
5+
6+
# Fix:
7+
# warning: mutex_m was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0.
8+
# Add mutex_m to your Gemfile or gemspec.
9+
install_if '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' do
10+
gem 'base64'
11+
gem 'mutex_m'
12+
end
913
end
1014

1115
appraise "ar-70" do
12-
# latest version
13-
gem "activerecord", "~> 7.1.2"
16+
gem "activerecord", "~> 7.0.0"
17+
18+
# Fix:
19+
# warning: mutex_m was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0.
20+
# Add mutex_m to your Gemfile or gemspec.
21+
install_if '-> { Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.4.0") }' do
22+
gem 'mutex_m'
23+
end
24+
end
25+
26+
appraise "ar-71" do
27+
gem "activerecord", "~> 7.1.0"
28+
end
29+
30+
appraise "ar-80" do
31+
gem "activerecord", "~> 8.0.0"
1432
end

Gemfile

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,26 @@
22

33
source "https://rubygems.org"
44

5-
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6-
7-
# Specify your gem's dependencies in prometheus_exporter.gemspec
85
gemspec
6+
7+
# Dev libs
8+
gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git"
9+
gem "activerecord", "~> 7.1"
10+
gem "bundler", ">= 2.1.4"
11+
gem "m"
12+
gem "mini_racer", "~> 0.12.0"
13+
gem "minitest", "~> 5.23.0"
14+
gem "minitest-stub-const", "~> 0.6"
15+
gem "oj", "~> 3.0"
16+
gem "rack-test", "~> 2.1.0"
17+
gem "rake", "~> 13.0"
18+
gem "redis", "> 5"
19+
gem "syntax_tree"
20+
gem "syntax_tree-disable_ternary"
21+
gem "raindrops", "~> 0.19" if !RUBY_ENGINE == "jruby"
22+
23+
# Dev tools / linter
24+
gem "guard", "~> 2.0", require: false
25+
gem "guard-minitest", "~> 2.0", require: false
26+
gem "rubocop", ">= 0.69", require: false
27+
gem "rubocop-discourse", ">= 3", require: false

bin/appraisal

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'appraisal' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12+
13+
require "rubygems"
14+
require "bundler/setup"
15+
16+
load Gem.bin_path("appraisal", "appraisal")

bin/rake

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'rake' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12+
13+
require "rubygems"
14+
require "bundler/setup"
15+
16+
load Gem.bin_path("rake", "rake")

bin/rubocop

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'rubocop' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12+
13+
require "rubygems"
14+
require "bundler/setup"
15+
16+
load Gem.bin_path("rubocop", "rubocop")

bin/stree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'stree' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12+
13+
require "rubygems"
14+
require "bundler/setup"
15+
16+
load Gem.bin_path("syntax_tree", "stree")
File renamed without changes.

0 commit comments

Comments
 (0)