pumog 1.0.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circleci/config.yml +30 -0
- data/Gemfile.lock +36 -0
- data/README.md +54 -1
- data/lib/pumog/commandline.rb +23 -20
- data/lib/pumog/messages.rb +0 -4
- data/lib/pumog/module_information.rb +3 -3
- data/lib/pumog/version.rb +1 -1
- data/lib/templates/init.txt.tt +8 -0
- data/{templates → lib/templates}/package.txt.tt +1 -1
- data/pumog.gemspec +5 -8
- data/spec/pumog/commandline_spec.rb +1 -0
- data/spec/pumog/messages_spec.rb +7 -7
- data/spec/pumog/module_information_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -4
- metadata +25 -41
- data/.travis.yml +0 -5
- data/templates/init.txt.tt +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2715dd445df7c76f331cd362fdda6911416594d06c0a2b0058a289d1aa8779d9
|
4
|
+
data.tar.gz: 54452e2a5ed60c0e69a76812a8964a96b71e97bd7ad839ab843016bbdd2ee49a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d714f9beeadd45e33e4361d69f03ddfb8ae7a53bde6e44033d592402695e0b7d590c3ec70a79fa8e463f63bae02edda7c98429a9ee335141567e9ae07f2b2d42
|
7
|
+
data.tar.gz: be0e196ba6719712f2aaa3ff3d394278d3b18c869a23a1007b38d51745df0901703d8eb0c03c5cc7cbdd279bf79357935a9c2e9f1efb58ef12922491a9c88e9e
|
@@ -0,0 +1,30 @@
|
|
1
|
+
version: 2.1
|
2
|
+
orbs:
|
3
|
+
ruby: circleci/ruby@0.1.2
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
parameters:
|
8
|
+
ruby-version:
|
9
|
+
type: string
|
10
|
+
docker:
|
11
|
+
- image: circleci/ruby:<< parameters.ruby-version >>
|
12
|
+
executor: ruby/default
|
13
|
+
steps:
|
14
|
+
- checkout
|
15
|
+
- run:
|
16
|
+
name: Which bundler?
|
17
|
+
command: gem install bundler:2.2.26
|
18
|
+
- ruby/bundle-install
|
19
|
+
- run:
|
20
|
+
name: Run rspec tests
|
21
|
+
command: bundle exec rake spec
|
22
|
+
workflows:
|
23
|
+
build_and_test:
|
24
|
+
jobs:
|
25
|
+
- build:
|
26
|
+
matrix:
|
27
|
+
parameters:
|
28
|
+
# https://github.com/CircleCI-Public/cimg-ruby
|
29
|
+
# only supports the last three ruby versions
|
30
|
+
ruby-version: ["2.6.0", "2.6.5", "2.7.4", "3.0.2"]
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
pumog (1.2.0)
|
5
|
+
thor (~> 0.19)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
diff-lcs (1.4.4)
|
11
|
+
rake (13.0.6)
|
12
|
+
rspec (3.10.0)
|
13
|
+
rspec-core (~> 3.10.0)
|
14
|
+
rspec-expectations (~> 3.10.0)
|
15
|
+
rspec-mocks (~> 3.10.0)
|
16
|
+
rspec-core (3.10.1)
|
17
|
+
rspec-support (~> 3.10.0)
|
18
|
+
rspec-expectations (3.10.1)
|
19
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
20
|
+
rspec-support (~> 3.10.0)
|
21
|
+
rspec-mocks (3.10.2)
|
22
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
23
|
+
rspec-support (~> 3.10.0)
|
24
|
+
rspec-support (3.10.2)
|
25
|
+
thor (0.20.3)
|
26
|
+
|
27
|
+
PLATFORMS
|
28
|
+
x86_64-linux
|
29
|
+
|
30
|
+
DEPENDENCIES
|
31
|
+
pumog!
|
32
|
+
rake (~> 13.0)
|
33
|
+
rspec (~> 3.3)
|
34
|
+
|
35
|
+
BUNDLED WITH
|
36
|
+
2.2.26
|
data/README.md
CHANGED
@@ -1 +1,54 @@
|
|
1
|
-
|
1
|
+
## Pumog
|
2
|
+
|
3
|
+
Stands for **PuppetModuleGenerator** and can be used to generate a basic structure for new puppet modules with or without documentation.
|
4
|
+
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/pumog.svg)](http://badge.fury.io/rb/pumog)
|
6
|
+
[![CircleCI](https://circleci.com/gh/wikimatze/pumog.svg?style=svg)](https://app.circleci.com/pipelines/github/wikimatze/pumog)
|
7
|
+
|
8
|
+
|
9
|
+
## Usage & Examples
|
10
|
+
|
11
|
+
Run `pumog start` and it will generate the following directory structure:
|
12
|
+
|
13
|
+
What is the name of the module?
|
14
|
+
test
|
15
|
+
|
16
|
+
What is the name of the author?
|
17
|
+
Matthias
|
18
|
+
|
19
|
+
What is the email adress of the author?
|
20
|
+
matthias@wikimatze.de
|
21
|
+
|
22
|
+
New module will be created in:
|
23
|
+
/home/wm/test
|
24
|
+
|
25
|
+
Author/creator of the new module:
|
26
|
+
Matthias <matthias@wikimatze.de>
|
27
|
+
|
28
|
+
Is this correct? [y|n]:
|
29
|
+
|
30
|
+
create test/files
|
31
|
+
create test/templates
|
32
|
+
create test/manifests
|
33
|
+
create test/manifests/init.pp
|
34
|
+
create test/manifests/package.pp
|
35
|
+
|
36
|
+
|
37
|
+
If you pass in the `--no-doc` option, you will not asked after the author name and the email (leaving the module without
|
38
|
+
documentation).
|
39
|
+
|
40
|
+
|
41
|
+
## Commands & Options
|
42
|
+
|
43
|
+
Commands:
|
44
|
+
|
45
|
+
|
46
|
+
pumog help [COMMAND] # Describe available commands or one specific command
|
47
|
+
pumog start # creates a new puppet module
|
48
|
+
|
49
|
+
|
50
|
+
Options:
|
51
|
+
|
52
|
+
|
53
|
+
-n, [--nodoc], [--no-nodoc] # no documentation
|
54
|
+
|
data/lib/pumog/commandline.rb
CHANGED
@@ -1,24 +1,26 @@
|
|
1
1
|
require 'thor'
|
2
|
-
require 'pumog'
|
2
|
+
require 'pumog/messages'
|
3
|
+
require 'pumog/module_information'
|
3
4
|
|
4
5
|
module Pumog
|
5
6
|
class Commandline < Thor
|
6
7
|
include Thor::Actions
|
7
8
|
|
8
9
|
def self.source_root
|
9
|
-
'templates'
|
10
|
+
File.expand_path('../templates', File.dirname(__FILE__))
|
10
11
|
end
|
11
12
|
|
12
|
-
desc "start", "
|
13
|
-
|
13
|
+
desc "start\n\n", "creates a new puppet module"
|
14
|
+
class_option :nodoc, :desc => 'no documentation', :aliases => '-n', :default => false, :type => :boolean
|
15
|
+
|
14
16
|
def start
|
15
17
|
@nodoc= options[:nodoc] ? false : true
|
16
18
|
|
17
|
-
|
18
|
-
while
|
19
|
+
name = ''
|
20
|
+
while name.empty?
|
19
21
|
say "What is the name of the module?", :green
|
20
|
-
|
21
|
-
say Pumog::Messages.module_name_error(
|
22
|
+
name = STDIN.gets.chop
|
23
|
+
say Pumog::Messages.module_name_error(name), :red
|
22
24
|
end
|
23
25
|
|
24
26
|
author = ''
|
@@ -35,33 +37,35 @@ module Pumog
|
|
35
37
|
say Pumog::Messages.email_adress_error(email), :red
|
36
38
|
end unless !@nodoc
|
37
39
|
|
38
|
-
module_information = Pumog::ModuleInformation.new(
|
40
|
+
module_information = Pumog::ModuleInformation.new(name, author, email)
|
39
41
|
confirm(module_information)
|
40
42
|
end
|
41
43
|
|
42
44
|
private
|
43
45
|
def confirm(data)
|
44
|
-
say Pumog::Messages.confirm_module_name(data.
|
45
|
-
say Pumog::Messages.confirm_creator(data), :yellow
|
46
|
-
say Pumog::Messages.confirm, :yellow
|
46
|
+
say Pumog::Messages.confirm_module_name(data.name.downcase), :blue
|
47
47
|
|
48
|
-
|
48
|
+
if @nodoc
|
49
|
+
say Pumog::Messages.confirm_creator(data), :yellow
|
50
|
+
say Pumog::Messages.confirm, :yellow
|
51
|
+
confirm = STDIN.gets.chop
|
49
52
|
|
50
|
-
|
51
|
-
|
53
|
+
while confirm.empty? | confirm.include?('n')
|
54
|
+
start
|
55
|
+
end
|
52
56
|
end
|
53
57
|
|
54
58
|
create_files(data)
|
55
59
|
end
|
56
60
|
|
57
61
|
def create_files(data)
|
58
|
-
manifests_directory_name = "
|
62
|
+
manifests_directory_name = data.name + "/manifests"
|
59
63
|
|
60
|
-
empty_directory "
|
61
|
-
empty_directory "
|
64
|
+
empty_directory data.name + "/files"
|
65
|
+
empty_directory data.name + "/templates"
|
62
66
|
empty_directory manifests_directory_name
|
63
67
|
|
64
|
-
@
|
68
|
+
@name = data.name.downcase
|
65
69
|
@author = data.author
|
66
70
|
@email = data.email
|
67
71
|
template(
|
@@ -73,7 +77,6 @@ module Pumog
|
|
73
77
|
"package.txt.tt",
|
74
78
|
"#{manifests_directory_name}/package.pp"
|
75
79
|
)
|
76
|
-
|
77
80
|
exit
|
78
81
|
end
|
79
82
|
end
|
data/lib/pumog/messages.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
module Pumog
|
2
2
|
class ModuleInformation
|
3
|
-
attr_accessor :
|
3
|
+
attr_accessor :name, :author, :email
|
4
4
|
|
5
|
-
def initialize(
|
6
|
-
@
|
5
|
+
def initialize(name= '', author = '', email= '')
|
6
|
+
@name = name
|
7
7
|
@author = author
|
8
8
|
@email = email
|
9
9
|
end
|
data/lib/pumog/version.rb
CHANGED
data/pumog.gemspec
CHANGED
@@ -7,8 +7,8 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.authors = ["Matthias Guenther"]
|
8
8
|
s.email = ["matthias@wikimatze.de"]
|
9
9
|
s.license = 'MIT'
|
10
|
-
s.homepage = "https://github.com/
|
11
|
-
s.summary = %q{Create new puppet
|
10
|
+
s.homepage = "https://github.com/wikimatze/pumog"
|
11
|
+
s.summary = %q{Create new puppet module with this template.}
|
12
12
|
s.description = %q{Generate a basic structure for new puppet modules with or without documentation.}
|
13
13
|
|
14
14
|
s.files = `git ls-files`.split("\n")
|
@@ -16,11 +16,8 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
|
19
|
-
s.extra_rdoc_files = ['README.md']
|
20
|
-
|
21
19
|
# specify any dependencies here; for example:
|
22
|
-
s.add_development_dependency "
|
23
|
-
s.add_development_dependency "
|
24
|
-
s.
|
25
|
-
s.add_runtime_dependency "thor"
|
20
|
+
s.add_development_dependency "rspec", "~> 3.3"
|
21
|
+
s.add_development_dependency "rake", "~> 13.0"
|
22
|
+
s.add_runtime_dependency "thor", "~>0.19"
|
26
23
|
end
|
data/spec/pumog/messages_spec.rb
CHANGED
@@ -4,16 +4,16 @@ describe Pumog::Messages do
|
|
4
4
|
context "basic information" do
|
5
5
|
let(:module_information) {Pumog::ModuleInformation.new("Ruby", "Matze", "matthias@wikimatze.de")}
|
6
6
|
|
7
|
-
context "#
|
8
|
-
it "print error message if
|
9
|
-
module_information.
|
7
|
+
context "#name" do
|
8
|
+
it "print error message if name is blank" do
|
9
|
+
module_information.name= ''
|
10
10
|
|
11
|
-
message = Pumog::Messages.module_name_error(module_information.
|
11
|
+
message = Pumog::Messages.module_name_error(module_information.name)
|
12
12
|
expect(message).to match(/Module name can't be blank!/)
|
13
13
|
end
|
14
14
|
|
15
15
|
it "print nothing" do
|
16
|
-
message = Pumog::Messages.module_name_error(module_information.
|
16
|
+
message = Pumog::Messages.module_name_error(module_information.name)
|
17
17
|
expect(message).to be_nil
|
18
18
|
end
|
19
19
|
end
|
@@ -50,8 +50,8 @@ describe Pumog::Messages do
|
|
50
50
|
context "#confirmation" do
|
51
51
|
let(:module_information) {Pumog::ModuleInformation.new("Ruby", "M", "m@test.de")}
|
52
52
|
it "print the path of the generated module" do
|
53
|
-
message = Pumog::Messages.confirm_module_name(module_information.
|
54
|
-
expect(message).to eql("New module will be created in:\n#{Dir.home}/#{module_information.
|
53
|
+
message = Pumog::Messages.confirm_module_name(module_information.name)
|
54
|
+
expect(message).to eql("New module will be created in:\n#{Dir.home}/#{module_information.name}")
|
55
55
|
end
|
56
56
|
|
57
57
|
it "print the creator information" do
|
@@ -4,7 +4,7 @@ describe Pumog::ModuleInformation do
|
|
4
4
|
it "creates an object" do
|
5
5
|
module_information = Pumog::ModuleInformation.new("ruby", "Matthias", "matthias@wikimatze.de")
|
6
6
|
|
7
|
-
expect(module_information.
|
7
|
+
expect(module_information.name).to eql("ruby")
|
8
8
|
expect(module_information.author).to eql("Matthias")
|
9
9
|
expect(module_information.email).to eql("matthias@wikimatze.de")
|
10
10
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
$:.push(File.join(File.dirname(__FILE__), '..', 'lib/pumog'))
|
2
2
|
|
3
|
-
require 'minitest/unit'
|
4
|
-
|
5
3
|
require 'commandline'
|
6
4
|
require 'messages'
|
7
5
|
require 'module_information'
|
8
6
|
|
9
7
|
RSpec.configure do |conf|
|
10
|
-
conf.
|
11
|
-
conf.
|
8
|
+
conf.color = true
|
9
|
+
conf.tty = true
|
12
10
|
end
|
metadata
CHANGED
@@ -1,82 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pumog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthias Guenther
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: minitest
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - '>='
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - '>='
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: rspec
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
|
-
- -
|
17
|
+
- - "~>"
|
32
18
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
19
|
+
version: '3.3'
|
34
20
|
type: :development
|
35
21
|
prerelease: false
|
36
22
|
version_requirements: !ruby/object:Gem::Requirement
|
37
23
|
requirements:
|
38
|
-
- -
|
24
|
+
- - "~>"
|
39
25
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
26
|
+
version: '3.3'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: rake
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
|
-
- -
|
31
|
+
- - "~>"
|
46
32
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
33
|
+
version: '13.0'
|
48
34
|
type: :development
|
49
35
|
prerelease: false
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
37
|
requirements:
|
52
|
-
- -
|
38
|
+
- - "~>"
|
53
39
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
40
|
+
version: '13.0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: thor
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
|
-
- -
|
45
|
+
- - "~>"
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
47
|
+
version: '0.19'
|
62
48
|
type: :runtime
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
|
-
- -
|
52
|
+
- - "~>"
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
54
|
+
version: '0.19'
|
69
55
|
description: Generate a basic structure for new puppet modules with or without documentation.
|
70
56
|
email:
|
71
57
|
- matthias@wikimatze.de
|
72
58
|
executables:
|
73
59
|
- pumog
|
74
60
|
extensions: []
|
75
|
-
extra_rdoc_files:
|
76
|
-
- README.md
|
61
|
+
extra_rdoc_files: []
|
77
62
|
files:
|
78
|
-
- .
|
63
|
+
- ".circleci/config.yml"
|
79
64
|
- Gemfile
|
65
|
+
- Gemfile.lock
|
66
|
+
- README.md
|
80
67
|
- Rakefile
|
81
68
|
- bin/pumog
|
82
69
|
- lib/pumog.rb
|
@@ -84,15 +71,14 @@ files:
|
|
84
71
|
- lib/pumog/messages.rb
|
85
72
|
- lib/pumog/module_information.rb
|
86
73
|
- lib/pumog/version.rb
|
74
|
+
- lib/templates/init.txt.tt
|
75
|
+
- lib/templates/package.txt.tt
|
87
76
|
- pumog.gemspec
|
88
77
|
- spec/pumog/commandline_spec.rb
|
89
78
|
- spec/pumog/messages_spec.rb
|
90
79
|
- spec/pumog/module_information_spec.rb
|
91
80
|
- spec/spec_helper.rb
|
92
|
-
|
93
|
-
- templates/package.txt.tt
|
94
|
-
- README.md
|
95
|
-
homepage: https://github.com/matthias-guenther/pumog
|
81
|
+
homepage: https://github.com/wikimatze/pumog
|
96
82
|
licenses:
|
97
83
|
- MIT
|
98
84
|
metadata: {}
|
@@ -102,19 +88,17 @@ require_paths:
|
|
102
88
|
- lib
|
103
89
|
required_ruby_version: !ruby/object:Gem::Requirement
|
104
90
|
requirements:
|
105
|
-
- -
|
91
|
+
- - ">="
|
106
92
|
- !ruby/object:Gem::Version
|
107
93
|
version: '0'
|
108
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
95
|
requirements:
|
110
|
-
- -
|
96
|
+
- - ">="
|
111
97
|
- !ruby/object:Gem::Version
|
112
98
|
version: '0'
|
113
99
|
requirements: []
|
114
|
-
|
115
|
-
rubygems_version: 2.0.3
|
100
|
+
rubygems_version: 3.1.2
|
116
101
|
signing_key:
|
117
102
|
specification_version: 4
|
118
|
-
summary: Create new puppet
|
103
|
+
summary: Create new puppet module with this template.
|
119
104
|
test_files: []
|
120
|
-
has_rdoc:
|