file-temp 1.1.0 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +8 -0
- data/README +4 -7
- data/Rakefile +55 -18
- data/file-temp.gemspec +20 -21
- data/lib/file/temp.rb +3 -1
- data/test/test_file_temp.rb +1 -1
- metadata +3 -13
data/CHANGES
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
= 1.1.2 - 28-Apr-2010
|
2
|
+
* Explicitly link against libc for Unix versions.
|
3
|
+
* Refactored the Rakefile. An old install task was removed and the gem
|
4
|
+
related tasks were placed under the 'gem' namespace.
|
5
|
+
|
6
|
+
= 1.1.1 - 24-Oct-2009
|
7
|
+
* Removed the 'use' library as a dependency.
|
8
|
+
|
1
9
|
= 1.1.0 - 21-Oct-2009
|
2
10
|
* Now pure Ruby, using FFI.
|
3
11
|
* Fixed RF Bug #26757 - FILE pointer leak. Thanks go to Eric Wong for the spot.
|
data/README
CHANGED
@@ -31,15 +31,12 @@
|
|
31
31
|
This library is also more secure because it restricts file permission via
|
32
32
|
umask() for files created with mkstemp().
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
has disabled all the trackers and mailing lists on the RubyForge project
|
38
|
-
site, as well as online SCM access. So, if he doesn't want feedback, I'm
|
39
|
-
not going to waste time with it.
|
34
|
+
Finally, this library subclasses the File class. This means you get almost
|
35
|
+
exactly the same interface as the File class. The only difference is the
|
36
|
+
constructor.
|
40
37
|
|
41
38
|
== JRuby
|
42
|
-
As of JRuby 1.
|
39
|
+
As of JRuby 1.4.0 this library will not work with JRuby because it does
|
43
40
|
not support low level systems programming.
|
44
41
|
|
45
42
|
== MS Windows
|
data/Rakefile
CHANGED
@@ -1,27 +1,64 @@
|
|
1
1
|
require 'rake'
|
2
2
|
require 'rake/testtask'
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
3
|
+
|
4
|
+
desc 'Remove all gem and archive files from the project'
|
5
|
+
task :clean do
|
6
|
+
Dir['*.gem'].each{ |f| File.delete(f) }
|
7
|
+
Dir['*.tar'].each{ |f| File.delete(f) }
|
8
|
+
Dir['*.zip'].each{ |f| File.delete(f) }
|
9
|
+
Dir['*.gz'].each{ |f| File.delete(f) }
|
10
|
+
Dir['*.bz2'].each{ |f| File.delete(f) }
|
11
|
+
end
|
12
|
+
|
13
|
+
namespace 'gem' do
|
14
|
+
desc 'Create the file-temp gem'
|
15
|
+
task :create => [:clean] do
|
16
|
+
spec = eval(IO.read('file-temp.gemspec'))
|
17
|
+
Gem::Builder.new(spec).build
|
18
|
+
end
|
19
|
+
|
20
|
+
desc 'Install the file-temp gem'
|
21
|
+
task :install => [:create] do
|
22
|
+
file = Dir["*.gem"].first
|
23
|
+
sh "gem install #{file}"
|
24
|
+
end
|
11
25
|
end
|
12
26
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
27
|
+
# Export the contents of the library to an archive. Note that this requires
|
28
|
+
# presence of the .gitattributes file in order to prevent the .git contents
|
29
|
+
# from being included.
|
30
|
+
#
|
31
|
+
# It also appears that I must add a trailing slash to the prefix manually.
|
32
|
+
# As of git 1.6.4.3 it does not automaticaly add it, despite what the docs
|
33
|
+
# say.
|
34
|
+
#
|
35
|
+
namespace 'export' do
|
36
|
+
spec = eval(IO.read('file-temp.gemspec'))
|
37
|
+
file = 'file-temp-' + spec.version.to_s
|
38
|
+
pref = file + '/' # Git does not add the trailing slash, despite what the docs say.
|
39
|
+
|
40
|
+
desc 'Export to a .tar.gz file'
|
41
|
+
task :gzip => [:clean] do
|
42
|
+
file += '.tar'
|
43
|
+
sh "git archive --prefix #{pref} --output #{file} master"
|
44
|
+
sh "gzip #{file}"
|
45
|
+
end
|
46
|
+
|
47
|
+
desc 'Export to a .tar.bz2 file'
|
48
|
+
task :bzip2 => [:clean] do
|
49
|
+
file += '.tar'
|
50
|
+
sh "git archive --prefix #{pref} --output #{file} master"
|
51
|
+
sh "bzip2 -f #{file}"
|
52
|
+
end
|
17
53
|
|
18
|
-
desc '
|
19
|
-
task :
|
20
|
-
|
21
|
-
|
54
|
+
desc 'Export to a .zip file'
|
55
|
+
task :zip => [:clean] do
|
56
|
+
file += '.zip'
|
57
|
+
sh "git archive --prefix #{pref} --output #{file} --format zip master"
|
58
|
+
end
|
22
59
|
end
|
23
60
|
|
24
61
|
Rake::TestTask.new do |t|
|
25
|
-
|
26
|
-
|
62
|
+
t.verbose = true
|
63
|
+
t.warning = true
|
27
64
|
end
|
data/file-temp.gemspec
CHANGED
@@ -1,27 +1,26 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
|
3
|
-
Gem::Specification.new do |
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = 'file-temp'
|
5
|
+
spec.version = '1.1.2'
|
6
|
+
spec.author = 'Daniel J. Berger'
|
7
|
+
spec.email = 'djberg96@gmail.com'
|
8
|
+
spec.homepage = 'http://www.rubyforge.org/projects/shards'
|
9
|
+
spec.summary = 'An alternative way to generate temp files'
|
10
|
+
spec.test_file = 'test/test_file_temp.rb'
|
11
|
+
spec.has_rdoc = true
|
12
|
+
spec.files = Dir['**/*'].delete_if{ |item| item.include?('git') }
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
spec.extra_rdoc_files = ['CHANGES', 'README', 'MANIFEST']
|
15
|
+
spec.rubyforge_project = 'shards'
|
16
|
+
spec.required_ruby_version = '>= 1.8.6'
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
gem.add_development_dependency('test-unit', '>= 2.0.3')
|
18
|
+
spec.add_dependency('ffi', '>= 0.5.0')
|
19
|
+
spec.add_development_dependency('test-unit', '>= 2.0.3')
|
21
20
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
21
|
+
spec.description = <<-EOF
|
22
|
+
The file-temp library provides an alternative approach to generating
|
23
|
+
temporary files. Features included improved security, a superior
|
24
|
+
interface, and better support for MS Windows.
|
25
|
+
EOF
|
27
26
|
end
|
data/lib/file/temp.rb
CHANGED
@@ -44,6 +44,8 @@ class File::Temp < File
|
|
44
44
|
FILE_FLAG_DELETE_ON_CLOSE = 0x04000000
|
45
45
|
INVALID_HANDLE_VALUE = -1
|
46
46
|
else
|
47
|
+
ffi_lib 'libc'
|
48
|
+
|
47
49
|
attach_function 'fileno', [:pointer], :int
|
48
50
|
attach_function 'mkstemp', [:string], :int
|
49
51
|
attach_function 'umask', [:int], :int
|
@@ -57,7 +59,7 @@ class File::Temp < File
|
|
57
59
|
# :startdoc:
|
58
60
|
|
59
61
|
# The version of the file-temp library.
|
60
|
-
VERSION = '1.1.
|
62
|
+
VERSION = '1.1.2'
|
61
63
|
|
62
64
|
if WINDOWS
|
63
65
|
# The temporary directory used on MS Windows.
|
data/test/test_file_temp.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: file-temp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
@@ -9,19 +9,9 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-04-28 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
16
|
-
name: use
|
17
|
-
type: :runtime
|
18
|
-
version_requirement:
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 1.3.1
|
24
|
-
version:
|
25
15
|
- !ruby/object:Gem::Dependency
|
26
16
|
name: ffi
|
27
17
|
type: :runtime
|
@@ -42,7 +32,7 @@ dependencies:
|
|
42
32
|
- !ruby/object:Gem::Version
|
43
33
|
version: 2.0.3
|
44
34
|
version:
|
45
|
-
description: "
|
35
|
+
description: " The file-temp library provides an alternative approach to generating\n temporary files. Features included improved security, a superior\n interface, and better support for MS Windows.\n"
|
46
36
|
email: djberg96@gmail.com
|
47
37
|
executables: []
|
48
38
|
|