ptools 1.2.2-universal-mingw32 → 1.2.3-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
data/test/test_which.rb CHANGED
@@ -1,113 +1,113 @@
1
- #####################################################################
2
- # test_which.rb
3
- #
4
- # Test case for the File.which method. You should run this test
5
- # via the 'rake test_which' rake task.
6
- #
7
- # NOTE: I make the assumption that Ruby (or JRuby) is in your
8
- # PATH for these tests.
9
- #####################################################################
10
- require 'rubygems'
11
- gem 'test-unit'
12
-
13
- require 'test/unit'
14
- require 'rbconfig'
15
- require 'fileutils'
16
- require 'ptools'
17
-
18
- class TC_FileWhich < Test::Unit::TestCase
19
- def self.startup
20
- @@windows = File::ALT_SEPARATOR
21
- @@dir = File.join(Dir.pwd, 'tempdir')
22
- @@non_exe = File.join(Dir.pwd, 'tempfile')
23
-
24
- Dir.mkdir(@@dir) unless File.exists?(@@dir)
25
- FileUtils.touch(@@non_exe)
26
- File.chmod(775, @@dir)
27
- File.chmod(644, @@non_exe)
28
- end
29
-
30
- def setup
31
- @ruby = RUBY_PLATFORM.match('java') ? 'jruby' : 'ruby'
32
- @ruby = 'rbx' if defined?(Rubinius)
33
-
34
- @exe = File.join(
35
- RbConfig::CONFIG['bindir'],
36
- RbConfig::CONFIG['ruby_install_name']
37
- )
38
-
39
- if @@windows
40
- @exe.tr!('/','\\')
41
- @exe << ".exe"
42
- end
43
- end
44
-
45
- test "which method basic functionality" do
46
- assert_respond_to(File, :which)
47
- assert_nothing_raised{ File.which(@ruby) }
48
- assert_kind_of(String, File.which(@ruby))
49
- end
50
-
51
- test "which accepts an optional path to search" do
52
- assert_nothing_raised{ File.which(@ruby, "/usr/bin:/usr/local/bin") }
53
- end
54
-
55
- test "which returns nil if not found" do
56
- assert_equal(nil, File.which(@ruby, '/bogus/path'))
57
- assert_equal(nil, File.which('blahblahblah'))
58
- end
59
-
60
- test "which handles executables without extensions on windows" do
61
- omit_unless(@@windows, "test skipped unless MS Windows")
62
- assert_not_nil(File.which('ruby'))
63
- assert_not_nil(File.which('notepad'))
64
- end
65
-
66
- test "which handles executables that already contain extensions on windows" do
67
- omit_unless(@@windows, "test skipped unless MS Windows")
68
- assert_not_nil(File.which('ruby.exe'))
69
- assert_not_nil(File.which('notepad.exe'))
70
- end
71
-
72
- test "which returns argument if an existent absolute path is provided" do
73
- assert_equal(@exe, File.which(@ruby), "=> May fail on a symlink")
74
- end
75
-
76
- test "which returns nil if a non-existent absolute path is provided" do
77
- assert_nil(File.which('/foo/bar/baz/ruby'))
78
- end
79
-
80
- test "which does not pickup files that are not executable" do
81
- assert_nil(File.which(@@non_exe))
82
- end
83
-
84
- test "which does not pickup executable directories" do
85
- assert_nil(File.which(@@dir))
86
- end
87
-
88
- test "which accepts a minimum of one argument" do
89
- assert_raises(ArgumentError){ File.which }
90
- end
91
-
92
- test "which accepts a maximum of two arguments" do
93
- assert_raises(ArgumentError){ File.which(@ruby, "foo", "bar") }
94
- end
95
-
96
- test "the second argument cannot be nil or empty" do
97
- assert_raises(ArgumentError){ File.which(@ruby, nil) }
98
- assert_raises(ArgumentError){ File.which(@ruby, '') }
99
- end
100
-
101
- def teardown
102
- @exe = nil
103
- @ruby = nil
104
- end
105
-
106
- def self.shutdown
107
- FileUtils.rm(@@non_exe)
108
- FileUtils.rm_rf(@@dir)
109
- @@windows = nil
110
- @@dir = nil
111
- @@non_exe = nil
112
- end
113
- end
1
+ #####################################################################
2
+ # test_which.rb
3
+ #
4
+ # Test case for the File.which method. You should run this test
5
+ # via the 'rake test_which' rake task.
6
+ #
7
+ # NOTE: I make the assumption that Ruby (or JRuby) is in your
8
+ # PATH for these tests.
9
+ #####################################################################
10
+ require 'rubygems'
11
+ gem 'test-unit'
12
+
13
+ require 'test/unit'
14
+ require 'rbconfig'
15
+ require 'fileutils'
16
+ require 'ptools'
17
+
18
+ class TC_FileWhich < Test::Unit::TestCase
19
+ def self.startup
20
+ @@windows = File::ALT_SEPARATOR
21
+ @@dir = File.join(Dir.pwd, 'tempdir')
22
+ @@non_exe = File.join(Dir.pwd, 'tempfile')
23
+
24
+ Dir.mkdir(@@dir) unless File.exists?(@@dir)
25
+ FileUtils.touch(@@non_exe)
26
+ File.chmod(775, @@dir)
27
+ File.chmod(644, @@non_exe)
28
+ end
29
+
30
+ def setup
31
+ @ruby = RUBY_PLATFORM.match('java') ? 'jruby' : 'ruby'
32
+ @ruby = 'rbx' if defined?(Rubinius)
33
+
34
+ @exe = File.join(
35
+ RbConfig::CONFIG['bindir'],
36
+ RbConfig::CONFIG['ruby_install_name']
37
+ )
38
+
39
+ if @@windows
40
+ @exe.tr!('/','\\')
41
+ @exe << ".exe"
42
+ end
43
+ end
44
+
45
+ test "which method basic functionality" do
46
+ assert_respond_to(File, :which)
47
+ assert_nothing_raised{ File.which(@ruby) }
48
+ assert_kind_of(String, File.which(@ruby))
49
+ end
50
+
51
+ test "which accepts an optional path to search" do
52
+ assert_nothing_raised{ File.which(@ruby, "/usr/bin:/usr/local/bin") }
53
+ end
54
+
55
+ test "which returns nil if not found" do
56
+ assert_equal(nil, File.which(@ruby, '/bogus/path'))
57
+ assert_equal(nil, File.which('blahblahblah'))
58
+ end
59
+
60
+ test "which handles executables without extensions on windows" do
61
+ omit_unless(@@windows, "test skipped unless MS Windows")
62
+ assert_not_nil(File.which('ruby'))
63
+ assert_not_nil(File.which('notepad'))
64
+ end
65
+
66
+ test "which handles executables that already contain extensions on windows" do
67
+ omit_unless(@@windows, "test skipped unless MS Windows")
68
+ assert_not_nil(File.which('ruby.exe'))
69
+ assert_not_nil(File.which('notepad.exe'))
70
+ end
71
+
72
+ test "which returns argument if an existent absolute path is provided" do
73
+ assert_equal(@exe, File.which(@ruby), "=> May fail on a symlink")
74
+ end
75
+
76
+ test "which returns nil if a non-existent absolute path is provided" do
77
+ assert_nil(File.which('/foo/bar/baz/ruby'))
78
+ end
79
+
80
+ test "which does not pickup files that are not executable" do
81
+ assert_nil(File.which(@@non_exe))
82
+ end
83
+
84
+ test "which does not pickup executable directories" do
85
+ assert_nil(File.which(@@dir))
86
+ end
87
+
88
+ test "which accepts a minimum of one argument" do
89
+ assert_raises(ArgumentError){ File.which }
90
+ end
91
+
92
+ test "which accepts a maximum of two arguments" do
93
+ assert_raises(ArgumentError){ File.which(@ruby, "foo", "bar") }
94
+ end
95
+
96
+ test "the second argument cannot be nil or empty" do
97
+ assert_raises(ArgumentError){ File.which(@ruby, nil) }
98
+ assert_raises(ArgumentError){ File.which(@ruby, '') }
99
+ end
100
+
101
+ def teardown
102
+ @exe = nil
103
+ @ruby = nil
104
+ end
105
+
106
+ def self.shutdown
107
+ FileUtils.rm(@@non_exe)
108
+ FileUtils.rm_rf(@@dir)
109
+ @@windows = nil
110
+ @@dir = nil
111
+ @@non_exe = nil
112
+ end
113
+ end
metadata CHANGED
@@ -1,71 +1,62 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ptools
3
- version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease:
6
- segments:
7
- - 1
8
- - 2
9
- - 2
10
- version: 1.2.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.3
11
5
  platform: universal-mingw32
