Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' into #19_addHeaderToFile
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianschwarz committed Jun 24, 2020
2 parents e7719c7 + a4067cc commit 195fdc3
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/version-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
major-labels: ['semver:major', 'Breaking Change']
minor-labels: ['semver:minor','enhancement', 'Deprecation']
patch-labels: ['semver:patch','bug']
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ env:

branches:
only:
- master
- /^\d+\.\d+(\.\d+)?(-\S*)?$/
- master
- /^\d+\.\d+(\.\d+)?(-\S*)?$/
except:
- release/next

services: docker

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ This resource adds a cookbook file for all given users and skel.
- `users`: Array of usernames that will be managed, defaults to an empty array
- `filename`: The filename inside the .bashrc.d folder as string, should begin with a number xxx- for sorting
- `cookbook_file`: The name of the cookbook file to add, this file must be present in your cookbook
- `cookbook`: The name of the cookbook the file is in, defaults to the calling cookbook

#### Examples

Expand Down Expand Up @@ -147,6 +148,7 @@ This resource adds a new file using chef templates for all given users and skel.
- `users`: Array of usernames that will be managed, defaults to an empty array
- `filename`: The filename inside the .bashrc.d folder as string, should begin with a number xxx- for sorting
- `source`: The source template to use. The template must be present in your cookbook
- `cookbook`: The name of the cookbook the template file is in, defaults to the calling cookbook

#### Examples

Expand Down
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
maintainer_email 'bastian@codename-php.de'
license 'Apache-2.0'
description 'Makes sure bash is installed and handles bash configurations'
version '2.0.5'
version '2.1.0'
chef_version '>= 13.0'
issues_url 'https://github.com/codenamephp/chef.cookbook.bash/issues'
source_url 'https://github.com/codenamephp/chef.cookbook.bash'
Expand Down
2 changes: 2 additions & 0 deletions resources/cookbook_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
property :users, Array, default: [], description: 'The users that will receive the file in their .bashrc.d dropfolder'
property :filename, String, required: true, description: 'The file name in the dropfolder, should begin with a number for sorting, e.g. 100-myFile'
property :cookbook_file, String, required: true, description: 'The cookbook_file to use as source for the cookbook_file'
property :cookbook, String, description: 'The cookbook the file is in, defaults to the current cookbook'

action :add do
create_file('/etc/skel', 'root', new_resource.filename, new_resource.cookbook_file) if new_resource.skel
Expand All @@ -17,6 +18,7 @@ def create_file(folder, user, filename, cookbook_file)
owner user
path "#{folder}/.bashrc.d/#{filename}"
source cookbook_file
cookbook new_resource.cookbook
end
end

Expand Down
2 changes: 2 additions & 0 deletions resources/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
property :users, Array, default: [], description: 'The users that will receive the file in their .bashrc.d dropfolder'
property :filename, String, required: true, description: 'The file name in the dropfolder, should begin with a number for sorting, e.g. 100-myFile'
property :source, String, required: true, description: 'The source template to use'
property :cookbook, String, description: 'The cookbook the template file is in, defaults to the current cookbook'

action :add do
create_file('/etc/skel', 'root', new_resource.filename, new_resource.source) if new_resource.skel
Expand All @@ -17,6 +18,7 @@ def create_file(folder, user, filename, source)
owner user
path "#{folder}/.bashrc.d/#{filename}"
source source
cookbook new_resource.cookbook
end
end

Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/cookbooks/test/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@
users %w[user1 user2 user3]
filename '200-file'
cookbook_file 'some_file'
cookbook 'test'
end

codenamephp_bash_template 'add a template file' do
users %w[user1 user2 user3]
filename '300-template'
source 'some_template'
cookbook 'test'
end

codenamephp_bash_file 'add a file' do
Expand Down

0 comments on commit 195fdc3

Please sign in to comment.