boxgrinder-core 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ v0.2.1
2
+
3
+ * [BGBUILD-142] Backtraces make output unreadable - add option to enable them, and disable by default
4
+ * [BGBUILD-150] Cyclical inclusion dependencies in appliance definition files are not detected/handled
5
+
1
6
  v0.2.0
2
7
 
3
8
  * [BGBUILD-133] Support a consolidated configuration file
data/Manifest CHANGED
@@ -1,32 +0,0 @@
1
- CHANGELOG
2
- LICENSE
3
- Manifest
4
- README
5
- Rakefile
6
- boxgrinder-core.gemspec
7
- lib/boxgrinder-core.rb
8
- lib/boxgrinder-core/helpers/appliance-config-helper.rb
9
- lib/boxgrinder-core/helpers/appliance-helper.rb
10
- lib/boxgrinder-core/helpers/exec-helper.rb
11
- lib/boxgrinder-core/helpers/log-helper.rb
12
- lib/boxgrinder-core/models/appliance-config.rb
13
- lib/boxgrinder-core/models/config.rb
14
- lib/boxgrinder-core/models/task.rb
15
- lib/boxgrinder-core/validators/appliance-config-validator.rb
16
- lib/boxgrinder-core/validators/errors.rb
17
- rubygem-boxgrinder-core.spec
18
- spec/helpers/appliance-config-helper-spec.rb
19
- spec/helpers/appliance-helper-spec.rb
20
- spec/helpers/exec-helper-spec.rb
21
- spec/helpers/log-helper-spec.rb
22
- spec/models/config-spec.rb
23
- spec/rspec/ls/one
24
- spec/rspec/ls/two
25
- spec/rspec/rspec-config-helper.rb
26
- spec/rspec/src/appliances/ephemeral-repo.appl
27
- spec/rspec/src/appliances/full.appl
28
- spec/rspec/src/appliances/invalid_yaml.appl
29
- spec/rspec/src/appliances/repo.appl
30
- spec/rspec/src/config/empty
31
- spec/rspec/src/config/valid
32
- spec/validators/appliance-config-validator-spec.rb
data/README CHANGED
@@ -2,8 +2,8 @@ This gem contains core classes used across BoxGrinder projects.
2
2
 
3
3
  Project home page
4
4
 
5
- http://www.jboss.org/boxgrinder
5
+ http://boxgrinder.org/
6
6
 
7
7
  Project documentation
8
8
 
9
- http://community.jboss.org/docs/DOC-14358
9
+ http://boxgrinder.org/tutorials/
@@ -2,15 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{boxgrinder-core}
5
- s.version = "0.2.0"
5
+ s.version = "0.2.1"
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 = %q{2011-02-09}
9
+ s.date = %q{2011-02-22}
10
10
  s.description = %q{Core library for BoxGrinder}
11
11
  s.email = %q{info@boxgrinder.org}
