diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bb5d14c..e40cbc8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,7 +31,7 @@ jobs: - "3.0" - "3.1" - "3.2" - rails: + rails: - "7.0" - "7.1" @@ -39,7 +39,7 @@ jobs: - uses: actions/checkout@v4 - name: Set up Ruby uses: ruby/setup-ruby@v1 - env: + env: RAILS_VERSION: ${{ matrix.rails }} with: ruby-version: ${{ matrix.ruby }} @@ -52,5 +52,4 @@ jobs: PGPASSWORD: password POSTGRES_PASSWORD: password run: | - bundle exec stree check --ignore-files="vendor/**/*.rb" "**/*.rb" bundle exec rake diff --git a/.streerc b/.streerc deleted file mode 100644 index f8bee31..0000000 --- a/.streerc +++ /dev/null @@ -1 +0,0 @@ ---print-width=100 diff --git a/.tool-versions b/.tool-versions index f280a04..a1c4ef8 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ ruby 3.2.2 -postgres 14.4 +postgres 16.1 diff --git a/Gemfile b/Gemfile index 08d5bae..ee6cf3f 100644 --- a/Gemfile +++ b/Gemfile @@ -1,14 +1,14 @@ # frozen_string_literal: true -source 'https://rubygems.org' +source "https://rubygems.org" -gem 'debug' -if (rails_version = ENV['RAILS_VERSION']) - gem 'rails', "~> #{rails_version}.0" +gem "debug" +if (rails_version = ENV["RAILS_VERSION"]) + gem "rails", "~> #{rails_version}.0" else - gem 'rails' + gem "rails" end -gem 'syntax_tree' -gem 'typeprof' +gem "syntax_tree" +gem "typeprof" gemspec diff --git a/Rakefile b/Rakefile index 2b1ca03..ffa82f9 100644 --- a/Rakefile +++ b/Rakefile @@ -1,16 +1,31 @@ # frozen_string_literal: true -require 'bundler/gem_tasks' -require 'rake/testtask' +require "bundler/gem_tasks" +require "rake/testtask" +require "syntax_tree/rake_tasks" Rake::TestTask.new(:test) do |t| - t.libs << 'test' - t.libs << 'lib' - t.test_files = FileList['test/**/test_*.rb'] + t.libs << "test" + t.libs << "lib" + t.test_files = FileList["test/**/test_*.rb"] end -task :pre_commit do - `typeprof lib/hoardable.rb && stree write "**/*.rb"` +SOURCE_FILES = %w[**/*.rb Rakefile Gemfile bin/console] + +SyntaxTree::Rake::CheckTask.new(:check) do |t| + t.source_files = SOURCE_FILES + t.print_width = 100 + t.ignore_files = "vendor/**/*.rb" +end + +SyntaxTree::Rake::WriteTask.new(:write) do |t| + t.source_files = SOURCE_FILES + t.print_width = 100 +end + +task :typeprof do + `typeprof lib/hoardable.rb` end -task default: %i[test] +task default: %i[check test] +task pre_commit: %i[write typeprof] diff --git a/bin/console b/bin/console index 6102306..4f255e4 100755 --- a/bin/console +++ b/bin/console @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # frozen_string_literal: true -require 'irb' -require_relative '../test/helper' +require "irb" +require_relative "../test/helper" IRB.start(__FILE__)