From 3bf3db4e1fb378c8838878f68cd0d76bce58e2c9 Mon Sep 17 00:00:00 2001 From: Sylvester Keil Date: Sun, 15 Nov 2026 13:27:20 +0100 Subject: [PATCH 1/2] Drop yard other unused dev dependencies --- .gitignore | 1 - .yardopts | 3 --- Gemfile | 4 ---- Rakefile | 8 -------- test/profile.rb | 30 ------------------------------ 5 files changed, 46 deletions(-) delete mode 100644 .yardopts delete mode 100644 test/profile.rb diff --git a/.gitignore b/.gitignore index ad5f724..aa81c77 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ **/*~ *.rbc doc/**/* -.yardoc .bundle lib/bibtex/parser.output lib/bibtex/name_parser.output diff --git a/.yardopts b/.yardopts deleted file mode 100644 index cfb6289..0000000 --- a/.yardopts +++ /dev/null @@ -1,3 +0,0 @@ ---no-private ---document ---exclude lib/bibtex/{name_parser,parser}.rb diff --git a/Gemfile b/Gemfile index 904b7b1..1f26ac0 100644 --- a/Gemfile +++ b/Gemfile @@ -3,8 +3,6 @@ source 'https://rubygems.org', cooldown: 7 gemspec -gem 'json', '~>2.0', platforms: :jruby - gem 'rdf', '~>3.0' gem 'rdf-vocab', '~>3.0' @@ -21,7 +19,6 @@ end group :profile do gem 'memory_profiler', platforms: [:mri] - gem 'ruby-prof', platforms: [:mri] end group :coverage do @@ -34,5 +31,4 @@ group :development do gem 'rubocop-minitest', '~> 0.41', require: false gem 'rubocop-performance', '~> 1.27', require: false gem 'rubocop-rake', '~> 0.7', require: false - gem 'yard' end diff --git a/Rakefile b/Rakefile index a4d5cd9..0559a6e 100644 --- a/Rakefile +++ b/Rakefile @@ -16,9 +16,6 @@ require 'rake/testtask' require 'bibtex/version' -require 'yard' -YARD::Rake::YardocTask.new - Rake::TestTask.new(:test_task) do |t| t.libs << 'lib' << 'test' t.test_files = FileList['test/**/test_*.rb'] @@ -99,11 +96,6 @@ namespace :bench do end end -desc 'Runs the profiler' -task profile: ['racc'] do - require File.expand_path('test/profile.rb', __dir__) -end - desc 'Builds the gem file' task build: %w[clean racc] do system 'gem build bibtex-ruby.gemspec' diff --git a/test/profile.rb b/test/profile.rb deleted file mode 100644 index 13ed805..0000000 --- a/test/profile.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true - -require File.expand_path('../lib/bibtex.rb', __dir__) - -require 'ruby-prof' - -data = <<~BIBTEX - @book{pickaxe, - Address = {Raleigh, North Carolina}, - Author = "Thomas, Dave, and Fowler, Chad, and Hunt, Andy", - Date-Added = {2010-08-05 09:54:07 +0200}, - Date-Modified = {2010-08-05 10:07:01 +0200}, - Keywords = {ruby}, - Publisher = {The Pragmatic Bookshelf}, - Series = {The Facets of Ruby}, - Title = {Programming Ruby 1.9: The Pragmatic Programmer's Guide}, - Year = {2009} - } -BIBTEX - -data *= 50 -# data = File.open(File.expand_path('../fixtures/benchmark.bib', __FILE__)).read - -result = RubyProf.profile do - BibTeX.parse(data) - # BibTeX::Lexer.new.analyse(data) -end - -printer = RubyProf::DotPrinter.new(result) -printer.print(File.open(File.expand_path('profile.dot', __dir__), 'w'), min_percent: 5) From de5c85fd79482ecd00503f92935391b14196ff97 Mon Sep 17 00:00:00 2001 From: Sylvester Keil Date: Sun, 15 Nov 2026 13:37:47 +0100 Subject: [PATCH 2/2] Modernize Rake tasks --- .gitignore | 3 +-- Rakefile | 69 ++++++---------------------------------------------- cucumber.yml | 1 + 3 files changed, 9 insertions(+), 64 deletions(-) create mode 100644 cucumber.yml diff --git a/.gitignore b/.gitignore index aa81c77..92618eb 100644 --- a/.gitignore +++ b/.gitignore @@ -8,8 +8,7 @@ lib/bibtex/parser.output lib/bibtex/name_parser.output coverage .byebug_history - .DS_Store .ruby-version - Gemfile.lock +pkg diff --git a/Rakefile b/Rakefile index 0559a6e..06f557f 100644 --- a/Rakefile +++ b/Rakefile @@ -1,76 +1,33 @@ # frozen_string_literal: true -require 'bundler' -begin - Bundler.setup -rescue Bundler::BundlerError => e - warn e.message - warn 'Run `bundle install` to install missing gems' - exit e.status_code -end - -$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), './lib')) - +require 'bundler/gem_tasks' require 'rake/clean' require 'rake/testtask' +require 'cucumber/rake/task' -require 'bibtex/version' - -Rake::TestTask.new(:test_task) do |t| +Rake::TestTask.new(:test) do |t| + t.deps = [:racc] t.libs << 'lib' << 'test' t.test_files = FileList['test/**/test_*.rb'] - # t.verbose = true end -begin - require 'cucumber/rake/task' - Cucumber::Rake::Task.new(:features) do |t| - t.cucumber_opts = ['--format progress'] - end -rescue LoadError - desc 'Cucumber rake task not available' - task :features do - abort 'Cucumber rake task is not available. Please install cucumber as a gem or plugin' - end -end +Cucumber::Rake::Task.new(:features) task default: %i[test features] desc 'Generates the BibTeX parser' task racc: ['lib/bibtex/parser.rb', 'lib/bibtex/name_parser.rb'] -task test: %w[racc test_task] +task build: %w[clean racc] -file 'lib/bibtex/parser.output' => ['lib/bibtex/parser.rb'] file 'lib/bibtex/parser.rb' => ['lib/bibtex/bibtex.y'] do - # sh 'racc -v -g -o lib/bibtex/parser.rb lib/bibtex/bibtex.y' sh 'bundle exec racc -F -l -o lib/bibtex/parser.rb lib/bibtex/bibtex.y' end file 'lib/bibtex/name_parser.rb' => ['lib/bibtex/names.y'] do - # sh 'racc -v -g -o lib/bibtex/name_parser.rb lib/bibtex/names.y' sh 'bundle exec racc -F -l -o lib/bibtex/name_parser.rb lib/bibtex/names.y' end -desc 'Run an IRB session with BibTeX-Ruby loaded' -task :console, [:script] do |_t, args| - ARGV.clear - - require 'irb' - require 'bibtex' - - IRB.conf[:SCRIPT] = args.script - IRB.start -end - -desc 'Loads BibTeX-Ruby with warnings enabled and prints its version' -task :check_warnings do - $VERBOSE = true - require 'bibtex' - - puts BibTeX::Version::STRING -end - desc 'Benchmarks speed and allocations (N=1000 ITERATIONS=5 WORKLOADS=a,b MEM=1 JSON=out.json COMPARE=base.json)' task bench: ['racc'] do sh Gem.ruby, '-W0', 'benchmark/run.rb' @@ -96,20 +53,8 @@ namespace :bench do end end -desc 'Builds the gem file' -task build: %w[clean racc] do - system 'gem build bibtex-ruby.gemspec' -end - -desc 'Pushes the gem file to rubygems.org' -task release: ['build'] do - system %(git tag "#{BibTeX::Version::STRING}") - system 'git push --tags' - system "gem push bibtex-ruby-#{BibTeX::Version::STRING}.gem" -end - CLEAN.include('lib/bibtex/parser.rb') CLEAN.include('lib/bibtex/parser.output') CLEAN.include('lib/bibtex/name_parser.rb') CLEAN.include('lib/bibtex/name_parser.output') -CLEAN.include('*.gem') +CLEAN.include('pkg') diff --git a/cucumber.yml b/cucumber.yml new file mode 100644 index 0000000..0b6b683 --- /dev/null +++ b/cucumber.yml @@ -0,0 +1 @@ +default: --publish-quiet --format progress