rbbt-util 5.28.8 → 5.28.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/entity.rb +1 -1
- data/lib/rbbt/fix_width_table.rb +5 -4
- data/lib/rbbt/hpc.rb +6 -4
- data/lib/rbbt/persist.rb +9 -4
- data/lib/rbbt/persist/tsv/adapter.rb +0 -1
- data/lib/rbbt/persist/tsv/fix_width_table.rb +5 -3
- data/lib/rbbt/resource.rb +12 -6
- data/lib/rbbt/resource/path.rb +1 -1
- data/lib/rbbt/tsv/attach.rb +7 -4
- data/lib/rbbt/tsv/dumper.rb +6 -2
- data/lib/rbbt/tsv/parallel.rb +0 -3
- data/lib/rbbt/util/R.rb +2 -2
- data/lib/rbbt/util/cmd.rb +10 -0
- data/lib/rbbt/util/misc/bgzf.rb +1 -1
- data/lib/rbbt/util/misc/indiferent_hash.rb +8 -0
- data/lib/rbbt/util/misc/inspect.rb +11 -7
- data/lib/rbbt/util/named_array.rb +1 -1
- data/lib/rbbt/util/open.rb +17 -16
- data/lib/rbbt/workflow/accessor.rb +1 -1
- data/lib/rbbt/workflow/definition.rb +3 -1
- data/lib/rbbt/workflow/integration/ansible.rb +53 -0
- data/lib/rbbt/workflow/integration/ansible/workflow.rb +60 -0
- data/lib/rbbt/workflow/step.rb +8 -0
- data/lib/rbbt/workflow/step/accessor.rb +23 -13
- data/lib/rbbt/workflow/step/dependencies.rb +8 -2
- data/lib/rbbt/workflow/step/run.rb +22 -19
- data/lib/rbbt/workflow/util/archive.rb +2 -0
- data/lib/rbbt/workflow/util/orchestrator.rb +49 -11
- data/lib/rbbt/workflow/util/provenance.rb +7 -3
- data/share/rbbt_commands/ansible +55 -0
- data/share/rbbt_commands/purge_job +0 -1
- data/share/rbbt_commands/system/status +22 -22
- data/share/rbbt_commands/workflow/forget_deps +9 -0
- data/share/rbbt_commands/workflow/info +12 -9
- data/share/rbbt_commands/workflow/prov +2 -1
- data/test/rbbt/association/test_index.rb +6 -6
- data/test/rbbt/knowledge_base/test_query.rb +3 -3
- data/test/rbbt/knowledge_base/test_registry.rb +1 -1
- data/test/rbbt/persist/tsv/test_cdb.rb +0 -7
- data/test/rbbt/persist/tsv/test_kyotocabinet.rb +2 -8
- data/test/rbbt/persist/tsv/test_leveldb.rb +0 -6
- data/test/rbbt/persist/tsv/test_lmdb.rb +0 -6
- data/test/rbbt/persist/tsv/test_tokyocabinet.rb +15 -14
- data/test/rbbt/test_entity.rb +0 -1
- data/test/rbbt/test_knowledge_base.rb +3 -4
- data/test/rbbt/test_persist.rb +10 -6
- data/test/rbbt/test_workflow.rb +49 -16
- data/test/rbbt/tsv/test_accessor.rb +11 -0
- data/test/rbbt/tsv/test_attach.rb +86 -8
- data/test/rbbt/tsv/test_index.rb +6 -7
- data/test/rbbt/tsv/test_manipulate.rb +2 -3
- data/test/rbbt/util/R/test_model.rb +2 -1
- data/test/rbbt/util/R/test_plot.rb +0 -2
- data/test/rbbt/util/concurrency/test_processes.rb +1 -1
- data/test/rbbt/util/misc/test_bgzf.rb +11 -7
- data/test/rbbt/util/misc/test_lock.rb +0 -1
- data/test/rbbt/util/misc/test_multipart_payload.rb +1 -1
- data/test/rbbt/util/misc/test_pipes.rb +0 -5
- data/test/rbbt/util/test_R.rb +1 -0
- data/test/rbbt/util/test_log.rb +4 -6
- data/test/rbbt/util/test_misc.rb +0 -2
- data/test/rbbt/util/test_open.rb +0 -1
- data/test/rbbt/util/test_python.rb +17 -1
- data/test/rbbt/workflow/test_remote_workflow.rb +1 -1
- data/test/rbbt/workflow/test_step.rb +8 -3
- data/test/rbbt/workflow/util/test_orchestrator.rb +155 -18
- metadata +5 -4
- data/test/rbbt/workflow/remote/test_client.rb +0 -56
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74253d97dc17c890ce9022e38ccd514847e785b69f4cfd74a8a5333a9aa1c97d
|
4
|
+
data.tar.gz: d908fecdec1c5e6ccce81b3190883011d775f38cab689c136e7c90808c3c93ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c6b8f81e5f814a35ed3b738ad85d4e7314b9fb24b36ecdb3828d1d4644cc8b9ce4117c862ae7baa0bd7f60362e93be2aff282a2d24c474e327d1d5948f56fff
|
7
|
+
data.tar.gz: 3a6235b141f139f245935b8858b175b2d54302b89dc3ac10101ffddfd10d1161760aaf0f176114a4fc6d8f0b8aa17556b8637e2f2ab815dcf875ea98c4825921
|
data/lib/rbbt/entity.rb
CHANGED
data/lib/rbbt/fix_width_table.rb
CHANGED
@@ -67,7 +67,7 @@ class FixWidthTable
|
|
67
67
|
|
68
68
|
def format(pos, value)
|
69
69
|
padding = value_size - value.length
|
70
|
-
if range
|
70
|
+
if @range
|
71
71
|
(pos + [padding, value + ("\0" * padding)]).pack("llll#{mask}")
|
72
72
|
else
|
73
73
|
[pos, padding, value + ("\0" * padding)].pack("ll#{mask}")
|
@@ -105,7 +105,7 @@ class FixWidthTable
|
|
105
105
|
|
106
106
|
def idx_value(index)
|
107
107
|
return nil if index < 0 or index >= size
|
108
|
-
@file.seek((range ? 17 : 9 ) + (record_size) * index, IO::SEEK_SET)
|
108
|
+
@file.seek((@range ? 17 : 9 ) + (record_size) * index, IO::SEEK_SET)
|
109
109
|
padding = @file.read(4).unpack("l").first+1
|
110
110
|
txt = @file.read(value_size)
|
111
111
|
str = txt.unpack(mask).first
|
@@ -277,7 +277,8 @@ class FixWidthTable
|
|
277
277
|
|
278
278
|
def [](pos)
|
279
279
|
return [] if size == 0
|
280
|
-
|
280
|
+
self.read
|
281
|
+
if @range
|
281
282
|
get_range(pos)
|
282
283
|
else
|
283
284
|
get_point(pos)
|
@@ -286,7 +287,7 @@ class FixWidthTable
|
|
286
287
|
|
287
288
|
def overlaps(pos, value = false)
|
288
289
|
return [] if size == 0
|
289
|
-
idxs = if range
|
290
|
+
idxs = if @range
|
290
291
|
get_range(pos, true)
|
291
292
|
else
|
292
293
|
get_point(pos, true)
|
data/lib/rbbt/hpc.rb
CHANGED
@@ -98,6 +98,8 @@ module Marenostrum
|
|
98
98
|
#SBATCH --nodes="#{nodes}"
|
99
99
|
EOF
|
100
100
|
|
101
|
+
prep = ""
|
102
|
+
|
101
103
|
if highmem
|
102
104
|
header +=<<-EOF
|
103
105
|
#SBATCH --constraint=highmem
|
@@ -122,7 +124,7 @@ module Marenostrum
|
|
122
124
|
module load java
|
123
125
|
|
124
126
|
# Calculate max available memory
|
125
|
-
let "MAX_MEMORY=$SLURM_MEM_PER_CPU * $
|
127
|
+
let "MAX_MEMORY=$SLURM_MEM_PER_CPU * $SLURM_CPUS_PER_TASK"
|
126
128
|
EOF
|
127
129
|
|
128
130
|
|
@@ -146,8 +148,6 @@ SINGULARITY_RUBY_INLINE="$HOME/.singularity_ruby_inline"
|
|
146
148
|
mkdir -p "$SINGULARITY_RUBY_INLINE"
|
147
149
|
EOF
|
148
150
|
|
149
|
-
prep = ""
|
150
|
-
|
151
151
|
if contain
|
152
152
|
scratch_group_dir = File.join('/gpfs/scratch/', group)
|
153
153
|
projects_group_dir = File.join('/gpfs/projects/', group)
|
@@ -172,7 +172,7 @@ cp ~/.rbbt/etc/environment $CONTAINER_DIR/.rbbt/etc/
|
|
172
172
|
# Set search_paths
|
173
173
|
echo "singularity: /singularity_opt/{PKGDIR}/{TOPLEVEL}/{SUBPATH}" > $CONTAINER_DIR/.rbbt/etc/search_paths
|
174
174
|
echo "rbbt_user: /home/rbbt/.rbbt/{TOPLEVEL}/{SUBPATH}" >> $CONTAINER_DIR/.rbbt/etc/search_paths
|
175
|
-
echo "
|
175
|
+
echo "outside_home: $CONTAINER_DIR/home/{TOPLEVEL}/{SUBPATH}" >> $CONTAINER_DIR/.rbbt/etc/search_paths
|
176
176
|
echo "group_projects: #{projects_group_dir}/{PKGDIR}/{TOPLEVEL}/{SUBPATH}" >> $CONTAINER_DIR/.rbbt/etc/search_paths
|
177
177
|
echo "group_scratch: #{scratch_group_dir}/{PKGDIR}/{TOPLEVEL}/{SUBPATH}" >> $CONTAINER_DIR/.rbbt/etc/search_paths
|
178
178
|
echo "user_projects: #{projects_group_dir}/#{user}/{PKGDIR}/{TOPLEVEL}/{SUBPATH}" >> $CONTAINER_DIR/.rbbt/etc/search_paths
|
@@ -214,6 +214,8 @@ singularity exec -e -C -H "$CONTAINER_DIR" "$SINGULARITY_IMG" rm -Rfv .rbbt/var/
|
|
214
214
|
singularity exec -e -C -H "$CONTAINER_DIR" "$SINGULARITY_IMG" rbbt system clean -f &>> #{fsync}
|
215
215
|
singularity exec -e -C -H "$CONTAINER_DIR" "$SINGULARITY_IMG" rm -Rfv tmp/ &>> #{fsync}
|
216
216
|
EOF
|
217
|
+
else
|
218
|
+
prep = ""
|
217
219
|
end
|
218
220
|
end
|
219
221
|
end
|
data/lib/rbbt/persist.rb
CHANGED
@@ -25,13 +25,18 @@ module Persist
|
|
25
25
|
MEMORY = {} unless defined? MEMORY
|
26
26
|
MAX_FILE_LENGTH = 150
|
27
27
|
|
28
|
-
#
|
29
|
-
def self.newer?(path, file)
|
28
|
+
# Is 'file' newer than 'path'? return non-true if path is newer than file
|
29
|
+
def self.newer?(path, file, by_link = false)
|
30
30
|
return true if not Open.exists?(file)
|
31
31
|
path = path.find if Path === path
|
32
32
|
file = file.find if Path === file
|
33
|
-
|
34
|
-
|
33
|
+
if by_link
|
34
|
+
patht = File.exists?(path) ? File.lstat(path).mtime : nil
|
35
|
+
filet = File.exists?(file) ? File.lstat(file).mtime : nil
|
36
|
+
else
|
37
|
+
patht = Open.mtime(path)
|
38
|
+
filet = Open.mtime(file)
|
39
|
+
end
|
35
40
|
return true if patht.nil? || filet.nil?
|
36
41
|
diff = patht - filet
|
37
42
|
return diff if diff < 0
|
@@ -52,7 +52,7 @@ module Persist
|
|
52
52
|
if TSV::ENTRY_KEYS.include? key
|
53
53
|
set_metadata(key, value)
|
54
54
|
else
|
55
|
-
if range
|
55
|
+
if @range
|
56
56
|
add_range_point key, value
|
57
57
|
else
|
58
58
|
add key, value
|
@@ -61,7 +61,7 @@ module Persist
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def add(key, value)
|
64
|
-
key = pos_function.call(key) if pos_function and not (range and Array === key)
|
64
|
+
key = pos_function.call(key) if pos_function and not (@range and Array === key)
|
65
65
|
super(key, value)
|
66
66
|
end
|
67
67
|
|
@@ -85,8 +85,10 @@ module Persist
|
|
85
85
|
end
|
86
86
|
|
87
87
|
def each
|
88
|
+
read
|
88
89
|
@size.times do |i|
|
89
|
-
|
90
|
+
v = idx_value(i)
|
91
|
+
yield i, v
|
90
92
|
end
|
91
93
|
end
|
92
94
|
|
data/lib/rbbt/resource.rb
CHANGED
@@ -112,13 +112,19 @@ module Resource
|
|
112
112
|
end
|
113
113
|
when Net::HTTPRedirection, Net::HTTPFound
|
114
114
|
location = response['location']
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
115
|
+
if location.include? 'get_directory'
|
116
|
+
Log.debug("Feching directory from: #{location}. Into: #{final_path}")
|
117
|
+
FileUtils.mkdir_p final_path unless File.exist? final_path
|
118
|
+
TmpFile.with_file do |tmp_dir|
|
119
|
+
Misc.in_dir tmp_dir do
|
120
|
+
CMD.cmd('tar xvfz -', :in => Open.open(location, :nocache => true))
|
121
|
+
end
|
122
|
+
FileUtils.mv tmp_dir, final_path
|
123
|
+
end
|
124
|
+
else
|
125
|
+
Open.open(location, :nocache => true) do |s|
|
126
|
+
Misc.sensiblewrite(final_path, s)
|
120
127
|
end
|
121
|
-
FileUtils.mv tmp_dir, final_path
|
122
128
|
end
|
123
129
|
when Net::HTTPInternalServerError
|
124
130
|
@server_missing_resource_cache << url
|
data/lib/rbbt/resource/path.rb
CHANGED
data/lib/rbbt/tsv/attach.rb
CHANGED
@@ -243,6 +243,7 @@ module TSV
|
|
243
243
|
Log.debug("Attachment of fields:#{Misc.fingerprint fields } from #{other.filename.inspect} finished.")
|
244
244
|
|
245
245
|
if complete
|
246
|
+
Log.warn "Attaching through index and completing empty rows; keys with wrong format may appear (#{other.key_field} insted of #{self.key_field})" if index
|
246
247
|
fill = TrueClass === complete ? nil : complete
|
247
248
|
field_length = self.fields.length
|
248
249
|
common_fields = (other.fields & self.fields)
|
@@ -255,11 +256,11 @@ module TSV
|
|
255
256
|
case type
|
256
257
|
when :single
|
257
258
|
missing.each do |k|
|
258
|
-
self[k] =
|
259
|
+
self[k] = fill
|
259
260
|
end
|
260
261
|
when :list
|
261
262
|
missing.each do |k|
|
262
|
-
values = [
|
263
|
+
values = [fill] * field_length
|
263
264
|
other_values = other[k]
|
264
265
|
other_common_pos.zip(this_common_pos).each do |o,t|
|
265
266
|
values[t] = other_values[o]
|
@@ -267,8 +268,9 @@ module TSV
|
|
267
268
|
self[k] = values
|
268
269
|
end
|
269
270
|
when :double
|
271
|
+
fill = [] if fill.nil?
|
270
272
|
missing.each do |k|
|
271
|
-
values = [
|
273
|
+
values = [fill] * field_length
|
272
274
|
other_values = other[k]
|
273
275
|
other_common_pos.zip(this_common_pos).each do |o,t|
|
274
276
|
values[t] = other_values[o]
|
@@ -276,8 +278,9 @@ module TSV
|
|
276
278
|
self[k] = values
|
277
279
|
end
|
278
280
|
when :flat
|
281
|
+
fill = [] if fill.nil?
|
279
282
|
missing.each do |k|
|
280
|
-
self[k] =
|
283
|
+
self[k] = fill
|
281
284
|
end
|
282
285
|
end
|
283
286
|
end
|
data/lib/rbbt/tsv/dumper.rb
CHANGED
@@ -32,13 +32,17 @@ module TSV
|
|
32
32
|
sep + ([""] * fields.length) * sep << "\n"
|
33
33
|
end
|
34
34
|
when Array
|
35
|
-
if fields.nil?
|
35
|
+
if fields.nil?
|
36
|
+
sep + (values.collect{|v| Array === v ? v * "|" : v} * sep) << "\n"
|
37
|
+
elsif fields.empty?
|
36
38
|
"\n"
|
37
39
|
else
|
38
40
|
sep + (values.collect{|v| Array === v ? v * "|" : v} * sep) << "\n"
|
39
41
|
end
|
40
42
|
else
|
41
|
-
if fields.nil?
|
43
|
+
if fields.nil?
|
44
|
+
sep + values.to_s + "\n"
|
45
|
+
elsif fields.empty?
|
42
46
|
"\n"
|
43
47
|
else
|
44
48
|
sep + values.to_s << "\n"
|
data/lib/rbbt/tsv/parallel.rb
CHANGED
data/lib/rbbt/util/R.rb
CHANGED
@@ -41,7 +41,7 @@ source('#{UTIL}');
|
|
41
41
|
|
42
42
|
if monitor
|
43
43
|
#io = CMD.cmd('R --no-save --quiet', options.merge(:in => cmd, :pipe => true, :log => true))
|
44
|
-
io = CMD.cmd('R --no-save --quiet', options.merge(:in => cmd, :pipe => true, :log => true))
|
44
|
+
io = CMD.cmd('R --no-save --quiet', options.merge(:in => cmd, :pipe => true, :log => true, :xvfb => true))
|
45
45
|
while line = io.gets
|
46
46
|
case monitor
|
47
47
|
when Proc
|
@@ -52,7 +52,7 @@ source('#{UTIL}');
|
|
52
52
|
end
|
53
53
|
nil
|
54
54
|
else
|
55
|
-
CMD.cmd('R --no-save --slave --quiet', options.merge(:in => cmd))
|
55
|
+
CMD.cmd('R --no-save --slave --quiet', options.merge(:in => cmd, :xvfb => true))
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
data/lib/rbbt/util/cmd.rb
CHANGED
@@ -98,7 +98,9 @@ module CMD
|
|
98
98
|
post = options.delete(:post)
|
99
99
|
log = options.delete(:log)
|
100
100
|
no_fail = options.delete(:no_fail)
|
101
|
+
no_fail = options.delete(:nofail) if no_fail.nil?
|
101
102
|
no_wait = options.delete(:no_wait)
|
103
|
+
xvfb = options.delete(:xvfb)
|
102
104
|
|
103
105
|
dont_close_in = options.delete(:dont_close_in)
|
104
106
|
|
@@ -116,6 +118,14 @@ module CMD
|
|
116
118
|
|
117
119
|
end
|
118
120
|
|
121
|
+
case xvfb
|
122
|
+
when TrueClass
|
123
|
+
cmd = "xvfb-run --server-args='-screen 0 1024x768x24' --auto-servernum #{cmd}"
|
124
|
+
when String
|
125
|
+
cmd = "xvfb-run --server-args='#{xvfb}' --auto-servernum --server-num=1 #{cmd}"
|
126
|
+
when String
|
127
|
+
end
|
128
|
+
|
119
129
|
if stderr == true
|
120
130
|
stderr = Log::HIGH
|
121
131
|
end
|
data/lib/rbbt/util/misc/bgzf.rb
CHANGED
@@ -7,7 +7,7 @@ module Bgzf
|
|
7
7
|
|
8
8
|
def self.bgzip_cmd
|
9
9
|
@@bgzip_cmd ||= begin
|
10
|
-
path = `bash -c "type -p
|
10
|
+
path = `bash -c "type -p bgzip"`.strip
|
11
11
|
if path.empty?
|
12
12
|
Rbbt.claim Rbbt.software.opt.htslib, :install, Rbbt.share.install.software.HTSLIB.find(:lib)
|
13
13
|
Rbbt.software.opt.htslib.produce
|
@@ -287,15 +287,19 @@ module Misc
|
|
287
287
|
when Symbol
|
288
288
|
obj.to_s
|
289
289
|
when (defined?(Path) and Path)
|
290
|
-
if obj.
|
291
|
-
|
292
|
-
|
293
|
-
|
290
|
+
if Step === obj.resource
|
291
|
+
"Step file: " + obj
|
292
|
+
else
|
293
|
+
if obj.exists?
|
294
|
+
if obj.directory?
|
295
|
+
files = obj.glob("**/*")
|
296
|
+
"directory: #{Misc.fingerprint(files)}"
|
297
|
+
else
|
298
|
+
"file: " << Open.realpath(obj) << "--" << mtime_str(obj)
|
299
|
+
end
|
294
300
|
else
|
295
|
-
|
301
|
+
obj + " (file missing)"
|
296
302
|
end
|
297
|
-
else
|
298
|
-
obj + " (file missing)"
|
299
303
|
end
|
300
304
|
when String
|
301
305
|
if Misc.is_filename?(obj) and ! %w(. ..).include?(obj)
|
data/lib/rbbt/util/open.rb
CHANGED
@@ -16,9 +16,9 @@ module Open
|
|
16
16
|
GREP_CMD = begin
|
17
17
|
if ENV["GREP_CMD"]
|
18
18
|
ENV["GREP_CMD"]
|
19
|
-
elsif File.
|
19
|
+
elsif File.exist?('/bin/grep')
|
20
20
|
"/bin/grep"
|
21
|
-
elsif File.
|
21
|
+
elsif File.exist?('/usr/bin/grep')
|
22
22
|
"/usr/bin/grep"
|
23
23
|
else
|
24
24
|
"grep"
|
@@ -262,7 +262,7 @@ module Open
|
|
262
262
|
if (dir_sub_path = find_repo_dir(file))
|
263
263
|
remove_from_repo(*dir_sub_path)
|
264
264
|
else
|
265
|
-
FileUtils.rm(file) if File.
|
265
|
+
FileUtils.rm(file) if File.exist?(file) or Open.broken_link?(file)
|
266
266
|
end
|
267
267
|
end
|
268
268
|
|
@@ -333,7 +333,7 @@ module Open
|
|
333
333
|
nil
|
334
334
|
else
|
335
335
|
target = target.find if Path === target
|
336
|
-
if ! File.
|
336
|
+
if ! File.exist?(target)
|
337
337
|
FileUtils.mkdir_p target
|
338
338
|
end
|
339
339
|
end
|
@@ -344,8 +344,8 @@ module Open
|
|
344
344
|
target = target.find if Path === target
|
345
345
|
|
346
346
|
target = File.join(target, File.basename(source)) if File.directory? target
|
347
|
-
FileUtils.mkdir_p File.dirname(target) unless File.
|
348
|
-
FileUtils.rm target if File.
|
347
|
+
FileUtils.mkdir_p File.dirname(target) unless File.exist?(File.dirname(target))
|
348
|
+
FileUtils.rm target if File.exist?(target)
|
349
349
|
FileUtils.ln_s source, target
|
350
350
|
end
|
351
351
|
|
@@ -353,8 +353,8 @@ module Open
|
|
353
353
|
source = source.find if Path === source
|
354
354
|
target = target.find if Path === target
|
355
355
|
|
356
|
-
FileUtils.mkdir_p File.dirname(target) unless File.
|
357
|
-
FileUtils.rm target if File.
|
356
|
+
FileUtils.mkdir_p File.dirname(target) unless File.exist?(File.dirname(target))
|
357
|
+
FileUtils.rm target if File.exist?(target)
|
358
358
|
FileUtils.ln source, target
|
359
359
|
end
|
360
360
|
|
@@ -362,8 +362,8 @@ module Open
|
|
362
362
|
source = source.find if Path === source
|
363
363
|
target = target.find if Path === target
|
364
364
|
|
365
|
-
FileUtils.mkdir_p File.dirname(target) unless File.
|
366
|
-
FileUtils.rm target if File.
|
365
|
+
FileUtils.mkdir_p File.dirname(target) unless File.exist?(File.dirname(target))
|
366
|
+
FileUtils.rm target if File.exist?(target)
|
367
367
|
begin
|
368
368
|
CMD.cmd("ln -L '#{ source }' '#{ target }'")
|
369
369
|
rescue ProcessFailed
|
@@ -475,6 +475,7 @@ module Open
|
|
475
475
|
File.exist?(file) #|| File.symlink?(file)
|
476
476
|
end
|
477
477
|
end
|
478
|
+
|
478
479
|
class << self
|
479
480
|
alias exist? exists?
|
480
481
|
end
|
@@ -747,7 +748,7 @@ module Open
|
|
747
748
|
if (dir_sub_path = find_repo_dir(path))
|
748
749
|
writable_repo?(*dir_sub_path)
|
749
750
|
else
|
750
|
-
if File.
|
751
|
+
if File.exist?(path)
|
751
752
|
File.writable?(path)
|
752
753
|
else
|
753
754
|
File.writable?(File.dirname(File.expand_path(path)))
|
@@ -776,14 +777,14 @@ module Open
|
|
776
777
|
file = file.find if Path === file
|
777
778
|
begin
|
778
779
|
if File.symlink?(file) || File.stat(file).nlink > 1
|
779
|
-
if File.
|
780
|
+
if File.exist?(file + '.info') && defined?(Step)
|
780
781
|
done = Step::INFO_SERIALIZER.load(Open.open(file + '.info'))[:done]
|
781
782
|
return done if done
|
782
783
|
end
|
783
784
|
|
784
785
|
file = Pathname.new(file).realpath.to_s
|
785
786
|
end
|
786
|
-
return nil unless File.
|
787
|
+
return nil unless File.exist?(file)
|
787
788
|
File.mtime(file)
|
788
789
|
rescue
|
789
790
|
nil
|
@@ -793,7 +794,7 @@ module Open
|
|
793
794
|
|
794
795
|
def self.update_mtime(path, target)
|
795
796
|
if File.symlink?(target) || File.stat(target).nlink > 1
|
796
|
-
if File.
|
797
|
+
if File.exist?(target + '.info')
|
797
798
|
target = target + '.info'
|
798
799
|
else
|
799
800
|
target = Pathname.new(target).realpath.to_s
|
@@ -801,7 +802,7 @@ module Open
|
|
801
802
|
end
|
802
803
|
|
803
804
|
CMD.cmd("touch -r '#{path}' '#{target}'")
|
804
|
-
CMD.cmd("touch -r '#{path}.info' '#{target}'") if File.
|
805
|
+
CMD.cmd("touch -r '#{path}.info' '#{target}'") if File.exist?(path + '.info')
|
805
806
|
end
|
806
807
|
|
807
808
|
def self.atime(file)
|
@@ -823,7 +824,7 @@ module Open
|
|
823
824
|
end
|
824
825
|
|
825
826
|
def self.broken_link?(path)
|
826
|
-
File.symlink?(path) && ! File.
|
827
|
+
File.symlink?(path) && ! File.exist?(File.readlink(path))
|
827
828
|
end
|
828
829
|
|
829
830
|
def self.download(url, path)
|