Giter Site home page Giter Site logo

threeturn / librarian Goto Github PK

View Code? Open in Web Editor NEW

This project forked from applicationsonline/librarian

1.0 2.0 0.0 344 KB

Librarian - A Bundler for your Chef Cookbooks

Home Page: https://applicationsonline.com/

License: MIT License

Ruby 100.00%

librarian's Introduction

Librarian

A tool to resolve recursively a set of specifications and fetch and install the fully resolved specifications.

Librarian::Mock

An adapter for Librarian for unit testing the general features. The mock source is in-process and in-memory and does not touch the filesystem or the network.

Librarian::Chef

An adapter for Librarian applying to Chef cookbooks in a Chef Repository.

Install librarian:

$ gem install librarian

Make sure your cookbooks directory is gitignored

$ cd ~/path/to/chef-repo
$ git rm -r cookbooks # if the directory is present
$ echo cookbooks >> .gitignore

Note that librarian takes over your cookbooks directory and manages it for you based on your Cheffile. Your Cheffile becomes the authoritative source for what cookbooks you have, rather than the directories in your cookbooks directory.

Make a Cheffile

$ librarian-chef init

Add dependencies and their sources to Cheffile

$ cat Cheffile
    site 'http://community.opscode.com/api/v1'
    cookbook 'ntp'
    cookbook 'timezone'
    cookbook 'rvm',
      :git => 'https://github.com/fnichol/chef-rvm',
      :ref => 'v0.7.1'

install dependencies into ./cookbooks

$ librarian-chef install [--clean] [--verbose]

Check your Cheffile.lock into version control

$ git add Cheffile.lock
$ git commit -m "I want these particular versions of these particular cookbooks from these particular."

Update your cheffile with new/changed/removed constraints/sources/dependencies

$ cat Cheffile
    site 'http://community.opscode.com/api/v1'
    cookbook 'ntp'
    cookbook 'timezone'
    cookbook 'rvm',
      :git => 'https://github.com/fnichol/chef-rvm',
      :ref => 'v0.7.1'
    cookbook 'monit' # new!
$ git diff Cheffile
$ librarian-chef install [--verbose]
$ git diff Cheffile.lock
$ git add Cheffile
$ git add Cheffile.lock
$ git commit -m "I also want these additional cookbooks."

Update the version of a dependency

$ librarian-chef update ntp timezone monit [--verbose]
$ git diff Cheffile.lock
$ git add Cheffile.lock
$ git commit -m "I want updated versions of these cookbooks."

Push your changes to the git repository

$ git push origin master

Upload the cookbooks to your chef-server

$ knife cookbook upload --all

You should .gitignore your ./cookbooks directory. If you are manually tracking/vendoring outside cookbooks within the repository, put them in another directory such as ./cookbooks-sources and use the :path source. You should typically not need to do this.

You can integrate your knife.rb with Librarian. Stick the following in your knife.rb:

require 'librarian/chef/integration/knife'
cookbook_path Librarian::Chef.install_path, "chef-repo/site-cookbooks"

In the above, make sure not to include the path to your chef-repo/cookbooks. If you have additional cookbooks directories in your chef-repo that you use for :path-sourced cookbooks in your Cheffile, make sure not to include the paths to those additional cookbooks directories either in your chef-repo. Since your chef-repo/site-cookbooks directory is for overrides (monkey-patches) to external cookbooks, and since you should not have any :path-sourced cookbooks in your Cheffile sourced from that directory, you still need to include your chef-repo/site-cookbooks directory in the above list.

What this integration does is when you use knife, it will enforce that your Cheffile and Cheffile.lock are in sync. When you knife cookbook upload, it will be sure to upload the same cookbook as is in your Cheffile.lock, regardless of what you've done to your chef-repo/cookbooks directory.

License

Written by Jay Feldblum.

Copyright (c) 2011 ApplicationsOnline, LLC.

Released under the terms of the MIT License.

librarian's People

Contributors

agoddard avatar fnichol avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.