Just include this cookbook in a wrapper cookbook and use the resources as you see fit. Just make sure you install git before you use any of the resources that use it
since they assume it is installed. You can of course use the codenamephp_git_client_package
resource for this.
The codenamephp_git_client_package
resource installs the package using a package manager.
:install
: Installs the git client using a package manager.
package_name
: The name of the package to install, defaults to'git'
# Minimal properties
codenamephp_git_client_package 'Install git'
# With custom package name
codenamephp_git_client_package 'Install git' do
package_name 'some package'
end
The codenamephp_git_client_config
resource is used to set configurations through git config
. It supports system wide, user global and per-repo configurations.
set
: Sets the given config
key
: The key of config to set, e.g. user.full_name, defaults to the resource namevalue
: The config value to setuser
: The user to run the command asscope
: The scope to set the config for, one oflocal global system
, defaults to globalpath
: The path to run the command in, needed when setting per-repo settings, defaults to empty stringoptions
: Additional options that will be appended to the command, defaults to empty string
# Minimal properties
codenamephp_git_client_config 'user.full_name' do
value 'Some User'
user 'someuser'
end
# All properties
codenamephp_git_client_config 'Set some config' do
key 'some config'
value 'some value'
user 'someuser'
scope 'local'
path '/some/path'
options '--some-options'
end
The codenamephp_git_client_config_user
is used to configure multiple values for a single user using a hash where the keys are the config keys and values the configs to be set for their keys.
The configs are all set in the --global scope.
Uses codenamephp_git_client_config
internally.
:set
: Sets the given configs for the given user
user
: The user to execute the command as and to set the configs forconfigs
: A hash with the config keys and their values
# Minimal properties
codenamephp_git_client_config_user 'Set configs for user' do
user 'some user'
configs lazy { { 'user.full_name' => 'Test User', 'user.email' => 'test@test.de' } }
end
The codenamephp_git_client_config_users
is used to configure multiple configs for multiple users at once. The configs are passed as a Hash with the username as key and another Hash with config name => config value pairs.
Uses codenamephp_git_client_config_user
internally.
:set
: Sets the given configs for the given users
users_configs
: A Hash with the username as key and another Hash with config name => config value pairs.
# Minimal properties
codenamephp_git_client_config_users 'Config user' do
users_configs lazy {
{
'user1' => { :config1_user1 => 'value1_user1', 'config2_user1' => 'value2_user1' },
'user2' => { :config1_user2 => 'value1_user2', 'config2_user2' => 'value2_user2' },
}
}
end
The config_users_from_data_bag
resource can be used to set git configurations from data bags. The configs have to be set in the user item. Example:
{
"id": "user",
"codenamephp": {
"git_client": {
"config": {
"user.full_name": "Test User",
"user.email": "test@test.de"
}
}
}
}
Only users that have a non-empty config set are used.
manage
: Manages the configs from the data bag
data_bag_name
: The name of the data bag to search for users, defaults tousers
# Minimal properties
codenamephp_git_client_config_users_from_data_bag 'Manage git users'
# With custom data_bag_name
codenamephp_git_client_config_users_from_data_bag 'Manage git users' do
data_bag_name 'some_data_bag'
end