Gemnasium-gem

Keep your project in shape! More info: https://gemnasium.com

View the Project on GitHub gemnasium/gemnasium-gem

Gemnasium gem

Dependency Status Build Status

This gem lets you push your dependency files to Gemnasium to track your project's dependencies and get notified about updates and security advisories.

Gemnasium app offers Github integration with fully automated synchronization but you can use this gem if you don't want to authorize access to your repositories (ie: for privacy concern).

Supported dependency files are:

Installation

Add this line to your application's Gemfile:

gem 'gemnasium'

Or in your terminal:

$ gem install gemnasium

Add configuration file in your project

$ gemnasium install

Install command supports 2 options : --rake and --git to respectively install the gemnasium rake task and a post-commit git hook.

gemnasium install will add the config/gemnasium.yml file to your .gitignore so your private API key won't be committed. If you use another versionning system, please remember to ignore this file.

Warning: your api key is dedicated to your own user account and must not be published!

Fill the values of the new config/gemnasium.yml file.

Usage

There is multiple ways to use the gemnasium gem. You can choose whichever you prefer.

1. Via the command line

Using gemnasium from the command line is as simple as typing gemnasium [command] :

To create a project on Gemnasium:

$ gemnasium create

Create command will look for data in your config/gemnasium.yml configuration file to create a project. If your project was previously managed automatically from Github you can use the --force option to overwrite existing setup.

Please note that automatic Github synchronization will be dropped once project is configured with this gem.

To push your dependency files on Gemnasium:

$ gemnasium push

2. Via the rake task

Gemnasium gem comes with a rake task ready to be used. To use it, you need to install it via: gemnasium install --rake Once installed, you'll have access to 2 tasks:

To create a project on Gemnasium:

$ rake gemnasium:create

Create command will look for data in your config/gemnasium.yml configuration file to create a project. If your project was previously managed automatically from Github you can use the gemnasium:create:force subtask to overwrite existing setup.

Please note that automatic Github synchronization will be dropped once project is configured with this gem.

To push your dependency files on Gemnasium:

$ rake gemnasium:push

3. Via the post-commit git hook

We wrote for you a ready-to-use post-commit git hook.

Once installed via gemnasium install --git, the gem will push your dependency files after each commit only if they have changed.

4. Directly in your code

If you need to use Gemnasium gem right into your code, you can do so just like below:

require 'gemnasium'


# To install gemnasium files
#
# options is a Hash which can contain the following keys:
#   project_path (required) - [String] path to the project
#   install_rake_task       - [Boolean] whether or not to install the rake task
#   install_git_hook        - [Boolean] whether or not to install the git hook
Gemnasium.install(options)

# To create your project on gemnasium
#
# options is a Hash which can contain the following keys:
#   project_path (required) - [String] path to the project
#   overwrite_attr          - [Boolean] whether or not to overwrite existing project's attributes
Gemnasium.create_project(options)

# To push supported dependency files to gemnasium
#
# options is a Hash which can contain the following keys:
#   project_path (required) - [String] path to the project
Gemnasium.push(options)

Sample config

Here is a sample config file:

api_key: "some_secret_api_key"
profile_name: "tech-angels"
project_name: "vandamme"
project_branch: "master"
ignored_paths:
  - spec/
  - tmp/

This will handle the dependencies of the vandamme project for the tech-angels profile on master branch. Gemnasium gem will also ignore the project dependency files found in spec/ and tmp/.

Troubleshooting

Gemnasium will try to display the most accurate error message when something goes wrong.

Though, if you're stil stuck with something, feel free to contact Gemnasium support.

Contributing

  1. Fork the project.
  2. Make your feature or bug fix.
  3. Test it.
  4. Commit.
  5. Create new pull request.

Credits

Tech-Angels