12
- s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README", "lib/boxgrinder-core.rb", "lib/boxgrinder-core/helpers/appliance-config-helper.rb", "lib/boxgrinder-core/helpers/appliance-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/validators/appliance-config-validator.rb", "lib/boxgrinder-core/validators/errors.rb"]
13
- s.files = ["CHANGELOG", "LICENSE", "Manifest", "README", "Rakefile", "boxgrinder-core.gemspec", "lib/boxgrinder-core.rb", "lib/boxgrinder-core/helpers/appliance-config-helper.rb", "lib/boxgrinder-core/helpers/appliance-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/validators/appliance-config-validator.rb", "lib/boxgrinder-core/validators/errors.rb", "rubygem-boxgrinder-core.spec", "spec/helpers/appliance-config-helper-spec.rb", "spec/helpers/appliance-helper-spec.rb", "spec/helpers/exec-helper-spec.rb", "spec/helpers/log-helper-spec.rb", "spec/models/config-spec.rb", "spec/rspec/ls/one", "spec/rspec/ls/two", "spec/rspec/rspec-config-helper.rb", "spec/rspec/src/appliances/ephemeral-repo.appl", "spec/rspec/src/appliances/full.appl", "spec/rspec/src/appliances/invalid_yaml.appl", "spec/rspec/src/appliances/repo.appl", "spec/rspec/src/config/empty", "spec/rspec/src/config/valid", "spec/validators/appliance-config-validator-spec.rb"]
12
+ s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README", "lib/boxgrinder-core.rb", "lib/boxgrinder-core/helpers/appliance-config-helper.rb", "lib/boxgrinder-core/helpers/appliance-definition-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/validators/appliance-config-validator.rb", "lib/boxgrinder-core/validators/errors.rb"]
13
+ s.files = ["CHANGELOG", "LICENSE", "Manifest", "README", "Rakefile", "boxgrinder-core.gemspec", "lib/boxgrinder-core.rb", "lib/boxgrinder-core/helpers/appliance-config-helper.rb", "lib/boxgrinder-core/helpers/appliance-definition-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/validators/appliance-config-validator.rb", "lib/boxgrinder-core/validators/errors.rb", "rubygem-boxgrinder-core.spec", "spec/helpers/appliance-config-helper-spec.rb", "spec/helpers/appliance-definition-helper-spec.rb", "spec/helpers/exec-helper-spec.rb", "spec/helpers/log-helper-spec.rb", "spec/models/config-spec.rb", "spec/rspec/ls/one", "spec/rspec/ls/two", "spec/rspec/src/appliances/ephemeral-repo.appl", "spec/rspec/src/appliances/full.appl", "spec/rspec/src/appliances/invalid_yaml.appl", "spec/rspec/src/appliances/repo.appl", "spec/rspec/src/config/empty", "spec/rspec/src/config/valid", "spec/validators/appliance-config-validator-spec.rb"]
14
14
  s.homepage = %q{http://www.jboss.org/boxgrinder}
15
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Boxgrinder-core", "--main", "README"]
16
16
  s.require_paths = ["lib"]
@@ -20,17 +20,18 @@ require 'boxgrinder-core/models/appliance-config'
20
20
  require 'yaml'
21
21
 
22
22
  module BoxGrinder
23
- class ApplianceHelper
23
+ class ApplianceDefinitionHelper
24
24
  def initialize(options = {})
25
25
  @log = options[:log] || Logger.new(STDOUT)
26
+ @appliance_configs = []
26
27
  end
27
28
 
29
+ attr_reader :appliance_configs
30
+
28
31
  # Reads definition provided as string. This string can be a YAML document. In this case
29
32
  # definition is parsed and an ApplianceConfig object is returned. In other cases it tries to search
30
33
  # for a file with provided name.
31
34
  def read_definitions(definition, content_type = nil)
32
- configs = []
33
-
34
35
  if File.exists?(definition)
35
36
  @log.debug "Reading definition from '#{definition}' file..."
36
37
 
@@ -55,19 +56,19 @@ module BoxGrinder
55
56
 
56
57
  raise 'Unsupported file format for appliance definition file.' if appliance_config.nil?
57
58
 
58
- configs << appliance_config
59
+ @appliance_configs << appliance_config
60
+ appliances = []
61
+
62
+ @appliance_configs.each { |config| appliances << config.name }
59
63
 
60
64
  appliance_config.appliances.reverse.each do |appliance_name|
61
- configs << read_definitions("#{File.dirname(definition)}/#{appliance_name}#{definition_file_extension}").first
65
+ read_definitions("#{File.dirname(definition)}/#{appliance_name}#{definition_file_extension}") unless appliances.include?(appliance_name)
62
66
  end unless appliance_config.appliances.nil? or !appliance_config.appliances.is_a?(Array)
63
67
  else
64
68
  @log.debug "Reading definition..."
65
69
 
66
- appliance_config = read_yaml(definition)
67
- configs << appliance_config
70
+ @appliance_configs << read_yaml(definition)
68
71
  end
69
-
70
- [configs.flatten, appliance_config]
71
72
  end
72
73
 
73
74
  def read_yaml(content)
@@ -104,7 +105,9 @@ module BoxGrinder
104
105
 
105
106
  definition['variables'].each { |key, value| appliance_config.variables[key] = value } unless definition['variables'].nil?
106
107
 
107
- appliance_config.packages = definition['packages'] unless definition['packages'].nil?
108
+ raise "packages section should be an Array" if !definition['packages'].nil? and !definition['packages'].is_a?(Array)
109
+
110
+ appliance_config.packages = definition['packages'] if definition['packages'].is_a?(Array)
108
111
  appliance_config.appliances = definition['appliances'] unless definition['appliances'].nil?
109
112
  appliance_config.repos = definition['repos'] unless definition['repos'].nil?
110
113
 
@@ -32,7 +32,8 @@ module BoxGrinder
32
32
  output = ""
33
33
 
34
34
  # dirty workaround for ruby segfaults related to logger.rb
35
- STDOUT.flush
35
+ STDOUT.sync = true
36
+ STDERR.sync = true
36
37
 
37
38
  begin
38
39
  status = Open4::popen4( command ) do |pid, stdin, stdout, stderr|
@@ -32,6 +32,7 @@ module BoxGrinder
32
32
  :delivery => :none,
33
33
  :force => false,
34
34
  :log_level => :info,
35
+ :backtrace => false,
35
36
  :dir => {
36
37
  :root => Dir.pwd,
37
38
  :build => 'build',
@@ -5,11 +5,11 @@
5
5
 
6
6
  Summary: Core library for BoxGrinder
7
7
  Name: rubygem-%{gemname}
8
- Version: 0.2.0
8
+ Version: 0.2.1
9
9
  Release: 1%{?dist}
10
10
  Group: Development/Languages
11
11
  License: LGPLv3+
12
- URL: http://www.jboss.org/boxgrinder
12
+ URL: http://boxgrinder.org/
13
13
  Source0: http://rubygems.org/gems/%{gemname}-%{version}.gem
14
14
  BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
15
15
 
@@ -74,6 +74,11 @@ popd
74
74
  %{gemdir}/doc/%{gemname}-%{version}
75
75
 
76
76
  %changelog
77
+ * Tue Feb 16 2011 <mgoldman@redhat.com> - 0.2.1-1
78
+ - Upstream release: 0.2.1
79
+ - [BGBUILD-142] Backtraces make output unreadable - add option to enable them, and disable by default
80
+ - [BGBUILD-150] Cyclical inclusion dependencies in appliance definition files are not detected/handled
81
+
77
82
  * Tue Jan 04 2011 <mgoldman@redhat.com> - 0.2.0-1
78
83
  - Upstream release: 0.2.0
79
84
  - Added BuildRoot tag to build for EPEL 5
@@ -16,13 +16,13 @@
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 'boxgrinder-core/helpers/appliance-helper'
19
+ require 'boxgrinder-core/helpers/appliance-definition-helper'
20
20
 
21
21
  module BoxGrinder
22
- describe ApplianceHelper do
22
+ describe ApplianceDefinitionHelper do
23
23
 
24
24
  before(:each) do
25
- @helper = ApplianceHelper.new(:log => Logger.new('/dev/null'))
25
+ @helper = ApplianceDefinitionHelper.new(:log => Logger.new('/dev/null'))
26
26
  end
27
27
 
28
28
  describe ".read_definitions" do
@@ -30,9 +30,13 @@ module BoxGrinder
30
30
  appliance_config = ApplianceConfig.new
31
31
 
32
32
  ['appl', 'yml', 'yaml'].each do |ext|
33
+ @helper = ApplianceDefinitionHelper.new(:log => Logger.new('/dev/null'))
33
34
  File.should_receive(:exists?).with("file.#{ext}").and_return(true)
34
35
  @helper.should_receive(:read_yaml_file).with("file.#{ext}").and_return(appliance_config)
35
- @helper.read_definitions("file.#{ext}").should == [[appliance_config], appliance_config]
36
+ @helper.read_definitions("file.#{ext}")
37
+
38
+ configs = @helper.appliance_configs
39
+ configs.should == [appliance_config]
36
40
  end
37
41
  end
38
42
 
@@ -40,9 +44,14 @@ module BoxGrinder
40
44
  appliance_config = ApplianceConfig.new
41
45
 
42
46
  ['application/x-yaml', 'text/yaml'].each do |type|
47
+ @helper = ApplianceDefinitionHelper.new(:log => Logger.new('/dev/null'))
43
48
  File.should_receive(:exists?).with("file").and_return(true)
44
49
  @helper.should_receive(:read_yaml_file).with("file").and_return(appliance_config)
45
- @helper.read_definitions("file", type).should == [[appliance_config], appliance_config]
50
+ @helper.read_definitions("file", type)
51
+
52
+ configs = @helper.appliance_configs
53
+ configs.should == [appliance_config]
54
+ configs.first.should == appliance_config
46
55
  end
47
56
  end
48
57
 
@@ -50,9 +59,14 @@ module BoxGrinder
50
59
  appliance_config = ApplianceConfig.new
51
60
 
52
61
  ['application/xml', 'text/xml', 'application/x-xml'].each do |type|
62
+ @helper = ApplianceDefinitionHelper.new(:log => Logger.new('/dev/null'))
53
63
  File.should_receive(:exists?).with("file").and_return(true)
54
64
  @helper.should_receive(:read_xml_file).with("file").and_return(appliance_config)
55
- @helper.read_definitions("file", type).should == [[appliance_config], appliance_config]
65
+ @helper.read_definitions("file", type)
66
+
67
+ configs = @helper.appliance_configs
68
+ configs.should == [appliance_config]
69
+ configs.first.should == appliance_config
56
70
  end
57
71
  end
58
72
 
@@ -70,7 +84,11 @@ module BoxGrinder
70
84
  @helper.should_receive(:read_yaml_file).ordered.with('a.appl').and_return(appliance_a)
71
85
  @helper.should_receive(:read_yaml_file).ordered.with('./b.appl').and_return(appliance_b)
72
86
 
73
- @helper.read_definitions("a.appl").should == [[appliance_a, appliance_b], appliance_a]
87
+ @helper.read_definitions("a.appl")
88
+
89
+ configs = @helper.appliance_configs
90
+ configs.should == [appliance_a, appliance_b]
91
+ configs.first.should == appliance_a
74
92
  end
75
93
 
76
94
  it "should read definitions from a tree file structure" do
@@ -105,7 +123,11 @@ module BoxGrinder
105
123
  @helper.should_receive(:read_yaml_file).ordered.with('./b1.appl').and_return(appliance_b1)
106
124
  @helper.should_receive(:read_yaml_file).ordered.with('./c1.appl').and_return(appliance_c1)
107
125
 
108
- @helper.read_definitions("a.appl").should == [[appliance_a, appliance_b2, appliance_c2, appliance_b1, appliance_c1], appliance_a]
126
+ @helper.read_definitions("a.appl")
127
+
128
+ configs = @helper.appliance_configs
129
+ configs.should == [appliance_a, appliance_b2, appliance_c2, appliance_b1, appliance_c1]
130
+ configs.first.should == appliance_a
109
131
  end
110
132
 
111
133
  # https://issues.jboss.org/browse/BGBUILD-60
@@ -130,15 +152,18 @@ module BoxGrinder
130
152
  File.should_receive(:exists?).ordered.with('./b2.appl').and_return(true)
131
153
  File.should_receive(:exists?).ordered.with('./c.appl').and_return(true)
132
154
  File.should_receive(:exists?).ordered.with('./b1.appl').and_return(true)
133
- File.should_receive(:exists?).ordered.with('./c.appl').and_return(true)
134
155
 
135
156
  @helper.should_receive(:read_yaml_file).ordered.with('a.appl').and_return(appliance_a)
136
157
  @helper.should_receive(:read_yaml_file).ordered.with('./b2.appl').and_return(appliance_b2)
137
158
  @helper.should_receive(:read_yaml_file).ordered.with('./c.appl').and_return(appliance_c)
138
159
  @helper.should_receive(:read_yaml_file).ordered.with('./b1.appl').and_return(appliance_b1)
139
- @helper.should_receive(:read_yaml_file).ordered.with('./c.appl').and_return(appliance_c)
160
+ @helper.should_not_receive(:read_yaml_file).ordered.with('./c.appl').and_return(appliance_c)
161
+
162
+ @helper.read_definitions("a.appl")
140
163
 
141
- @helper.read_definitions("a.appl").should == [[appliance_a, appliance_b2, appliance_c, appliance_b1, appliance_c], appliance_a]
164
+ configs = @helper.appliance_configs
165
+ configs.should == [appliance_a, appliance_b2, appliance_c, appliance_b1]
166
+ configs.first.should == appliance_a
142
167
  end
143
168
 
144
169
  it "should read a YAML content instead of a loading a file" do
@@ -171,6 +196,30 @@ module BoxGrinder
171
196
  File.should_receive(:exists?).with("file.xmdfl").and_return(true)
172
197
  lambda { @helper.read_definitions("file.xmdfl") }.should raise_error(RuntimeError, "Unsupported file format for appliance definition file.")
173
198
  end
199
+
200
+ # https://issues.jboss.org/browse/BGBUILD-150
201
+ context "cyclical dependency" do
202
+ it "should stop reading appliances when appliance was already read" do
203
+ appliance_a = ApplianceConfig.new
204
+ appliance_a.name = 'a'
205
+ appliance_a.appliances << "b"
206
+
207
+ appliance_b = ApplianceConfig.new
208
+ appliance_b.name = 'b'
209
+ appliance_b.appliances << "a"
210
+
211
+
212
+ File.should_receive(:exists?).with('a.appl').and_return(true)
213
+ File.should_receive(:exists?).with('./b.appl').and_return(true)
214
+ File.should_not_receive(:exists?).ordered.with('./a.appl')
215
+
216
+ @helper.should_receive(:read_yaml_file).ordered.with('a.appl').and_return(appliance_a)
217
+ @helper.should_receive(:read_yaml_file).ordered.with('./b.appl').and_return(appliance_b)
218
+ @helper.should_not_receive(:read_yaml_file).ordered.with('./a.appl')
219
+
220
+ @helper.read_definitions("a.appl")
221
+ end
222
+ end
174
223
  end
175
224
 
176
225
  describe "read_yaml_file" do
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: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
9
+ - 1
10
+ version: 0.2.1
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: 2011-02-09 00:00:00 +01:00
18
+ date: 2011-02-22 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -62,7 +62,7 @@ extra_rdoc_files:
62
62
  - README
63
63
  - lib/boxgrinder-core.rb
64
64
  - lib/boxgrinder-core/helpers/appliance-config-helper.rb
65
- - lib/boxgrinder-core/helpers/appliance-helper.rb
65
+ - lib/boxgrinder-core/helpers/appliance-definition-helper.rb
66
66
  - lib/boxgrinder-core/helpers/exec-helper.rb
67
67
  - lib/boxgrinder-core/helpers/log-helper.rb
68
68
  - lib/boxgrinder-core/models/appliance-config.rb
@@ -79,7 +79,7 @@ files:
79
79
  - boxgrinder-core.gemspec
80
80
  - lib/boxgrinder-core.rb
81
81
  - lib/boxgrinder-core/helpers/appliance-config-helper.rb
82
- - lib/boxgrinder-core/helpers/appliance-helper.rb
82
+ - lib/boxgrinder-core/helpers/appliance-definition-helper.rb
83
83
  - lib/boxgrinder-core/helpers/exec-helper.rb
84
84
  - lib/boxgrinder-core/helpers/log-helper.rb
85
85
  - lib/boxgrinder-core/models/appliance-config.rb
@@ -89,13 +89,12 @@ files:
89
89
  - lib/boxgrinder-core/validators/errors.rb
90
90
  - rubygem-boxgrinder-core.spec
91
91
  - spec/helpers/appliance-config-helper-spec.rb
92
- - spec/helpers/appliance-helper-spec.rb
92
+ - spec/helpers/appliance-definition-helper-spec.rb
93
93
  - spec/helpers/exec-helper-spec.rb
94
94
  - spec/helpers/log-helper-spec.rb
95
95
  - spec/models/config-spec.rb
96
96
  - spec/rspec/ls/one
97
97
  - spec/rspec/ls/two
98
- - spec/rspec/rspec-config-helper.rb
99
98
  - spec/rspec/src/appliances/ephemeral-repo.appl
100
99
  - spec/rspec/src/appliances/full.appl
101
100
  - spec/rspec/src/appliances/invalid_yaml.appl
@@ -1,77 +0,0 @@
1
- #
2
- # Copyright 2010 Red Hat, Inc.
3
- #
4
- # This is free software; you can redistribute it and/or modify it
5
- # under the terms of the GNU Lesser General Public License as
6
- # published by the Free Software Foundation; either version 3 of
7
- # the License, or (at your option) any later version.
8
- #
9
- # This software is distributed in the hope that it will be useful,
10
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
- # Lesser General Public License for more details.
13
- #
14
- # You should have received a copy of the GNU Lesser General Public
15
- # License along with this software; if not, write to the Free
16
- # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17
- # 02110-1301 USA, or see the FSF site: http://www.fsf.org.
18
-
19
- require 'boxgrinder-core/models/config'
20
- require 'boxgrinder-core/models/appliance-config'
21
- require 'boxgrinder-core/helpers/appliance-config-helper'
22
- require 'boxgrinder-core/helpers/appliance-helper'
23
- require 'logger'
24
-
25
- Logger.const_set(:TRACE, 0)
26
- Logger.const_set(:DEBUG, 1)
27
- Logger.const_set(:INFO, 2)
28
- Logger.const_set(:WARN, 3)
29
- Logger.const_set(:ERROR, 4)
30
- Logger.const_set(:FATAL, 5)
31
- Logger.const_set(:UNKNOWN, 6)
32
-
33
- Logger::SEV_LABEL.insert(0, 'TRACE')
34
-
35
- class Logger
36
- def trace?
37
- @level <= TRACE
38
- end
39
-
40
- def trace(progname = nil, &block)
41
- add(TRACE, nil, progname, &block)
42
- end
43
- end
44
-
45
- module RSpecConfigHelper
46
- RSPEC_BASE_LOCATION = "#{File.dirname(__FILE__)}"
47
-
48
- def generate_config( params = OpenStruct.new )
49
- config = BoxGrinder::Config.new
50
-
51
- # files
52
- config.files.base_vmdk = params.base_vmdk || "../../../src/base.vmdk"
53
- config.files.base_vmx = params.base_vmx || "../../../src/base.vmx"
54
-
55
- config
56
- end
57
-
58
- def generate_appliance_config( appliance_definition_file = "#{RSPEC_BASE_LOCATION}/src/appliances/full.appl" )
59
- appliance_configs, appliance_config = BoxGrinder::ApplianceHelper.new(:log => Logger.new('/dev/null')).read_definitions( appliance_definition_file )
60
- appliance_config_helper = BoxGrinder::ApplianceConfigHelper.new( appliance_configs )
61
-
62
- appliance_config_helper.merge(appliance_config.clone.init_arch).initialize_paths
63
- end
64
-
65
- def generate_appliance_config_gnome( os_version = "11" )
66
- appliance_config = BoxGrinder::ApplianceConfig.new("valid-appliance-gnome", (-1.size) == 8 ? "x86_64" : "i386", "fedora", os_version)
67
-
68
- appliance_config.disk_size = 2
69
- appliance_config.summary = "this is a summary"
70
- appliance_config.network_name = "NAT"
71
- appliance_config.vcpu = "1"
72
- appliance_config.mem_size = "1024"
73
- appliance_config.appliances = [ appliance_config.name ]
74
-
75
- appliance_config
76
- end
77
- end