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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0439e6595202db84a8dea3cfd41b526a0f1adba1
4
- data.tar.gz: 135ca4378282ef1eabcef68f2b7b3dbea3193de8
2
+ SHA256:
3
+ metadata.gz: 2f7a532c6a985ef7afd93f064e38ff3fb81228d642707fa06156f23b1a2d33c6
4
+ data.tar.gz: 5de639ab3cc6644fb385d35b364f8aa4c6c8afbd989706875a8e6f90193eaa18
5
5
  SHA512:
6
- metadata.gz: 74c529e0f8179a27ebb8428cb1636b5401439b2a546f553960e97c9b305e96cfe327edb196865e9cbaeb99f9bf6ef8c1044cece6442918742b84c5e890243388
7
- data.tar.gz: ebba50979466de41024f48e2cfd60dab4439fa3f4cbe9c09fd7914120eba0e53039b936e17633b75a5b06d9052c4e051f3f6c2206d199234613d3e3daddfd8fd
6
+ metadata.gz: 7e77feff9b86f7e33c233037e5c5342fac28a7bd3e5b18296cfae915e8a9e39b0d73a4a9dc87ac3ce096869b9bad401c98041bd2cb847a04d4c1b74f98a5b884
7
+ data.tar.gz: 285fe4b48491c6468e7f0a3646d3a9da2b9d55e9386b5f6ee232882bb611311c3122ffa34ac98162e3f847f618c20fae57254c8135d368cc58aeb7d76761dd8e
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,4 +1,32 @@
1
- = 1.3.0 - 9-Apr-2016
1
+ ## 1.7.1 - 28-Dec-2020
2
+ * Updated file option kwarg handling so that it's compatible with Ruby 3.x.
3
+ * Switched from rdoc to markdown format since github isn't rendering rdoc properly.
4
+ * Fixed up one of the specs.
5
+
6
+ ## 1.7.0 - 1-Jul-2020
7
+ * Replaced test-unit with rspec, and updated the tests.
8
+ * Updated ffi dependency to 1.1.x.
9
+ * Removed some archiving options from the Rakefile that I wasn't using.
10
+
11
+ ## 1.6.0 - 9-May-2020
12
+ * Added an +options+ argument that is passed along as options to the the
13
+ underlying File.new constructor.
14
+
15
+ ## 1.5.0 - 8-May-2020
16
+ * Switched to keyword arguments.
17
+ * Added the ability to specify a tmp directory.
18
+ * Updates to the JRuby version, removed some code that no longer worked, and
19
+ added support for specifying your own directory.
20
+ * Added a LICENSE file to the distro as part of the Apache-2.0 requirement.
21
+ * Added explicit .rdoc extensions to the README, CHANGES and MANIFEST files.
22
+
23
+ ## 1.4.0 - 12-Oct-2019
24
+ * Changed license to Apache-2.0.
25
+ * VERSION constant now lives in a single place, and is frozen.
26
+ * Added metadata to the gemspec.
27
+ * Updated cert.
28
+
29
+ ## 1.3.0 - 9-Apr-2016
2
30
  * This gem is now signed.
3
31
  * Added a file-temp.rb file for convenience.
4
32
  * The gem tasks in the Rakefile now assume Rubygems 2.x.
@@ -8,7 +36,7 @@
8
36
  are each in their own directory and have their own versions for ease
9
37
  of maintenance.
10
38
 
11
- = 1.2.1 - 17-Feb-2014
39
+ ## 1.2.1 - 17-Feb-2014
12
40
  * There is now a completely separate implementation for JRuby that uses the
13
41
  Java API instead of C. It uses a GUID to create the temporary file name
14
42
  instead of the 'XXXXXX' template, but is otherwise identical in function.
@@ -21,53 +49,53 @@
21
49
  * Use tmpnam_s on Windows instead of tmpnam.
22
50
  * Use wide character functions on Windows.
23
51
 
24
- = 1.2.0 - 10-Apr-2012
52
+ ## 1.2.0 - 10-Apr-2012
25
53
  * Removed the old FileTemp alias for File::Temp. It was deprecated and
26
54
  has now been officially removed.
27
55
  * Some refactoring of the custom internal Windows functions.
