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