file-temp 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
- == Other libraries
35
- I am aware of Cian Synnott's ruby-stemp project. However, I don't like the
36
- interface, it's GNU-centric (which causes portability issues), and Cian
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.3.1 this library will not work with JRuby because it does
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
- require 'rbconfig'
4
-
5
- desc 'Install the file-temp library (non-gem)'
6
- task :install do
7
- dir = File.join(CONFIG['sitelibdir'], 'file')
8
- Dir.mkdir(dir) unless File.exists?(dir)
9
- file = 'lib/file/temp.rb'
10
- FileUtils.cp_r(file, dir, :verbose => true)
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
- desc 'Build the gem'
14
- task :gem do
15
- spec = eval(IO.read('file-temp.gemspec'))
16
- Gem::Builder.new(spec).build
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 'Install the file-temp library as a gem'
19
- task :install_gem => [:gem] do
20
- file = Dir["*.gem"].first
21
- sh "gem install #{file}"
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
- t.verbose = true
26
- t.warning = true
62
+ t.verbose = true
63
+ t.warning = true
27
64
  end
@@ -1,27 +1,26 @@
1
1
  require 'rubygems'
2
2
 
3
- Gem::Specification.new do |gem|
4
- gem.name = 'file-temp'
5
- gem.version = '1.1.0'
6
- gem.author = 'Daniel J. Berger'
7
- gem.email = 'djberg96@gmail.com'
8
- gem.homepage = 'http://www.rubyforge.org/projects/shards'
9
- gem.summary = 'An alternative way to generate temp files'
10
- gem.test_file = 'test/test_file_temp.rb'
11
- gem.has_rdoc = true
12
- gem.files = Dir['**/*'].delete_if{ |item| item.include?('CVS') }
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
- gem.extra_rdoc_files = ['CHANGES', 'README', 'MANIFEST']
15
- gem.rubyforge_project = 'shards'
16
- gem.required_ruby_version = '>= 1.8.6'
14
+ spec.extra_rdoc_files = ['CHANGES', 'README', 'MANIFEST']
15
+ spec.rubyforge_project = 'shards'
16
+ spec.required_ruby_version = '>= 1.8.6'
17
17
 
18
- gem.add_dependency('use', '>= 1.3.1')
19
- gem.add_dependency('ffi', '>= 0.5.0')
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
- gem.description = <<-EOF
23
- The file-temp library provides an alternative approach to generating
24
- temporary files. Features included improved security, a superior
25
- interface, and better support for MS Windows.
26
- EOF
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
@@ -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.0'
62
+ VERSION = '1.1.2'
61
63
 
62
64
  if WINDOWS
63
65
  # The temporary directory used on MS Windows.
@@ -22,7 +22,7 @@ class TC_File_Temp < Test::Unit::TestCase
22
22
  end
23
23
 
24
24
  def test_file_temp_version
25
- assert_equal('1.1.0', File::Temp::VERSION)
25
+ assert_equal('1.1.2', File::Temp::VERSION)
26
26
  end
27
27
 
28
28
  def test_file_temp_threaded
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.0
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: 2009-10-21 00:00:00 -06:00
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: " 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"
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