blob: 1526e825fea5c64db17508caca7c2def0497aa57 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
require 'rubygems/test_case'
require 'rubygems'
require 'rubygems/package_task'
class TestGemPackageTask < Gem::TestCase
def setup
super
Rake.application = Rake::Application.new
RakeFileUtils.verbose_flag = false
end
def test_gem_package
gem = Gem::Specification.new do |g|
g.name = "pkgr"
g.version = "1.2.3"
g.authors = %w[author]
g.files = %w[x]
g.summary = 'summary'
end
pkg = Gem::PackageTask.new(gem) do |p|
p.package_files << "y"
end
assert_equal %w[x y], pkg.package_files
Dir.chdir @tempdir do
FileUtils.touch 'x'
FileUtils.touch 'y'
Rake.application['package'].invoke
assert_path_exists 'pkg/pkgr-1.2.3.gem'
end
end
def test_gem_package_with_current_platform
gem = Gem::Specification.new do |g|
g.name = "pkgr"
g.version = "1.2.3"
g.files = Rake::FileList["x"].resolve
g.platform = Gem::Platform::CURRENT
end
pkg = Gem::PackageTask.new(gem) do |p|
p.package_files << "y"
end
assert_equal ["x", "y"], pkg.package_files
end
def test_gem_package_with_ruby_platform
gem = Gem::Specification.new do |g|
g.name = "pkgr"
g.version = "1.2.3"
g.files = Rake::FileList["x"].resolve
g.platform = Gem::Platform::RUBY
end
pkg = Gem::PackageTask.new(gem) do |p|
p.package_files << "y"
end
assert_equal ["x", "y"], pkg.package_files
end
def test_package_dir_path
gem = Gem::Specification.new do |g|
g.name = 'nokogiri'
g.version = '1.5.0'
g.platform = 'java'
end
pkg = Gem::PackageTask.new gem
pkg.define
assert_equal 'pkg/nokogiri-1.5.0-java', pkg.package_dir_path
end
end
|