12
- authors:
6
+ authors:
13
7
  - Daniel J. Berger
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2012-04-06 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
11
+ date: 2014-02-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
21
14
  name: test-unit
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 31
29
- segments:
30
- - 2
31
- - 4
32
- - 0
33
- version: 2.4.0
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 2.5.0
34
20
  type: :development
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: win32-file
38
21
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
40
- none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- hash: 3
45
- segments:
46
- - 0
47
- - 5
48
- - 4
49
- version: 0.5.4
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 2.5.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: win32-file
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: 0.7.0
50
34
  type: :runtime
51
- version_requirements: *id002
52
- description: " The ptools (power tools) library provides several handy methods to\n Ruby's core File class, such as File.which for finding executables,\n File.null to return the null device on your platform, and so on.\n"
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: 0.7.0
41
+ description: |2
42
+ The ptools (power tools) library provides several handy methods to
43
+ Ruby's core File class, such as File.which for finding executables,
44
+ File.null to return the null device on your platform, and so on.
53
45
  email: djberg96@gmail.com
54
46
  executables: []
55
-
56
47
  extensions: []
57
-
58
- extra_rdoc_files:
48
+ extra_rdoc_files:
59
49
  - README
60
50
  - CHANGES
61
51
  - MANIFEST
62
- files:
52
+ files:
53
+ - .gemtest
63
54
  - CHANGES
