traut 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -19,9 +19,10 @@ daemon hooked up to Gerrit's ssh stream-events so that we might turn
19
19
  example. See `samples/kili`. All payloads are delivered to the
20
20
  scripts' stdin.
21
21
 
22
- Traut cannot daemonize itself. We use [supervisord](http://supervisord.org/) to daemonize Traut;
23
- the code needed to achieve self-daemonization is outside of the core
24
- focus of this program.
22
+ Traut cannot daemonize itself. We use
23
+ [supervisord](http://supervisord.org/) to daemonize Traut; the code
24
+ needed to achieve self-daemonization is outside of the core focus of
25
+ this program.
25
26
 
26
27
  Installation
27
28
  ------------
@@ -0,0 +1 @@
1
+ com.carepilot.event.code.review.app: deploy/app
@@ -4,7 +4,4 @@ amqp:
4
4
  logs: /tmp/traut.log
5
5
  pid: /tmp/traut.pid
6
6
  scripts: /tmp/traut/scripts
7
- daemon: true
8
-
9
- actions:
10
- com.carepilot.event.code.review.app: deploy/app
7
+ action_dir: /tmp/traut/actions
data/lib/traut/runner.rb CHANGED
@@ -20,11 +20,12 @@ module Traut
20
20
  :host => 'localhost',
21
21
  :port => '5672'
22
22
  },
23
- :logs => '/var/log/traut.log',
24
- :config => '/etc/traut/traut.conf',
25
- :scripts => '/usr/local/bin/traut',
26
- :debug => false,
27
- :actions => nil,
23
+ :logs => '/var/log/traut.log',
24
+ :config => '/etc/traut/traut.conf',
25
+ :action_dir => '/etc/traut/actions/',
26
+ :scripts => '/usr/local/bin/traut',
27
+ :debug => false,
28
+ :actions => nil,
28
29
  }
29
30
 
30
31
  parse!
@@ -34,22 +35,22 @@ module Traut
34
35
  @parser ||= OptionParser.new do |opts|
35
36
  opts.banner = "Usage: traut [options]"
36
37
  opts.separator ""
37
- opts.on("-A", "--amqp [HOST]", "The AMQP server host") {
38
+ opts.on("-A", "--amqp HOST", "The AMQP server host") {
38
39
  |host| @options[:amqp][:host] = host
39
40
  }
40
- opts.on("-P", "--amqp_port [PORT]", "The AMQP server host port") {
41
+ opts.on("-P", "--amqp_port PORT", "The AMQP server host port") {
41
42
  |port| @options[:amqp][:port] = port
42
43
  }
43
- opts.on("-S", "--subscriptions", "The server AMQP subscriptions.") {
44
- |subscriptions| @options[:subscriptions] = subscriptions || '*'
45
- }
46
- opts.on("-C", "--config [FILE]", "Load options from config file") {
44
+ opts.on("-C", "--config FILE", "Load options from config file") {
47
45
  |file| @options[:config] = file
48
46
  }
49
- opts.on("-s", "--scripts", "Location of traut scripts directory") {
47
+ opts.on("-s", "--scripts DIR", "Location of traut scripts directory"){
50
48
  |scripts| @options[:scripts] = scripts
51
49
  }
52
- opts.on('-l', '--logs [LOG]', "Location of log directory location") {
50
+ opts.on("-a", "--actions DIR", "Location of traut actions directory"){
51
+ |acts| @options[:action_dir] = acts
52
+ }
53
+ opts.on('-l', '--logs LOG', "Location of log directory location") {
53
54
  |log| @options[:logs] = log
54
55
  }
55
56
  opts.on('--debug', 'Enable debug logging') {
@@ -108,6 +109,14 @@ module Traut
108
109
  YAML.load_file(file).each {
109
110
  |key, value| @options[key.to_sym] = value
110
111
  }
112
+ dir = Dir.open(@options[:action_dir])
113
+ @options[:actions] = {}
114
+ dir.each do |f|
115
+ af = File.join(dir, f)
116
+ if ! File.directory? af
117
+ YAML.load_file(af).each { |k,v| @options[:actions][k] = v }
118
+ end
119
+ end
111
120
  end
112
121
  end
113
122
 
data/lib/traut/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Traut
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: traut
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-09-28 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: daemons
16
- requirement: &76404200 !ruby/object:Gem::Requirement
16
+ requirement: &80625300 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '1.1'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *76404200
24
+ version_requirements: *80625300
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: amqp
27
- requirement: &76403940 !ruby/object:Gem::Requirement
27
+ requirement: &80625050 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.8.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *76403940
35
+ version_requirements: *80625050
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: systemu
38
- requirement: &76403680 !ruby/object:Gem::Requirement
38
+ requirement: &80624780 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '2.4'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *76403680
46
+ version_requirements: *80624780
47
47
  description: Traut is a configurable daemon for running localhost commands in response
48
48
  to events generated elsewhere. AMQP is used as the interchange. Traut can make application
49
49
  deployments in response to code checkins, automate database failover and anything
@@ -62,6 +62,7 @@ files:
62
62
  - README.md
63
63
  - Rakefile
64
64
  - bin/traut
65
+ - etc/actions/app.action
65
66
  - etc/traut.conf.sample
66
67
  - lib/traut.rb
67
68
  - lib/traut/runner.rb