dyntask-ruby 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/dyntask-init +37 -14
- data/bin/dyntask-server +12 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f38c086b8f9f06b0bdd5785efd1dc7ce0b1252bb
|
4
|
+
data.tar.gz: 1365c87f14249dccf8ff9dfc4e9d04d84ff55689
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca43457a5174ccc982c00c1e5b6ccb8532bcc4ed32084e412784bf480a4b793d903f304754b856bab3736141d289bb4a6984cd0135ecf7f3aa20099e07a3a9cb
|
7
|
+
data.tar.gz: c1feef5c9d7492c12a018a317350771976f8b7a730b49cc9cfdd5828b7383a5cb959e7c0f188a39290bf650bf088fee24c5e57a00a32f4b443246d4fed5b261f
|
data/bin/dyntask-init
CHANGED
@@ -31,30 +31,53 @@ when "first"
|
|
31
31
|
when "rundir","run"
|
32
32
|
rundirs=[]
|
33
33
|
etc_rundirs=File.join( DynTask.cfg_dir[:etc],"rundirs")
|
34
|
-
rundirs += File.read(etc_rundirs).strip.split("
|
34
|
+
rundirs += File.read(etc_rundirs).strip.split(";").map{|d| d.strip} if File.exists? etc_rundirs
|
35
35
|
etc_rundirs_to_update=false
|
36
36
|
case ARGV[1]
|
37
37
|
when "ls"
|
38
38
|
puts "Additional directories watched: #{rundirs.empty? ? 'none' : rundirs.join(',')}"
|
39
39
|
when "add"
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
40
|
+
## ex: dyn,pdflatex,pandoc:
|
41
|
+
watchdir,tasks_to_watch=ARGV[2],""
|
42
|
+
tasks_to_watch,watchdir=watchdir.split(":") if watchdir.include? ":"
|
43
|
+
tasks_to_watch=(tasks_to_watch.split(",") & DynTask::TaskMngr::TASKS).sort
|
44
|
+
subdir = watchdir[-1,1] == File::Separator
|
45
|
+
watchdir = File.expand_path watchdir
|
46
|
+
rundir=subdir ? File.join(watchdir,"") : watchdir
|
47
|
+
if File.directory? watchdir and !rundirs.include? rundir
|
48
|
+
rundirs << (tasks_to_watch.empty? ? rundir : tasks_to_watch.join(",")+":"+rundir)
|
45
49
|
puts "DynTask Server needs to be restarted to apply this change!"
|
46
50
|
etc_rundirs_to_update=true
|
47
51
|
else
|
48
52
|
"Nothing to do!"
|
49
53
|
end
|
50
54
|
when "rm"
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
watchdir,tasks_to_watch=ARGV[2],""
|
56
|
+
tasks_to_watch,watchdir=watchdir.split(":") if watchdir.include? ":"
|
57
|
+
tasks_to_watch=(tasks_to_watch.split(",") & DynTask::TaskMngr::TASKS).sort
|
58
|
+
subdir = watchdir[-1,1] == File::Separator
|
59
|
+
watchdir = File.expand_path watchdir
|
60
|
+
rundir=subdir ? File.join(watchdir,"") : watchdir
|
61
|
+
if File.directory? watchdir
|
62
|
+
rundirs2=rundirs.map do |e|
|
63
|
+
t,r=((e.include? ":") ? e.split(":") : ["",e])
|
64
|
+
##p [t,r,rundir]
|
65
|
+
if r==rundir
|
66
|
+
puts "DynTask Server needs to be restarted to apply this change!"
|
67
|
+
etc_rundirs_to_update=true
|
68
|
+
t=t.split(",").sort - (tasks_to_watch.empty? ? DynTask::TaskMngr::TASKS : tasks_to_watch)
|
69
|
+
##p [:t,t]
|
70
|
+
if t.empty?
|
71
|
+
nil # to remove
|
72
|
+
else
|
73
|
+
t.sort.join(",")+":"+r
|
74
|
+
end
|
75
|
+
else
|
76
|
+
r
|
77
|
+
end
|
78
|
+
end
|
79
|
+
##p rundirs2
|
80
|
+
rundirs=rundirs2.compact
|
58
81
|
else
|
59
82
|
"Nothing to do!"
|
60
83
|
end
|
@@ -64,7 +87,7 @@ when "rundir","run"
|
|
64
87
|
File.unlink etc_rundirs
|
65
88
|
else
|
66
89
|
File.open(etc_rundirs,"w") do |f|
|
67
|
-
f << rundirs.join("
|
90
|
+
f << rundirs.join(";")
|
68
91
|
end
|
69
92
|
end
|
70
93
|
end
|
data/bin/dyntask-server
CHANGED
@@ -25,16 +25,21 @@ end
|
|
25
25
|
|
26
26
|
rundirs=[DynTask.cfg_dir[:run]]
|
27
27
|
etc_rundirs=File.join( DynTask.cfg_dir[:etc],"rundirs")
|
28
|
-
rundirs += File.read(etc_rundirs).strip.split("
|
29
|
-
|
30
|
-
##tasks_to_watch = DynTask::TaskMngr::TASKS
|
28
|
+
rundirs += File.read(etc_rundirs).strip.split(";").map{|d| d.strip} if File.exists? etc_rundirs
|
31
29
|
|
32
30
|
files_to_watch=[]
|
33
31
|
rundirs.each do |rundir|
|
34
|
-
|
35
|
-
watchdir
|
36
|
-
|
37
|
-
|
32
|
+
tasks_to_watch,watchdir=["*"],rundir #default
|
33
|
+
# watchdir of the form dyn,pdflatex:~/tmp or dyn,pdflatex:~/tmp/
|
34
|
+
# when / at the end, be careful that it could be watching too much files => TOO SLOW!
|
35
|
+
if watchdir.include? ":"
|
36
|
+
tasks_to_watch,watchdir=rundir.split(":")
|
37
|
+
tasks_to_watch=tasks_to_watch.split(",") & DynTask::TaskMngr::TASKS
|
38
|
+
end
|
39
|
+
watchdir = watchdir[-1,1] == File::Separator ? [watchdir[0...-1],"**"] : watchdir
|
40
|
+
tasks_to_watch.each do |e|
|
41
|
+
files_to_watch << File.join(watchdir,"*" +DynTask::TaskMngr::TASK_EXT+e )
|
42
|
+
end
|
38
43
|
end
|
39
44
|
|
40
45
|
files_to_watch.uniq!
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dyntask-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CQLS
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trollop
|