file-temp 1.3.0 → 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,65 +1,70 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: file-temp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MREwDwYDVQQDDAhkamJl
13
+ MIIEcDCCAtigAwIBAgIBATANBgkqhkiG9w0BAQsFADA/MREwDwYDVQQDDAhkamJl
14
14
  cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
15
- MB4XDTE1MDkwMjIwNDkxOFoXDTE2MDkwMTIwNDkxOFowPzERMA8GA1UEAwwIZGpi
15
+ MB4XDTE4MDMxODE1MjIwN1oXDTI4MDMxNTE1MjIwN1owPzERMA8GA1UEAwwIZGpi
16
16
  ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
17
- bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMyTkvXqRp6hLs9eoJOS
18
- Hmi8kRYbq9Vkf15/hMxJpotYMgJVHHWrmDcC5Dye2PbnXjTkKf266Zw0PtT9h+lI
19
- S3ts9HO+vaCFSMwFFZmnWJSpQ3CNw2RcHxjWkk9yF7imEM8Kz9ojhiDXzBetdV6M
20
- gr0lV/alUr7TNVBDngbXEfTWscyXh1qd7xZ4EcOdsDktCe5G45N/o3662tPQvJsi
21
- FOF0CM/KuBsa/HL1/eoEmF4B3EKIRfTHrQ3hu20Kv3RJ88QM4ec2+0dd97uX693O
22
- zv6981fyEg+aXLkxrkViM/tz2qR2ZE0jPhHTREPYeMEgptRkTmW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 74BMnx0FIq6fCpu5slAipvxZ3ZkZpEXZFr3cIBtO1gFvQWW7E/Y3ijliWJS1GQFq
25
+ 058qERadHGu1yu1dojmFRo6W2KZvY9al2yIlbkpDrD5MYQIDAQABo3cwdTAJBgNV
26
+ HRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUFZsMapgzJimzsbaBG2Tm8j5e
27
+ AzgwHQYDVR0RBBYwFIESZGpiZXJnOTZAZ21haWwuY29tMB0GA1UdEgQWMBSBEmRq
28
+ YmVyZzk2QGdtYWlsLmNvbTANBgkqhkiG9w0BAQsFAAOCAYEAW2tnYixXQtKxgGXq
29
+ /3iSWG2bLwvxS4go3srO+aRXZHrFUMlJ5W0mCxl03aazxxKTsVVpZD8QZxvK91OQ
30
+ h9zr9JBYqCLcCVbr8SkmYCi/laxIZxsNE5YI8cC8vvlLI7AMgSfPSnn/Epq1GjGY
31
+ 6L1iRcEDtanGCIvjqlCXO9+BmsnCfEVehqZkQHeYczA03tpOWb6pon2wzvMKSsKH
32
+ ks0ApVdstSLz1kzzAqem/uHdG9FyXdbTAwH1G4ZPv69sQAFAOCgAqYmdnzedsQtE
33
+ 1LQfaQrx0twO+CZJPcRLEESjq8ScQxWRRkfuh2VeR7cEU7L7KqT10mtUwrvw7APf
34
+ DYoeCY9KyjIBjQXfbj2ke5u1hZj94Fsq9FfbEQg8ygCgwThnmkTrrKEiMSs3alYR
35
+ ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
36
+ WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
32
37
  -----END CERTIFICATE-----
33
- date: 2016-04-09 00:00:00.000000000 Z
38
+ date:
34
39
  dependencies:
35
40
  - !ruby/object:Gem::Dependency
36
41
  name: ffi
37
42
  requirement: !ruby/object:Gem::Requirement
38
43
  requirements:
39
- - - ">="
44
+ - - "~>"
40
45
  - !ruby/object:Gem::Version
41
- version: 1.0.0
46
+ version: '1.1'
42
47
  type: :runtime
43
48
  prerelease: false
44
49
  version_requirements: !ruby/object:Gem::Requirement
45
50
  requirements:
46
- - - ">="
51
+ - - "~>"
47
52
  - !ruby/object:Gem::Version
48
- version: 1.0.0
53
+ version: '1.1'
49
54
  - !ruby/object:Gem::Dependency
50
- name: test-unit
55
+ name: rspec
51
56
  requirement: !ruby/object:Gem::Requirement
52
57
  requirements:
53
- - - ">="
58
+ - - "~>"
54
59
  - !ruby/object:Gem::Version
55
- version: '0'
60
+ version: '3.9'
56
61
  type: :development
57
62
  prerelease: false
58
63
  version_requirements: !ruby/object:Gem::Requirement
59
64
  requirements:
60
- - - ">="
65
+ - - "~>"
61
66
  - !ruby/object:Gem::Version
62
- version: '0'
67
+ version: '3.9'
63
68
  - !ruby/object:Gem::Dependency
64
69
  name: rake
65
70
  requirement: !ruby/object:Gem::Requirement
@@ -81,35 +86,40 @@ description: |2
81
86
  email: djberg96@gmail.com
82
87
  executables: []
83
88
  extensions: []
