emconvert 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +19 -0
- data/LICENSE.txt +13 -0
- data/README.md +47 -0
- data/Rakefile +2 -0
- data/bin/emconvert +46 -0
- data/emconvert.gemspec +37 -0
- data/lib/emconvert/converter.rb +89 -0
- data/lib/emconvert/version.rb +3 -0
- data/lib/emconvert.rb +2 -0
- metadata +86 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1f87368078cbfc615b8355be6958b1b005ca7233
|
4
|
+
data.tar.gz: 4331822594a68c2cdb13669c57a052dc6d197189
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5ff411fa6953225c0111ad23fca5e3ef56103c17fe5b3b749b7dc90ac45dde070af6771a271dedb3e74d39d50bc56912d640a2e2beca021d6c71a8359159ff09
|
7
|
+
data.tar.gz: af03e845332f423ed794cd5db6ca6ef46f6c75151df9a5430a647340ed562d2399e1416f0658ebf06041d0b25a3368f4deff9236a8f103e55d60cafc8e8fbe69
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright 2015 Enterprise Modules
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
Module converter
|
2
|
+
=================
|
3
|
+
|
4
|
+
[Enterprise Modules](https://www.enterprisemodules.com) provides a set of high-quality modules to manage Oracle databases and Oracle WebLogic installations. These modules originated from the original Open Source modules, but where changed to:
|
5
|
+
- Add better documentation
|
6
|
+
- Add better error checking
|
7
|
+
- Add more enterprise options
|
8
|
+
|
9
|
+
## Why a name change
|
10
|
+
|
11
|
+
Puppet doesn't support namespaces. So for puppet to differentiate between the unsupported Open Source modules and the supported modules from [Enterprise Modules], we needed different names.
|
12
|
+
|
13
|
+
## Automatically change names
|
14
|
+
|
15
|
+
This utility automatically converts your Puppet class from using the Open Source Oracle and WebLogic modules into using the supported modules from Enterprise Modules.
|
16
|
+
|
17
|
+
## Installation
|
18
|
+
|
19
|
+
This utility is distributed as a Ruby Gem. So to install it, you'll need a running ruby environment. To install this gem, enter:
|
20
|
+
|
21
|
+
```sh
|
22
|
+
$ gem install emconvert
|
23
|
+
Successfully installed emconvert-1.0.0
|
24
|
+
1 gem installed
|
25
|
+
````
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
The syntax of the `emconvert` utility is:
|
30
|
+
|
31
|
+
```
|
32
|
+
$ emconvert [-v] [-b] wildcard_file
|
33
|
+
```
|
34
|
+
|
35
|
+
Where the options are:
|
36
|
+
-v --verbose Show a log of all files being processed and changed
|
37
|
+
-b --backup Make a backup of a file, when it is changed
|
38
|
+
|
39
|
+
## Examples
|
40
|
+
|
41
|
+
Here is an example:
|
42
|
+
|
43
|
+
```
|
44
|
+
$ emconvert -v -b my_module/**/*.pp
|
45
|
+
```
|
46
|
+
|
47
|
+
This command will check all files with extension `.pp` and change all calls and references to the Oracle and Weblogic modules to calls and references to the puppet modules provided by Enterprise Modules.
|
data/Rakefile
ADDED
data/bin/emconvert
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require "bundler/setup"
|
3
|
+
require "emconvert/version"
|
4
|
+
require "emconvert/converter"
|
5
|
+
require 'optparse'
|
6
|
+
require 'fileutils'
|
7
|
+
|
8
|
+
options = {:verbose => false, :backup => true}
|
9
|
+
|
10
|
+
parser = OptionParser.new do|opts|
|
11
|
+
opts.banner = "Usage: emconvert --verbose --backup files"
|
12
|
+
opts.on('-v', '--verbose', 'Show verbose output') do |verbose|
|
13
|
+
options[:verbose] = true;
|
14
|
+
end
|
15
|
+
|
16
|
+
opts.on('-b', '--backup', 'Create backup files when changed') do |verbose|
|
17
|
+
options[:backup] = true;
|
18
|
+
end
|
19
|
+
|
20
|
+
opts.on('-h', '--help', 'Displays Help') do
|
21
|
+
puts opts
|
22
|
+
exit
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
parser.parse!
|
28
|
+
filename = ARGV.pop
|
29
|
+
raise "Need to specify a set of files to process" unless filename
|
30
|
+
files = Dir.glob(filename)
|
31
|
+
|
32
|
+
files.each do |file|
|
33
|
+
content = File.read(file)
|
34
|
+
puts "Checking file #{file}..." if options[:verbose]
|
35
|
+
converter = Converter.new(content)
|
36
|
+
new_content = converter.convert
|
37
|
+
if new_content != content
|
38
|
+
puts "Found changes..." if options[:verbose]
|
39
|
+
if options[:backup]
|
40
|
+
backup_file = File.join(File.dirname(file),File.basename(file,'.*')) + File.extname(file + '_bak')
|
41
|
+
puts "Creating backup file #{backup_file}..." if options[:verbose]
|
42
|
+
FileUtils.mv(file, backup_file)
|
43
|
+
end
|
44
|
+
File.write(file, new_content)
|
45
|
+
end
|
46
|
+
end
|
data/emconvert.gemspec
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'emconvert/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "emconvert"
|
8
|
+
spec.version = Emconvert::VERSION
|
9
|
+
spec.authors = ["Bert Hajee"]
|
10
|
+
spec.email = ["info@enterprisemodules.com"]
|
11
|
+
spec.licenses = ['Apache2']
|
12
|
+
spec.summary = %q{Enterprise Modules module converter}
|
13
|
+
spec.homepage = 'https://github.com/enterprisemodules/emconvert'
|
14
|
+
spec.description = <<-EOD
|
15
|
+
|
16
|
+
This utility automatically converts your Puppet class from using the
|
17
|
+
Open Source Oracle and WebLogic modules into using the supported modules
|
18
|
+
from Enterprise Modules.
|
19
|
+
|
20
|
+
EOD
|
21
|
+
|
22
|
+
# # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
23
|
+
# # delete this section to allow pushing this gem to any host.
|
24
|
+
# if spec.respond_to?(:metadata)
|
25
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
26
|
+
# else
|
27
|
+
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
28
|
+
# end
|
29
|
+
|
30
|
+
spec.files = `git ls-files -z`.split("\x0")
|
31
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
32
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
33
|
+
spec.require_paths = ["lib"]
|
34
|
+
|
35
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
36
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
37
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
class Converter
|
2
|
+
|
3
|
+
def self.convert(options)
|
4
|
+
@from = options[:from]
|
5
|
+
@to = options[:to]
|
6
|
+
end
|
7
|
+
|
8
|
+
def initialize(content)
|
9
|
+
@content = content
|
10
|
+
end
|
11
|
+
|
12
|
+
def convert
|
13
|
+
change from:'orawls::bsu', to:'ora_install::bsu'
|
14
|
+
change from:'oradb::autostartdatabase', to:'ora_install::autostartdatabase'
|
15
|
+
change from:'oradb::client', to:'ora_install::client'
|
16
|
+
change from:'oradb::database', to:'ora_install::database'
|
17
|
+
change from:'oradb::database_pluggable', to:'ora_install::database_pluggable'
|
18
|
+
change from:'oradb::dbactions', to:'ora_install::dbactions'
|
19
|
+
change from:'oradb::goldengate', to:'ora_install::goldengate'
|
20
|
+
change from:'oradb::installdb', to:'ora_install::installdb'
|
21
|
+
change from:'oradb::installasm', to:'ora_install::installasm'
|
22
|
+
change from:'oradb::installem', to:'ora_install::installem'
|
23
|
+
change from:'oradb::installem_agent', to:'ora_install::installem_agent'
|
24
|
+
change from:'oradb::listener', to:'ora_install::listener'
|
25
|
+
change from:'oradb::net', to:'ora_install::net'
|
26
|
+
change from:'oradb::opatch', to:'ora_install::opatch'
|
27
|
+
change from:'oradb::opatchupgrade', to:'ora_install::opatchupgrade'
|
28
|
+
change from:'oradb::prepareautostart', to:'ora_install::prepareautostart'
|
29
|
+
change from:'oradb::rcu', to:'ora_install::rcu'
|
30
|
+
change from:'oradb::tnsnames', to:'ora_install::tnsnames'
|
31
|
+
change from:'oradb::utils::dborainst', to:'ora_install::utils::dborainst'
|
32
|
+
change from:'orwls::resourceadapter', to:'wls_config::resourceadapter'
|
33
|
+
change from:'orawls::bsu', to:'wls_install::bsu'
|
34
|
+
change from:'orawls::control', to:'wls_install::control'
|
35
|
+
change from:'orawls::copydomain', to:'wls_install::copydomain'
|
36
|
+
change from:'orawls::domain ', to:'wls_install::domain '
|
37
|
+
change from:'orawls::fmw', to:'wls_install::fmw'
|
38
|
+
change from:'orawls::fmwlogdir', to:'wls_install::fmwlogdir'
|
39
|
+
change from:'orawls::nodemanager ', to:'wls_install::nodemanager '
|
40
|
+
change from:'orawls::opatch', to:'wls_install::opatch'
|
41
|
+
change from:'orawls::packdomain', to:'wls_install::packdomain'
|
42
|
+
change from:'orawls::weblogic', to:'wls_install::software'
|
43
|
+
change from:'orawls::storeuserconfig', to:'wls_install::storeuserconfig'
|
44
|
+
change from:'orawls::urandomfix', to:'wls_install::urandomfix'
|
45
|
+
change from:'orawls::utils::fmwcluster', to:'wls_install::utils::fmwcluster'
|
46
|
+
change from:'orawls::utils::fmwclusterjrf', to:'wls_install::utils::fmwclusterjrf '
|
47
|
+
change from:'orawls::utils::forms11gpatch', to:'wls_install::utils::forms11gpatch'
|
48
|
+
change from:'orawls::utils::oimconfig', to:'wls_install::utils::oimconfig'
|
49
|
+
change from:'orawls::utils::orainst', to:'wls_install::utils::orainst'
|
50
|
+
change from:'orawls::utils::rcu', to:'wls_install::utils::rcu'
|
51
|
+
change from:'orawls::utils::webtier', to:'wls_install::utils::webtier'
|
52
|
+
change from:'wls_install::support::files', to:'wls_install::support::files'
|
53
|
+
change from:'wls_install::support::nodemanagerautostart',to:'wls_install::support::nodemanagerautostart'
|
54
|
+
change from:'wls_install::support::params', to:'wls_install::support::params'
|
55
|
+
@content
|
56
|
+
end
|
57
|
+
|
58
|
+
def change(options)
|
59
|
+
@from = options[:from]
|
60
|
+
@to = options[:to]
|
61
|
+
@content = convert_reference
|
62
|
+
@content = convert_calls
|
63
|
+
end
|
64
|
+
|
65
|
+
def convert_calls
|
66
|
+
@content.gsub(@from, @to)
|
67
|
+
end
|
68
|
+
|
69
|
+
def convert_reference
|
70
|
+
@content.gsub(from_reference, to_reference)
|
71
|
+
end
|
72
|
+
|
73
|
+
def upcase(string)
|
74
|
+
string.split('::').map(&:capitalize).join('::')
|
75
|
+
end
|
76
|
+
|
77
|
+
def from_reference
|
78
|
+
as_reference(@from)
|
79
|
+
end
|
80
|
+
|
81
|
+
def to_reference
|
82
|
+
as_reference(@to)
|
83
|
+
end
|
84
|
+
|
85
|
+
def as_reference(ref)
|
86
|
+
upcase(ref)
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
data/lib/emconvert.rb
ADDED
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: emconvert
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bert Hajee
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-10-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.9'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: "\n This utility automatically converts your Puppet class from using
|
42
|
+
the \n Open Source Oracle and WebLogic modules into using the supported modules\n
|
43
|
+
\ from Enterprise Modules. \n\n"
|
44
|
+
email:
|
45
|
+
- info@enterprisemodules.com
|
46
|
+
executables:
|
47
|
+
- emconvert
|
48
|
+
extensions: []
|
49
|
+
extra_rdoc_files: []
|
50
|
+
files:
|
51
|
+
- ".gitignore"
|
52
|
+
- Gemfile
|
53
|
+
- Gemfile.lock
|
54
|
+
- LICENSE.txt
|
55
|
+
- README.md
|
56
|
+
- Rakefile
|
57
|
+
- bin/emconvert
|
58
|
+
- emconvert.gemspec
|
59
|
+
- lib/emconvert.rb
|
60
|
+
- lib/emconvert/converter.rb
|
61
|
+
- lib/emconvert/version.rb
|
62
|
+
homepage: https://github.com/enterprisemodules/emconvert
|
63
|
+
licenses:
|
64
|
+
- Apache2
|
65
|
+
metadata: {}
|
66
|
+
post_install_message:
|
67
|
+
rdoc_options: []
|
68
|
+
require_paths:
|
69
|
+
- lib
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
requirements: []
|
81
|
+
rubyforge_project:
|
82
|
+
rubygems_version: 2.4.6
|
83
|
+
signing_key:
|
84
|
+
specification_version: 4
|
85
|
+
summary: Enterprise Modules module converter
|
86
|
+
test_files: []
|