dyntask-ruby 0.3.1 → 0.3.2
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 +0 -82
- data/bin/dyntask-server +11 -29
- 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: 1a1d3a2f58fa8f7a19799e9538ee3410bf2da9f4
|
4
|
+
data.tar.gz: 148be5987679bd47f02da94a56f77ffd054cee5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e40f7fc56b14813dd6146006b43ef6962ba716e4e6471608fff19528add7e871f42e4f8c1ab8fc49e60b60b5df9b193321095294972d6e8db239f470402c887
|
7
|
+
data.tar.gz: 82724d6c2ad05f254b314a066cb1b4fb45bc120473c0cc28a5404a95ee4af0e33f326093b4e1a89125cff8a5e7a99b2c92b42a572c8074478bfcbdf7adaedc9a
|
data/bin/dyntask-init
CHANGED
@@ -59,86 +59,4 @@ when "pandoc-extra"
|
|
59
59
|
|
60
60
|
end
|
61
61
|
exit
|
62
|
-
when "srv" #MacOSX user only
|
63
|
-
if RUBY_PLATFORM =~ /darwin/
|
64
|
-
dyntask_srv_plist=File.expand_path("~/Library/LaunchAgents/dyntask-srv.plist")
|
65
|
-
case ARGV[1] || "help"
|
66
|
-
when "help"
|
67
|
-
puts <<-DOC
|
68
|
-
launchctl helpers to launch dyntask-srv service.
|
69
|
-
Usage:
|
70
|
-
dyntask-init srv new|load => create when not existing the dyntask-srv service
|
71
|
-
dyntask-init srv unload => unload existing service
|
72
|
-
dyntask-init srv start/stop => start/stop the dyntask-srv service
|
73
|
-
dyntask-init srv list => list dyntask-srv service
|
74
|
-
DOC
|
75
|
-
when "load","new"
|
76
|
-
unless File.exists? dyntask_srv_plist
|
77
|
-
plist= <<-END.sub(/DYNTASKSRV/,`which dyntask-server`.strip)
|
78
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
79
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
80
|
-
<plist version="1.0">
|
81
|
-
<dict>
|
82
|
-
<key>Label</key>
|
83
|
-
<string>dyntask-srv</string>
|
84
|
-
<key>ProgramArguments</key>
|
85
|
-
<array>
|
86
|
-
<string>DYNTASKSRV</string>
|
87
|
-
</array>
|
88
|
-
<key>RunAtLoad</key>
|
89
|
-
<true/>
|
90
|
-
<key>KeepAlive</key>
|
91
|
-
<dict>
|
92
|
-
<key>Crashed</key>
|
93
|
-
<true/>
|
94
|
-
</dict>
|
95
|
-
<key>StandardErrorPath</key>
|
96
|
-
<string>/tmp/dyntask-srv.err</string>
|
97
|
-
<key>StandardOutPath</key>
|
98
|
-
<string>/tmp/dyntask-srv.out</string>
|
99
|
-
</dict>
|
100
|
-
</plist>
|
101
|
-
END
|
102
|
-
File.open(dyntask_srv_plist,"w") do |f|
|
103
|
-
f << plist
|
104
|
-
end
|
105
|
-
end
|
106
|
-
`launchctl load #{dyntask_srv_plist}`
|
107
|
-
`launchctl setenv PATH $PATH`
|
108
|
-
when "unload"
|
109
|
-
if File.exists? dyntask_srv_plist
|
110
|
-
`launchctl unload #{dyntask_srv_plist}`
|
111
|
-
else
|
112
|
-
puts "Service dyntask-srv not available. Create it first: dyntask-init srv new"
|
113
|
-
end
|
114
|
-
when "start", "stop"
|
115
|
-
`launchctl #{ARGV[1]} dyntask-srv`
|
116
|
-
when "list"
|
117
|
-
puts `launchctl list | grep dyn`
|
118
|
-
end
|
119
|
-
end
|
120
62
|
end
|
121
|
-
|
122
|
-
|
123
|
-
# etc_tasks=File.join(DynTask.cfg_dir[:etc],"tasks",ARGV[0])
|
124
|
-
#
|
125
|
-
# if ARGV.size==1
|
126
|
-
# if options[:rm] and options[:force]
|
127
|
-
# require 'fileutils'
|
128
|
-
# FileUtils.rm etc_tasks
|
129
|
-
# end
|
130
|
-
# else
|
131
|
-
# if File.exists? etc_tasks and !options[:force]
|
132
|
-
# puts "Error: file #{etc_tasks} already exist. Use --force or -f to modify this file!"
|
133
|
-
# exit
|
134
|
-
# else
|
135
|
-
# require 'fileutils'
|
136
|
-
# FileUtils.mkdir_p File.dirname(etc_tasks)
|
137
|
-
# dyntask_tasks=ARGV[1..-1].join(" ")
|
138
|
-
# File.open(etc_tasks,"w") do |f|
|
139
|
-
# f << dyntask_tasks
|
140
|
-
# end
|
141
|
-
# end
|
142
|
-
# end
|
143
|
-
#
|
144
|
-
# puts "#{etc_tasks} contains: #{File.read(etc_tasks)}" if File.exists? etc_tasks
|
data/bin/dyntask-server
CHANGED
@@ -35,36 +35,18 @@ files_to_watch.uniq!
|
|
35
35
|
|
36
36
|
puts "Tasks watched: #{files_to_watch}"
|
37
37
|
|
38
|
-
|
39
|
-
# begin
|
40
|
-
# require 'win32/dirmonitor'
|
41
|
-
# include Win32
|
42
|
-
#
|
43
|
-
# # Wait for a change in your home directory and report any changes.
|
44
|
-
#
|
45
|
-
# monitor = Win32::DirMonitor.new(DynTask.cfg_dir[:run])
|
46
|
-
#
|
47
|
-
# monitor.wait(){ |struct|
|
48
|
-
# path = Pathname.new(struct.file).realpath.to_s
|
49
|
-
# DynTask.read_tasks path
|
50
|
-
# }
|
51
|
-
# rescue SystemExit, Interrupt
|
52
|
-
# puts "leaving win32-dirmonitor"
|
53
|
-
# end
|
54
|
-
# else
|
55
|
-
begin
|
38
|
+
begin
|
56
39
|
|
57
|
-
|
58
|
-
|
40
|
+
##p files
|
41
|
+
fw = FileWatcher.new(files_to_watch, options[:list], options[:dontwait], options[:spinner])
|
59
42
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
end
|
43
|
+
fw.watch(options[:interval]) do |filename, event|
|
44
|
+
if([:changed,:new].include? event)
|
45
|
+
path = Pathname.new(filename).realpath.to_s
|
46
|
+
DynTask.read_tasks path
|
65
47
|
end
|
66
|
-
|
67
|
-
rescue SystemExit, Interrupt
|
68
|
-
fw.finalize
|
69
48
|
end
|
70
|
-
|
49
|
+
|
50
|
+
rescue SystemExit, Interrupt
|
51
|
+
fw.finalize
|
52
|
+
end
|
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.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CQLS
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trollop
|