ansible_make_role 0.7.8 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8fe8e24d4a2a257d19e11b2ca0758a63a13b0508fb30275c3a070d5f69ba156b
4
- data.tar.gz: 76624736cd47411c67168b84f2557097f7bad6e32b709ceb887f80e3ba5e8181
3
+ metadata.gz: b4bf6a49779b5b627fed22a87359414134d4db0ddb2f5f163c8bf7a753ea367e
4
+ data.tar.gz: 8afaa7ac4516b29048f03d6a091435d6575c0e10e6513998adff5a386b4c28ff
5
5
  SHA512:
6
- metadata.gz: b79115eb6a4a34d75f4fc949d29ac1a3b2f32d822b218e280390a7d88429cf925c4e7f30c1173d9212686e6d61b1eae3a5b1233b2284e3cbddaf125e0a25ea91
7
- data.tar.gz: '018970b8bd8de8cfe0840cc7a49cc413b6564b4e0d52232137a3385da7f5fb2640733fd2bd73669b4287446015674751ecb708d675dee971983a31af3610f634'
6
+ metadata.gz: 3d09989652d8432d72bc5c4f256b005d441b13517d20c5f3ed91919871bcc1d4efcdd2e8113d665a01f8e1e7c6d9bea1ea4b3c27fd95f8fa3892b84ed1480b04
7
+ data.tar.gz: 4106a49adc35a71113bbc860d7d5cf26df64bbc3b569d370af4e2d3014cfcd5dce650330724d6cbfb3f29cc432b10c5234745456b146e61b08c85d9349a2ee2a
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.6.0
1
+ ruby-3.1.2
data/README.md CHANGED
@@ -1,21 +1,21 @@
1
1
  # ansible-make-role
2
2
 
3
3
  Pre-compiler that turns a single-file role definition into Ansible role files.
4
- The `role.yml` file combines the Ansible `main.yml` where each `main.yml` file
5
- is represented by a section (`defaults:`, `vars:`, `tasks:` etc.)
4
+ The single-file `role.yml` file combines the Ansible `main.yml` files from the
5
+ `defaults`, `vars`, `tasks`, and `meta` subdirectories with a YAML top-level
6
+ section for each file (`defaults:`, `vars:`, `tasks:` etc.)
6
7
 
7
8
  ## Usage
8
9
 
9
- ```shell
10
+ ```
10
11
  ansible-make-role -c|--clean -f|--force -g|--git -r|--roles=DIR -v|--verbose --version DIR...
