diff --git a/Gemfile b/Gemfile index dbe6f64..dab8aa4 100644 --- a/Gemfile +++ b/Gemfile @@ -10,11 +10,12 @@ gem 'rake', '~> 13.0' gem 'colorize', '~> 1.1' +gem 'dry-cli', '~> 1.0' + +gem 'bump', '~> 0.10.0' + group :development, :test do gem 'minitest', '~> 5.19' + gem 'mocha', '~> 2.1' gem 'rubocop', '~> 1.56' end - -gem 'dry-cli', '~> 1.0' - -gem 'mocha', '~> 2.1' diff --git a/Rakefile b/Rakefile index d0c6390..454fdcd 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,7 @@ # frozen_string_literal: true require 'rake/testtask' +require 'bump/tasks' Rake::TestTask.new do |t| t.libs << 'test' @@ -8,3 +9,33 @@ end desc 'Run tests' task default: :test + +desc 'Run the Windclutter executable' +task :windclutter, [:args] do + args = ARGV[1..] # Capture all arguments after the task name + begin + cmd = "ruby -Ilib ./bin/windclutter #{args.join(' ')}" + sh cmd + ensure + exit 0 + end +end + +namespace :gem do + desc 'Build the gem' + task :build do + sh 'gem build windclutter.gemspec' + end + + desc 'Push the latest gem that was built.' + task :push do + gem_file = Dir.glob('*.gem').max_by { |f| File.mtime(f) } + + if gem_file.nil? + puts 'No gem file found in the current directory.' + else + puts "Pushing gem: #{gem_file}" + sh "gem push #{gem_file}" + end + end +end