simp-metadata 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +0 -0
- data/Rakefile +69 -0
- data/exe/simp-install +8 -0
- data/exe/simp-media +8 -0
- data/exe/simp-metadata +8 -0
- data/lib/simp/install.rb +0 -0
- data/lib/simp/install/command.rb +70 -0
- data/lib/simp/media.rb +9 -0
- data/lib/simp/media/command.rb +69 -0
- data/lib/simp/media/engine.rb +104 -0
- data/lib/simp/media/type.rb +14 -0
- data/lib/simp/media/type/base.rb +63 -0
- data/lib/simp/media/type/control-repo.rb +211 -0
- data/lib/simp/media/type/internet.rb +38 -0
- data/lib/simp/media/type/iso.rb +9 -0
- data/lib/simp/media/type/local.rb +36 -0
- data/lib/simp/media/type/tar.rb +71 -0
- data/lib/simp/metadata.rb +416 -0
- data/lib/simp/metadata/bootstrap_source.rb +137 -0
- data/lib/simp/metadata/buildinfo.rb +58 -0
- data/lib/simp/metadata/command.rb +92 -0
- data/lib/simp/metadata/commands.rb +21 -0
- data/lib/simp/metadata/commands/base.rb +65 -0
- data/lib/simp/metadata/commands/clone.rb +26 -0
- data/lib/simp/metadata/commands/component.rb +109 -0
- data/lib/simp/metadata/commands/delete.rb +26 -0
- data/lib/simp/metadata/commands/pry.rb +19 -0
- data/lib/simp/metadata/commands/release.rb +47 -0
- data/lib/simp/metadata/commands/releases.rb +24 -0
- data/lib/simp/metadata/commands/save.rb +33 -0
- data/lib/simp/metadata/commands/script.rb +38 -0
- data/lib/simp/metadata/commands/search.rb +65 -0
- data/lib/simp/metadata/commands/set-write-url.rb +19 -0
- data/lib/simp/metadata/commands/set-write.rb +19 -0
- data/lib/simp/metadata/commands/update.rb +46 -0
- data/lib/simp/metadata/component.rb +388 -0
- data/lib/simp/metadata/components.rb +70 -0
- data/lib/simp/metadata/engine.rb +101 -0
- data/lib/simp/metadata/fake_uri.rb +19 -0
- data/lib/simp/metadata/git_ssh_wrapper.sh +6 -0
- data/lib/simp/metadata/location.rb +198 -0
- data/lib/simp/metadata/locations.rb +54 -0
- data/lib/simp/metadata/release.rb +119 -0
- data/lib/simp/metadata/releases.rb +57 -0
- data/lib/simp/metadata/source.rb +204 -0
- data/spec/simp/media/command_spec.rb +12 -0
- data/spec/simp/media/engine_spec.rb +28 -0
- data/spec/simp/media/type/control_repo_spec.rb +23 -0
- data/spec/simp/media/type/internet_spec.rb +29 -0
- data/spec/simp/media/type/iso_spec.rb +15 -0
- data/spec/simp/media/type/local_spec.rb +16 -0
- data/spec/simp/media/type/tar_spec.rb +16 -0
- data/spec/simp/metadata/buildinfo_spec.rb +64 -0
- data/spec/simp/metadata/commands/clone_spec.rb +8 -0
- data/spec/simp/metadata/component_spec.rb +90 -0
- data/spec/simp/metadata/engine_spec.rb +70 -0
- data/spec/simp/metadata/release_spec.rb +104 -0
- data/spec/simp/metadata/source_spec.rb +25 -0
- data/spec/simp/metadata_spec.rb +175 -0
- data/spec/spec_helper.rb +40 -0
- metadata +260 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: cd811e5083f3cd404451122df3724881a443263d
|
4
|
+
data.tar.gz: 2ab75c024b695795b5493e1f184a8c8ca8f977c9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6e5a4bbed0632c0111f1db207c4e0cdb6cd73a9a29d9653e0d976928053a07b76b62728ed4c9e2d0098c8ecc5bb18a2a1cf8a57c740f8f0e7cdc74e75c11cc4b
|
7
|
+
data.tar.gz: f469ef9161c3345c86b51a0a98b9e59f6963143fea46b5bf419b58486742a8d123edb0c72c62977424b1c45a396deb87d4d2a74c8869e81eac1268ec43ddd0f4
|
data/README.md
ADDED
File without changes
|
data/Rakefile
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
#
|
2
|
+
# To change this license header, choose License Headers in Project Properties.
|
3
|
+
# To change this template file, choose Tools | Templates
|
4
|
+
# and open the template in the editor.
|
5
|
+
|
6
|
+
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rake'
|
9
|
+
require 'rake/clean'
|
10
|
+
require 'rubygems/package_task'
|
11
|
+
require 'rake/testtask'
|
12
|
+
require 'rspec/core/rake_task'
|
13
|
+
|
14
|
+
|
15
|
+
Rake::TestTask.new do |t|
|
16
|
+
t.test_files = FileList['test/**/*.rb']
|
17
|
+
end
|
18
|
+
begin
|
19
|
+
require 'rspec/core/rake_task'
|
20
|
+
RSpec::Core::RakeTask.new(:spec)
|
21
|
+
rescue LoadError
|
22
|
+
end
|
23
|
+
|
24
|
+
begin
|
25
|
+
require 'yard'
|
26
|
+
YARD::Rake::YardocTask.new
|
27
|
+
rescue LoadError
|
28
|
+
end
|
29
|
+
|
30
|
+
begin
|
31
|
+
require 'rubygems/tasks'
|
32
|
+
Gem::Tasks.new
|
33
|
+
rescue LoadError
|
34
|
+
end
|
35
|
+
|
36
|
+
begin
|
37
|
+
|
38
|
+
# yardstick
|
39
|
+
|
40
|
+
# measure coverage
|
41
|
+
require 'yardstick/rake/measurement'
|
42
|
+
|
43
|
+
Yardstick::Rake::Measurement.new(:yardstick_measure) do |measurement|
|
44
|
+
measurement.output = 'measurement/report.txt'
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
# verify coverage
|
49
|
+
|
50
|
+
require 'yardstick/rake/verify'
|
51
|
+
|
52
|
+
Yardstick::Rake::Verify.new(:yardstick_verify) do |verify|
|
53
|
+
verify.threshold = 50
|
54
|
+
verify.require_exact_threshold = false
|
55
|
+
end
|
56
|
+
rescue LoadError
|
57
|
+
end
|
58
|
+
|
59
|
+
begin
|
60
|
+
|
61
|
+
# reek
|
62
|
+
require 'reek/rake/task'
|
63
|
+
|
64
|
+
Reek::Rake::Task.new do |t|
|
65
|
+
t.fail_on_error = false
|
66
|
+
end
|
67
|
+
rescue LoadError
|
68
|
+
end
|
69
|
+
|
data/exe/simp-install
ADDED
data/exe/simp-media
ADDED
data/exe/simp-metadata
ADDED
data/lib/simp/install.rb
ADDED
File without changes
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'simp/install'
|
2
|
+
require 'simp/media'
|
3
|
+
require 'optparse'
|
4
|
+
module Simp
|
5
|
+
module Install
|
6
|
+
class Command
|
7
|
+
def run(argv)
|
8
|
+
options = {}
|
9
|
+
OptionParser.new do |opts|
|
10
|
+
opts.banner = "Usage: simp-install [options]"
|
11
|
+
|
12
|
+
opts.on("-v", "--version [version]", "version to install") do |opt|
|
13
|
+
options["version"] = opt
|
14
|
+
end
|
15
|
+
opts.on("-i", "--input [file]", "input filename") do |opt|
|
16
|
+
options["input"] = opt
|
17
|
+
end
|
18
|
+
opts.on("-t", "--input-type [type]", "input install type", "valid types:", " - internet", " - local", " - tar", " - iso") do |opt|
|
19
|
+
options["input_type"] = opt
|
20
|
+
end
|
21
|
+
opts.on("-o", "--output [file]", "output filename, path, or url (if control_repo type is specified)") do |opt|
|
22
|
+
options["output"] = opt
|
23
|
+
end
|
24
|
+
opts.on("-T", "--output-type [type]", "output install type", "valid types:", " - control_repo", " - local", " - tar", " - iso") do |opt|
|
25
|
+
options["output_type"] = opt
|
26
|
+
end
|
27
|
+
opts.on("-e", "--edition [edition_name]", "SIMP Edition", "valid editions:", " - community", " - enterprise") do |opt|
|
28
|
+
options["edition"] = opt
|
29
|
+
end
|
30
|
+
opts.on("-f", "--flavor [flavor_name]", "SIMP flavor", "valid flavors:", " - default") do |opt|
|
31
|
+
options["destination_branch"] = opt
|
32
|
+
end
|
33
|
+
opts.on("-c", "--channel [channel_name]", "Distribution Channel") do |opt|
|
34
|
+
options["channel"] = opt
|
35
|
+
end
|
36
|
+
opts.on("-l", "--license [license]", "path to license file") do |opt|
|
37
|
+
options["license"] = opt
|
38
|
+
end
|
39
|
+
opts.on("-s", "--sign", "sign output (if applicable)") do |opt|
|
40
|
+
options["sign"] = opt
|
41
|
+
end
|
42
|
+
opts.on("-S", "--signing-key [keyid]", "GPG ID of signing key") do |opt|
|
43
|
+
options["signing_key"] = opt
|
44
|
+
end
|
45
|
+
opts.on("-d", "--local-directory [directory]", "Local directory to add to SIMP") do |opt|
|
46
|
+
options["local_directory"] = opt
|
47
|
+
end
|
48
|
+
opts.on("-u", "--url [url]", "URL of git hosting server to use (control-repo output only)") do |opt|
|
49
|
+
options["embed"] = opt
|
50
|
+
end
|
51
|
+
opts.on("-E", "--embed", "embed puppet modules (control-repo output only)") do |opt|
|
52
|
+
options["embed"] = opt
|
53
|
+
end
|
54
|
+
opts.on("-b", "--branch [branch_name]", "branch to use (control-repo output only)") do |opt|
|
55
|
+
options["branch"] = opt
|
56
|
+
end
|
57
|
+
opts.on("-B", "--destination_branch [branch_name]", "destination branch to use (control-repo output only)") do |opt|
|
58
|
+
options["destination_branch"] = opt
|
59
|
+
end
|
60
|
+
opts.on("-d", "--debug [level]", "debug logging level: critical, error, warning, info, debug1, debug2") do |opt|
|
61
|
+
$simp_metadata_debug_level = opt
|
62
|
+
end
|
63
|
+
end.parse!(argv)
|
64
|
+
media = Simp::Media::Engine.new(options)
|
65
|
+
media.run
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
data/lib/simp/media.rb
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'simp/media'
|
2
|
+
require 'optparse'
|
3
|
+
module Simp
|
4
|
+
module Media
|
5
|
+
class Command
|
6
|
+
def run(argv)
|
7
|
+
options = {}
|
8
|
+
OptionParser.new do |opts|
|
9
|
+
opts.banner = "Usage: simp-media [options]"
|
10
|
+
|
11
|
+
opts.on("-v", "--version [version]", "version to install") do |opt|
|
12
|
+
options["version"] = opt
|
13
|
+
end
|
14
|
+
opts.on("-i", "--input [file]", "input filename") do |opt|
|
15
|
+
options["input"] = opt
|
16
|
+
end
|
17
|
+
opts.on("-t", "--input-type [type]", "input install type", "valid types:", " - internet", " - local", " - tar", " - iso") do |opt|
|
18
|
+
options["input_type"] = opt
|
19
|
+
end
|
20
|
+
opts.on("-o", "--output [file]", "output filename, path, or url (if control_repo type is specified)") do |opt|
|
21
|
+
options["output"] = opt
|
22
|
+
end
|
23
|
+
opts.on("-T", "--output-type [type]", "output install type", "valid types:", " - control_repo", " - local", " - tar", " - iso") do |opt|
|
24
|
+
options["output_type"] = opt
|
25
|
+
end
|
26
|
+
opts.on("-e", "--edition [edition_name]", "SIMP Edition", "valid editions:", " - community", " - enterprise") do |opt|
|
27
|
+
options["edition"] = opt
|
28
|
+
end
|
29
|
+
opts.on("-f", "--flavor [flavor_name]", "SIMP flavor", "valid flavors:", " - default") do |opt|
|
30
|
+
options["destination_branch"] = opt
|
31
|
+
end
|
32
|
+
opts.on("-c", "--channel [channel_name]", "Distribution Channel") do |opt|
|
33
|
+
options["channel"] = opt
|
34
|
+
end
|
35
|
+
opts.on("-l", "--license [license]", "path to license file") do |opt|
|
36
|
+
options["license"] = opt
|
37
|
+
end
|
38
|
+
opts.on("-s", "--sign", "sign output (if applicable)") do |opt|
|
39
|
+
options["sign"] = opt
|
40
|
+
end
|
41
|
+
opts.on("-S", "--signing-key [keyid]", "GPG ID of signing key") do |opt|
|
42
|
+
options["signing_key"] = opt
|
43
|
+
end
|
44
|
+
opts.on("-D", "--local-directory [directory]", "Local directory to add to SIMP") do |opt|
|
45
|
+
options["local_directory"] = opt
|
46
|
+
end
|
47
|
+
opts.on("-u", "--url [url]", "URL of git hosting server to use (control-repo output only)") do |opt|
|
48
|
+
options["embed"] = opt
|
49
|
+
end
|
50
|
+
opts.on("-E", "--embed", "embed puppet modules (control-repo output only)") do |opt|
|
51
|
+
options["embed"] = opt
|
52
|
+
end
|
53
|
+
opts.on("-b", "--branch [branch_name]", "branch to use (control-repo output only)") do |opt|
|
54
|
+
options["branch"] = opt
|
55
|
+
end
|
56
|
+
opts.on("-B", "--destination_branch [branch_name]", "destination branch to use (control-repo output only)") do |opt|
|
57
|
+
options["destination_branch"] = opt
|
58
|
+
end
|
59
|
+
opts.on("-d", "--debug [level]", "debug logging level: critical, error, warning, info, debug1, debug2") do |opt|
|
60
|
+
$simp_metadata_debug_level = opt
|
61
|
+
end
|
62
|
+
end.parse!(argv)
|
63
|
+
media = Simp::Media::Engine.new(options)
|
64
|
+
media.run
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
@@ -0,0 +1,104 @@
|
|
1
|
+
require 'simp/media'
|
2
|
+
|
3
|
+
module Simp
|
4
|
+
module Media
|
5
|
+
class Engine
|
6
|
+
attr_accessor :options
|
7
|
+
attr_accessor :input
|
8
|
+
attr_accessor :output
|
9
|
+
|
10
|
+
def debug2(output)
|
11
|
+
Simp::Metadata.debug2(output)
|
12
|
+
end
|
13
|
+
|
14
|
+
def debug1(output)
|
15
|
+
Simp::Metadata.debug1(output)
|
16
|
+
end
|
17
|
+
|
18
|
+
def info(output)
|
19
|
+
Simp::Metadata.info(output)
|
20
|
+
end
|
21
|
+
|
22
|
+
def warning(output)
|
23
|
+
Simp::Metadata.warning(output)
|
24
|
+
end
|
25
|
+
|
26
|
+
def error(output)
|
27
|
+
Simp::Metadata.error(output)
|
28
|
+
end
|
29
|
+
|
30
|
+
def critical(output)
|
31
|
+
Simp::Metadata.critical(output)
|
32
|
+
end
|
33
|
+
|
34
|
+
def initialize(options ={})
|
35
|
+
{
|
36
|
+
"input_type" => "internet",
|
37
|
+
"input" => nil,
|
38
|
+
"output_type" => "control_repo",
|
39
|
+
"output" => "file:///usr/share/simp/control-repo",
|
40
|
+
"url" => nil,
|
41
|
+
"embed" => true,
|
42
|
+
"license" => '/etc/simp/license.key',
|
43
|
+
"sign" => false,
|
44
|
+
"signing_key" => nil,
|
45
|
+
"metadata" => nil,
|
46
|
+
"branch" => "production",
|
47
|
+
"destination_branch" => nil,
|
48
|
+
"edition" => "community",
|
49
|
+
"channel" => "stable",
|
50
|
+
"flavor" => "default",
|
51
|
+
}.each do |key, default_value|
|
52
|
+
unless (options.key?(key))
|
53
|
+
options[key] = default_value
|
54
|
+
end
|
55
|
+
end
|
56
|
+
@cleanup = []
|
57
|
+
@options = options
|
58
|
+
if (options["input_type"] == nil)
|
59
|
+
raise "input_type must be specified"
|
60
|
+
end
|
61
|
+
if (options["output_type"] == nil)
|
62
|
+
raise "output_type must be specified"
|
63
|
+
end
|
64
|
+
@input = Module.const_get("Simp::Media::Type::#{@options["input_type"].capitalize}").new(options, self)
|
65
|
+
@output = Module.const_get("Simp::Media::Type::#{@options["output_type"].capitalize}").new(options, self)
|
66
|
+
end
|
67
|
+
|
68
|
+
def run()
|
69
|
+
# XXX ToDo: Need to not create a target_directory if an input directory exists
|
70
|
+
if (@output.target_directory == nil)
|
71
|
+
target = Dir.mktmpdir("cachedir")
|
72
|
+
@cleanup << target
|
73
|
+
else
|
74
|
+
target = @output.target_directory
|
75
|
+
end
|
76
|
+
|
77
|
+
# XXX ToDo: only set this if input is specified
|
78
|
+
@input.input_directory = @options["input"]
|
79
|
+
|
80
|
+
metadata = Simp::Metadata::Engine.new(nil, nil, @options["edition"])
|
81
|
+
version = @options["version"]
|
82
|
+
metadata.releases[version].components.each do |component|
|
83
|
+
info("Adding #{component.name}")
|
84
|
+
retval = @input.fetch_component(component, {})
|
85
|
+
@output.add_component(component, retval)
|
86
|
+
end
|
87
|
+
@output.finalize(nil)
|
88
|
+
@input.cleanup
|
89
|
+
@output.cleanup
|
90
|
+
cleanup
|
91
|
+
end
|
92
|
+
|
93
|
+
def loaded?()
|
94
|
+
true
|
95
|
+
end
|
96
|
+
|
97
|
+
def cleanup()
|
98
|
+
@cleanup.each do |path|
|
99
|
+
FileUtils.rmtree(path)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
require 'simp/media/type/base'
|
3
|
+
require 'simp/media/type/internet'
|
4
|
+
require 'simp/media/type/local'
|
5
|
+
require 'simp/media/type/tar'
|
6
|
+
require 'simp/media/type/iso'
|
7
|
+
require 'simp/media/type/control-repo'
|
8
|
+
module Simp
|
9
|
+
module Media
|
10
|
+
module Type
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'open3'
|
2
|
+
module Simp
|
3
|
+
module Media
|
4
|
+
module Type
|
5
|
+
class Base
|
6
|
+
attr_accessor :engine
|
7
|
+
attr_accessor :options
|
8
|
+
def initialize(options, engine)
|
9
|
+
@options = options
|
10
|
+
@engine = engine
|
11
|
+
end
|
12
|
+
def debug2(output)
|
13
|
+
engine.debug2(output)
|
14
|
+
end
|
15
|
+
|
16
|
+
def debug1(output)
|
17
|
+
engine.debug1(output)
|
18
|
+
end
|
19
|
+
|
20
|
+
def info(output)
|
21
|
+
engine.info(output)
|
22
|
+
end
|
23
|
+
|
24
|
+
def warning(output)
|
25
|
+
engine.warning(output)
|
26
|
+
end
|
27
|
+
|
28
|
+
def error(output)
|
29
|
+
engine.error(output)
|
30
|
+
end
|
31
|
+
|
32
|
+
def critical(output)
|
33
|
+
engine.critical(output)
|
34
|
+
end
|
35
|
+
def run(command)
|
36
|
+
exitcode = nil
|
37
|
+
Open3.popen3(command) do |stdin, stdout, stderr, thread|
|
38
|
+
pid = thread.pid
|
39
|
+
debug1(stdout.read.chomp)
|
40
|
+
debug1(stderr.read.chomp)
|
41
|
+
exitcode = thread.value
|
42
|
+
end
|
43
|
+
exitcode
|
44
|
+
end
|
45
|
+
def target_directory
|
46
|
+
nil
|
47
|
+
end
|
48
|
+
def cleanup
|
49
|
+
true
|
50
|
+
end
|
51
|
+
def fetch_component(component, options)
|
52
|
+
raise '`fetch_component` not implemented'
|
53
|
+
end
|
54
|
+
def add_component(component, options)
|
55
|
+
raise '`add_component` not implemented'
|
56
|
+
end
|
57
|
+
def finalize()
|
58
|
+
raise '`finalize` not implemented'
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|