smartware 0.1.29 → 0.1.30

Sign up to get free protection for your applications and to get access to all the features.
data/bin/smartware CHANGED
@@ -3,28 +3,24 @@
3
3
  require 'rubygems'
4
4
  require 'bundler/setup'
5
5
  require 'smartware'
6
- require 'dante'
6
+ require 'trollop'
7
7
 
8
- Smartkiosk::Common::Patches.dante_should_log_with Smartware::Logging.logger
9
-
10
- runner = Dante::Runner.new('smartware')
11
- runner.description = 'Smartkiosk hardware control daemon'
12
- runner.with_options do |opts|
13
- opts.on('-c', '--config-file FILE', String, 'Hardware config file to use. Sample: --config-file=/path/to/smartware.yml') do |x|
14
- options[:config] = x
15
- end
8
+ opts = Trollop.options do
9
+ version "Smartware #{Smartware::VERSION}"
10
+ banner "Smartware - Smartkiosk hardware control service"
11
+ opt :config, "Hardware config file to use (smartware.yml, absolute path)", type: String, required: true
12
+ opt :log, "Log file to use", type: String
16
13
  end
17
14
 
18
- runner.execute do |opts|
19
- abort 'You should specify hardware configuration file path(--config-file=/path/to/smartware.yml)' if opts[:config].nil?
15
+ p opts[:log]
16
+
17
+ Smartware::Logging.destination = opts[:log] if opts[:log]
18
+ Smartware::Logging.init
20
19
 
21
- begin
22
- Smartware::Logging.destination = opts[:log_path] if opts[:log_path]
23
- Smartware::Service.start(opts[:config])
24
- rescue => e
25
- raise e if $DEBUG
26
- STDERR.puts e.message
27
- STDERR.puts e.backtrace.join("\n")
28
- exit 1
29
- end
30
- end
20
+ begin
21
+ Smartware::Service.start(opts[:config])
22
+ rescue => e
23
+ Smartware::Logging.logger.error e.message
24
+ Smartware::Logging.logger.error e.backtrace.join("\n")
25
+ exit 1
26
+ end
data/lib/smartware.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'smartkiosk/common'
2
+ require 'smartware/version'
2
3
  require 'smartware/logging'
3
4
  require 'smartware/service'
4
5
  require 'smartware/clients/cash_acceptor'
@@ -13,37 +13,35 @@ module Smartware
13
13
 
14
14
  @config = YAML.load File.read(File.expand_path(config_file))
15
15
 
16
- Smartware::Logging.logger = Logging.init
17
16
  Smartware::Logging.logger.info "Smartware started at #{Time.now}"
18
17
 
19
-
20
18
  @threads = %w(modem
21
19
  cash_acceptor
22
20
  printer
23
21
  ).inject([]) do |arr, iface|
24
22
  arr << Thread.new do
25
23
  begin
26
- driver = Smartware::Service.config["#{iface}_driver"].downcase
24
+ driver = Service.config["#{iface}_driver"].downcase
27
25
 
28
26
  require "smartware/drivers/#{iface}/#{driver}"
29
27
  require "smartware/interfaces/#{iface}"
30
28
  rescue => e
31
- Smartware::Logging.logger.fatal "During startup of #{iface}:"
32
- Smartware::Logging.logger.fatal e.message
33
- Smartware::Logging.logger.fatal e.backtrace.join("\n")
29
+ Logging.logger.fatal "During startup of #{iface}:"
30
+ Logging.logger.fatal e.message
31
+ Logging.logger.fatal e.backtrace.join("\n")
34
32
  end
35
33
  end
36
34
  end
37
35
 
38
36
  @threads.map(&:join)
39
37
  rescue => e
40
- Smartware::Logging.logger.fatal e.message
41
- Smartware::Logging.logger.fatal e.backtrace.join("\n")
38
+ Logging.logger.fatal e.message
39
+ Logging.logger.fatal e.backtrace.join("\n")
42
40
  end
43
41
 
44
42
  def self.stop
45
43
  @threads.map(&:kill)
46
- Smartware::Logging.logger.info "Smartware shutdown at #{Time.now}"
44
+ Logging.logger.info "Smartware shutdown at #{Time.now}"
47
45
  exit 0
48
46
  end
49
47
 
@@ -1,3 +1,3 @@
1
1
  module Smartware
2
- VERSION = "0.1.29"
2
+ VERSION = "0.1.30"
3
3
  end
data/smartware.gemspec CHANGED
@@ -19,6 +19,6 @@ Gem::Specification.new do |gem|
19
19
 
20
20
  gem.add_dependency 'smartkiosk-common', '>= 0.0.2'
21
21
  gem.add_dependency 'serialport'
22
- gem.add_dependency 'dante'
23
22
  gem.add_dependency 'cmux'
23
+ gem.add_dependency 'trollop'
24
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smartware
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.29
4
+ version: 0.1.30
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ date: 2013-01-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: smartkiosk-common
17
- requirement: &70338350434340 !ruby/object:Gem::Requirement
17
+ requirement: !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,15 @@ dependencies:
22
22
  version: 0.0.2
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70338350434340
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: 0.0.2
26
31
  - !ruby/object:Gem::Dependency
27
32
  name: serialport
28
- requirement: &70338350433660 !ruby/object:Gem::Requirement
33
+ requirement: !ruby/object:Gem::Requirement
29
34
  none: false
30
35
  requirements:
31
36
  - - ! '>='
@@ -33,10 +38,15 @@ dependencies:
33
38
  version: '0'
34
39
  type: :runtime
35
40
  prerelease: false
36
- version_requirements: *70338350433660
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
37
47
  - !ruby/object:Gem::Dependency
38
- name: dante
39
- requirement: &70338350432680 !ruby/object:Gem::Requirement
48
+ name: cmux
49
+ requirement: !ruby/object:Gem::Requirement
40
50
  none: false
41
51
  requirements:
42
52
  - - ! '>='
@@ -44,10 +54,15 @@ dependencies:
44
54
  version: '0'
45
55
  type: :runtime
46
56
  prerelease: false
47
- version_requirements: *70338350432680
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
48
63
  - !ruby/object:Gem::Dependency
49
- name: cmux
50
- requirement: &70338350431700 !ruby/object:Gem::Requirement
64
+ name: trollop
65
+ requirement: !ruby/object:Gem::Requirement
51
66
  none: false
52
67
  requirements:
53
68
  - - ! '>='
@@ -55,7 +70,12 @@ dependencies:
55
70
  version: '0'
56
71
  type: :runtime
57
72
  prerelease: false
58
- version_requirements: *70338350431700
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
59
79
  description: Smartware is the Smartkiosk hardware control daemon
60
80
  email:
61
81
  - e.sudarchikov@roundlake.ru
@@ -110,9 +130,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
130
  version: '0'
111
131
  requirements: []
112
132
  rubyforge_project:
113
- rubygems_version: 1.8.15
133
+ rubygems_version: 1.8.24
114
134
  signing_key:
115
135
  specification_version: 3
116
136
  summary: Smartware is the Smartkiosk hardware control daemon
117
137
  test_files: []
118
- has_rdoc: