lib/tasks/coco_tasks.rake in coveragebook_components-0.8.7 vs lib/tasks/coco_tasks.rake in coveragebook_components-0.8.8

- old
+ new

@@ -1,15 +1,25 @@ +require "json" + namespace :coco do - desc "Run Ruby and JS tests" - task :test do + desc "Run tests" + task :test, [:files] do |task, args| puts "🥥 Running Ruby tests..." - Rake::Task["test"].execute + system "npm run build:dev" + system "bundle exec rake test TEST=#{args.files || "test/**/*_test.rb"}" puts "✅ Ruby tests complete" + end - puts "🥥 Running JS tests..." - system "npm run js:test" - puts "✅JS tests complete" + namespace :test do + desc "Run tests in CI" + task :ci do + puts "🥥 Building assets..." + Rake::Task["coco:assets:build"].execute + puts "🥥 Running Ruby tests..." + Rake::Task["test"].execute + puts "✅ Ruby tests complete" + end end task :lint do puts "🥥 Running standardrb..." Rake::Task["standard"].execute @@ -37,8 +47,47 @@ desc "Build assets" task :build do puts "🥥 Building assets..." system "npm run build" puts "✅ Asset build complete" + end + end + + namespace :gem do + desc "Build and push to RubyGems" + task :release, [:version] do |task, args| + Rake::Task["coco:gem:build"].execute + Rake::Task["coco:gem:push"].invoke(args.version) + end + + desc "Bump gem version" + task :bump_version, [:version] => :environment do |task, args| + puts "🥥 Bumping version number to #{args.version}" + + new_version = args.version.sub("v", "").tr("-", ".") + version_file = File.expand_path("#{File.dirname(__FILE__)}/../coco.rb") + current_version = Coco::VERSION.to_s + file = File.open(version_file) + contents = file.read + File.write(version_file, contents.gsub(current_version, new_version)) + + puts "✅ Version bump complete" + end + + desc "Build gem" + task :build do + puts "🥥 Building Gem..." + Rake::Task["build"].execute + puts "✅ Gem build complete" + end + + desc "Push gem to Rubygems" + task :push, [:version] do |task, args| + puts "🥥 Pushing to RubyGems..." + + version = args.version.sub("v", "").tr("-", ".") + system "gem push pkg/coveragebook_components-#{version}.gem" + + puts "✅ Gem pushed to RubyGems" end end end