28
56
  * Nicer error handling if certain FFI functions fail.
29
57
  * Made the FFI functions private.
30
58
 
31
- = 1.1.5 - 17-Jul-2011
59
+ ## 1.1.5 - 17-Jul-2011
32
60
  * Now stores file path information if the file is retained on the filesystem.
33
61
  Thanks go to joerixaop for the patch.
34
62
  * The TMPDIR fallback determination on Windows is no longer hard coded.
35
63
 
36
- = 1.1.4 - 16-Sep-2010
64
+ ## 1.1.4 - 16-Sep-2010
37
65
  * The File::Temp.temp_name method has been altered on Unix systems. It
38
66
  no longer prefixes TMPDIR to the name since it was redundant and could
39
67
  generate a bogus path.
40
68
  * Set the license to Artistic 2.0.
41
69
  * Set the test task as the default Rake task.
42
70
 
43
- = 1.1.3 - 14-Sep-2010
71
+ ## 1.1.3 - 14-Sep-2010
44
72
  * Fixed potential libc linker failure.
45
73
 
46
- = 1.1.2 - 28-Apr-2010
74
+ ## 1.1.2 - 28-Apr-2010
47
75
  * Explicitly link against libc for Unix versions.
48
76
  * Refactored the Rakefile. An old install task was removed and the gem
49
77
  related tasks were placed under the 'gem' namespace.
50
78
 
51
- = 1.1.1 - 24-Oct-2009
79
+ ## 1.1.1 - 24-Oct-2009
52
80
  * Removed the 'use' library as a dependency.
53
81
 
54
- = 1.1.0 - 21-Oct-2009
82
+ ## 1.1.0 - 21-Oct-2009
55
83
  * Now pure Ruby, using FFI.
56
84
  * Fixed RF Bug #26757 - FILE pointer leak. Thanks go to Eric Wong for the spot.
57
85
  * Renamed and refactored the test file slightly.
58
86
  * Updated the gemspec.
59
87
 
60
- = 1.0.0 - 12-Apr-2008
88
+ ## 1.0.0 - 12-Apr-2008
61
89
  * Added security via umask().
62
90
  * Version bump to 1.0.0.
63
91
 
64
- = 0.1.2 - 6-Jun-2007
92
+ ## 0.1.2 - 6-Jun-2007
65
93
  * Gemspec fix (forgot the temp.h file - oops).
66
94
  * Added an extra test.
67
95
 
68
- = 0.1.1 - 2-Jun-2007
96
+ ## 0.1.1 - 2-Jun-2007
69
97
  * Core code and test case now work properly on MS Windows.
70
98
  * Now uses MS VC++ 8 functions when available (tmpfile_s, _sopen_s).
71
99
 
72
- = 0.1.0 - 1-Jun-2007
100
+ ## 0.1.0 - 1-Jun-2007
73
101
  * Initial release.
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org' do
2
+ gem 'rake'
3
+ gem 'ffi', '~> 1.1'
4
+ group 'test' do
5
+ gem 'rspec', '~> 3.9'
6
+ end
7
+ end
data/LICENSE ADDED
@@ -0,0 +1,177 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
@@ -1,6 +1,7 @@
1
- * CHANGES
2
- * MANIFEST
3
- * README
1
+ * CHANGES.md
2
+ * LICENSE
3
+ * MANIFEST.md
4
+ * README.md
4
5
  * Rakefile
5
6
  * file-temp.gemspec
6
7
  * certs/djberg96_pub.pem
@@ -9,4 +10,4 @@
9
10
  * lib/file/java/temp.rb
10
11
  * lib/file/unix/temp.rb
11
12
  * lib/file/windows/temp.rb
