tools

various tools I have been using throughout the years
Log | Files | Refs | README | LICENSE

Rakefile (1270B)


      1 # frozen_string_literal: true
      2 
      3 require 'rake'
      4 
      5 begin
      6   require 'rspec/core/rake_task'
      7   RSpec::Core::RakeTask.new(:spec) do |t|
      8     t.rspec_opts = ['-fd', '-c']
      9     t.ruby_opts = ['-Ispec,lib']
     10     t.pattern = 'spec/**/*_spec.rb'
     11   end
     12 rescue LoadError
     13   desc 'Spec rake task not available'
     14   task :spec do
     15     abort 'Spec rake task is not available. Be sure to install rspec as a gem or plugin'
     16   end
     17 end
     18 
     19 namespace :gem do
     20   desc 'Build the gem'
     21   task :build do
     22     mkdir_p 'pkg'
     23     sh 'gem build hue.gemspec'
     24     sh 'mv *.gem pkg/'
     25   end
     26 
     27   desc 'Publish the gem'
     28   task publish: :build do
     29     gem = Dir['pkg/*.gem'].max_by { |f| File.mtime(f) }
     30     sh "gem push #{gem}"
     31   end
     32 
     33   desc 'Install the gem locally'
     34   task install: :build do
     35     gem = Dir['pkg/*.gem'].max_by { |f| File.mtime(f) }
     36     sh "gem install #{gem}"
     37   end
     38 end
     39 
     40 desc 'Remove generated files'
     41 task :clean do
     42   rm_rf 'pkg'
     43 end
     44 
     45 require 'rubocop/rake_task'
     46 RuboCop::RakeTask.new
     47 
     48 require 'reek/rake/task'
     49 Reek::Rake::Task.new
     50 
     51 desc 'Run bundler-audit'
     52 task :audit do
     53   sh 'bundle exec bundle-audit check --update'
     54 end
     55 
     56 desc 'Run sorbet typecheck'
     57 task :sorbet do
     58   sh 'bundle exec srb tc'
     59 end
     60 
     61 desc 'Run all static analysis'
     62 task lint: %i[rubocop reek sorbet audit]
     63 
     64 task default: %i[spec rubocop]