rd2odt 0.1.0 → 0.1.1
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/NEWS +7 -0
- data/Rakefile +1 -1
- data/lib/rd2odt/compat/ruby-1.8.6.rb +86 -0
- data/lib/rd2odt.rb +2 -0
- data/rd2odt.gemspec +3 -2
- metadata +12 -7
data/NEWS
CHANGED
data/Rakefile
CHANGED
@@ -0,0 +1,86 @@
|
|
1
|
+
# This part is from Ruby 1.8.7's tmpdir.rb.
|
2
|
+
|
3
|
+
class Dir
|
4
|
+
# Dir.mktmpdir creates a temporary directory.
|
5
|
+
#
|
6
|
+
# The directory is created with 0700 permission.
|
7
|
+
#
|
8
|
+
# The prefix and suffix of the name of the directory is specified by
|
9
|
+
# the optional first argument, <i>prefix_suffix</i>.
|
10
|
+
# - If it is not specified or nil, "d" is used as the prefix and no suffix is used.
|
11
|
+
# - If it is a string, it is used as the prefix and no suffix is used.
|
12
|
+
# - If it is an array, first element is used as the prefix and second element is used as a suffix.
|
13
|
+
#
|
14
|
+
# Dir.mktmpdir {|dir| dir is ".../d..." }
|
15
|
+
# Dir.mktmpdir("foo") {|dir| dir is ".../foo..." }
|
16
|
+
# Dir.mktmpdir(["foo", "bar"]) {|dir| dir is ".../foo...bar" }
|
17
|
+
#
|
18
|
+
# The directory is created under Dir.tmpdir or
|
19
|
+
# the optional second argument <i>tmpdir</i> if non-nil value is given.
|
20
|
+
#
|
21
|
+
# Dir.mktmpdir {|dir| dir is "#{Dir.tmpdir}/d..." }
|
22
|
+
# Dir.mktmpdir(nil, "/var/tmp") {|dir| dir is "/var/tmp/d..." }
|
23
|
+
#
|
24
|
+
# If a block is given,
|
25
|
+
# it is yielded with the path of the directory.
|
26
|
+
# The directory and its contents are removed
|
27
|
+
# using FileUtils.remove_entry_secure before Dir.mktmpdir returns.
|
28
|
+
# The value of the block is returned.
|
29
|
+
#
|
30
|
+
# Dir.mktmpdir {|dir|
|
31
|
+
# # use the directory...
|
32
|
+
# open("#{dir}/foo", "w") { ... }
|
33
|
+
# }
|
34
|
+
#
|
35
|
+
# If a block is not given,
|
36
|
+
# The path of the directory is returned.
|
37
|
+
# In this case, Dir.mktmpdir doesn't remove the directory.
|
38
|
+
#
|
39
|
+
# dir = Dir.mktmpdir
|
40
|
+
# begin
|
41
|
+
# # use the directory...
|
42
|
+
# open("#{dir}/foo", "w") { ... }
|
43
|
+
# ensure
|
44
|
+
# # remove the directory.
|
45
|
+
# FileUtils.remove_entry_secure dir
|
46
|
+
# end
|
47
|
+
#
|
48
|
+
def Dir.mktmpdir(prefix_suffix=nil, tmpdir=nil)
|
49
|
+
case prefix_suffix
|
50
|
+
when nil
|
51
|
+
prefix = "d"
|
52
|
+
suffix = ""
|
53
|
+
when String
|
54
|
+
prefix = prefix_suffix
|
55
|
+
suffix = ""
|
56
|
+
when Array
|
57
|
+
prefix = prefix_suffix[0]
|
58
|
+
suffix = prefix_suffix[1]
|
59
|
+
else
|
60
|
+
raise ArgumentError, "unexpected prefix_suffix: #{prefix_suffix.inspect}"
|
61
|
+
end
|
62
|
+
tmpdir ||= Dir.tmpdir
|
63
|
+
t = Time.now.strftime("%Y%m%d")
|
64
|
+
n = nil
|
65
|
+
begin
|
66
|
+
path = "#{tmpdir}/#{prefix}#{t}-#{$$}-#{rand(0x100000000).to_s(36)}"
|
67
|
+
path << "-#{n}" if n
|
68
|
+
path << suffix
|
69
|
+
Dir.mkdir(path, 0700)
|
70
|
+
rescue Errno::EEXIST
|
71
|
+
n ||= 0
|
72
|
+
n += 1
|
73
|
+
retry
|
74
|
+
end
|
75
|
+
|
76
|
+
if block_given?
|
77
|
+
begin
|
78
|
+
yield path
|
79
|
+
ensure
|
80
|
+
FileUtils.remove_entry_secure path
|
81
|
+
end
|
82
|
+
else
|
83
|
+
path
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
data/lib/rd2odt.rb
CHANGED
data/rd2odt.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "rd2odt"
|
3
|
-
s.version = "0.1.
|
3
|
+
s.version = "0.1.1"
|
4
4
|
|
5
5
|
s.authors = "Yuya.Nishida."
|
6
6
|
s.email = "yuyaAT@ATj96DOT.DOTorg"
|
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.rubyforge_project = s.name
|
9
9
|
s.homepage = "http://rubyforge.org/projects/#{s.name}/"
|
10
10
|
s.platform = Gem::Platform::RUBY
|
11
|
-
s.required_ruby_version = ">= 1.8.
|
11
|
+
s.required_ruby_version = ">= 1.8.6"
|
12
12
|
s.rubygems_version = ">= 1.3.0"
|
13
13
|
s.requirements << "rubyzip"
|
14
14
|
s.require_paths = ["lib", "lib/rd2odt/rdtool"]
|
@@ -26,6 +26,7 @@ EOF
|
|
26
26
|
|
27
27
|
# "lib/**/*.rb",
|
28
28
|
"lib/rd2odt.rb",
|
29
|
+
"lib/rd2odt/compat/ruby-1.8.6.rb",
|
29
30
|
"lib/rd2odt/rdtool/NOTICE.rd2odt",
|
30
31
|
"lib/rd2odt/rdtool/README.rd",
|
31
32
|
"lib/rd2odt/rdtool/README.rd.ja",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rd2odt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuya.Nishida.
|
@@ -9,11 +9,13 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-07-01 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
16
|
-
description:
|
16
|
+
description: |
|
17
|
+
RD(Ruby Document) to OpenDocument converter.
|
18
|
+
|
17
19
|
email: yuyaAT@ATj96DOT.DOTorg
|
18
20
|
executables:
|
19
21
|
- rd2odt
|
@@ -24,6 +26,7 @@ extra_rdoc_files: []
|
|
24
26
|
files:
|
25
27
|
- bin/rd2odt
|
26
28
|
- lib/rd2odt.rb
|
29
|
+
- lib/rd2odt/compat/ruby-1.8.6.rb
|
27
30
|
- lib/rd2odt/rdtool/NOTICE.rd2odt
|
28
31
|
- lib/rd2odt/rdtool/README.rd
|
29
32
|
- lib/rd2odt/rdtool/README.rd.ja
|
@@ -91,8 +94,10 @@ files:
|
|
91
94
|
- NEWS
|
92
95
|
- LICENSE
|
93
96
|
- setup.rb
|
94
|
-
has_rdoc:
|
97
|
+
has_rdoc: true
|
95
98
|
homepage: http://rubyforge.org/projects/rd2odt/
|
99
|
+
licenses: []
|
100
|
+
|
96
101
|
post_install_message:
|
97
102
|
rdoc_options: []
|
98
103
|
|
@@ -103,7 +108,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
103
108
|
requirements:
|
104
109
|
- - ">="
|
105
110
|
- !ruby/object:Gem::Version
|
106
|
-
version: 1.8.
|
111
|
+
version: 1.8.6
|
107
112
|
version:
|
108
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
114
|
requirements:
|
@@ -114,9 +119,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
119
|
requirements:
|
115
120
|
- rubyzip
|
116
121
|
rubyforge_project: rd2odt
|
117
|
-
rubygems_version: 1.3.
|
122
|
+
rubygems_version: 1.3.4
|
118
123
|
signing_key:
|
119
|
-
specification_version:
|
124
|
+
specification_version: 3
|
120
125
|
summary: RD(Ruby Document) to OpenDocument converter.
|
121
126
|
test_files: []
|
122
127
|
|