boxgrinder-core 0.3.10 → 0.3.11
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -0
- data/Rakefile +13 -8
- data/boxgrinder-core.gemspec +4 -4
- data/lib/boxgrinder-core.rb +4 -0
- data/lib/boxgrinder-core/appliance-parser.rb +3 -1
- data/lib/boxgrinder-core/compat/yaml19.rb +7 -0
- data/lib/boxgrinder-core/helpers/appliance-definition-helper.rb +3 -58
- data/lib/boxgrinder-core/models/appliance-config.rb +26 -3
- data/lib/boxgrinder-core/schemas/appliance_schema_0.8.0.yaml +3 -0
- data/lib/boxgrinder-core/schemas/appliance_schema_0.9.0.yaml +3 -0
- data/lib/boxgrinder-core/schemas/appliance_schema_0.9.6.yaml +3 -0
- data/rubygem-boxgrinder-core.spec +7 -2
- data/spec/appliance-parser-spec.rb +5 -6
- data/spec/appliance-validator-spec.rb +0 -2
- data/spec/helpers/appliance-config-helper-spec.rb +0 -2
- data/spec/helpers/appliance-definition-helper-spec.rb +0 -21
- data/spec/helpers/appliance-transformation-helper-spec.rb +0 -2
- data/spec/helpers/exec-helper-spec.rb +0 -2
- data/spec/helpers/log-helper-spec.rb +0 -2
- data/spec/models/appliance-config-spec.rb +0 -2
- data/spec/models/config-spec.rb +0 -3
- data/spec/rcov_helper.rb +2 -0
- data/spec/spec_helper.rb +9 -0
- metadata +8 -4
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
@@ -31,16 +31,21 @@ Echoe.new("boxgrinder-core") do |p|
|
|
31
31
|
end
|
32
32
|
|
33
33
|
RSpec::Core::RakeTask.new('spec') do |t|
|
34
|
-
t.
|
35
|
-
t.
|
36
|
-
t.rspec_opts = ['--colour', '--format', 'doc', '-b']
|
34
|
+
t.pattern = ["spec/**/*-spec.rb"]
|
35
|
+
t.rspec_opts = ['-r rubygems', '-r boxgrinder-core', '--colour', '--format', 'doc', '-b']
|
37
36
|
t.verbose = true
|
38
37
|
end
|
39
38
|
|
40
|
-
RSpec::Core::RakeTask.new('spec:coverage') do |t|
|
39
|
+
RSpec::Core::RakeTask.new('spec:coverage') do |t|
|
41
40
|
t.pattern = "spec/**/*-spec.rb"
|
42
|
-
t.rspec_opts = ['
|
43
|
-
|
44
|
-
t.
|
45
|
-
|
41
|
+
t.rspec_opts = ['-r rubygems', '-r spec_helper', '-r boxgrinder-core', '--colour',
|
42
|
+
'--format', 'html', '--out', 'pkg/rspec_report.html', '-b']
|
43
|
+
t.verbose = true
|
44
|
+
|
45
|
+
if RUBY_VERSION =~ /^1.8/
|
46
|
+
t.rcov = true
|
47
|
+
t.rcov_opts = ["-Ispec:lib spec/rcov_helper.rb", '--exclude', 'spec,teamcity/*,/usr/lib/ruby/,.gem/ruby,/boxgrinder-build/,/gems/']
|
48
|
+
else
|
49
|
+
ENV['COVERAGE'] = 'true'
|
50
|
+
end
|
46
51
|
end
|
data/boxgrinder-core.gemspec
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "boxgrinder-core"
|
5
|
-
s.version = "0.3.
|
5
|
+
s.version = "0.3.11"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Marek Goldmann"]
|
9
|
-
s.date = "
|
9
|
+
s.date = "2012-03-19"
|
10
10
|
s.description = "Core library for BoxGrinder"
|
11
11
|
s.email = "info@boxgrinder.org"
|
12
|
-
s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README", "lib/boxgrinder-core.rb", "lib/boxgrinder-core/appliance-parser.rb", "lib/boxgrinder-core/appliance-validator.rb", "lib/boxgrinder-core/errors.rb", "lib/boxgrinder-core/helpers/appliance-config-helper.rb", "lib/boxgrinder-core/helpers/appliance-definition-helper.rb", "lib/boxgrinder-core/helpers/appliance-transformation-helper.rb", "lib/boxgrinder-core/helpers/exec-helper.rb", "lib/boxgrinder-core/helpers/log-helper.rb", "lib/boxgrinder-core/models/appliance-config.rb", "lib/boxgrinder-core/models/config.rb", "lib/boxgrinder-core/models/task.rb", "lib/boxgrinder-core/schemas/appliance_schema_0.8.0.yaml", "lib/boxgrinder-core/schemas/appliance_schema_0.9.0.yaml", "lib/boxgrinder-core/schemas/appliance_schema_0.9.6.yaml"]
|
13
|
-
s.files = ["CHANGELOG", "LICENSE", "Manifest", "README", "Rakefile", "boxgrinder-core.gemspec", "lib/boxgrinder-core.rb", "lib/boxgrinder-core/appliance-parser.rb", "lib/boxgrinder-core/appliance-validator.rb", "lib/boxgrinder-core/errors.rb", "lib/boxgrinder-core/helpers/appliance-config-helper.rb", "lib/boxgrinder-core/helpers/appliance-definition-helper.rb", "lib/boxgrinder-core/helpers/appliance-transformation-helper.rb", "lib/boxgrinder-core/helpers/exec-helper.rb", "lib/boxgrinder-core/helpers/log-helper.rb", "lib/boxgrinder-core/models/appliance-config.rb", "lib/boxgrinder-core/models/config.rb", "lib/boxgrinder-core/models/task.rb", "lib/boxgrinder-core/schemas/appliance_schema_0.8.0.yaml", "lib/boxgrinder-core/schemas/appliance_schema_0.9.0.yaml", "lib/boxgrinder-core/schemas/appliance_schema_0.9.6.yaml", "rubygem-boxgrinder-core.spec", "spec/appliance-parser-spec.rb", "spec/appliance-validator-spec.rb", "spec/helpers/appliance-config-helper-spec.rb", "spec/helpers/appliance-definition-helper-spec.rb", "spec/helpers/appliance-transformation-helper-spec.rb", "spec/helpers/exec-helper-spec.rb", "spec/helpers/log-helper-spec.rb", "spec/models/appliance-config-spec.rb", "spec/models/config-spec.rb", "spec/rspec/ls/one", "spec/rspec/ls/two", "spec/rspec/src/appliances/0.8.x.appl", "spec/rspec/src/appliances/0.9.x-invalid.appl", "spec/rspec/src/appliances/0.9.x.appl", "spec/rspec/src/appliances/comments.appl", "spec/rspec/src/appliances/ephemeral-repo.appl", "spec/rspec/src/appliances/full.appl", "spec/rspec/src/appliances/invalid-yaml.appl", "spec/rspec/src/appliances/legacy.appl", "spec/rspec/src/appliances/repo.appl", "spec/rspec/src/config/empty", "spec/rspec/src/config/valid"]
|
12
|
+
s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README", "lib/boxgrinder-core.rb", "lib/boxgrinder-core/appliance-parser.rb", "lib/boxgrinder-core/appliance-validator.rb", "lib/boxgrinder-core/compat/yaml19.rb", "lib/boxgrinder-core/errors.rb", "lib/boxgrinder-core/helpers/appliance-config-helper.rb", "lib/boxgrinder-core/helpers/appliance-definition-helper.rb", "lib/boxgrinder-core/helpers/appliance-transformation-helper.rb", "lib/boxgrinder-core/helpers/exec-helper.rb", "lib/boxgrinder-core/helpers/log-helper.rb", "lib/boxgrinder-core/models/appliance-config.rb", "lib/boxgrinder-core/models/config.rb", "lib/boxgrinder-core/models/task.rb", "lib/boxgrinder-core/schemas/appliance_schema_0.8.0.yaml", "lib/boxgrinder-core/schemas/appliance_schema_0.9.0.yaml", "lib/boxgrinder-core/schemas/appliance_schema_0.9.6.yaml"]
|
13
|
+
s.files = ["CHANGELOG", "LICENSE", "Manifest", "README", "Rakefile", "boxgrinder-core.gemspec", "lib/boxgrinder-core.rb", "lib/boxgrinder-core/appliance-parser.rb", "lib/boxgrinder-core/appliance-validator.rb", "lib/boxgrinder-core/compat/yaml19.rb", "lib/boxgrinder-core/errors.rb", "lib/boxgrinder-core/helpers/appliance-config-helper.rb", "lib/boxgrinder-core/helpers/appliance-definition-helper.rb", "lib/boxgrinder-core/helpers/appliance-transformation-helper.rb", "lib/boxgrinder-core/helpers/exec-helper.rb", "lib/boxgrinder-core/helpers/log-helper.rb", "lib/boxgrinder-core/models/appliance-config.rb", "lib/boxgrinder-core/models/config.rb", "lib/boxgrinder-core/models/task.rb", "lib/boxgrinder-core/schemas/appliance_schema_0.8.0.yaml", "lib/boxgrinder-core/schemas/appliance_schema_0.9.0.yaml", "lib/boxgrinder-core/schemas/appliance_schema_0.9.6.yaml", "rubygem-boxgrinder-core.spec", "spec/appliance-parser-spec.rb", "spec/appliance-validator-spec.rb", "spec/helpers/appliance-config-helper-spec.rb", "spec/helpers/appliance-definition-helper-spec.rb", "spec/helpers/appliance-transformation-helper-spec.rb", "spec/helpers/exec-helper-spec.rb", "spec/helpers/log-helper-spec.rb", "spec/models/appliance-config-spec.rb", "spec/models/config-spec.rb", "spec/rcov_helper.rb", "spec/rspec/ls/one", "spec/rspec/ls/two", "spec/rspec/src/appliances/0.8.x.appl", "spec/rspec/src/appliances/0.9.x-invalid.appl", "spec/rspec/src/appliances/0.9.x.appl", "spec/rspec/src/appliances/comments.appl", "spec/rspec/src/appliances/ephemeral-repo.appl", "spec/rspec/src/appliances/full.appl", "spec/rspec/src/appliances/invalid-yaml.appl", "spec/rspec/src/appliances/legacy.appl", "spec/rspec/src/appliances/repo.appl", "spec/rspec/src/config/empty", "spec/rspec/src/config/valid", "spec/spec_helper.rb"]
|
14
14
|
s.homepage = "http://boxgrinder.org"
|
15
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Boxgrinder-core", "--main", "README"]
|
16
16
|
s.require_paths = ["lib"]
|
data/lib/boxgrinder-core.rb
CHANGED
@@ -15,3 +15,7 @@
|
|
15
15
|
# License along with this software; if not, write to the Free
|
16
16
|
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
17
17
|
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
18
|
+
|
19
|
+
module BoxGrinder
|
20
|
+
require 'boxgrinder-core/compat/yaml19'
|
21
|
+
end
|
@@ -32,7 +32,7 @@ module BoxGrinder
|
|
32
32
|
def load_schemas
|
33
33
|
Dir.glob("#{File.dirname(__FILE__)}/schemas/{*.yaml,*.yml}").each do |f|
|
34
34
|
# DON'T use Kwalify::Yaml here!
|
35
|
-
# This will not
|
35
|
+
# This will not treat '#' sign in schema files correctly
|
36
36
|
schema = YAML.load_file(f)
|
37
37
|
@schemas[schema['version']] = schema
|
38
38
|
end
|
@@ -50,6 +50,7 @@ module BoxGrinder
|
|
50
50
|
schema_versions = @schemas.keys.sort.reverse
|
51
51
|
|
52
52
|
schema_versions.each do |schema_version|
|
53
|
+
@log.debug "Parsing definition using schema version #{schema_version}."
|
53
54
|
@schemas[schema_version].delete('version')
|
54
55
|
appliance_config, errors = parse(@schemas[schema_version], appliance_definition)
|
55
56
|
|
@@ -72,6 +73,7 @@ module BoxGrinder
|
|
72
73
|
def parse(schema_document, appliance_definition)
|
73
74
|
validator = ApplianceValidator.new(schema_document)
|
74
75
|
parser = Kwalify::Yaml::Parser.new(validator)
|
76
|
+
parser.data_binding = true
|
75
77
|
|
76
78
|
begin
|
77
79
|
parsed = parser.parse(appliance_definition)
|
@@ -42,12 +42,12 @@ module BoxGrinder
|
|
42
42
|
appliance_config =
|
43
43
|
case definition_file_extension
|
44
44
|
when '.appl', '.yml', '.yaml'
|
45
|
-
|
45
|
+
@appliance_parser.parse_definition(definition)
|
46
46
|
else
|
47
47
|
unless content_type.nil?
|
48
48
|
case content_type
|
49
49
|
when 'application/x-yaml', 'text/yaml'
|
50
|
-
|
50
|
+
@appliance_parser.parse_definition(definition)
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
@@ -64,63 +64,8 @@ module BoxGrinder
|
|
64
64
|
end unless appliance_config.appliances.nil? or !appliance_config.appliances.is_a?(Array)
|
65
65
|
else
|
66
66
|
# Assuming that the definition is provided as string
|
67
|
-
@appliance_configs <<
|
67
|
+
@appliance_configs << @appliance_parser.parse_definition(definition, false)
|
68
68
|
end
|
69
69
|
end
|
70
|
-
|
71
|
-
# TODO this needs to be rewritten - using kwalify it could be possible to instantiate document structure as objects[, or opencascade hash?]
|
72
|
-
def parse_yaml(definition)
|
73
|
-
return definition if definition.is_a?(ApplianceConfig)
|
74
|
-
raise "Provided definition is not a Hash." unless definition.is_a?(Hash)
|
75
|
-
|
76
|
-
appliance_config = ApplianceConfig.new
|
77
|
-
|
78
|
-
appliance_config.name = definition['name'] unless definition['name'].nil?
|
79
|
-
appliance_config.summary = definition['summary'] unless definition['summary'].nil?
|
80
|
-
|
81
|
-
definition['variables'].each { |key, value| appliance_config.variables[key] = value } unless definition['variables'].nil?
|
82
|
-
|
83
|
-
@log.debug "Adding packages to appliance..."
|
84
|
-
|
85
|
-
appliance_config.packages = definition['packages'] unless definition['packages'].nil?
|
86
|
-
|
87
|
-
@log.debug "#{appliance_config.packages.size} package(s) added to appliance." if appliance_config.packages
|
88
|
-
|
89
|
-
appliance_config.appliances = definition['appliances'] unless definition['appliances'].nil?
|
90
|
-
appliance_config.repos = definition['repos'] unless definition['repos'].nil?
|
91
|
-
|
92
|
-
appliance_config.version = definition['version'] unless definition['version'].nil?
|
93
|
-
appliance_config.release = definition['release'] unless definition['release'].nil?
|
94
|
-
|
95
|
-
unless definition['default_repos'].nil?
|
96
|
-
appliance_config.default_repos = definition['default_repos']
|
97
|
-
raise "default_repos should be set to true or false" unless appliance_config.default_repos.is_a?(TrueClass) or appliance_config.default_repos.is_a?(FalseClass)
|
98
|
-
end
|
99
|
-
|
100
|
-
unless definition['os'].nil?
|
101
|
-
appliance_config.os.name = definition['os']['name'] unless definition['os']['name'].nil?
|
102
|
-
appliance_config.os.version = definition['os']['version'] unless definition['os']['version'].nil?
|
103
|
-
appliance_config.os.password = definition['os']['password'] unless definition['os']['password'].nil?
|
104
|
-
appliance_config.os.pae = definition['os']['pae'] unless definition['os']['pae'].nil?
|
105
|
-
end
|
106
|
-
|
107
|
-
unless definition['hardware'].nil?
|
108
|
-
appliance_config.hardware.arch = definition['hardware']['arch'] unless definition['hardware']['arch'].nil?
|
109
|
-
appliance_config.hardware.cpus = definition['hardware']['cpus'] unless definition['hardware']['cpus'].nil?
|
110
|
-
appliance_config.hardware.memory = definition['hardware']['memory'] unless definition['hardware']['memory'].nil?
|
111
|
-
appliance_config.hardware.network = definition['hardware']['network'] unless definition['hardware']['network'].nil?
|
112
|
-
|
113
|
-
unless definition['hardware']['partitions'].nil?
|
114
|
-
definition['hardware']['partitions'].each do |key, part|
|
115
|
-
appliance_config.hardware.partitions[key] = part
|
116
|
-
end if definition['hardware']['partitions'].is_a?(Hash)
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
definition['files'].each { |key, value| appliance_config.files[key] = value } unless definition['files'].nil?
|
121
|
-
definition['post'].each { |key, value| appliance_config.post[key] = value } unless definition['post'].nil?
|
122
|
-
|
123
|
-
appliance_config
|
124
|
-
end
|
125
70
|
end
|
126
71
|
end
|
@@ -21,11 +21,12 @@ require 'hashery/opencascade'
|
|
21
21
|
|
22
22
|
module BoxGrinder
|
23
23
|
class ApplianceConfig
|
24
|
+
|
24
25
|
def initialize
|
25
26
|
@name = nil
|
26
27
|
@summary = nil
|
27
28
|
|
28
|
-
@
|
29
|
+
@default_repos = true
|
29
30
|
|
30
31
|
@os = OpenCascade.new
|
31
32
|
|
@@ -41,8 +42,7 @@ module BoxGrinder
|
|
41
42
|
@hardware.network = 'NAT'
|
42
43
|
@hardware.partitions = {"/" => {'size' => 1}}
|
43
44
|
|
44
|
-
@
|
45
|
-
|
45
|
+
@variables = {}
|
46
46
|
@post = {}
|
47
47
|
@files = {}
|
48
48
|
|
@@ -70,6 +70,29 @@ module BoxGrinder
|
|
70
70
|
attr_accessor :release
|
71
71
|
attr_accessor :default_repos
|
72
72
|
|
73
|
+
def [](k)
|
74
|
+
instance_variable_get("@#{k}")
|
75
|
+
end
|
76
|
+
|
77
|
+
def []=(k, v)
|
78
|
+
case k
|
79
|
+
when "hardware"
|
80
|
+
@hardware.cpus = v['cpus'] if v['cpus']
|
81
|
+
@hardware.memory = v['memory'] if v['memory']
|
82
|
+
@hardware.network = v['network'] if v['network']
|
83
|
+
@hardware.partitions = v['partitions'] if v['partitions']
|
84
|
+
when "os"
|
85
|
+
@os.name = v['name'] if v['name']
|
86
|
+
@os.version = v['version'] if v['version']
|
87
|
+
@os.password = v['password'] if v['password']
|
88
|
+
# TODO this is OS specific, move it to OS plugin!
|
89
|
+
@os.pae = false if v['pae'] == false
|
90
|
+
else
|
91
|
+
instance_variable_set("@#{k}", v)
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
|
73
96
|
def init
|
74
97
|
init_arch
|
75
98
|
initialize_paths
|
@@ -1,5 +1,6 @@
|
|
1
1
|
#0.8.x schema
|
2
2
|
version: 0.8.0
|
3
|
+
class: BoxGrinder::ApplianceConfig
|
3
4
|
type: map
|
4
5
|
mapping:
|
5
6
|
"name":
|
@@ -14,6 +15,7 @@ mapping:
|
|
14
15
|
"release":
|
15
16
|
type: int
|
16
17
|
"os":
|
18
|
+
class: OpenCascade
|
17
19
|
type: map
|
18
20
|
mapping:
|
19
21
|
"name":
|
@@ -26,6 +28,7 @@ mapping:
|
|
26
28
|
"password":
|
27
29
|
type: str
|
28
30
|
"hardware":
|
31
|
+
class: OpenCascade
|
29
32
|
type: map
|
30
33
|
name: Hardware
|
31
34
|
mapping:
|
@@ -1,5 +1,6 @@
|
|
1
1
|
#0.9.x schema
|
2
2
|
version: 0.9.0
|
3
|
+
class: BoxGrinder:ApplianceConfig
|
3
4
|
type: map
|
4
5
|
mapping:
|
5
6
|
"name":
|
@@ -14,6 +15,7 @@ mapping:
|
|
14
15
|
"release":
|
15
16
|
type: int
|
16
17
|
"os":
|
18
|
+
class: OpenCascade
|
17
19
|
type: map
|
18
20
|
mapping:
|
19
21
|
"name":
|
@@ -26,6 +28,7 @@ mapping:
|
|
26
28
|
"password":
|
27
29
|
type: str
|
28
30
|
"hardware":
|
31
|
+
class: OpenCascade
|
29
32
|
type: map
|
30
33
|
name: Hardware
|
31
34
|
mapping:
|
@@ -1,5 +1,6 @@
|
|
1
1
|
#0.9.x schema
|
2
2
|
version: 0.9.6
|
3
|
+
class: BoxGrinder::ApplianceConfig
|
3
4
|
type: map
|
4
5
|
mapping:
|
5
6
|
"name":
|
@@ -14,6 +15,7 @@ mapping:
|
|
14
15
|
"release":
|
15
16
|
type: int
|
16
17
|
"os":
|
18
|
+
class: OpenCascade
|
17
19
|
type: map
|
18
20
|
mapping:
|
19
21
|
"name":
|
@@ -26,6 +28,7 @@ mapping:
|
|
26
28
|
"password":
|
27
29
|
type: str
|
28
30
|
"hardware":
|
31
|
+
class: OpenCascade
|
29
32
|
type: map
|
30
33
|
name: Hardware
|
31
34
|
mapping:
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Summary: Core library for BoxGrinder
|
7
7
|
Name: rubygem-%{gemname}
|
8
|
-
Version: 0.3.
|
8
|
+
Version: 0.3.11
|
9
9
|
Release: 1%{?dist}
|
10
10
|
Group: Development/Languages
|
11
11
|
License: LGPLv3+
|
@@ -76,7 +76,12 @@ popd
|
|
76
76
|
%{gemdir}/doc/%{gemname}-%{version}
|
77
77
|
|
78
78
|
%changelog
|
79
|
-
*
|
79
|
+
* Wed Feb 29 2012 Marc Savy <msavy@redhat.com> - 0.3.11
|
80
|
+
- Upstream release: 0.3.11
|
81
|
+
- [BGBUILD-346] Confirm Ruby 1.9.3 support
|
82
|
+
- [BGBUILD-348] Simplecov coverage testing for Ruby >=1.9
|
83
|
+
|
84
|
+
* Thu Dec 1 2011 Marc Savy <msavy@redhat.com> - 0.3.10
|
80
85
|
- Upstream release: 0.3.10
|
81
86
|
- [BGBUILD-324] Add wildcard to packages schema
|
82
87
|
- [BGBUILD-320] Support variable substitution in any string value field of appliance definition
|
@@ -16,8 +16,6 @@
|
|
16
16
|
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
17
17
|
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
18
18
|
|
19
|
-
require 'rubygems'
|
20
|
-
require 'rspec'
|
21
19
|
require 'boxgrinder-core/appliance-parser'
|
22
20
|
require 'boxgrinder-core/helpers/log-helper'
|
23
21
|
|
@@ -53,16 +51,16 @@ module BoxGrinder
|
|
53
51
|
@parser.load_schemas
|
54
52
|
definition = @parser.parse_definition(File.read("#{File.dirname(__FILE__)}/rspec/src/appliances/0.9.x.appl"), false)
|
55
53
|
|
56
|
-
definition
|
57
|
-
definition
|
54
|
+
definition.os.password.should == 'boxgrinder-ftw'
|
55
|
+
definition.packages.size.should == 2
|
58
56
|
end
|
59
57
|
|
60
58
|
it "should validate 0.8.0 version definition without error" do
|
61
59
|
@parser.load_schemas
|
62
60
|
definition = @parser.parse_definition("#{File.dirname(__FILE__)}/rspec/src/appliances/0.8.x.appl")
|
63
61
|
|
64
|
-
definition
|
65
|
-
definition
|
62
|
+
definition.os.password.should == 'boxgrinder-ftw'
|
63
|
+
definition.packages.size.should == 3
|
66
64
|
end
|
67
65
|
end
|
68
66
|
|
@@ -74,6 +72,7 @@ module BoxGrinder
|
|
74
72
|
schema = schemas[schemas.keys.first]
|
75
73
|
schema.delete('version')
|
76
74
|
parsed, errors = @parser.parse(schema, definition)
|
75
|
+
|
77
76
|
parsed['repos'].first['baseurl'].should == 'http://repo.boxgrinder.org/packages/#OS_NAME#/#OS_VERSION#/RPMS/#ARCH#'
|
78
77
|
end
|
79
78
|
end
|
@@ -16,8 +16,6 @@
|
|
16
16
|
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
17
17
|
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
18
18
|
|
19
|
-
require 'rubygems'
|
20
|
-
require 'rspec'
|
21
19
|
require 'boxgrinder-core/appliance-validator'
|
22
20
|
require 'hashery/opencascade'
|
23
21
|
|
@@ -16,8 +16,6 @@
|
|
16
16
|
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
17
17
|
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
18
18
|
|
19
|
-
require 'rubygems'
|
20
|
-
require 'rspec'
|
21
19
|
require 'boxgrinder-core/helpers/appliance-config-helper'
|
22
20
|
require 'boxgrinder-core/models/appliance-config'
|
23
21
|
|
@@ -16,8 +16,6 @@
|
|
16
16
|
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
17
17
|
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
18
18
|
|
19
|
-
require 'rubygems'
|
20
|
-
require 'rspec'
|
21
19
|
require 'boxgrinder-core/helpers/appliance-definition-helper'
|
22
20
|
require 'boxgrinder-core/appliance-parser'
|
23
21
|
|
@@ -242,24 +240,5 @@ module BoxGrinder
|
|
242
240
|
end
|
243
241
|
end
|
244
242
|
end
|
245
|
-
|
246
|
-
describe ".parse_yaml" do
|
247
|
-
context "partitions" do
|
248
|
-
it "should add default partition when no partitions are specified" do
|
249
|
-
appliance_config = @helper.parse_yaml({})
|
250
|
-
appliance_config.hardware.partitions.size.should == 1
|
251
|
-
appliance_config.hardware.partitions['/'].should == {'size' => 1}
|
252
|
-
end
|
253
|
-
|
254
|
-
it "should merge partitions with the default one specified in appliance config" do
|
255
|
-
appliance_config = @helper.parse_yaml({'hardware' => {'partitions' => {'/home' => {'size' => 1}}}})
|
256
|
-
|
257
|
-
appliance_config.hardware.partitions.size.should == 2
|
258
|
-
appliance_config.hardware.partitions['/'].should == {'size' => 1}
|
259
|
-
appliance_config.hardware.partitions['/home'].should == {'size' => 1}
|
260
|
-
end
|
261
|
-
|
262
|
-
end
|
263
|
-
end
|
264
243
|
end
|
265
244
|
end
|
@@ -16,8 +16,6 @@
|
|
16
16
|
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
17
17
|
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
18
18
|
|
19
|
-
require 'rubygems'
|
20
|
-
require 'rspec'
|
21
19
|
require 'boxgrinder-core/helpers/appliance-transformation-helper'
|
22
20
|
|
23
21
|
module BoxGrinder
|
data/spec/models/config-spec.rb
CHANGED
@@ -16,8 +16,6 @@
|
|
16
16
|
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
17
17
|
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
18
18
|
|
19
|
-
require 'rubygems'
|
20
|
-
require 'rspec'
|
21
19
|
require 'boxgrinder-core/models/config'
|
22
20
|
|
23
21
|
module BoxGrinder
|
@@ -88,7 +86,6 @@ module BoxGrinder
|
|
88
86
|
|
89
87
|
it "should discover a user and group when under su" do
|
90
88
|
ENV['LOGNAME'] = 'gravy1'
|
91
|
-
['SUDO_USER', 'LOGNAME'].each{|v| puts "From config-spec.rb: #{ENV[v]}"}
|
92
89
|
|
93
90
|
Process.should_receive(:uid).and_return(99)
|
94
91
|
Process.should_receive(:gid).and_return(79)
|
data/spec/rcov_helper.rb
ADDED
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: boxgrinder-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 11
|
10
|
+
version: 0.3.11
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Marek Goldmann
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2012-03-19 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: hashery
|
@@ -78,6 +78,7 @@ extra_rdoc_files:
|
|
78
78
|
- lib/boxgrinder-core.rb
|
79
79
|
- lib/boxgrinder-core/appliance-parser.rb
|
80
80
|
- lib/boxgrinder-core/appliance-validator.rb
|
81
|
+
- lib/boxgrinder-core/compat/yaml19.rb
|
81
82
|
- lib/boxgrinder-core/errors.rb
|
82
83
|
- lib/boxgrinder-core/helpers/appliance-config-helper.rb
|
83
84
|
- lib/boxgrinder-core/helpers/appliance-definition-helper.rb
|
@@ -100,6 +101,7 @@ files:
|
|
100
101
|
- lib/boxgrinder-core.rb
|
101
102
|
- lib/boxgrinder-core/appliance-parser.rb
|
102
103
|
- lib/boxgrinder-core/appliance-validator.rb
|
104
|
+
- lib/boxgrinder-core/compat/yaml19.rb
|
103
105
|
- lib/boxgrinder-core/errors.rb
|
104
106
|
- lib/boxgrinder-core/helpers/appliance-config-helper.rb
|
105
107
|
- lib/boxgrinder-core/helpers/appliance-definition-helper.rb
|
@@ -122,6 +124,7 @@ files:
|
|
122
124
|
- spec/helpers/log-helper-spec.rb
|
123
125
|
- spec/models/appliance-config-spec.rb
|
124
126
|
- spec/models/config-spec.rb
|
127
|
+
- spec/rcov_helper.rb
|
125
128
|
- spec/rspec/ls/one
|
126
129
|
- spec/rspec/ls/two
|
127
130
|
- spec/rspec/src/appliances/0.8.x.appl
|
@@ -135,6 +138,7 @@ files:
|
|
135
138
|
- spec/rspec/src/appliances/repo.appl
|
136
139
|
- spec/rspec/src/config/empty
|
137
140
|
- spec/rspec/src/config/valid
|
141
|
+
- spec/spec_helper.rb
|
138
142
|
homepage: http://boxgrinder.org
|
139
143
|
licenses: []
|
140
144
|
|