pumog 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +5 -0
- data/Gemfile +3 -0
- data/README.md +1 -0
- data/Rakefile +11 -0
- data/bin/pumog +4 -0
- data/lib/pumog/commandline.rb +80 -0
- data/lib/pumog/messages.rb +31 -0
- data/lib/pumog/module_information.rb +11 -0
- data/lib/pumog/version.rb +3 -0
- data/lib/pumog.rb +8 -0
- data/pumog.gemspec +26 -0
- data/spec/pumog/commandline_spec.rb +4 -0
- data/spec/pumog/messages_spec.rb +67 -0
- data/spec/pumog/module_information_spec.rb +11 -0
- data/spec/spec_helper.rb +12 -0
- data/templates/init.txt.tt +8 -0
- data/templates/package.txt.tt +10 -0
- metadata +120 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e403fd89f9353d923b24a2dcd619cb73c885ab08
|
4
|
+
data.tar.gz: 92e18de26e84073480603a7214d6aa13476b94f2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7436f8f8b07aa00a9dc9dea146879f87f6473004ca74380117d8378d7d35306a5e85d0725fb8382eac879b4cea47d8a013737bd3c1a24b94a343953d34be43f5
|
7
|
+
data.tar.gz: c799dd619937c4a01d7ef11033425387967440958ad2223d0fec2c5c36598bc770417760ace5f68c49e7e4204a12f7101679ef5f70343876b24e7147bc10ca91
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/matthias-guenther/pumog.png?branch=master)](https://travis-ci.org/matthias-guenther/pumog)
|
data/Rakefile
ADDED
data/bin/pumog
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'pumog'
|
3
|
+
|
4
|
+
module Pumog
|
5
|
+
class Commandline < Thor
|
6
|
+
include Thor::Actions
|
7
|
+
|
8
|
+
def self.source_root
|
9
|
+
'templates'
|
10
|
+
end
|
11
|
+
|
12
|
+
desc "start", "sear something in a pan"
|
13
|
+
method_option :nodoc, :type => :boolean, :desc => 'create new puppet module without documentation', :default => false
|
14
|
+
def start
|
15
|
+
@nodoc= options[:nodoc] ? false : true
|
16
|
+
|
17
|
+
module_name = ''
|
18
|
+
while module_name.empty?
|
19
|
+
say "What is the name of the module?", :green
|
20
|
+
module_name = STDIN.gets.chop
|
21
|
+
say Pumog::Messages.module_name_error(module_name), :red
|
22
|
+
end
|
23
|
+
|
24
|
+
author = ''
|
25
|
+
while author.empty?
|
26
|
+
say "What is the name of the author?", :green
|
27
|
+
author = STDIN.gets.chop
|
28
|
+
say Pumog::Messages.author_name_error(author), :red
|
29
|
+
end unless !@nodoc
|
30
|
+
|
31
|
+
email = ''
|
32
|
+
while email.empty?
|
33
|
+
say "What is the email adress of the author?", :green
|
34
|
+
email = STDIN.gets.chop
|
35
|
+
say Pumog::Messages.email_adress_error(email), :red
|
36
|
+
end unless !@nodoc
|
37
|
+
|
38
|
+
module_information = Pumog::ModuleInformation.new(module_name, author, email)
|
39
|
+
confirm(module_information)
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
def confirm(data)
|
44
|
+
say Pumog::Messages.confirm_module_name(data.module_name.downcase), :blue
|
45
|
+
say Pumog::Messages.confirm_creator(data), :yellow
|
46
|
+
say Pumog::Messages.confirm, :yellow
|
47
|
+
|
48
|
+
confirm = STDIN.gets.chop
|
49
|
+
|
50
|
+
while confirm.empty? | confirm.include?('n')
|
51
|
+
start
|
52
|
+
end
|
53
|
+
|
54
|
+
create_files(data)
|
55
|
+
end
|
56
|
+
|
57
|
+
def create_files(data)
|
58
|
+
manifests_directory_name = "manifests_tmp"
|
59
|
+
|
60
|
+
empty_directory "files_tmp"
|
61
|
+
empty_directory "templates_tmp"
|
62
|
+
empty_directory manifests_directory_name
|
63
|
+
|
64
|
+
@module_name = data.module_name.downcase
|
65
|
+
@author = data.author
|
66
|
+
@email = data.email
|
67
|
+
template(
|
68
|
+
"init.txt.tt",
|
69
|
+
"#{manifests_directory_name}/init.pp"
|
70
|
+
)
|
71
|
+
|
72
|
+
template(
|
73
|
+
"package.txt.tt",
|
74
|
+
"#{manifests_directory_name}/package.pp"
|
75
|
+
)
|
76
|
+
|
77
|
+
exit
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Pumog
|
2
|
+
class Messages
|
3
|
+
def self.message
|
4
|
+
"aa"
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.module_name_error(name)
|
8
|
+
"Module name can't be blank!" unless !name.empty?
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.author_name_error(author)
|
12
|
+
"Author name can't be blank!" unless !author.empty?
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.email_adress_error(email)
|
16
|
+
"Email adress can't be blank!" unless !email.empty?
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.confirm_module_name(name)
|
20
|
+
"New module will be created in:\n#{Dir.home}/#{name}"
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.confirm_creator(module_information)
|
24
|
+
"Author/creator of the new module:\n#{module_information.author} <#{module_information.email}>"
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.confirm
|
28
|
+
"Is this correct? [y|n]:"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/pumog.rb
ADDED
data/pumog.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
require "pumog/version"
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "pumog"
|
6
|
+
s.version = Pumog::VERSION
|
7
|
+
s.authors = ["Matthias Guenther"]
|
8
|
+
s.email = ["matthias@wikimatze.de"]
|
9
|
+
s.license = 'MIT'
|
10
|
+
s.homepage = "https://github.com/matthias-guenther/pumog"
|
11
|
+
s.summary = %q{Create new puppet modules with this templates}
|
12
|
+
s.description = %q{Generate a basic structure for new puppet modules with or without documentation.}
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
|
19
|
+
s.extra_rdoc_files = ['README.md']
|
20
|
+
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
s.add_development_dependency "minitest"
|
23
|
+
s.add_development_dependency "rspec"
|
24
|
+
s.add_development_dependency "rake"
|
25
|
+
s.add_runtime_dependency "thor"
|
26
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Pumog::Messages do
|
4
|
+
context "basic information" do
|
5
|
+
let(:module_information) {Pumog::ModuleInformation.new("Ruby", "Matze", "matthias@wikimatze.de")}
|
6
|
+
|
7
|
+
context "#module_name" do
|
8
|
+
it "print error message if module_name is blank" do
|
9
|
+
module_information.module_name= ''
|
10
|
+
|
11
|
+
message = Pumog::Messages.module_name_error(module_information.module_name)
|
12
|
+
expect(message).to match(/Module name can't be blank!/)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "print nothing" do
|
16
|
+
message = Pumog::Messages.module_name_error(module_information.module_name)
|
17
|
+
expect(message).to be_nil
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
context "#author" do
|
22
|
+
it "print error message if author is blank" do
|
23
|
+
module_information.author = ''
|
24
|
+
|
25
|
+
message = Pumog::Messages.author_name_error(module_information.author)
|
26
|
+
expect(message).to match(/Author name can't be blank!/)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "print nothing" do
|
30
|
+
message = Pumog::Messages.author_name_error(module_information.author)
|
31
|
+
expect(message).to be_nil
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context "#email_adress_error" do
|
36
|
+
it "print error message if email adress is blank" do
|
37
|
+
module_information.email= ''
|
38
|
+
|
39
|
+
message = Pumog::Messages.email_adress_error(module_information.email)
|
40
|
+
expect(message).to match (/Email adress can't be blank!/)
|
41
|
+
end
|
42
|
+
|
43
|
+
it "print nothing" do
|
44
|
+
message = Pumog::Messages.email_adress_error(module_information.email)
|
45
|
+
expect(message).to be_nil
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context "#confirmation" do
|
51
|
+
let(:module_information) {Pumog::ModuleInformation.new("Ruby", "M", "m@test.de")}
|
52
|
+
it "print the path of the generated module" do
|
53
|
+
message = Pumog::Messages.confirm_module_name(module_information.module_name)
|
54
|
+
expect(message).to eql("New module will be created in:\n#{Dir.home}/#{module_information.module_name}")
|
55
|
+
end
|
56
|
+
|
57
|
+
it "print the creator information" do
|
58
|
+
message = Pumog::Messages.confirm_creator(module_information)
|
59
|
+
expect(message).to eql("Author/creator of the new module:\n#{module_information.author} <#{module_information.email}>")
|
60
|
+
end
|
61
|
+
|
62
|
+
it "print confirmation" do
|
63
|
+
message = Pumog::Messages.confirm
|
64
|
+
expect(message).to eql("Is this correct? [y|n]:")
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper.rb'
|
2
|
+
|
3
|
+
describe Pumog::ModuleInformation do
|
4
|
+
it "creates an object" do
|
5
|
+
module_information = Pumog::ModuleInformation.new("ruby", "Matthias", "matthias@wikimatze.de")
|
6
|
+
|
7
|
+
expect(module_information.module_name).to eql("ruby")
|
8
|
+
expect(module_information.author).to eql("Matthias")
|
9
|
+
expect(module_information.email).to eql("matthias@wikimatze.de")
|
10
|
+
end
|
11
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
$:.push(File.join(File.dirname(__FILE__), '..', 'lib/pumog'))
|
2
|
+
|
3
|
+
require 'minitest/unit'
|
4
|
+
|
5
|
+
require 'commandline'
|
6
|
+
require 'messages'
|
7
|
+
require 'module_information'
|
8
|
+
|
9
|
+
RSpec.configure do |conf|
|
10
|
+
conf.color_enabled = true
|
11
|
+
conf.include Minitest::Assertions
|
12
|
+
end
|
metadata
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pumog
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matthias Guenther
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-12-29 00:00:00.000000000 Z
|
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
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: thor
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Generate a basic structure for new puppet modules with or without documentation.
|
70
|
+
email:
|
71
|
+
- matthias@wikimatze.de
|
72
|
+
executables:
|
73
|
+
- pumog
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files:
|
76
|
+
- README.md
|
77
|
+
files:
|
78
|
+
- .travis.yml
|
79
|
+
- Gemfile
|
80
|
+
- Rakefile
|
81
|
+
- bin/pumog
|
82
|
+
- lib/pumog.rb
|
83
|
+
- lib/pumog/commandline.rb
|
84
|
+
- lib/pumog/messages.rb
|
85
|
+
- lib/pumog/module_information.rb
|
86
|
+
- lib/pumog/version.rb
|
87
|
+
- pumog.gemspec
|
88
|
+
- spec/pumog/commandline_spec.rb
|
89
|
+
- spec/pumog/messages_spec.rb
|
90
|
+
- spec/pumog/module_information_spec.rb
|
91
|
+
- spec/spec_helper.rb
|
92
|
+
- templates/init.txt.tt
|
93
|
+
- templates/package.txt.tt
|
94
|
+
- README.md
|
95
|
+
homepage: https://github.com/matthias-guenther/pumog
|
96
|
+
licenses:
|
97
|
+
- MIT
|
98
|
+
metadata: {}
|
99
|
+
post_install_message:
|
100
|
+
rdoc_options: []
|
101
|
+
require_paths:
|
102
|
+
- lib
|
103
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - '>='
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - '>='
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
requirements: []
|
114
|
+
rubyforge_project:
|
115
|
+
rubygems_version: 2.0.3
|
116
|
+
signing_key:
|
117
|
+
specification_version: 4
|
118
|
+
summary: Create new puppet modules with this templates
|
119
|
+
test_files: []
|
120
|
+
has_rdoc:
|