84
- extra_rdoc_files:
85
- - CHANGES
86
- - README
87
- - MANIFEST
89
+ extra_rdoc_files: []
88
90
  files:
91
+ - LICENSE
92
+ - file-temp.gemspec
93
+ - spec
94
+ - spec/file_temp_spec.rb
95
+ - README.md
96
+ - Rakefile
97
+ - MANIFEST.md
89
98
  - certs
90
99
  - certs/djberg96_pub.pem
91
- - CHANGES
92
- - file-temp.gemspec
93
100
  - lib
101
+ - lib/file-temp.rb
94
102
  - lib/file
103
+ - lib/file/temp.rb
95
104
  - lib/file/java
96
105
  - lib/file/java/temp.rb
97
- - lib/file/temp.rb
98
106
  - lib/file/unix
99
107
  - lib/file/unix/temp.rb
100
108
  - lib/file/windows
101
109
  - lib/file/windows/temp.rb
102
- - lib/file-temp.rb
103
- - MANIFEST
104
- - Rakefile
105
- - README
106
- - test
107
- - test/test_file_temp.rb
110
+ - Gemfile
111
+ - CHANGES.md
108
112
  homepage: http://github.com/djberg96/file-temp
109
113
  licenses:
110
- - Artistic 2.0
111
- metadata: {}
112
- post_install_message:
114
+ - Apache-2.0
115
+ metadata:
116
+ homepage_uri: https://github.com/djberg96/file-temp
117
+ bug_tracker_uri: https://github.com/djberg96/file-temp/issues
118
+ changelog_uri: https://github.com/djberg96/file-temp/blob/master/CHANGES.md
119
+ documentation_uri: https://github.com/djberg96/file-temp/wiki
120
+ source_code_uri: https://github.com/djberg96/file-temp
121
+ wiki_uri: https://github.com/djberg96/file-temp/wiki
122
+ post_install_message:
113
123
  rdoc_options: []
114
124
  require_paths:
115
125
  - lib
@@ -124,10 +134,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
134
  - !ruby/object:Gem::Version
125
135
  version: '0'
126
136
  requirements: []
127
- rubyforge_project:
128
- rubygems_version: 2.5.1
129
- signing_key:
137
+ rubygems_version: 3.0.3
138
+ signing_key:
130
139
  specification_version: 4
131
140
  summary: An alternative way to generate temp files
132
141
  test_files:
