/itamae-plugin-recipe-rust

Itamae plugin to install Rust

Primary LanguageRubyMIT LicenseMIT

Itamae::Plugin::Recipe::Rust

Itamae plugin to install Rust

Gem Version test

Installation

Add this line to your application's Gemfile:

gem 'itamae-plugin-recipe-rust'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install itamae-plugin-recipe-rust

Usage

System wide installation

Install Rust to /usr/local/cargo or some shared path

Recipe

# your recipe
include_recipe "rust::system"

Node

Use this with itamae -y node.yml

rust:
  # Rust install dir, optional (default: /usr/local/cargo)
  cargo_home: /usr/local/cargo

  # Version of Rust to install, optional (default: latest)
  # version: 1.58.1

  # Passed to `rustup install`, optional (This is used to install a specific version of Rust)
  # rustup_install_option: "--profile minimal"

.bashrc

Recommend to append this to .bashrc in your server.

export CARGO_HOME=/usr/local/rust
export PATH="${CARGO_HOME}/bin:${PATH}"

Installation for a user

Install Rust to ~/.cargo

Recipe

# your recipe
include_recipe "rust::user"

Node

Use this with itamae -y node.yml

rust:
  # User to be installed, optional (default: ENV["USER"])
  user: deploy

  # Rust install dir, optional (default: "/home/#{node[:rust][:user]}/.cargo" or "/Users/#{node[:rust][:user]}/.cargo" (MacOS))
  # cargo_home: /home/deploy/.cargo

  # Version of Rust to install, optional (default: latest)
  # version: 1.58.1

  # Passed to `rustup install`, optional (This is used to install a specific version of Rust)
  # rustup_install_option: "--profile minimal"

mitamae

This plugin can be used for mitamae too. Put this repository under ./plugins as git submodule.

node.reverse_merge!(
  rust: {
    user: "deploy",
    version: "1.58.1",
  }
)

include_recipe "rust::user"

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/itamae-plugins/itamae-plugin-recipe-rust.

License

The gem is available as open source under the terms of the MIT License.