11
12
  ```
12
13
 
13
14
  `ansible-make-role` expects a `role.yml` file in each of the given directories
14
15
  and generates an Ansible role in it. Existing `main.yml` files will be
15
- overwritten or removed but other files won't be touched
16
-
17
- `ansible-make-role` only generates up-to-date files unless the --force option
18
- is used
16
+ overwritten or removed but other files won't be touched. `ansible-make-role`
17
+ search subdirectories of `./roles` if no dirctories was given on the command
18
+ line
19
19
 
20
20
  ## Description
21
21
 
@@ -59,10 +59,12 @@ handlers: # Goes to handlers/main.yml"
59
59
  Clean the project by removing autogenerated files
60
60
 
61
61
  `-f, --force`
62
- Re-generate all files even if not needed
62
+ Re-generate all files even if not needed. Useful if you forgot a
63
+ `--git` option
63
64
 
64
65
  `-g, --git`
65
- Also handle per-role .gitignore files. Note that the .gitignore file will be overwritten
66
+ Also handle per-role .gitignore files. Note that existing .gitignore
67
+ files are overwritten
66
68
 
67
69
  `-r, --roles=DIR`
68
70
  Use DIR instead of default `./roles`
@@ -38,9 +38,9 @@ Gem::Specification.new do |spec|
38
38
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
39
39
  spec.require_paths = ["lib"]
40
40
 
41
- spec.add_development_dependency "bundler", "~> 1.17"
42
- spec.add_development_dependency "rake", ">= 12.3.3"
43
- spec.add_development_dependency "rspec", "~> 3.0"
41
+ spec.add_development_dependency "bundler"
42
+ spec.add_development_dependency "rake"
43
+ spec.add_development_dependency "rspec"
44
44
 
45
45
  spec.add_dependency "shellopts", "0.9.3"
46
46
  spec.add_dependency "indented_io"
@@ -44,7 +44,7 @@ end
44
44
 
45
45
  role_dirs = args
46
46
  for roles_dir in roles_dirs
47
- role_dirs += Dir["#{roles_dir}/*/role.yml"].map { |f| File.dirname(f) }
47
+ role_dirs += Dir["#{roles_dir}/**/role.yml"].map { |f| File.dirname(f) }
48
48
  end
49
49
 
50
50
  if role_dirs.empty?
@@ -1,3 +1,3 @@
1
1
  module AnsibleMakeRole
2
- VERSION = "0.7.8"
2
+ VERSION = "0.8.0"
3
3
  end
@@ -55,7 +55,7 @@ module AnsibleMakeRole
55
55
 
56
56
  private
57
57
  # Turn a SystemCallError into a AnsibleMakeRole::Error exception and remove
58
- # Ruby reference from message (eg. "@ rb_sysopen")
58
+ # Ruby reference from message (eg. the "@ rb_sysopen" part)
59
59
  def self.wrap_system_call_error(&block)
60
60
  begin
61
61
  yield
@@ -64,7 +64,8 @@ private
64
64
  end
65
65
  end
66
66
 
67
- # source is a single-file role and target is the role directory. Returns list generated files
67
+ # source is a single-file role and target is the role directory. Returns list
68
+ # of generated files
68
69
  def self.compile_role(source, target)
69
70
  meta = []
70
71
  sections = {
@@ -96,15 +97,20 @@ private
96
97
  end
97
98
 
98
99
  (sections.to_a + [["meta", meta]]).map { |section, lines|
99
- next if lines.all? { |l| l =~ /^\s*$/ }
100
100
  dir = "#{target}/#{section}"
101
101
  file = "#{dir}/main.yml"
102
- FileUtils.mkdir_p(dir)
103
- File.open(file, "w") { |f|
104
- f.puts "---" if section != "meta"
105
- unindent(lines).each { |l| f.puts l }
106
- }
107
- file
102
+ if lines.all? { |l| l =~ /^\s*$/ }
103
+ FileUtils.rm_f(file)
104
+ FileUtils.rmdir(dir) if Dir.exist?(dir)
105
+ nil
106
+ else
107
+ FileUtils.mkdir_p(dir)
108
+ File.open(file, "w") { |f|
109
+ f.puts "---" if section != "meta"
110
+ unindent(lines).each { |l| f.puts l }
111
+ }
112
+ file
113
+ end
108
114
  }.compact
109
115
  end
110
116
 
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ansible_make_role
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.8
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claus Rasmussen
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-15 00:00:00.000000000 Z
11
+ date: 2022-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.17'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.17'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 12.3.3
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 12.3.3
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '3.0'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '3.0'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: shellopts
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -112,7 +112,7 @@ homepage: http://github.com/clrgit/ansible_make_role
112
112
  licenses: []
113
113
  metadata:
114
114
  allowed_push_host: https://rubygems.org
115
- post_install_message:
115
+ post_install_message:
116
116
  rdoc_options: []
117
117
  require_paths:
118
118
  - lib
@@ -127,8 +127,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
127
  - !ruby/object:Gem::Version
128
128
  version: '0'
129
129
  requirements: []
130
- rubygems_version: 3.0.1
131
- signing_key:
130
+ rubygems_version: 3.3.18
131
+ signing_key:
132
132
  specification_version: 4
133
133
  summary: Make Ansible role from make.yml file
134
134
  test_files: []