Skip to content

Commit

Permalink
Remove baloney in Rakefile (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyshields authored Apr 10, 2023
1 parent 534cad0 commit 5c3c680
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 76 deletions.
79 changes: 4 additions & 75 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,8 @@ require "bundler"
require "bundler/gem_tasks"
Bundler.setup

ROOT = File.expand_path(File.join(File.dirname(__FILE__)))

$: << File.join(ROOT, 'spec/shared/lib')

require "rake"
require "rspec/core/rake_task"
require 'mrss/spec_organizer'

$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
require "mongoid/version"

tasks = Rake.application.instance_variable_get('@tasks')
tasks['release:do'] = tasks.delete('release')

task :gem => :build
task :build do
system "gem build mongoid.gemspec"
end

task :install => :build do
system "sudo gem install mongoid-#{Mongoid::VERSION}.gem"
end

task :release do
raise "Please use ./release.sh to release"
end

RSpec::Core::RakeTask.new("spec") do |spec|
spec.pattern = "spec/**/*_spec.rb"
Expand All @@ -40,52 +16,13 @@ RSpec::Core::RakeTask.new('spec:progress') do |spec|
spec.pattern = "spec/**/*_spec.rb"
end

CLASSIFIERS = [
[%r,^mongoid/attribute,, :attributes],
[%r,^mongoid/association/[or],, :associations_referenced],
[%r,^mongoid/association,, :associations],
[%r,^mongoid,, :unit],
[%r,^integration,, :integration],
[%r,^rails,, :rails],
]

RUN_PRIORITY = %i(
unit attributes associations_referenced associations
integration rails
)

def spec_organizer
Mrss::SpecOrganizer.new(
root: ROOT,
classifiers: CLASSIFIERS,
priority_order: RUN_PRIORITY,
)
end

task :ci do
spec_organizer.run
end

task :bucket, %i(buckets) do |task, args|
buckets = args[:buckets]
buckets = if buckets.nil? || buckets.empty?
[nil]
else
buckets.split(':').map do |bucket|
if bucket.empty?
nil
else
bucket.to_sym
end
end
end
spec_organizer.run_buckets(*buckets)
end
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
require "mongoid/version"

task :default => :spec
task default: :spec

desc "Generate all documentation"
task :docs => 'docs:yard'
task docs: 'docs:yard'

namespace :docs do
desc "Generate yard documention"
Expand All @@ -95,11 +32,3 @@ namespace :docs do
system "yardoc -o #{out} --title mongoid-#{Mongoid::VERSION}"
end
end

namespace :release do
task :check_private_key do
unless File.exist?('gem-private_key.pem')
raise "No private key present, cannot release"
end
end
end
2 changes: 1 addition & 1 deletion mongoid.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Gem::Specification.new do |s|

s.add_development_dependency("bson", ['>=4.14.0', '<5.0.0'])

s.files = Dir.glob("lib/**/*") + %w(CHANGELOG.md LICENSE README.md Rakefile)
s.files = Dir.glob("lib/**/*") + %w[LICENSE README.md Rakefile]
s.test_files = Dir.glob("spec/**/*")
s.require_path = 'lib'
end

0 comments on commit 5c3c680

Please sign in to comment.