12
- * test/test_file_temp.rb
13
+ * spec/file_temp_spec.rb
@@ -0,0 +1,68 @@
1
+ ## Description
2
+ The file-temp library is an alternate way to handle tempfile generation.
3
+
4
+ ## Requirements
5
+ * ffi 1.1.0 or later
6
+
7
+ ## Installation
8
+ `gem install file-temp`
9
+
10
+ ## Synopsis
11
+ ```
12
+ require 'file/temp'
13
+
14
+ fh = File::Temp.new
15
+ fh.puts "hello"
16
+ fh.close # => Tempfile automatically deleted
17
+
18
+ fh = File::Temp.new(delete: false)
19
+ fh.puts "world"
20
+ fh.close # => Tempfile still on your filesystem
21
+ ```
22
+
23
+ ## Motivation
24
+ Unlike the tempfile library that ships with Ruby's standard library, this
25
+ library uses your system's native `tmpfile` or `mkstemp` functions.
26
+
27
+ This library is also more secure because it restricts file permission via
28
+ `umask` for files created with `mkstemp`.
29
+
30
+ Finally, this library subclasses the File class. This means you get almost
31
+ exactly the same interface as the File class. The only difference is the
32
+ constructor.
33
+
34
+ Note that my original motivation was a problem with race conditions in
35
+ the tempfile library, but that was a very long time ago, and my assumption
36
+ at this point is that it's no longer true. But, I still prefer this version
37
+ to the one in the Ruby standard library.
38
+
39
+ ## JRuby
40
+ The implementation for JRuby uses the Java API, not the C API. The
41
+ temporary file name generated by Java is different than the C version,
42
+ since it uses a GUID instead of the 'XXXXXX' template, but the
43
+ interface is otherwise identical.
44
+
45
+ ## MS Windows
46
+ You may need to use the mingw build in order to use this library.
47
+
48
+ Also, there was a bug with the `GetTempFileName` function on certain versions
49
+ of MS Windows that may cause a failure. However, if you'r patched up you
50
+ should not see it.
51
+
52
+ ## License
53
+ Apache-2.0
54
+
55
+ ## Copyright
56
+ (C) 2007-2020 Daniel J. Berger
57
+ All Rights Reserved
58
+
59
+ ## Warranty
60
+ This library is provided "as is" and without any express or
61
+ implied warranties, including, without limitation, the implied
62
+ warranties of merchantability and fitness for a particular purpose.
63
+
64
+ ## Author
65
+ Daniel J. Berger
66
+
67
+ ## See also
68
+ tmpfile(), mkstemp(), tmpnam()
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'rake'
2
2
  require 'rake/clean'
3
- require 'rake/testtask'
3
+ require 'rspec/core/rake_task'
4
4
 
5
5
  CLEAN.include('**/*.tar', '**/*.zip', '**/*.gz', '**/*.bz2')
6
6
  CLEAN.include('**/*.rbc', '**/*.gem', '**/*.tmp')
@@ -21,43 +21,7 @@ namespace 'gem' do
21
21
  end
22
22
  end
23
23
 
24
- # Export the contents of the library to an archive. Note that this requires
25
- # presence of the .gitattributes file in order to prevent the .git contents
26
- # from being included.
27
- #
28
- # It also appears that I must add a trailing slash to the prefix manually.
29
- # As of git 1.6.4.3 it does not automaticaly add it, despite what the docs
30
- # say.
31
- #
32
- namespace 'export' do
33
- spec = eval(IO.read('file-temp.gemspec'))
34
- file = 'file-temp-' + spec.version.to_s
35
- pref = file + '/' # Git does not add the trailing slash, despite what the docs say.
24
+ desc 'Run the test suite for the file-temp library'
25
+ RSpec::Core::RakeTask.new(:spec)
36
26
 
37
- desc 'Export to a .tar.gz file'
38
- task :gzip => [:clean] do
39
- file += '.tar'
40
- sh "git archive --prefix #{pref} --output #{file} master"
41
- sh "gzip #{file}"
42
- end
43
-
44
- desc 'Export to a .tar.bz2 file'
45
- task :bzip2 => [:clean] do
46
- file += '.tar'
47
- sh "git archive --prefix #{pref} --output #{file} master"
48
- sh "bzip2 -f #{file}"
49
- end
50
-
51
- desc 'Export to a .zip file'
52
- task :zip => [:clean] do
53
- file += '.zip'
54
- sh "git archive --prefix #{pref} --output #{file} --format zip master"
55
- end
56
- end
57
-
58
- Rake::TestTask.new do |t|
59
- t.verbose = true
60
- t.warning = true
61
- end
62
-
63
- task :default => :test
27
+ task :default => :spec