Inventory-Rake provides Rake tasks for your Inventory. This includes tasks for cleaning up our project, compiling extensions, installing dependencies, installing and uninstalling the project itself, and creating and pushing distribution files to distribution points.
Install Inventory-Rake with
% gem install inventory-rake
Include the following code in your
Package is the
top-level module of your project:
require 'inventory-rake-3.0' load File.expand_path('../lib/package/version.rb', __FILE__) Inventory::Rake::Tasks.define Package::Version Inventory::Rake::Tasks.unless_installing_dependencies do # Any additional tasks that your project’s dependencies provide end
Inventory::Rake::Tasks.define does the heavy lifting. It takes our
inventory and sets up the tasks mentioned above. We also do some
additional customization of the gem specification.
As we want to be able to use our Rakefile to install our dependencies for us, the rest of the Rakefile is inside the conditional #unless_installing_dependencies, which, as the name certainly implies, executes its block unless the task being run is the one that installs our dependencies. This becomes relevant if we want to, for example, set up Travis integration. To do so, simply add
before_script: - gem install inventory-rake -v '~> VERSION' --no-rdoc --no-ri - rake gem:deps:install
.travis.yml file. This’ll make sure that Travis installs all
development, runtime, and optional dependencies that you’ve listed in your
inventory before running any tests.
There’s more information in the API documentation that you’ll likely want to read up on if anything is unclear.
The tasks that are created if you use Inventory-Rake are:
Check that the package meets its expectations.
Delete targets built by rake that are ofter rebuilt.
Delete targets built by rake; depends on mostlyclean.
Delete all files not meant for distribution; depends on clean.
Compile all extensions; depends on each compile:name.
Compile extension name; depends on lib/path/so file.
Installed dynamic library of extension name inside inventory path; depends on ext/name/so.
Dynamic library of extension name; depends on ext/name/Makefile and the source files of the extension.
Makefile for extension name; depends on inventory path, ext/name/extconf.rb file, and ext/name/depend file. Will be created by extconf.rb, which may take options from environment variable name#upcase_EXTCONF_OPTIONS or
Clean files built for extension name; depended upon by clean.
Create specifications; depends on gem:spec.
Create gem specification; depends on gemspec.
- gemspec (file)
Gem specification file; depends on Rakefile, README, and inventory path.
Create files for distribution; depends on gem:dist.
Create gem for distribution; depends on inventory:check and gem file.
Check that the inventory is correct by looking for files not listed in the inventory that match the pattern and for files listed in the inventory that don’t exist; depends on distclean.
- gem (file)
Gem file; depends on files included in gem.
Check files before distribution; depends on dist and gem:dist:check.
Check gem before distribution; depends on gem:dist.
Install dependencies on the local system; depends on gem:deps:install.
Install dependencies in ruby gem directory.
Install dependencies for the current user; depends on gem:deps:install:user.
Install dependencies in the user gem directory.
Install distribution files on the local system; depends on gem:install.
Install gem in ruby gem directory; depends on gem:dist.
Install distribution files for the current user; depends on gem:install:user.
Install gem in the user gem directory.
Delete all files installed on the local system.
Uninstall gem from ruby gem directory.
Delete all files installed for current user.
Uninstall gem from ruby gem directory.
Push distribution files to distribution hubs.
Push gem to rubygems.org.
Currently, most of my time is spent at my day job and in my rather busy private life. Please motivate me to spend time on this piece of software by donating some of your money to this project. Yeah, I realize that requesting money to develop software is a bit, well, capitalistic of me. But please realize that I live in a capitalistic society and I need money to have other people give me the things that I need to continue living under the rules of said society. So, if you feel that this piece of software has helped you out enough to warrant a reward, please PayPal a donation to email@example.com. Thanks! Your support won’t go unnoticed!
Please report any bugs that you encounter to the issue tracker.
Inventory-Rake is free software: you may redistribute it and/or modify it under the terms of the GNU Lesser General Public License, version 3 or later, as published by the Free Software Foundation.