From 82d586fa2e48f6de3420316ac90b46303397a04d Mon Sep 17 00:00:00 2001 From: Greg Cobb Date: Tue, 27 Jan 2026 00:13:23 -0800 Subject: [PATCH] Remove Spork preloader - Spork is old and unsupported - I wasn't able to get it working with modern ruby - Spring is the modern implementation of the same concept --- Gemfile | 1 - Gemfile.lock | 8 -------- scripts/file_watcher.rb | 29 ----------------------------- spec/README.md | 24 ------------------------ spec/spec_helper.rb | 27 ++------------------------- 5 files changed, 2 insertions(+), 87 deletions(-) delete mode 100755 scripts/file_watcher.rb diff --git a/Gemfile b/Gemfile index 685b617732..ad835214eb 100644 --- a/Gemfile +++ b/Gemfile @@ -96,7 +96,6 @@ group :development do gem 'listen' gem 'roodi' gem 'solargraph' - gem 'spork', git: 'https://github.com/sporkrb/spork', ref: '224df49' # '~> 1.0rc' gem 'spring' gem 'spring-commands-rspec' end diff --git a/Gemfile.lock b/Gemfile.lock index 98a0681a6f..fc0616fba9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -32,13 +32,6 @@ GIT azure-core (~> 0.1.13) nokogiri (~> 1.6, >= 1.6.8) -GIT - remote: https://github.com/sporkrb/spork - revision: 224df492657e617a0c93c0319e78f0eefee5b636 - ref: 224df49 - specs: - spork (1.0.0rc4) - GEM remote: https://rubygems.org/ specs: @@ -693,7 +686,6 @@ DEPENDENCIES sinatra (~> 4.2) sinatra-contrib solargraph - spork! spring spring-commands-rspec statsd-ruby (~> 1.5.0) diff --git a/scripts/file_watcher.rb b/scripts/file_watcher.rb deleted file mode 100755 index 61f08eded1..0000000000 --- a/scripts/file_watcher.rb +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby - -# file-watcher.rb - Wait for files to change, and run associated tests -# -# usage: bundle exec scripts/file-watcher.rb - -require 'listen' - -spork_thread = Thread.new do - system('bundle exec spork') -end - -def gather_spec_files(files) - files2 = files.reject { |x| x['#'] || x['~'] }.map { |x| x.sub("#{Dir.pwd}/", '') } - spec_files, other = files2.partition { |x| %r{^spec/} =~ x } - app_files, lib_files = other.partition { |x| %r{^app/} =~ x } - app_spec_files = app_files.map { |x| "spec/unit/#{x[4..-4]}_spec.rb" }.select { |x| File.exist?(x) } - lib_spec_files = lib_files.map { |x| "spec/unit/#{x[0..-4]}_spec.rb" }.select { |x| File.exist?(x) } - spec_files + app_spec_files + lib_spec_files -end - -listener = Listen.to('app', 'lib', 'spec', only: /.*\.rb$/) do |modified, added, removed| - files = (modified + added + removed) - spec_files = gather_spec_files(files) - system("bundle exec rspec --drb #{spec_files.join(' ')}") unless spec_files.empty? -end -listener.start # not blocking -sleep -spork_thread.join diff --git a/spec/README.md b/spec/README.md index f975b0c0e6..094b821933 100644 --- a/spec/README.md +++ b/spec/README.md @@ -159,27 +159,3 @@ real 18.628 2.077 13.934 19.062 21.821 user 0.177 0.032 0.129 0.185 0.233 sys 0.103 0.014 0.078 0.107 0.126 ``` - -#### Spork (Legacy) - -Spork is an older implementation of the same "forking" strategy implemented by Spring. - -### Running Individual Tests - -In one terminal, change to the `Cloud Controller` root directory and run `bundle exec spork` - -In a separate terminal, you can run selected unit tests quickly by running them with the `--drb` option, as in: - - bundle exec rspec --drb spec/unit/models/services/service_plan_visibility_spec.rb - -You can configure your IDE to take advantage of spork by inserting the `--drb` option. If `spork` isn't running `rspec` will ignore the `--drb` option and run the test the usual slower way. - -Press Ctrl-C in the first terminal to stop running `spork`. - -### Running Tests Automatically When Files Change - -In one terminal, change to the `Cloud Controller` root directory and run `bundle exec scripts/file-watcher.rb` - -As files change, they, or their related spec files, will be run automatically. - -Press Ctrl-C to stop running `file-watcher.rb`. diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index eccbdcacd1..a0648216eb 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -3,28 +3,5 @@ require 'mock_redis' require 'spec_helper_helper' -begin - require 'spork' - # uncomment the following line to use spork with the debugger - # require 'spork/ext/ruby-debug' - - run_spork = !`ps | grep spork | grep -v grep`.empty? -rescue LoadError - run_spork = false -end - -if run_spork - Spork.prefork do - # Loading more in this block will cause your tests to run faster. However, - # if you change any configuration or code from libraries loaded here, you'll - # need to restart spork for it to take effect. - SpecHelperHelper.init - end - Spork.each_run do - # This code will be run each time you run your specs. - SpecHelperHelper.each_run - end -else - SpecHelperHelper.init - SpecHelperHelper.each_run -end +SpecHelperHelper.init +SpecHelperHelper.each_run