Giter Club home page Giter Club logo

librarian-puppet-go's Introduction

README

librarian-puppet-go is a simple command to clone modules and to checkout based on Puppetfile.

go run main.go install --modulepath /tmp/modules < Puppetfile

Feature

This command ensures that git repositories are checked out with tag, ref and version.

For instance, let's say you have a following Puppetfile.

mod 'bar', :git => '[email protected]:tmtk75/tmtk75-bar.git', :ref => 'master'
mod 'foo', :git => '[email protected]:tmtk75/tmtk75-foo.git', :ref => 'v0.1.2'
mod 'puppetlabs/stdlib', '4.1.0'

Then modules directory has these repositories after running the command.

modules
  |-- bar       # chekced out at the latest of master origin/branch
  |-- foo       # checked out at the specified tag, v0.1.2
  `-- stdlib    # checked out at the commit versioned as 4.1.0 in puppetlabs.com
  • Check out the present latest commit of origin/${branchname} if :ref is a branch.
  • Check out the tag if :ref is a tag.
  • Check out the commit registered with a version in puppetlabs.com retrieving its URL of source repository using REST API. puppet module command is NOT used.

Extensions

include

include directive allows you to include several Puppetfiles like this.

include "Puppetfile.common"
include "Puppetfile.debug"
mod 'puppetlabs/stdlib'
  • It can be only in the head of file. You cannot put include after mod directive.
  • The latest mod is used if same module name appears. For example, next case is 1.0.0 is enabled.
mod 'puppetlabs/stdlib', '4.1.0'
mod 'puppetlabs/stdlib', '1.0.0'

Performance

  • It takes about 30 seconds in order to clone about 80 modules although basically cloning modules strongly depends on the network speed ๐Ÿ˜
  • It takes about 7 seconds in order to fetch & checkout about 80 modules.

Assumption

$ cat Puppetfile.1 | grep '^mod' | wc -l
      84
$ cat Puppetfile.2 | grep '^mod' | wc -l
      81

Puppetfile.1 has 84 mod declarations. For example,

mod 'puppetlabs/stdlib', '4.1.0'
mod 'nodejs', :git => 'git://github.com/danheberden/puppet-nodejs.git'

Puppetfile.2 also has 81 mod declarations which each mod has a specific tag. For instance,

mod 'foo', :git => '[email protected]:tmtk75/tmtk75-foo.git', :ref => 'v0.1.2'
mod 'bar', :git => '[email protected]:tmtk75/tmtk75-bar.git', :ref => 'v0.2.0'

Time to cloning all & checkout all

At first there is no modules, which will be created, so all modules are cloned.

$ time ./librarian-puppet-go install --modulepath modules < Puppetfile.1

real    0m32.639s
user    0m14.881s
sys     0m12.581s

Afterward fetch & checkout complete within 5 seconds.

$ time ./librarian-puppet-go install --modulepath modules < Puppetfile.2

real    0m7.282s
user    0m4.266s
sys     0m2.788s

Limitation

Acceptable Puppetfile is NOT compatible to original Puppetfile written in DSL of Ruby.
A mod definition MUST be one line which contains mod, version string, :git or :ref. Please see mod_test.go for expected definitions.

librarian-puppet-go's People

Contributors

tmtk75 avatar msanft 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.