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