133
- - test/test_file_temp.rb
142
+ - spec/file_temp_spec.rb
metadata.gz.sig CHANGED
Binary file
data/README DELETED
@@ -1,65 +0,0 @@
1
- == Description
2
- The file-temp library is an alternate way to handle tempfile generation.
3
-
4
- == Requirements
5
- ffi 1.0.0 or later
6
-
7
- == Installation
8
- gem install file-temp
9
-
10
- == Synopsis
11
- require 'file/temp'
12
-
13
- fh = File::Temp.new
14
- fh.puts "hello"
15
- fh.close # => Tempfile automatically deleted
16
-
17
- fh = File::Temp.new(false)
18
- fh.puts "world"
19
- fh.close # => Tempfile still on your filesystem
20
-
21
- == Motivation
22
- Ruby's tempfile.rb is overwrought and susceptible to race conditions.
23
- This library uses your system's native tmpfile() or mkstemp() functions
24
- instead of trying to handle race conditions manually via pure Ruby.
25
-
26
- This library is also more secure because it restricts file permission via
27
- umask() for files created with mkstemp().
28
-
29
- Finally, this library subclasses the File class. This means you get almost
30
- exactly the same interface as the File class. The only difference is the
31
- constructor.
32
-
33
- == JRuby
34
- The implementation for JRuby uses the Java API, not the C API. The
35
- temporary file name generated by Java is different than the C version,
36
- since it uses a GUID instead of the 'XXXXXX' template, but the
37
- interface is otherwise identical.
38
-
39
- There is one test failure with JRuby (threaded tempfile creation). I am
40
- not sure why, as sample code seems to work fine. Help wanted.
41
-
42
- == MS Windows
43
- You may need to use the mingw build in order to use this library.
44
-
45
- Also, there was a bug with GetTempFileName function on certain versions
46
- of MS Windows that may cause a failure. However, if you'r patched up you
47
- should not see it.
48
-
49
- == License
50
- Artistic 2.0
51
-
52
- == Copyright
53
- (C) 2007-2016 Daniel J. Berger
54
- All Rights Reserved
55
-
56
- == Warranty
57
- This library is provided "as is" and without any express or
58
- implied warranties, including, without limitation, the implied
59
- warranties of merchantability and fitness for a particular purpose.
60
-
61
- == Author
62
- Daniel J. Berger
63
-
64
- == See also
65
- tmpfile(), mkstemp(), tmpnam()
@@ -1,137 +0,0 @@
1
- ######################################################################
2
- # test_file_temp.rb
3
- #
4
- # Test suite for the file-temp library. These tests should be run
5
- # via the 'rake test' task.
6
- ######################################################################
7
- require 'rubygems'
8
- require 'test-unit'
9
- require 'file/temp'
10
-
11
- class TC_File_Temp < Test::Unit::TestCase
12
- WINDOWS = File::ALT_SEPARATOR
13
- OSX = RbConfig::CONFIG['host_os'] =~ /darwin/i
14
-
15
- def setup
16
- @dir = File::Temp::TMPDIR
17
- @template = 'file-temp-test-XXXXX'
18
- @fh = nil
19
-
20
- # Because Dir[] doesn't work right with backslashes
21
- @dir = @dir.tr("\\", "/") if WINDOWS
22
- end
23
-
24
- test "library version is set to expected value" do
25
- assert_equal('1.3.0', File::Temp::VERSION)
26
- end
27
-
28
- # Fails with JRuby, not sure why.
29
- test "library works as expected with multiple threads" do
30
- threads = []
31
- assert_nothing_raised{ 100.times{ threads << Thread.new{ File::Temp.new }}}
32
- assert_nothing_raised{ threads.each{ |t| t.join } }
33
- end
34
-
35
- test "TMPDIR constant is defined" do
36
- assert_not_nil(File::Temp::TMPDIR)
37
- assert_kind_of(String, File::Temp::TMPDIR)
38
- end
39
-
40
- test "constructor works as expected with default auto delete option" do
41
- assert_nothing_raised{
42
- @fh = File::Temp.new
43
- @fh.print "hello"
44
- @fh.close
45
- }
46
- end
47
-
48
- test "constructor works as expected with false auto delete option" do
49
- assert_nothing_raised{
50
- @fh = File::Temp.new(false)
51
- @fh.print "hello"
52
- @fh.close
53
- }
54
- end
55
-
56
- test "constructor accepts and uses an optional template as expected" do
57
- assert_nothing_raised{ File::Temp.new(false, 'temp_foo_XXXXXX').close }
58
- assert_true(Dir["#{@dir}/temp_foo*"].length >= 1)
59
- end
60
-
61
- test "constructor with false auto delete and block works as expected" do
62
- assert_nothing_raised{ File::Temp.open(false, 'temp_foo_XXXXXX'){ |fh| fh.puts "hello" } }
63
- assert_true(Dir["#{@dir}/temp_foo*"].length >= 1)
64
- end
65
-
66
- test "second argument to constructor must be a string" do
67
- assert_raise(TypeError, ArgumentError){ @fh = File::Temp.new(false, 1) }
68
- end
69
-
70
- test "an error is raised if a custom template is invalid" do
71
- omit_if(OSX)
72
- assert_raise(Errno::EINVAL){ File::Temp.new(false, 'xx') }
73
- end
74
-
75
- test "constructor accepts a maximum of two arguments" do
76
- assert_raise(ArgumentError){ @fh = File::Temp.new(true, 'temp_bar_XXXXX', 1) }
77
- end
78
-
79
- test "temp_name basic functionality" do
80
- assert_respond_to(File::Temp, :temp_name)
81
- assert_nothing_raised{ File::Temp.temp_name }
82
- assert_kind_of(String, File::Temp.temp_name)
83
- end
84
-
85
- test "temp_name returns expected value" do
86
- if File::ALT_SEPARATOR
87
- assert_match(/^.*?\d*?tmp/, File.extname(File::Temp.temp_name))
88
- else
89
- assert_equal('.tmp', File.extname(File::Temp.temp_name))
90
- end
91
- end
92
-
93
- test "temp path basic functionality" do
94
- @fh = File::Temp.new
95
- assert_respond_to(@fh, :path)
96
- end
97
-
98
- test "temp path is nil if delete option is true" do
99
- @fh = File::Temp.new
100
- assert_nil(@fh.path)
101
- end
102
-
103
- test "temp path is not nil if delete option is false" do
104
- @fh = File::Temp.new(false)
105
- assert_not_nil(@fh.path)
106
- end
107
-
108
- test "ffi functions are private" do
109
- methods = File::Temp.methods(false).map{ |e| e.to_s }
110
- assert_false(methods.include?('_fileno'))
111
- assert_false(methods.include?('mkstemp'))
112
- assert_false(methods.include?('_umask'))
113
- assert_false(methods.include?('fclose'))
114
- assert_false(methods.include?('strerror'))
115
- assert_false(methods.include?('tmpnam'))
116
- assert_false(methods.include?('CloseHandle'))
117
- assert_false(methods.include?('CreateFileA'))
118
- assert_false(methods.include?('DeleteFileA'))
119
- assert_false(methods.include?('GetTempPathA'))
120
- assert_false(methods.include?('GetTempFileNameA'))
121
- end
122
-
123
- def teardown
124
- @dir = nil
125
- @template = nil
126
- @fh.close if @fh && !@fh.closed?
127
- @fh = nil
128
-
129
- Dir["temp_*"].each{ |f| File.delete(f) }
130
- Dir["rb_file_temp_*"].each{ |f| File.delete(f) }
131
-
132
- Dir.chdir(File::Temp::TMPDIR) do
133
- Dir["temp_*"].each{ |f| File.delete(f) }
134
- Dir["rb_file_temp_*"].each{ |f| File.delete(f) }
135
- end
136
- end
137
- end