Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
smtlaissezfaire-spork
Advanced tools
= Spork
== SYNOPSIS:
Spork is Tim Harper's implementation of test server (similar to the script/spec_server provided by rspec-rails), except rather than using the Rails constant unloading to reload your files, it forks a copy of the server each time you run your tests. The result? Spork runs more solid: it doesn't get corrupted over time, and it properly handles modules and any voo-doo meta programming you may have put in your app.
Because Spork uses Kernel.fork, it only works on POSIX systems. This means Windows users are not invited to this party. Sorry :(
== Supported Testing Frameworks
And more to come! Vote for your favorite at http://github.com/timcharper/spork/issues
== Supported Application Frameworks
Actually, Spork can work with any application framework. But, it ships with hooks and helpers to help make the experience much more "out of the box"
More can be added! Vote for your favorite at http://github.com/timcharper/spork/issues
== INSTALL:
[sudo] gem install spork
alternatively:
git clone git://github.com/timcharper/spork.git cd spork gem build spork.gemspec sudo gem install spork.gemspec
== Usage
From a terminal, change to your project directory.
Then, bootstrap your spec/spec_helper.rb file.
spork --bootstrap
Next, edit spec/spec_helper.rb and follow the instructions that were put at the top.
Finally, run spork. A spec DRb server will be running!
spork
== Diagnostic mode
Initially, you may find that a few files don't reload automatically. This is because they are being loaded during Spork startup. To identify which project files are being pre-loaded, and why, run:
spork --diagnose (or spork -d, for short)
It will output a lot of stuff. At the top you'll find a summary of all project files loaded. Down below, the stack trace for each file (how it got loaded). Spork hooks into Rails and does some magic (TM) to prevent ApplicationController observers, etc from pre-loading. Similar hooks for other ruby frameworks may come as support demands.
== Running specs over Spork
=== RSpec
To get the TextMate RSpec bundle to use spork, go to config->advanced->shell variables, and add:
TM_RSPEC_OPTS=--drb.
To run from the command line, use:
spec --drb spec/lib/my_spec.rb
Or, you could add the following flag to your +spec.opts+ file.
--drb
=== Cucumber
Cucumber --drb support for spork is not official yet (but it works). It's the hottest sauce boiling on the world wide web right now. If you can't wait to try it, head on over to Cucumber core-team member Ben Mabey's drb branch and build your own cucumber gem:
http://github.com/bmabey/cucumber/tree/drb_server
Use this as a guideline when "Sporking" your features/support/env.rb file
== Some potential issues and ways to overcome them:
=== Database connections don't work inside of Spork
If you're using ActiveRecord and Rails, Spork will automatically reconnect to the database. However, if you're not using ActiveRecord, or if you're doing some tricky stuff with connections, you'll have to make sure your connections get re-established on each run. In your spec/spec_helper.rb file:
Spork.each_run do # Do your connection re-establishing here end
=== Couldn't find formatter class Spec::Runner::Formatter::TextMateFormatter
Make sure the --require option is specified before --format
On one of our projects, many of us using TextMate with spork, only one developer got this error message while the rest of us ran just fine. I don't know exactly why it happened, but requiring the textmate formatter in the prefork block made it go away, like this:
Spork.prefork do gem "rspec", "= 1.2.6" require 'spec' ... require 'spec/runner/formatter/text_mate_formatter' ... end
=== uninitialized constant MissingSourceFile
This is kind of an issue with RSpec. See this ticket for more info:
Basically, just remove the " unless defined?(RAILS_ROOT)" from your spec/spec_helper.rb, and this should go away.
== Kudos to
Spork (c) 2009 Tim Harper, released under the MIT license
FAQs
Unknown package
We found that smtlaissezfaire-spork demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.