chef-plenv icon indicating copy to clipboard operation
chef-plenv copied to clipboard

chef-plenv

Chef cookbook and LWRPs for plenv

Requirements

Platforms

  • Debian, Ubuntu
  • RedHat, CentOS, Fedora, Amazon, Scientific

Cookbooks

Usage

Using Attributes and Recipes

Add these recipes below into run_list:

recipe[plenv]
recipe[plenv::install]
recipe[plenv::global]
recipe[plenv::cpanm]

Then set attributes described later.

Using LWRPs (Recommended)

Only recipe[plenv] should be added into your run_list.

recipe[plenv]

Then use LWRPs in your own recipe.

plenv_install "5.16.3" do
  user   "kentaro"
  action :install
end

plenv_global "5.16.3" do
  user   "kentaro"
  action :run
end

%w[
  carton
  Plack
  Amon2
].each do |mod|
  plenv_cpanm mod do
    user    "kentaro"
    version "5.16.3"
    options "--force"
    action  :install
  end
end

Attributes

Key Type Description Default
['plenv']['repository'] String Repository URL of plenv git://github.com/tokuhirom/plenv.git
['plenv']['reference'] String Reference to the Git repository master
['plenv']['users'] Hash Users and information of Perls to be installed for each users See the example below

Example of users attribute

plenv: {
  users: [
    {
      name:  "kentaro",
      group: "stuff",
      versions: [
        {
          version:         "5.16.3",
          install_options: "-Dusethreads",
          cpanm_options:   "--force",
          moudles: %w[
            Plack
            Amon2
          ],
        },
        {
          version:         "5.14.3",
          install_options: "-Dusethreads",
          cpanm_options:   "--force",
          moudles: %w[
            Mojolicious
          ],
        },
      ],

      global: "5.16.3",
    },

    {
      name: "studio3104",
      group: "stuff",
      versions: [
        {
          # This version will be treated as global if `global` option not set
          version:         "5.16.3",

          install_options: "-Dusethreads",
          cpanm_options:   "--force",
          moudles: %w[
            Plack
            Amon2
          ],
        },
      ],
    },
  ]
}

Recipes

  • plenv::install: Installs plenv (if not installed yey) and perls
  • plenv::global: Sets a certain version of perl as globally used version
  • plenv::cpanm: Installs cpanm (if not installed yet) and a perl module via cpanm

If you want to handle the installation manually, just use only plenv recipe and use LWRPs described below.

Resources and Providers

This cookbook provides serveral LWRPs listed below:

  • plenv_install: Installs plenv (if not installed yet) and runs plenv install ...
  • plenv_global: Runs plenv global ...
  • plenv_cpanm: Installs cpanm (if not installed yet) and a perl module via cpanm

plenv_install

Installs plenv (if not installed yet) and perl via plenv.

plenv_install "5.16.3" do
  user            "kentaro"
  install_options "-Dusethreads"
  action          :install
end

plenv_global

Set a certain version of perl as globally used version.

plenv_global "5.16.3" do
  user   "kentaro"
  action :run
end

plenv_cpanm

Installs cpanm (if not installed yet) and a perl module.

plenv_cpanm "Plack" do
  version "5.16.3"
  user    "kentaro"
  options "--force --reinstall"
  action :install
end

Contributing

  1. Fork the repository on Github
  2. Create a named feature branch (like add_component_x)
  3. Write you change
  4. Write tests for your change (if applicable)
  5. Run the tests, ensuring they all pass
  6. Submit a Pull Request using Github

License and Authors

License

MIT License

Authors