smartguard 0.1.1 → 0.1.2
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.
- data/bin/smartguard +41 -13
- data/lib/smartguard/applications/smartkiosk/smartware.rb +5 -5
- data/lib/smartguard/applications/smartkiosk.rb +1 -1
- data/lib/smartguard/version.rb +1 -1
- data/lib/smartguard.rb +1 -0
- data/smartguard.gemspec +1 -1
- metadata +11 -11
data/bin/smartguard
CHANGED
@@ -1,23 +1,51 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'smartguard'
|
4
|
-
require '
|
4
|
+
require 'dante'
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
runner = Dante::Runner.new('smartguard')
|
7
|
+
runner.description = "Smartkiosk services control daemon"
|
8
|
+
|
9
|
+
runner.with_options do |opts|
|
10
|
+
options[:port] = 10000
|
11
|
+
|
12
|
+
opts.on("-a", "--app APPLICATION", String, "Application to use") do |x|
|
13
|
+
options[:application] = x
|
14
|
+
end
|
15
|
+
opts.on("-x", "--path PATH", String, "Path to application") do |x|
|
16
|
+
options[:path] = x
|
17
|
+
end
|
18
|
+
|
19
|
+
opts.on("-p", "--port PORT", Integer, "Port to run DRB (default: #{options[:port]})") do |x|
|
20
|
+
options[:port] = x
|
21
|
+
end
|
22
|
+
|
23
|
+
opts.on("-s", "--start", "Start all services and exit") do |x|
|
24
|
+
options[:start] = x
|
25
|
+
end
|
26
|
+
|
27
|
+
opts.on("-S", "--stop", "Stop all services and exit") do |x|
|
28
|
+
options[:stop] = x
|
29
|
+
end
|
10
30
|
end
|
11
31
|
|
12
|
-
|
13
|
-
|
32
|
+
runner.execute do |opts|
|
33
|
+
abort "You should specify application (--app)" if opts[:application].blank?
|
34
|
+
abort "You should specify application path (--path)" if opts[:path].blank?
|
14
35
|
|
15
|
-
application = Smartguard::Applications.const_get(opts[:application].camelize) rescue nil
|
36
|
+
application = Smartguard::Applications.const_get(opts[:application].camelize) rescue nil
|
16
37
|
|
17
|
-
|
38
|
+
abort "Application `#{opts[:application]}` not supported" if application.nil?
|
18
39
|
|
19
|
-
application = application.new(opts[:path])
|
20
|
-
application.warm_up
|
40
|
+
application = application.new(opts[:path])
|
21
41
|
|
22
|
-
|
23
|
-
|
42
|
+
if opts[:stop]
|
43
|
+
application.stop_services
|
44
|
+
elsif opts[:start]
|
45
|
+
application.start_services
|
46
|
+
else
|
47
|
+
application.warm_up
|
48
|
+
DRb.start_service("druby://localhost:#{opts[:port]}", application)
|
49
|
+
DRb.thread.join
|
50
|
+
end
|
51
|
+
end
|
@@ -3,18 +3,18 @@ module Smartguard
|
|
3
3
|
class Smartkiosk
|
4
4
|
class Smartware < Smartguard::Process
|
5
5
|
def initialize(path)
|
6
|
-
@path
|
7
|
-
@
|
8
|
-
@
|
6
|
+
@path = path
|
7
|
+
@pid_file = path.join('tmp/pids/smartware.pid')
|
8
|
+
@log_file = path.join('log/smartware.log')
|
9
9
|
end
|
10
10
|
|
11
11
|
def pid
|
12
|
-
File.read(
|
12
|
+
File.read(@pid_file).to_i rescue nil
|
13
13
|
end
|
14
14
|
|
15
15
|
def start
|
16
16
|
Logging.logger.info "Starting smartware"
|
17
|
-
run @path, "bundle exec smartware
|
17
|
+
run @path, "bundle exec smartware -d --pid=#{@pid_file} --log=#{@log_file}"
|
18
18
|
end
|
19
19
|
|
20
20
|
def stop
|
data/lib/smartguard/version.rb
CHANGED
data/lib/smartguard.rb
CHANGED
data/smartguard.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smartguard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: i18n
|
16
|
-
requirement: &
|
16
|
+
requirement: &70350512255040 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70350512255040
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: active_support
|
27
|
-
requirement: &
|
27
|
+
requirement: &70350512253720 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70350512253720
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
38
|
-
requirement: &
|
37
|
+
name: dante
|
38
|
+
requirement: &70350512252860 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70350512252860
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: pry
|
49
|
-
requirement: &
|
49
|
+
requirement: &70350512252360 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70350512252360
|
58
58
|
description: Smartguard is the Smartkiosk services control daemon
|
59
59
|
email:
|
60
60
|
- boris@roundlake.ru
|