ptools 1.2.6-universal-mingw32 → 1.2.7-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,30 +1,30 @@
1
- require 'rubygems'
2
- require 'rbconfig'
3
-
4
- Gem::Specification.new do |gem|
5
- gem.name = 'ptools'
6
- gem.version = '1.2.6'
7
- gem.license = 'Artistic 2.0'
8
- gem.author = 'Daniel J. Berger'
9
- gem.email = 'djberg96@gmail.com'
10
- gem.homepage = 'https://github.com/djberg96/ptools'
11
- gem.summary = 'Extra methods for the File class'
12
- gem.test_files = Dir['test/test*']
13
- gem.files = Dir['**/*'] << '.gemtest'
14
-
15
- gem.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
16
-
17
- gem.description = <<-EOF
18
- The ptools (power tools) library provides several handy methods to
19
- Ruby's core File class, such as File.which for finding executables,
20
- File.null to return the null device on your platform, and so on.
21
- EOF
22
-
23
- gem.add_development_dependency('rake')
24
- gem.add_development_dependency('test-unit', '>= 2.5.0')
25
-
26
- if File::ALT_SEPARATOR
27
- gem.platform = Gem::Platform.new(['universal', 'mingw32'])
28
- gem.add_dependency('win32-file', '>= 0.7.0')
29
- end
30
- end
1
+ require 'rubygems'
2
+ require 'rbconfig'
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.name = 'ptools'
6
+ gem.version = '1.2.7'
7
+ gem.license = 'Artistic 2.0'
8
+ gem.author = 'Daniel J. Berger'
9
+ gem.email = 'djberg96@gmail.com'
10
+ gem.homepage = 'https://github.com/djberg96/ptools'
11
+ gem.summary = 'Extra methods for the File class'
12
+ gem.test_files = Dir['test/test*']
13
+ gem.files = Dir['**/*'] << '.gemtest'
14
+
15
+ gem.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
16
+
17
+ gem.description = <<-EOF
18
+ The ptools (power tools) library provides several handy methods to
19
+ Ruby's core File class, such as File.which for finding executables,
20
+ File.null to return the null device on your platform, and so on.
21
+ EOF
22
+
23
+ gem.add_development_dependency('rake')
24
+ gem.add_development_dependency('test-unit', '>= 2.5.0')
25
+
26
+ if File::ALT_SEPARATOR
27
+ gem.platform = Gem::Platform.new(['universal', 'mingw32'])
28
+ gem.add_dependency('win32-file', '>= 0.7.0')
29
+ end
30
+ end
@@ -1,65 +1,65 @@
1
- #####################################################################
2
- # test_binary.rb
3
- #
4
- # Test case for the File.binary? method. You should run this test
5
- # via the 'rake test_binary' task.
6
- #####################################################################
7
- require 'rubygems'
8
- require 'test-unit'
9
- require 'ptools'
10
-
11
- class TC_Ptools_Binary < Test::Unit::TestCase
12
- def self.startup
13
- if File::ALT_SEPARATOR
14
- @@bin_file = File.join(ENV['windir'], 'notepad.exe')
15
- else
16
- @@bin_file = '/bin/ls'
17
- end
18
-
19
- Dir.chdir('test') if File.exist?('test')
20
- end
21
-
22
- def setup
23
- @txt_file = File.join('txt', 'english.txt')
24
- @uni_file = File.join('txt', 'korean.txt')
25
- @png_file = File.join('img', 'test.png')
26
- @jpg_file = File.join('img', 'test.jpg')
27
- @gif_file = File.join('img', 'test.gif')
28
- end
29
-
30
- test "File.binary? basic functionality" do
31
- assert_respond_to(File, :binary?)
32
- assert_nothing_raised{ File.binary?(@txt_file) }
33
- end
34
-
35
- test "File.binary? returns true for binary files" do
36
- assert_true(File.binary?(@@bin_file))
37
- end
38
-
39
- test "File.binary? returns false for text files" do
40
- assert_false(File.binary?(@txt_file))
41
- assert_false(File.binary?(@uni_file))
42
- end
43
-
44
- test "File.binary? returns false for image files" do
45
- assert_false(File.binary?(@png_file))
46
- assert_false(File.binary?(@jpg_file))
47
- assert_false(File.binary?(@gif_file))
48
- end
49
-
50
- test "File.binary? raises an error if the file cannot be found" do
51
- assert_raise_kind_of(SystemCallError){ File.binary?('bogus') }
52
- end
53
-
54
- test "File.binary? only accepts one argument" do
55
- assert_raise_kind_of(ArgumentError){ File.binary?(@txt_file, @@bin_file) }
56
- end
57
-
58
- def teardown
59
- @txt_file = nil
60
- @uni_file = nil
61
- @png_file = nil
62
- @jpg_file = nil
63
- @gif_file = nil
64
- end
65
- end
1
+ #####################################################################
2
+ # test_binary.rb
3
+ #
4
+ # Test case for the File.binary? method. You should run this test
5
+ # via the 'rake test_binary' task.
6
+ #####################################################################
7
+ require 'rubygems'
8
+ require 'test-unit'
9
+ require 'ptools'
10
+
11
+ class TC_Ptools_Binary < Test::Unit::TestCase
12
+ def self.startup
13
+ if File::ALT_SEPARATOR
14
+ @@bin_file = File.join(ENV['windir'], 'notepad.exe')
15
+ else
16
+ @@bin_file = '/bin/ls'
17
+ end
18
+
19
+ Dir.chdir('test') if File.exist?('test')
20
+ end
21
+
22
+ def setup
23
+ @txt_file = File.join('txt', 'english.txt')
24
+ @uni_file = File.join('txt', 'korean.txt')
25
+ @png_file = File.join('img', 'test.png')
26
+ @jpg_file = File.join('img', 'test.jpg')
27
+ @gif_file = File.join('img', 'test.gif')
28
+ end
29
+
30
+ test "File.binary? basic functionality" do
31
+ assert_respond_to(File, :binary?)
32
+ assert_nothing_raised{ File.binary?(@txt_file) }
33
+ end
34
+
35
+ test "File.binary? returns true for binary files" do
36
+ assert_true(File.binary?(@@bin_file))
37
+ end
38
+
39
+ test "File.binary? returns false for text files" do
40
+ assert_false(File.binary?(@txt_file))
41
+ assert_false(File.binary?(@uni_file))
42
+ end
43
+
44
+ test "File.binary? returns false for image files" do
45
+ assert_false(File.binary?(@png_file))
46
+ assert_false(File.binary?(@jpg_file))
47
+ assert_false(File.binary?(@gif_file))
48
+ end
49
+
50
+ test "File.binary? raises an error if the file cannot be found" do
51
+ assert_raise_kind_of(SystemCallError){ File.binary?('bogus') }
52
+ end
53
+
54
+ test "File.binary? only accepts one argument" do
55
+ assert_raise_kind_of(ArgumentError){ File.binary?(@txt_file, @@bin_file) }
56
+ end
57
+
58
+ def teardown
59
+ @txt_file = nil
60
+ @uni_file = nil
61
+ @png_file = nil
62
+ @jpg_file = nil
63
+ @gif_file = nil
64
+ end
65
+ end
@@ -1,38 +1,38 @@
1
- #####################################################################
2
- # test_constants.rb
3
- #
4
- # Tests the constants that have been defined for our package. This
5
- # test case should be run via the 'rake test_constants' task.
6
- #####################################################################
7
- require 'rubygems'
8
- require 'test-unit'
9
- require 'rbconfig'
10
- require 'ptools'
11
-
12
- class TC_Ptools_Constants < Test::Unit::TestCase
13
- def self.startup
14
- @@windows = File::ALT_SEPARATOR
15
- end
16
-
17
- test "PTOOLS_VERSION constant is set to expected value" do
18
- assert_equal('1.2.6', File::PTOOLS_VERSION)
19
- end
20
-
21
- test "IMAGE_EXT constant is set to array of values" do
22
- assert_equal(%w[.bmp .gif .jpeg .jpg .png], File::IMAGE_EXT.sort)
23
- end
24
-
25
- test "WINDOWS constant is defined on MS Windows" do
26
- omit_unless(@@windows, "Skipping on Unix systems")
27
- assert_not_nil(File::MSWINDOWS)
28
- end
29
-
30
- test "WIN32EXTS constant is defiend on MS Windows" do
31
- omit_unless(@@windows, "Skipping on Unix systems")
32
- assert_not_nil(File::WIN32EXTS)
33
- end
34
-
35
- def self.shutdown
36
- @@windows = nil
37
- end
38
- end
1
+ #####################################################################
2
+ # test_constants.rb
3
+ #
4
+ # Tests the constants that have been defined for our package. This
5
+ # test case should be run via the 'rake test_constants' task.
6
+ #####################################################################
7
+ require 'rubygems'
8
+ require 'test-unit'
9
+ require 'rbconfig'
10
+ require 'ptools'
11
+
12
+ class TC_Ptools_Constants < Test::Unit::TestCase
13
+ def self.startup
14
+ @@windows = File::ALT_SEPARATOR
15
+ end
16
+
17
+ test "PTOOLS_VERSION constant is set to expected value" do
18
+ assert_equal('1.2.7', File::PTOOLS_VERSION)
19
+ end
20
+
21
+ test "IMAGE_EXT constant is set to array of values" do
22
+ assert_equal(%w[.bmp .gif .jpeg .jpg .png], File::IMAGE_EXT.sort)
23
+ end
24
+
25
+ test "WINDOWS constant is defined on MS Windows" do
26
+ omit_unless(@@windows, "Skipping on Unix systems")
27
+ assert_not_nil(File::MSWINDOWS)
28
+ end
29
+
30
+ test "WIN32EXTS constant is defiend on MS Windows" do
31
+ omit_unless(@@windows, "Skipping on Unix systems")
32
+ assert_not_nil(File::WIN32EXTS)
33
+ end
34
+
35
+ def self.shutdown
36
+ @@windows = nil
37
+ end
38
+ end
@@ -1,48 +1,48 @@
1
- ######################################################################
2
- # test_head.rb
3
- #
4
- # Test case for the File.head method. This test should be run via
5
- # the 'rake test_head' task.
6
- ######################################################################
7
- require 'test-unit'
8
- require 'ptools'
9
-
10
- class TC_FileHead < Test::Unit::TestCase
11
- def self.startup
12
- Dir.chdir('test') if File.exist?('test')
13
- File.open('test_file1.txt', 'w'){ |fh| 25.times{ |n| fh.puts "line#{n+1}" } }
14
- end
15
-
16
- def setup
17
- @test_file = 'test_file1.txt'
18
- @expected_head1 = ["line1\n","line2\n","line3\n","line4\n","line5\n"]
19
- @expected_head1.push("line6\n","line7\n","line8\n","line9\n","line10\n")
20
- @expected_head2 = ["line1\n","line2\n","line3\n","line4\n","line5\n"]
21
- end
22
-
23
- def test_head_basic
24
- assert_respond_to(File, :head)
25
- assert_nothing_raised{ File.head(@test_file) }
26
- assert_nothing_raised{ File.head(@test_file, 5) }
27
- assert_nothing_raised{ File.head(@test_file){} }
28
- end
29
-
30
- def test_head_expected_results
31
- assert_kind_of(Array, File.head(@test_file))
32
- assert_equal(@expected_head1, File.head(@test_file))
33
- assert_equal(@expected_head2, File.head(@test_file, 5))
34
- end
35
-
36
- def test_head_expected_errors
37
- assert_raises(ArgumentError){ File.head(@test_file, 5, "foo") }
38
- assert_raises(Errno::ENOENT){ File.head("bogus") }
39
- end
40
-
41
- def teardown
42
- @test_file = nil
43
- end
44
-
45
- def self.shutdown
46
- File.delete('test_file1.txt') if File.exist?('test_file1.txt')
47
- end
48
- end
1
+ ######################################################################
2
+ # test_head.rb
3
+ #
4
+ # Test case for the File.head method. This test should be run via
5
+ # the 'rake test_head' task.
6
+ ######################################################################
7
+ require 'test-unit'
8
+ require 'ptools'
9
+
10
+ class TC_FileHead < Test::Unit::TestCase
11
+ def self.startup
12
+ Dir.chdir('test') if File.exist?('test')
13
+ File.open('test_file1.txt', 'w'){ |fh| 25.times{ |n| fh.puts "line#{n+1}" } }
14
+ end
15
+
16
+ def setup
17
+ @test_file = 'test_file1.txt'
18
+ @expected_head1 = ["line1\n","line2\n","line3\n","line4\n","line5\n"]
19
+ @expected_head1.push("line6\n","line7\n","line8\n","line9\n","line10\n")
20
+ @expected_head2 = ["line1\n","line2\n","line3\n","line4\n","line5\n"]
21
+ end
22
+
23
+ def test_head_basic
24
+ assert_respond_to(File, :head)
25
+ assert_nothing_raised{ File.head(@test_file) }
26
+ assert_nothing_raised{ File.head(@test_file, 5) }
27
+ assert_nothing_raised{ File.head(@test_file){} }
28
+ end
29
+
30
+ def test_head_expected_results
31
+ assert_kind_of(Array, File.head(@test_file))
32
+ assert_equal(@expected_head1, File.head(@test_file))
33
+ assert_equal(@expected_head2, File.head(@test_file, 5))
34
+ end
35
+
36
+ def test_head_expected_errors
37
+ assert_raises(ArgumentError){ File.head(@test_file, 5, "foo") }
38
+ assert_raises(Errno::ENOENT){ File.head("bogus") }
39
+ end
40
+
41
+ def teardown
42
+ @test_file = nil
43
+ end
44
+
45
+ def self.shutdown
46
+ File.delete('test_file1.txt') if File.exist?('test_file1.txt')
47
+ end
48
+ end
@@ -1,57 +1,57 @@
1
- #####################################################################
2
- # test_image.rb
3
- #
4
- # Test case for the File.image? method. You should run this test
5
- # via the 'rake test:image' task.
6
- #####################################################################
7
- require 'test-unit'
8
- require 'ptools'
9
-
10
- class TC_Ptools_Image < Test::Unit::TestCase
11
- def self.startup
12
- Dir.chdir('test') if File.exist?('test')
13
- end
14
-
15
- def setup
16
- @txt_file = File.join(Dir.pwd, 'txt', 'english.txt')
17
- @uni_file = File.join(Dir.pwd, 'txt', 'korean.txt')
18
- @jpg_file = File.join(Dir.pwd, 'img', 'test.jpg')
19
- @png_file = File.join(Dir.pwd, 'img', 'test.png')
20
- @gif_file = File.join(Dir.pwd, 'img', 'test.gif')
21
- end
22
-
23
- test "image? method basic functionality" do
24
- assert_respond_to(File, :image?)
25
- assert_nothing_raised{ File.image?(@txt_file) }
26
- assert_boolean(File.image?(@txt_file))
27
- end
28
-
29
- test "image? method returns false for a text file" do
30
- assert_false(File.image?(@txt_file))
31
- assert_false(File.image?(@uni_file))
32
- end
33
-
34
- test "image? method returns true for a gif" do
35
- assert_true(File.image?(@gif_file))
36
- end
37
-
38
- test "image? method returns true for a jpeg" do
39
- assert_true(File.image?(@jpg_file))
40
- end
41
-
42
- test "image? method returns true for a png" do
43
- assert_true(File.image?(@png_file))
44
- end
45
-
46
- test "image? method raises an error if the file does not exist" do
47
- assert_raises(Errno::ENOENT, ArgumentError){ File.image?('bogus') }
48
- end
49
-
50
- def teardown
51
- @txt_file = nil
52
- @uni_file = nil
53
- @jpg_file = nil
54
- @png_file = nil
55
- @gif_file = nil
56
- end
57
- end
1
+ #####################################################################
2
+ # test_image.rb
3
+ #
4
+ # Test case for the File.image? method. You should run this test
5
+ # via the 'rake test:image' task.
6
+ #####################################################################
7
+ require 'test-unit'
8
+ require 'ptools'
9
+
10
+ class TC_Ptools_Image < Test::Unit::TestCase
11
+ def self.startup
12
+ Dir.chdir('test') if File.exist?('test')
13
+ end
14
+
15
+ def setup
16
+ @txt_file = File.join(Dir.pwd, 'txt', 'english.txt')
17
+ @uni_file = File.join(Dir.pwd, 'txt', 'korean.txt')
18
+ @jpg_file = File.join(Dir.pwd, 'img', 'test.jpg')
19
+ @png_file = File.join(Dir.pwd, 'img', 'test.png')
20
+ @gif_file = File.join(Dir.pwd, 'img', 'test.gif')
21
+ end
22
+
23
+ test "image? method basic functionality" do
24
+ assert_respond_to(File, :image?)
25
+ assert_nothing_raised{ File.image?(@txt_file) }
26
+ assert_boolean(File.image?(@txt_file))
27
+ end
28
+
29
+ test "image? method returns false for a text file" do
30
+ assert_false(File.image?(@txt_file))
31
+ assert_false(File.image?(@uni_file))
32
+ end
33
+
34
+ test "image? method returns true for a gif" do
35
+ assert_true(File.image?(@gif_file))
36
+ end
37
+
38
+ test "image? method returns true for a jpeg" do
39
+ assert_true(File.image?(@jpg_file))
40
+ end
41
+
42
+ test "image? method returns true for a png" do
43
+ assert_true(File.image?(@png_file))
44
+ end
45
+
46
+ test "image? method raises an error if the file does not exist" do
47
+ assert_raises(Errno::ENOENT, ArgumentError){ File.image?('bogus') }
48
+ end
49
+
50
+ def teardown
51
+ @txt_file = nil
52
+ @uni_file = nil
53
+ @jpg_file = nil
54
+ @png_file = nil
55
+ @gif_file = nil
56
+ end
57
+ end