Building Inject From Source
Want to build your very own copy of Inject? Perhaps you’d like to contribute to the project or maybe just tinker around under the hood. Whatever the reason, these steps will get you started quickly.
1. Grab a Copy of the Source
Clone or fork Inject from GitHub:
2. Install Dependencies
You’ll need to gather a few npm packages and submodules to build and test successfully. Before we begin, install Node.js and npm if you don’t have them already:
Now you can install the required dependencies. Navigate to the root directory and issue this command to install the necessary npm packages:
To properly test your Inject build, you’ll need to install a few submodules. While still in the root directory:
git submodule init
git submodule update
After all the dependencies have been successfully installed, you’re ready to build Inject. Simply run this command:
node makefile.js build
To customize your build, these options are available:
Disables cross domain support (default is false)
Disables ie7 support (default is false)
Set an output directory (default is ./artifacts)
4. Viewing Examples and Testing Your Build
The Inject source package includes a collection of usage examples and a suit of tests that cover Inject-specific integration, the CommonJS specification, and the AMD tests. These can be accessed by starting the server:
node makefile.js server
Hit http://localhost:4000/tests/ to run the test suite. It’s a good idea to run the tests after building to verify your copy is in working order.
5. Integrating with Travis CI
Travis-CI is a continuous integration server that works with GitHub. Every time you push to “origin”, a build can be kicked off to validate your code is working as expected. Set up Travis-CI as follows:
- Visit http://travis-ci.org in your browser.
- Sign in with your GitHub credentials and authorize Travis-CI.
- Visit your Travis-CI Profile.
- If none of your repositories are listed, click “Sync now”.
- In the list of your repositories, flip the on/off switch for yourname/inject.
- Click the wrench to configure your service hook and verify everything looks good (you can use our .travis.yml file).
- From the settings page, give the “Test Hook” a click. It will kick off a Travis-CI build for you and you can verify things are behaving correctly. Anything comes up, open an issue and we’ll try and get things working for you.