64
- - lib/ptools.rb
65
55
  - MANIFEST
66
- - ptools.gemspec
67
- - Rakefile
68
56
  - README
57
+ - Rakefile
58
+ - lib/ptools.rb
59
+ - ptools.gemspec
69
60
  - test/test_binary.rb
70
61
  - test/test_constants.rb
71
62
  - test/test_head.rb
@@ -79,41 +70,31 @@ files:
79
70
  - test/test_wc.rb
80
71
  - test/test_whereis.rb
81
72
  - test/test_which.rb
82
- - .gemtest
83
- homepage: http://www.rubyforge.org/projects/shards
84
- licenses:
73
+ homepage: https://github.com/djberg96/ptools
74
+ licenses:
85
75
  - Artistic 2.0
76
+ metadata: {}
86
77
  post_install_message:
87
78
  rdoc_options: []
88
-
89
- require_paths:
79
+ require_paths:
90
80
  - lib
91
- required_ruby_version: !ruby/object:Gem::Requirement
92
- none: false
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- hash: 3
97
- segments:
98
- - 0
99
- version: "0"
100
- required_rubygems_version: !ruby/object:Gem::Requirement
101
- none: false
102
- requirements:
103
- - - ">="
104
- - !ruby/object:Gem::Version
105
- hash: 3
106
- segments:
107
- - 0
108
- version: "0"
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
109
91
  requirements: []
110
-
111
92
  rubyforge_project: shards
112
- rubygems_version: 1.8.10
93
+ rubygems_version: 2.2.2
113
94
  signing_key:
114
- specification_version: 3
95
+ specification_version: 4
115
96
  summary: Extra methods for the File class
116
- test_files:
97
+ test_files:
117
98
  - test/test_binary.rb
118
99
  - test/test_constants.rb
119
100
  - test/test_head.rb