Many Forge modules save space by omitting development files such as the Git history and testing files from the packaged module. This can dramatically reduce download times and disk space required in your codebase, but it means that you'll need to find the original source code of the module to do any development work on it, even if all you want to do is run the unit tests.
You'll first need to have git installed to clone the repository. Open your terminal and run git --version
at the command line. If you get a command not found error, then you'll need to install it.
Then, you'll want to find the hosting repository. Find the module on the Forge and click the Source URL link. If you've already got the module downloaded, you can also find it as the source
or project_page
keys in the module's metadata.json
.
If your intent is to contribute fixes back upstream, you'll probably want to switch over and follow the repository forking tutorials from the hosting provider instead of following the rest of this tutorial.
Different repository hosting providers will have slightly different layouts, but the workflow will be relatively similar. For example, all of Puppet's modules are hosted on GitHub. There, you'd click the big green [Code] button and copy either the HTTPS or SSH URL. For example, the SSH URL for the puppetlabs-apt
module is git@github.com:puppetlabs/puppetlabs-apt.git
.
Now open your terminal in your workspace directory and clone the repository locally. This example is cloning the puppetlabs-apt
module, you'll use the cloning URL you just copied:
[~/Projects]$ git clone git@github.com:puppetlabs/puppetlabs-apt.git
Cloning into 'puppetlabs-apt'...
remote: Enumerating objects: 24, done.
remote: Counting objects: 100% (24/24), done.
remote: Compressing objects: 100% (20/20), done.
remote: Total 6890 (delta 4), reused 13 (delta 2), pack-reused 6866
Receiving objects: 100% (6890/6890), 1.67 MiB | 8.41 MiB/s, done.
Resolving deltas: 100% (4000/4000), done.
[~/Projects]$ cd puppetlabs-apt
[~/Projects/puppetlabs-apt]$
Now you've got a copy of the module's source files, including all the development files you'll need to run tests or inspect the git history.
Comments
0 comments
Please sign in to leave a comment.