dyntask-ruby 0.4.1 → 0.5.0

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/dyntask-init +37 -14
  3. data/bin/dyntask-server +12 -7
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 002b62cb26d3be08a52f4ca611374c3bffe77516
4
- data.tar.gz: e7604dc0fd14ac038678972c0cdcb7e4a7c86d2c
3
+ metadata.gz: f38c086b8f9f06b0bdd5785efd1dc7ce0b1252bb
4
+ data.tar.gz: 1365c87f14249dccf8ff9dfc4e9d04d84ff55689
5
5
  SHA512:
6
- metadata.gz: 25f1f5031438b090a6e06d6485bc6791cad03b890f02eb0e2fc1555c22dce484fa12b9c2ea16e1a2cf3c1fc85e456170f062f6457efbbfd85d9ed4ee3dc281f3
7
- data.tar.gz: d49d5e9f344fc0589fb8bc151a953a9a942632beb5e1945bfabda1d3173e2290bf478c5636854aeb9d2a185b2a4db440c4fd70901cfbadb4777091e8cb62c3f4
6
+ metadata.gz: ca43457a5174ccc982c00c1e5b6ccb8532bcc4ed32084e412784bf480a4b793d903f304754b856bab3736141d289bb4a6984cd0135ecf7f3aa20099e07a3a9cb
7
+ data.tar.gz: c1feef5c9d7492c12a018a317350771976f8b7a730b49cc9cfdd5828b7383a5cb959e7c0f188a39290bf650bf088fee24c5e57a00a32f4b443246d4fed5b261f
@@ -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(",").map{|d| d.strip} if File.exists? etc_rundirs
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
- subdir = ARGV[2][-1,1] == File::Separator
41
- newdir = File.expand_path ARGV[2]
42
- newrundir=subdir ? File.join(newdir,"") : newdir
43
- if File.directory? newdir and !rundirs.include? newrundir
44
- rundirs << newrundir
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
- subdir = ARGV[2][-1,1] == File::Separator
52
- newdir = File.expand_path ARGV[2]
53
- newrundir=subdir ? File.join(newdir,"") : newdir
54
- if File.directory? newdir and rundirs.include? newrundir
55
- rundirs -= [newrundir]
56
- puts "DynTask Server needs to be restarted to apply this change!"
57
- etc_rundirs_to_update=true
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
@@ -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(",").map{|d| d.strip} if File.exists? etc_rundirs
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
- ##tasks_to_watch.each do |e|
35
- watchdir = rundir[-1,1] == File::Separator ? [rundir[0...-1],"**"] : rundir
36
- files_to_watch << File.join(watchdir,"*" +DynTask::TaskMngr::TASK_EXT+"*" ) ##+e) #if DynTask::TaskMngr::TASKS.include? file
37
- ##end
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.1
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-19 00:00:00.000000000 Z
11
+ date: 2016-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trollop