boxgrinder-core 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ v0.3.3
2
+
3
+ * [BGBUILD-233] BoxGrinder Build fails to report a missing config file
4
+
1
5
  v0.3.2
2
6
 
3
7
  * [BGBUILD-210] In Fedora 14 parameters are not being expanded, and cause early string truncation.
data/Manifest CHANGED
@@ -0,0 +1,29 @@
1
+ CHANGELOG
2
+ LICENSE
3
+ Manifest
4
+ README
5
+ Rakefile
6
+ boxgrinder-core.gemspec
7
+ lib/boxgrinder-core.rb
8
+ lib/boxgrinder-core/appliance-parser.rb
9
+ lib/boxgrinder-core/appliance-validator.rb
10
+ lib/boxgrinder-core/errors.rb
11
+ lib/boxgrinder-core/helpers/appliance-config-helper.rb
12
+ lib/boxgrinder-core/helpers/appliance-definition-helper.rb
13
+ lib/boxgrinder-core/helpers/appliance-transformation-helper.rb
14
+ lib/boxgrinder-core/helpers/exec-helper.rb
15
+ lib/boxgrinder-core/helpers/log-helper.rb
16
+ lib/boxgrinder-core/models/appliance-config.rb
17
+ lib/boxgrinder-core/models/config.rb
18
+ lib/boxgrinder-core/models/task.rb
19
+ lib/boxgrinder-core/schemas/appliance_schema_0.8.0.yaml
20
+ lib/boxgrinder-core/schemas/appliance_schema_0.9.0.yaml
21
+ rubygem-boxgrinder-core.spec
22
+ spec/appliance-parser-spec.rb
23
+ spec/appliance-validator-spec.rb
24
+ spec/helpers/appliance-config-helper-spec.rb
25
+ spec/helpers/appliance-definition-helper-spec.rb
26
+ spec/helpers/appliance-transformation-helper-spec.rb
27
+ spec/helpers/exec-helper-spec.rb
28
+ spec/helpers/log-helper-spec.rb
29
+ spec/models/config-spec.
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{boxgrinder-core}
5
- s.version = "0.3.2"
5
+ s.version = "0.3.3"
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-05-17}
9
+ s.date = %q{2011-06-28}
10
10
  s.description = %q{Core library for BoxGrinder}
11
11
  s.email = %q{info@boxgrinder.org}
12
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"]
@@ -131,7 +131,7 @@ module BoxGrinder
131
131
  end
132
132
 
133
133
  # https://bugzilla.redhat.com/show_bug.cgi?id=466275
134
- partitions['/boot'] = {'type' => 'ext3', 'size' => 0.1} if partitions['/boot'].nil? and (@appliance_config.os.name == 'centos' or @appliance_config.os.name == 'rhel') and @appliance_config.os.version == '5'
134
+ partitions['/boot'] = {'type' => 'ext3', 'size' => 0.1} if partitions['/boot'].nil? and (@appliance_config.os.name == 'sl' or @appliance_config.os.name == 'centos' or @appliance_config.os.name == 'rhel') and @appliance_config.os.version == '5'
135
135
 
136
136
  @appliance_config.hardware.partitions = partitions
137
137
  end
@@ -93,13 +93,15 @@ module BoxGrinder
93
93
  def default_filesystem_type
94
94
  fs = 'ext4'
95
95
 
96
- case @os.name
97
- when 'rhel', 'centos'
98
- case @os.version
99
- when '5'
100
- fs = 'ext3'
101
- end
102
- end
96
+ # Since RHEL 5.6 the default filesystem is ext4
97
+ #
98
+ # case @os.name
99
+ # when 'rhel', 'centos'
100
+ # case @os.version
101
+ # when '5'
102
+ # fs = 'ext3'
103
+ # end
104
+ # end
103
105
 
104
106
  fs
105
107
  end
@@ -45,12 +45,25 @@ module BoxGrinder
45
45
  :additional_plugins => []
46
46
  )
47
47
 
48
- deep_merge(self, YAML.load_file(self.file)) if File.exists?(self.file)
49
- merge!(values.inject({}) { |memo, (k, v)| memo[k.to_sym] = v; memo })
48
+ if ENV['BG_CONFIG_FILE']
49
+ raise "You specified empty configuration file path. Please make sure you set correct path for BG_CONFIG_FILE environment variable." if ENV['BG_CONFIG_FILE'].strip.empty?
50
+ raise "Configuration file '#{ENV['BG_CONFIG_FILE']}' couldn't be found. Please make sure you set correct path for BG_CONFIG_FILE environment variable." unless File.exists?(ENV['BG_CONFIG_FILE'])
51
+ end
52
+
53
+ deep_merge!(YAML.load_file(self.file)) if File.exists?(self.file)
54
+ merge_with_symbols!(values)
50
55
 
51
56
  self.backtrace = true if [:debug, :trace].include?(self.log_level)
52
57
  end
53
58
 
59
+ def merge_with_symbols!(values)
60
+ merge!(values.inject({}) { |memo, (k, v)| memo[k.to_sym] = v; memo })
61
+ end
62
+
63
+ def deep_merge!(h)
64
+ deep_merge(self, h)
65
+ end
66
+
54
67
  def deep_merge(first, second)
