Skip to content

Commit

Permalink
Merge pull request #19 from bastelfreak/ruby
Browse files Browse the repository at this point in the history
Add Ruby 3.1/3.2/3.3 to CI
  • Loading branch information
bastelfreak committed Apr 23, 2024
2 parents d68e3eb + 42bc3d6 commit fdb2b4c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 114 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ jobs:
- ruby: "2.7"
- ruby: "3.0"
coverage: "yes"
- ruby: "3.1"
- ruby: "3.2"
- ruby: "3.3"
env:
COVERAGE: ${{ matrix.coverage }}
steps:
Expand Down
13 changes: 2 additions & 11 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,9 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org'

gemspec

def location_for(place, fake_version = nil)
if place =~ /^git:([^#]*)#(.*)/
[fake_version, { git: Regexp.last_match(1), branch: Regexp.last_match(2), require: false }].compact
elsif place =~ %r{^file://(.*)}
['>= 0', { path: File.expand_path(Regexp.last_match(1)), require: false }]
else
[place, { require: false }]
end
end

group :release do
gem 'github_changelog_generator', require: false
gem 'faraday-retry', '~> 2.1', require: false
gem 'github_changelog_generator', '~> 1.16.4', require: false
end

group :coverage, optional: ENV['COVERAGE'] != 'yes' do
Expand Down
105 changes: 2 additions & 103 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,115 +19,14 @@ task 'test:spec' => 'test:spec:run'
task test: 'test:spec'
task default: :test

###########################################################
#
# Documentation Tasks
#
###########################################################
DOCS_DAEMON = 'yard server --reload --daemon --server thin'
FOREGROUND_SERVER = 'bundle exec yard server --reload --verbose --server thin lib/beaker'

def running?(cmdline)
ps = `ps -ef`
found = ps.lines.grep(/#{Regexp.quote(cmdline)}/)
raise StandardError, "Found multiple YARD Servers. Don't know what to do." if found.length > 1

yes = found.empty? ? false : true
[yes, found.first]
end

def pid_from(output)
output.squeeze(' ').strip.split(' ')[1]
end

desc 'Start the documentation server in the foreground'
task docs: 'docs:clear' do
original_dir = Dir.pwd
Dir.chdir(__dir__)
sh FOREGROUND_SERVER
Dir.chdir(original_dir)
end

namespace :docs do
desc 'Clear the generated documentation cache'
task :clear do
original_dir = Dir.pwd
Dir.chdir(__dir__)
sh 'rm -rf docs'
Dir.chdir(original_dir)
end

desc 'Generate static documentation'
task gen: 'docs:clear' do
original_dir = Dir.pwd
Dir.chdir(__dir__)
output = `bundle exec yard doc`
puts output
raise 'Errors/Warnings during yard documentation generation' if /\[warn\]|\[error\]/.match?(output)

Dir.chdir(original_dir)
end

desc 'Run the documentation server in the background, alias `bg`'
task background: 'docs:clear' do
yes, output = running?(DOCS_DAEMON)
if yes
puts 'Not starting a new YARD Server...'
puts "Found one running with pid #{pid_from(output)}."
else
original_dir = Dir.pwd
Dir.chdir(__dir__)
sh "bundle exec #{DOCS_DAEMON}"
Dir.chdir(original_dir)
end
end

task(:bg) { Rake::Task['docs:background'].invoke }

desc 'Check the status of the documentation server'
task :status do
yes, output = running?(DOCS_DAEMON)
if yes
pid = pid_from(output)
puts "Found a YARD Server running with pid #{pid}"
else
puts 'Could not find a running YARD Server.'
end
end

desc 'Stop a running YARD Server'
task :stop do
yes, output = running?(DOCS_DAEMON)
if yes
pid = pid_from(output)
puts "Found a YARD Server running with pid #{pid}"
`kill #{pid}`
puts 'Stopping...'
yes, output = running?(DOCS_DAEMON)
if yes
`kill -9 #{pid}`
yes, output = running?(DOCS_DAEMON)
if yes
puts 'Could not Stop Server!'
else
puts 'Server stopped.'
end
else
puts 'Server stopped.'
end
else
puts 'Could not find a running YARD Server'
end
end
end

begin
require 'rubygems'
require 'github_changelog_generator/task'
rescue LoadError
# github_changelog_generator is an optional group
else
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
config.exclude_labels = %w[duplicate question invalid wontfix wont-fix skip-changelog]
config.exclude_labels = %w[duplicate question invalid wontfix wont-fix skip-changelog github_actions]
config.user = 'voxpupuli'
config.project = 'beaker-vcloud'
gem_version = Gem::Specification.load("#{config.project}.gemspec").version
Expand Down
2 changes: 2 additions & 0 deletions beaker-vcloud.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Gem::Specification.new do |s|
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
s.require_paths = ['lib']

s.required_ruby_version = '>= 2.7'

# Testing dependencies
s.add_development_dependency 'fakefs', '~> 2.5'
s.add_development_dependency 'rake'
Expand Down

0 comments on commit fdb2b4c

Please sign in to comment.