Repository navigation
Expand file tree
/
Copy pathRakefile
More file actions
51 lines (43 loc) · 1.57 KB
/
Copy pathRakefile
File metadata and controls
51 lines (43 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
require "rspec/core/rake_task"
desc "Prepare MongoDB connection"
task :mongo_prepare do
# Wait for mongod to start on Travis.
# From the Mongo Ruby Driver gem.
if ENV["TRAVIS"]
require "mongo"
client = Mongo::Client.new(["127.0.0.1:27017"])
begin
puts "Waiting for MongoDB..."
client.command("ismaster" => 1)
rescue Mongo::Error::NoServerAvailable
sleep 2
# 1 Retry
puts "Waiting for MongoDB..."
client.cluster.scan!
client.command(Mongo::Error::NoServerAvailable)
end
end
end
desc "Run the mongo_session_store gem test suite."
RSpec::Core::RakeTask.new :test => :mongo_prepare
require "bundler/gem_tasks"
if RUBY_ENGINE == "ruby" && Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.3") &&
Gem.loaded_specs.key?("ruby-gem-release")
require_relative "script/release"
MongoSessionStoreRelease.workflow.install_tasks
%w[release release:rubygem_push release:source_control_push].each do |name|
Rake::Task[name].clear
desc "Disabled; releases run through GitHub Actions, see RELEASING.md"
task(name) { abort "#{name} is disabled; releases run through GitHub Actions, see RELEASING.md" }
end
end
lint = RUBY_ENGINE == "ruby" && Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.3") &&
Gem.loaded_specs.key?("rubocop")
if lint
require "rubocop/rake_task"
RuboCop::RakeTask.new(:rubocop)
desc "Lint Ruby, Markdown, YAML, and spelling"
task :lint => :rubocop
end
desc "Default task for Rake. Runs lint, where available, and the test suite."
task :default => (lint ? [:rubocop, :test] : [:test])