dumon 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.md +16 -0
  2. data/lib/dumon/version.rb +1 -0
  3. data/lib/dumon.rb +13 -1
  4. metadata +2 -2
data/README.md CHANGED
@@ -26,10 +26,26 @@ Dual monitor manager for Linux with GTK2 based user interface represented by sys
26
26
 
27
27
  > dumon
28
28
 
29
+ * or as daemon process
30
+
31
+ > ruby -r dumon -e 'Dumon::run' --daemon
32
+
33
+ > dumon --daemon
34
+
29
35
  ### UPGRADE NOTICES
30
36
 
31
37
  * see lib/dumon/version.rb
32
38
 
39
+ ### CONFIGURATION
40
+
41
+ #### Logger
42
+
43
+ * by default to 'STDOUT' on level 'INFO'
44
+
45
+ > Dumon.logger = Logger.new('/tmp/log.txt')
46
+
47
+ > Dumon.logger.level = Logger::DEBUG
48
+
33
49
 
34
50
  ## FEATURES/PROBLEMS
35
51
 
data/lib/dumon/version.rb CHANGED
@@ -2,6 +2,7 @@ module Dumon
2
2
 
3
3
  # Version history.
4
4
  VERSION_HISTORY = [
5
+ ['0.1.4', '2013-02-07', 'Enh #1: Starting as daemon'],
5
6
  ['0.1.3', '2013-02-03', 'Changed starting mechanism'],
6
7
  ['0.1.2', '2013-02-01', 'Refactoring: class name optimalization'],
7
8
  ['0.1.1', '2013-01-28', 'Release candidate supporting two output devices'],
data/lib/dumon.rb CHANGED
@@ -24,9 +24,22 @@ module Dumon
24
24
  ###
25
25
  # Runs the application.
26
26
  def self.run
27
+ if ARGV[0] == '--daemon'
28
+ if RUBY_VERSION < '1.9'
29
+ Dumon::logger.warn 'Daemon mode supported only in Ruby >= 1.9'
30
+ else
31
+ # Daemonize the process
32
+ # - stay in the current directory
33
+ # - don't redirect standard input, standard output and standard error to /dev/null
34
+ Dumon::logger.info 'Running as daemon...'
35
+ Process.daemon(true, true)
36
+ end
37
+ end
38
+
27
39
  ui = Dumon::Tray.new
28
40
  ui.omanager = Dumon::XrandrManager.new
29
41
  ui.render
42
+
30
43
  end
31
44
 
32
45
  end
@@ -43,4 +56,3 @@ Dumon::logger.info \
43
56
  # development
44
57
  #Dumon::logger.level = Logger::DEBUG
45
58
  #Dumon::run
46
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dumon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-03 00:00:00.000000000 Z
12
+ date: 2013-02-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gtk2