Skip to content

Commit

Permalink
* Rakefile: make gems off the REVISION number by default.
Browse files Browse the repository at this point in the history
 * lib/hpricot/tag.rb: make sure the script tag (and other PCDATA wrappers) don't get output as empty elements.


git-svn-id: https://code.whytheluckystiff.net/svn/hpricot/trunk@30 9e82565c-fa0a-db11-9fa0-00132028b6dc
  • Loading branch information
why committed Jul 27, 2006
1 parent 6f78f2e commit ca13188
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
12 changes: 6 additions & 6 deletions Rakefile
Expand Up @@ -7,8 +7,8 @@ require 'fileutils'
include FileUtils

NAME = "hpricot"
VERS = "0.3"
PKG_REVISION = ".0"
REV = File.read(".svn/entries")[/committed-rev="(\d+)"/, 1] rescue nil
VERS = "0.3" + (REV ? ".#{REV}" : "")
CLEAN.include ['ext/hpricot_scan/*.{bundle,so,obj,pdb,lib,def,exp}', 'ext/hpricot_scan/Makefile',
'**/.*.sw?', '*.gem', '.config']

Expand Down Expand Up @@ -40,7 +40,7 @@ end
spec =
Gem::Specification.new do |s|
s.name = NAME
s.version = VERS + PKG_REVISION
s.version = VERS
s.platform = Gem::Platform::RUBY
s.has_rdoc = false
s.extra_rdoc_files = ["README", "CHANGELOG", "COPYING"]
Expand Down Expand Up @@ -110,7 +110,7 @@ PKG_FILES = FileList[

Win32Spec = Gem::Specification.new do |s|
s.name = NAME
s.version = VERS + PKG_REVISION
s.version = VERS
s.platform = Gem::Platform::WIN32
s.has_rdoc = false
s.extra_rdoc_files = ["README", "CHANGELOG", "COPYING"]
Expand All @@ -128,7 +128,7 @@ Win32Spec = Gem::Specification.new do |s|
s.bindir = "bin"
end

WIN32_PKG_DIR = "hpricot-" + VERS + PKG_REVISION
WIN32_PKG_DIR = "hpricot-" + VERS

file WIN32_PKG_DIR => [:package] do
sh "tar zxf pkg/#{WIN32_PKG_DIR}.tgz"
Expand All @@ -146,7 +146,7 @@ task :rubygems_win32 => ["hpricot_scan_win32"] do
Dir.chdir("#{WIN32_PKG_DIR}") do
Gem::Builder.new(Win32Spec).build
verbose(true) {
mv Dir["*.gem"].first, "../pkg/hpricot-#{VERS + PKG_REVISION}-mswin32.gem"
mv Dir["*.gem"].first, "../pkg/hpricot-#{VERS}-mswin32.gem"
}
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/hpricot/tag.rb
Expand Up @@ -32,7 +32,7 @@ def empty?; @children.empty? end
[m, "#{m}="].each { |m2| define_method(m2) { |*a| @stag.send(m2, *a) } }
end
def output(out)
if empty?
if empty? and ElementContent[@stag.name] != :CDATA
@stag.output(out, :style => :empty)
else
@stag.output(out)
Expand Down
4 changes: 4 additions & 0 deletions test/test_parser.rb
Expand Up @@ -9,6 +9,7 @@ def setup
@basic = Hpricot.parse(TestFiles::BASIC)
@boingboing = Hpricot.parse(TestFiles::BOINGBOING)
@immob = Hpricot.parse(TestFiles::IMMOB)
@utf8 = Hpricot.parse(TestFiles::UTF8)
end

# def test_set_attr
Expand Down Expand Up @@ -119,4 +120,7 @@ def test_body_newlines
def test_javascripts
assert_equal 3, (@immob/:script)[0].innerHTML.scan(/<LINK/).length
end

def test_unicode
end
end

0 comments on commit ca13188

Please sign in to comment.