Prospector
Last updated December 22, 2015
This is a draft article - the text and URL may change in the future. This article is unlisted. Only contributors can access it.
The Prospector add-on is currently in beta.
Table of Contents
Prospector is an add-on providing dependency tracking and analysis in Ruby projects. On app boot, Prospector queues a background job to connect to the API and deliver details about your project’s Gemfile and dependencies.
Prospector works with any Bundler based Ruby project, including Ruby on Rails, Sinatra, Padrino and more. Be alerted to new updates in your Gemfile, track your project health and perform informed updates so you aren’t met with a dependency upgrade nightmare when your team least expects it.
Prospector is accessible via an API and has supported client libraries for Ruby.
To see a full list of features available, read more on our site here.
Provisioning the add-on
Prospector can be attached to a Heroku application via the CLI:
A list of all plans available can be found here.
$ heroku addons:create prospector
-----> Adding prospector to sharp-mountain-4005... done, v18 (free)
Once Prospector has been added, three new settings will be available in the app configuration to configure the Prospector Ruby client. This can be confirmed using the heroku config:get
command.
$ heroku config | grep PROSPECTOR
PROSPECTOR_CLIENT_SECRET: <secret>
PROSPECTOR_ENABLED: true
PROSPECTOR_SECRET_TOKEN: <token>
After installing Prospector the application should be configured to fully integrate with the add-on.
Using with Rails 3.x and Rails 4.x
Ruby on Rails applications will need to add the following entry into their Gemfile
specifying the Prospector client library.
gem 'prospector'
Update application dependencies with bundler.
$ bundle install
By default, Prospector will be configured via the settings in your app configuration. Additional settings can be configured by creating an initializer.
# config/initializers/prospector.rb
Prospector.configure do |config|
# Will default to using ActiveJob
# config.background_adapter = :active_job
# config.background_adapter = :sidekiq
# config.background_adapter = :inline
# config.background_adapter = :none
end
The default is active_job
if running Rails 4.2 or later, but other values are sidekiq
to queue a supplied Sidekiq worker, inline
to run immediately without a background queue, or none
to do nothing and skip entirely. If you choose none
, it is up to you to decide when to call our API manually.
Using with Sinatra
Sinatra applications will need to add the following entry into their Gemfile
specifying the Prospector client library.
gem 'prospector'
Update application dependencies with bundler.
$ bundle install
In Sinatra, we recommend choosing when to deliver details to the Prospector API, and to perform that in a non-blocking way. If you choose to call our API directly anywhere in your codebase, you can do so simply with the following snippet.
Prospector.notify! if Prospector.enabled?
Using with Rake
In addition to simply calling our API manually with Prospector.notify!
, you have the option of using a Rake task at any time.
$ bundle exec rake prospector:deliver
Dashboard
For more information on the features available within the Prospector dashboard please see the docs at support.gemprospector.com.
The Prospector dashboard allows you to track and analyze your project’s dependencies. Use the project score to track the health of your project, easily review a list of minor and major pending updates to your codebase, and invite other engineers to join your team.
The dashboard can be accessed via the CLI:
$ heroku addons:open prospector
Opening prospector for sharp-mountain-4005
or by visiting the Heroku Dashboard and selecting the application in question. Select Prospector from the Add-ons menu.
Errors
NotEnabledError
Check to make sure that you have enabled Prospector, either via a setting in your app configuration PROSPECTOR_ENABLED=true
, or via a Rails initializer (if using Rails).
If calling our API manually, do the following to avoid the error.
Prospector.notify! if Prospector.enabled?
AuthenticationError
Your secret and token are invalid. Either someone has removed the Prospector add-on from Heroku and the credentials are invalid, or a team member has reset the credentials via the Prospector dashboard.
InvalidCredentialsError
This is raised when the secret or token is missing entirely from the settings in your app configuration. Double check by running the following command and checking for PROSPECTOR_SECRET_TOKEN
and PROSPECTOR_CLIENT_SECRET
values.
$ heroku config | grep PROSPECTOR
UnsupportedAdapterError
For Rails users, check to make sure that the specified background queue adapter in your initializer is valid. The default is active_job
if running Rails 4.2 or later, but other values are sidekiq
for Sidekiq support, inline
to run immediately without a background queue, or none
to do nothing and skip entirely.
Removing the add-on
Prospector can be removed via the CLI.
This will destroy all associated data and cannot be undone!
$ heroku addons:destroy prospector
-----> Removing prospector from sharp-mountain-4005... done, v20 (free)
Removing Prospector will immediately delete your entire project history, teams, and organization on Prospector. After removing the add-on, you can safely uninstall the Ruby client from your codebase.
Support
All Prospector support and runtime issues should be submitted via one of the Heroku Support channels. Any non-support related issues or product feedback is welcome at support@gemprospector.com.