PageRenderTime 149ms CodeModel.GetById 140ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 1ms

/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.9.2/test/test_rake_package_task.rb

http://github.com/agross/netopenspace
Ruby | 78 lines | 64 code | 14 blank | 0 comment | 0 complexity | 87371b9196e380961f4d819ff5111d5a MD5 | raw file
 1require File.expand_path('../helper', __FILE__)
 2require 'rake/packagetask'
 3
 4class TestRakePackageTask < Rake::TestCase
 5
 6  def test_initialize
 7    pkg = Rake::PackageTask.new("pkgr", "1.2.3") { |p|
 8      p.package_files << "install.rb"
 9      p.package_files.include(
10        '[A-Z]*',
11        'bin/**/*',
12        'lib/**/*.rb',
13        'test/**/*.rb',
14        'doc/**/*',
15        'build/rubyapp.rb',
16        '*.blurb')
17      p.package_files.exclude(/\bCVS\b/)
18      p.package_files.exclude(/~$/)
19      p.package_dir = 'pkg'
20      p.need_tar = true
21      p.need_tar_gz = true
22      p.need_tar_bz2 = true
23      p.need_zip = true
24    }
25
26    assert_equal "pkg", pkg.package_dir
27    assert pkg.package_files.include?("bin/rake")
28    assert_equal 'pkgr', pkg.name
29    assert_equal '1.2.3', pkg.version
30    assert Rake::Task[:package]
31    assert Rake::Task['pkg/pkgr-1.2.3.tgz']
32    assert Rake::Task['pkg/pkgr-1.2.3.tar.gz']
33    assert Rake::Task['pkg/pkgr-1.2.3.tar.bz2']
34    assert Rake::Task['pkg/pkgr-1.2.3.zip']
35    assert Rake::Task['pkg/pkgr-1.2.3']
36    assert Rake::Task[:clobber_package]
37    assert Rake::Task[:repackage]
38  end
39
40  def test_initialize_no_version
41    e = assert_raises RuntimeError do
42      Rake::PackageTask.new 'pkgr'
43    end
44
45    assert_equal 'Version required (or :noversion)', e.message
46  end
47
48  def test_initialize_noversion
49    pkg = Rake::PackageTask.new 'pkgr', :noversion
50
51    assert_equal 'pkg',  pkg.package_dir
52    assert_equal 'pkgr', pkg.name
53    assert_equal nil,    pkg.version
54  end
55
56  def test_clone
57    pkg = Rake::PackageTask.new("x", :noversion)
58    p2 = pkg.clone
59    pkg.package_files << "y"
60    p2.package_files << "x"
61    assert_equal ["y"], pkg.package_files
62    assert_equal ["x"], p2.package_files
63  end
64
65  def test_package_name
66    pkg = Rake::PackageTask.new 'a', '1'
67
68    assert_equal 'a-1', pkg.package_name
69  end
70
71  def test_package_name_noversion
72    pkg = Rake::PackageTask.new 'a', :noversion
73
74    assert_equal 'a', pkg.package_name
75  end
76
77end
78