tenter 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tenter.rb +2 -1
- data/lib/tenter/helpers.rb +7 -2
- data/lib/tenter/utils.rb +11 -8
- data/lib/tenter/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2cec3086122a566c922ffaeeda6e9d086c3dc78cd4900666e6e0ae2edefb15a3
|
4
|
+
data.tar.gz: 9dacc38cf020d66efa977acdbf2dfab90527b926445b5f7aa5e1e57206a7c0b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b535883fe1cd070d1f8706a895c043db077950bb8e2c0d622e310e026831feed390a79980e5b0d39510c1abbed8f0f3b1072b8c4df0d92d390200724d2396193
|
7
|
+
data.tar.gz: 660effd30f91a6d47745ee803d73b5f0082183c49268aca2bf7fa3cabb52dfd03bef29d683c282d12081ce6c3362ca80a3e6e4b2be319184972f69b616344b0e
|
data/lib/tenter.rb
CHANGED
data/lib/tenter/helpers.rb
CHANGED
@@ -30,10 +30,15 @@ module Tenter
|
|
30
30
|
msg = "Command not found"
|
31
31
|
halt 400, msg unless File.file? command["path"]
|
32
32
|
|
33
|
-
|
33
|
+
ts = Tenter.settings[:timestamp] ? "[#{Time.now}] " : ""
|
34
|
+
msg = ts + "Initiating: #{command["path"]}\n"
|
34
35
|
Tenter::Utils.append_to_log command["log"], msg
|
35
36
|
|
36
|
-
pid =
|
37
|
+
pid = if defined?(Bundler) && Bundler.respond_to?(:with_clean_env)
|
38
|
+
Bundler.with_clean_env { command["proc"].call }
|
39
|
+
else
|
40
|
+
command["proc"].call
|
41
|
+
end
|
37
42
|
(ENV["APP_ENV"] != "test") ? Process.detach(pid) : Process.wait(pid)
|
38
43
|
end
|
39
44
|
|
data/lib/tenter/utils.rb
CHANGED
@@ -21,20 +21,23 @@ module Tenter
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def self.command(command_name, site_dir)
|
24
|
-
|
24
|
+
site_path = File.join(Tenter.settings[:doc_root], site_dir)
|
25
25
|
command = {}
|
26
|
-
command["
|
27
|
-
command["path"] = File.join(command["
|
28
|
-
Tenter.settings[:command_dir],
|
29
|
-
command_name)
|
26
|
+
command["dir"] = File.join(site_path, Tenter.settings[:command_dir])
|
27
|
+
command["path"] = File.join(command["dir"], command_name)
|
30
28
|
command["log"] = unless Tenter.settings[:log_file].nil?
|
31
|
-
File.join(
|
29
|
+
File.join(site_path, Tenter.settings[:log_file])
|
32
30
|
else
|
33
31
|
"/dev/null"
|
34
32
|
end
|
35
33
|
command["proc"] = Proc.new {
|
36
|
-
|
37
|
-
|
34
|
+
ts = if Tenter.settings[:timestamp]
|
35
|
+
%q{ | xargs -L 1 sh -c 'printf "[%s] %s\n" "$(date +%Y-%m-%d\ %H:%M:%S\ %z )" "$*" ' sh}
|
36
|
+
else
|
37
|
+
""
|
38
|
+
end
|
39
|
+
spawn command["path"] + ts, { :chdir => command["dir"],
|
40
|
+
[ :out, :err ] => [ command["log"], "a" ] }
|
38
41
|
}
|
39
42
|
|
40
43
|
return command
|
data/lib/tenter/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tenter
|
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
|
- Michael Camilleri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|