puppeteer 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README +37 -0
- data/Rakefile +2 -0
- data/bin/puppeteer +18 -0
- data/lib/puppeteer.rb +35 -0
- data/lib/puppeteer/screenplay.rb +26 -0
- data/lib/puppeteer/templates/manifests_pp.erb +3 -0
- data/lib/puppeteer/version.rb +3 -0
- data/puppeteer.gemspec +19 -0
- metadata +59 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 AbhishekKr
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Puppeteer
|
2
|
+
|
3
|
+
Puppeteer is there to ease out Puppet-izing the infrastructure.
|
4
|
+
Automate the automation development.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
gem 'puppeteer'
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
$ bundle
|
15
|
+
|
16
|
+
Or install it yourself as:
|
17
|
+
|
18
|
+
$ gem install puppeteer
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
Currently it just allows creating Puppet Module with full directory structure and creates skeleton *pp file.
|
23
|
+
Example:
|
24
|
+
$ puppeteer module myapp
|
25
|
+
$ puppeteer module myapp::config
|
26
|
+
$ puppeteer module myapp::config::params
|
27
|
+
~~~ just to quickly check what's all available
|
28
|
+
$ puppeteer
|
29
|
+
|
30
|
+
|
31
|
+
## Contributing
|
32
|
+
|
33
|
+
1. Fork it
|
34
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
35
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
36
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
37
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/bin/puppeteer
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
|
3
|
+
|
4
|
+
require 'puppeteer'
|
5
|
+
|
6
|
+
case ARGV[0]
|
7
|
+
when 'module'
|
8
|
+
Puppeteer.module ARGV[1], (ARGV[2] || Dir.pwd)
|
9
|
+
else
|
10
|
+
puts <<-HELP
|
11
|
+
\e[1m\e[31mPuppet-eer ver.#{Puppeteer::VERSION}\e[0m
|
12
|
+
\e[33m
|
13
|
+
$ puppeteer module $ModuleName <$ModulePath>
|
14
|
+
\e[32m_____
|
15
|
+
\e[33m.....more to come
|
16
|
+
\e[0m
|
17
|
+
HELP
|
18
|
+
end
|
data/lib/puppeteer.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require "puppeteer/version"
|
2
|
+
require "puppeteer/screenplay"
|
3
|
+
|
4
|
+
module Puppeteer
|
5
|
+
|
6
|
+
def self.module_structure
|
7
|
+
['files', 'lib', 'spec','templates', 'tests']
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.module(namespace,
|
11
|
+
module_path = File.expand_path(File.dirname __FILE__),
|
12
|
+
dir_struct = module_structure
|
13
|
+
)
|
14
|
+
dirs = []
|
15
|
+
dirs << File.join(module_path, namespace.split(/::/)[0])
|
16
|
+
dirs << File.join(dirs[0], 'manifests')
|
17
|
+
namespace.split(/::/)[1..-2].each_with_index do |nam, idx|
|
18
|
+
dirs << File.join(dirs[idx+1], nam)
|
19
|
+
end
|
20
|
+
dirs.each {|dir| Dir.mkdir dir unless File.directory?(dir) }
|
21
|
+
dir_struct.each {|mdir|
|
22
|
+
dir = File.join(dirs[0], mdir)
|
23
|
+
Dir.mkdir dir unless File.directory?(dir)
|
24
|
+
}
|
25
|
+
|
26
|
+
unless namespace.match(/::/)
|
27
|
+
init_pp = File.join dirs[-1], 'init.pp'
|
28
|
+
else
|
29
|
+
puts File.join(dirs[-1], namespace.split(/::/)[-1])
|
30
|
+
init_pp = "#{File.join dirs[-1], namespace.split(/::/)[-1]}.pp"
|
31
|
+
end
|
32
|
+
|
33
|
+
Screenplay.create_pp namespace, init_pp
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'erb'
|
2
|
+
|
3
|
+
module Puppeteer
|
4
|
+
module Screenplay
|
5
|
+
attr_accessor :pp_name, :pp_config
|
6
|
+
|
7
|
+
def self.erb(fylname)
|
8
|
+
dir = File.dirname(File.expand_path(__FILE__))
|
9
|
+
file_erb = File.join dir, 'templates', fylname
|
10
|
+
template = File.open(file_erb, 'r').read
|
11
|
+
ERB.new(template)
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.default_manifest
|
15
|
+
@pp_config ||= "# module :: #{@pp_name.split(/::/).join(' > ')}"
|
16
|
+
manifest_dat = erb('manifests_pp.erb').result(binding)
|
17
|
+
return manifest_dat
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.create_pp(namespace, fylname)
|
21
|
+
@pp_name = namespace
|
22
|
+
fyldata = default_manifest
|
23
|
+
File.open(fylname, 'w') {|fyl| fyl.write(fyldata) }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/puppeteer.gemspec
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'puppeteer/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = "puppeteer"
|
7
|
+
gem.version = Puppeteer::VERSION
|
8
|
+
gem.authors = ["abhishekkr"]
|
9
|
+
gem.email = ["abhikumar163@gmail.com"]
|
10
|
+
gem.homepage = "https://github.com/abhishekkr/rubygem_puppeteer"
|
11
|
+
gem.summary = %q{Puppeteer has been started to: ease [Puppet Configuration], [CRUD of puppet-modules-parts], [...] ~~~~~ https://raw.github.com/abhishekkr/rubygem_puppeteer/master/README}
|
12
|
+
gem.description = %q{Puppeteer is there to ease out Puppet-izing the infrastructure. Automate the automation development.}
|
13
|
+
|
14
|
+
gem.files = `git ls-files`.split("\n")
|
15
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
gem.require_paths = ["lib"]
|
17
|
+
|
18
|
+
gem.executables = %w( puppeteer )
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: puppeteer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- abhishekkr
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-09-11 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Puppeteer is there to ease out Puppet-izing the infrastructure. Automate
|
15
|
+
the automation development.
|
16
|
+
email:
|
17
|
+
- abhikumar163@gmail.com
|
18
|
+
executables:
|
19
|
+
- puppeteer
|
20
|
+
extensions: []
|
21
|
+
extra_rdoc_files: []
|
22
|
+
files:
|
23
|
+
- .gitignore
|
24
|
+
- Gemfile
|
25
|
+
- LICENSE
|
26
|
+
- README
|
27
|
+
- Rakefile
|
28
|
+
- bin/puppeteer
|
29
|
+
- lib/puppeteer.rb
|
30
|
+
- lib/puppeteer/screenplay.rb
|
31
|
+
- lib/puppeteer/templates/manifests_pp.erb
|
32
|
+
- lib/puppeteer/version.rb
|
33
|
+
- puppeteer.gemspec
|
34
|
+
homepage: https://github.com/abhishekkr/rubygem_puppeteer
|
35
|
+
licenses: []
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options: []
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
48
|
+
requirements:
|
49
|
+
- - ! '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
requirements: []
|
53
|
+
rubyforge_project:
|
54
|
+
rubygems_version: 1.8.24
|
55
|
+
signing_key:
|
56
|
+
specification_version: 3
|
57
|
+
summary: ! 'Puppeteer has been started to: ease [Puppet Configuration], [CRUD of puppet-modules-parts],
|
58
|
+
[...] ~~~~~ https://raw.github.com/abhishekkr/rubygem_puppeteer/master/README'
|
59
|
+
test_files: []
|