buildrdeb 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/buildrdeb.gemspec CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
  Gem::Specification.new do |spec|
18
18
  spec.name = 'buildrdeb'
19
- spec.version = '1.0.0'
19
+ spec.version = '1.0.1'
20
20
  spec.author = 'Antoine Toulme'
21
21
  spec.email = "antoine@lunar-ocean.com"
22
22
  spec.homepage = "http://buildr.apache.org/"
@@ -36,11 +36,16 @@ module BuildrDeb
36
36
  raise "Cannot find #{filename}: #{file} doesn't exist" if !File.exists? file
37
37
  target = File.join(root, "DEBIAN", filename)
38
38
  contents = File.read(file)
39
- # Replace version if we are looking at control.
40
- contents.gsub!(/^Version: .*$/, "Version: #{@version}") if (filename == "control" && !@version.nil?)
41
- File.open(target, "w+") {|t|
42
- t.write eval("\"#{contents}\"")
43
- }
39
+ # Replace version and use ERB to evaluate the control file, in case there are variables to pass.
40
+ if (filename == "control" && !@version.nil?)
41
+ contents.gsub!(/^Version: .*$/, "Version: #{@version}")
42
+ File.open(target, "w") {|t|
43
+ t.write ERB.new(contents).result
44
+ }
45
+ else
46
+ cp file.to_s, target
47
+ end
48
+
44
49
  File.chmod 0755, target
45
50
  end
46
51
  end
@@ -40,6 +40,28 @@ Description: The description can contain free-form text
40
40
  More descriptive text.
41
41
  CONTROL
42
42
  Buildr::write "control2", ""
43
+ Buildr::write "control3", <<-CONTROL
44
+ Package: acme
45
+ Version: 1.0
46
+ Section: <%= MY_CUSTOM_VALUE %>
47
+ Priority: optional
48
+ Architecture: all
49
+ Essential: no
50
+ Depends: libwww-perl, acme-base (>= 1.2)
51
+ Pre-Depends: perl
52
+ Recommends: mozilla | netscape
53
+ Suggests: docbook
54
+ Installed-Size: 1024
55
+ Maintainer: Joe Brockmeier <jzb@dissociatedpress.net>
56
+ Conflicts: wile-e-coyote
57
+ Replaces: sam-sheepdog
58
+ Provides: acme
59
+ Description: The description can contain free-form text
60
+ describing the function of the program, what
61
+ kind of features it has, and so on.
62
+ More descriptive text.
63
+ CONTROL
64
+
43
65
  Buildr::write "postinst", ""
44
66
  Buildr::write "prerm", ""
45
67
  Buildr::write "postinst2", <<-POSTINST2
@@ -130,19 +152,19 @@ POSTINST2
130
152
  File.read("target/foo-2.0.deb-contents/DEBIAN/control").should match /^Version: 2.0$/
131
153
  end
132
154
 
133
- it "should evaluate the contents of the file" do
155
+ it "should evaluate the contents of the control file" do
134
156
  write_files
135
157
  define("foo", :version => "2.0") do
136
158
  project.package(:deb).tap do |deb|
137
- deb.control = _("control")
138
- deb.postinst = _("postinst2")
159
+ deb.control = _("control3")
160
+ deb.postinst = _("postinst")
139
161
  deb.prerm = _("prerm")
140
162
  end
141
163
  end
142
164
  MY_CUSTOM_VALUE = "custom"
143
165
  project("foo").package(:deb).invoke
144
166
  File.exists?( project("foo").package(:deb).to_s).should be_true
145
- File.exists?("target/foo-2.0.deb-contents/DEBIAN/postinst").should be_true
146
- File.read("target/foo-2.0.deb-contents/DEBIAN/postinst").should match MY_CUSTOM_VALUE
167
+ File.exists?("target/foo-2.0.deb-contents/DEBIAN/control").should be_true
168
+ File.read("target/foo-2.0.deb-contents/DEBIAN/control").should match MY_CUSTOM_VALUE
147
169
  end
148
170
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: buildrdeb
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 0
10
- version: 1.0.0
9
+ - 1
10
+ version: 1.0.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Antoine Toulme
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-25 00:00:00 -07:00
18
+ date: 2010-10-08 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies: []
21
21