55
68
  second.each_key do |k|
56
69
  if first[k.to_sym].is_a?(Hash) and second[k].is_a?(Hash)
@@ -59,8 +59,8 @@ mapping:
59
59
  "includes": &pkg
60
60
  type: seq
61
61
  sequence:
62
- - type: str
63
- pattern: /^[\w\-+.@\043]+$/ #fedora packaging standard http://bit.ly/h0JN9u (plus a few more, disallow symbols/spaces)
62
+ - type: str # Now allowing spaces due to group labels (these map to real groups with no spaces, but confuses users) https://issues.jboss.org/browse/BGBUILD-220
63
+ pattern: /^[\w\-+.@#\s]+$/ #fedora packaging standard http://bit.ly/h0JN9u (plus a few more, disallow symbols)
64
64
  length: { min: 1 }
65
65
  "excludes": *pkg
66
66
  "repos":
@@ -56,8 +56,8 @@ mapping:
56
56
  "packages":
57
57
  type: seq
58
58
  sequence:
59
- - type: str
60
- pattern: /^[\w\-+.@#]+$/ #fedora packaging standard http://bit.ly/h0JN9u (plus a few more, disallow symbols/spaces)
59
+ - type: str # Now allowing spaces due to group labels (these map to real groups with no spaces, but confuses users) https://issues.jboss.org/browse/BGBUILD-220
60
+ pattern: /^[\w\-+.@#\s]+$/ #fedora packaging standard http://bit.ly/h0JN9u (plus a few more, disallow symbols)
61
61
  length: { min: 1 }
62
62
  "repos":
63
63
  type: seq
@@ -5,7 +5,7 @@
5
5
 
6
6
  Summary: Core library for BoxGrinder
7
7
  Name: rubygem-%{gemname}
8
- Version: 0.3.2
8
+ Version: 0.3.3
9
9
  Release: 1%{?dist}
10
10
  Group: Development/Languages
11
11
  License: LGPLv3+
@@ -76,6 +76,12 @@ popd
76
76
  %{gemdir}/doc/%{gemname}-%{version}
77
77
 
78
78
  %changelog
79
+
80
+ * Tue Jun 14 2011 Marc Savy <msavy@redhat.com> - 0.3.3-1
81
+ - Upstream release: 0.3.3
82
+ - [BGBUILD-233] BoxGrinder Build fails to report a missing config file
83
+
84
+
79
85
  * Tue May 10 2011 Marek Goldmann <mgoldman@redhat.com> - 0.3.2-1
80
86
  - Upstream release: 0.3.2
81
87
  - [BGBUILD-210] In Fedora 14 parameters are not being expanded, and cause early string truncation.
@@ -21,11 +21,12 @@ require 'boxgrinder-core/models/config'
21
21
 
22
22
  module BoxGrinder
23
23
  describe Config do
24
- it "should not load options from file if it doesn't exists" do
25
- ENV['BG_CONFIG_FILE'] = "doesntexists"
24
+ it "should not load options from file if it doesn't exist" do
25
+ ENV['BG_CONFIG_FILE'] = ""
26
26
 
27
- config = Config.new
28
- config.force.should == false
27
+ lambda {
28
+ config = Config.new
29
+ }.should raise_error(RuntimeError, "You specified empty configuration file path. Please make sure you set correct path for BG_CONFIG_FILE environment variable.")
29
30
  end
30
31
 
31
32
  it "should load empty config file" do
@@ -46,11 +47,23 @@ module BoxGrinder
46
47
  config.dir.root.should == 'root/dir'
47
48
  end
48
49
 
49
- it "should merge platform" do
50
- ENV['BG_CONFIG_FILE'] = "doesntexists"
50
+ it "should raise a file not found error if BG_CONFIG_FILE is set, but the path is invalid" do
51
+ ENV['BG_CONFIG_FILE'] = "leo/tol/stoy"
52
+ lambda { Config.new }.should raise_error(RuntimeError, "Configuration file 'leo/tol/stoy' couldn't be found. Please make sure you set correct path for BG_CONFIG_FILE environment variable.")
53
+ end
51
54
 
52
- config = Config.new.merge(:platform => :ec2)
55
+ it "should raise if the specified config file is whitespace" do
56
+ ENV['BG_CONFIG_FILE'] = " "
53
57
 
58
+ lambda {
59
+ config = Config.new
60
+ }.should raise_error(RuntimeError, "You specified empty configuration file path. Please make sure you set correct path for BG_CONFIG_FILE environment variable.")
61
+ end
62
+
63
+ it "should merge platform" do
64
+ # Make sure we don't have the variable defined anymore
65
+ ENV.delete('BG_CONFIG_FILE')
66
+ config = Config.new.merge(:platform => :ec2)
54
67
  config.platform.should == :ec2
55
68
  end
56
69
  end
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
  - 3
9
- - 2
10
- version: 0.3.2
9
+ - 3
10
+ version: 0.3.3
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-05-17 00:00:00 +02:00
18
+ date: 2011-06-28 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency