bigwig 0.3 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ v0.4. Added the ability to require init scripts at startup
2
+
1
3
  v0.3. added bigwig-push command to place arbitrary messages on the queue
2
4
 
3
5
  v0.2. added bigwig-ping command to place ping messages on the queue
data/Manifest CHANGED
@@ -3,12 +3,14 @@ LICENSE
3
3
  Manifest
4
4
  README.markdown
5
5
  Rakefile
6
+ bigwig.gemspec
6
7
  bigwig.yml
7
8
  bigwig.yml.example
8
9
  bin/bigwig
9
10
  bin/bigwig-ping
10
11
  bin/bigwig-push
11
12
  lib/bigwig.rb
13
+ lib/bigwig/init_scripts.rb
12
14
  lib/bigwig/internal_plugins/ping_plugin.rb
13
15
  lib/bigwig/job.rb
14
16
  lib/bigwig/pinger.rb
@@ -88,6 +88,16 @@ Pings
88
88
 
89
89
  There is a plugin built-in to bigwig called PingPlugin, that registers itself under the name "ping". If you place a message onto the queue with :method => 'ping', the PingPlugin responds by writing a message to the log file. This is useful for monitoring bigwig - another system places ping messages onto the queue at regular intervals and we watch to ensure that the log file's update time is changing.
90
90
 
91
+ Init Scripts
92
+ ------------
93
+
94
+ Sometimes you need to do something on starting bigwig. Most common is setting up warren filters. Just add
95
+
96
+ init_folder: /path/to/init/folder
97
+
98
+ to your `config.yml` and bigwig will load any `rb` files that folder contains.
99
+
100
+
91
101
  Command-line Interface
92
102
  ----------------------
93
103
 
@@ -2,16 +2,16 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{bigwig}
5
- s.version = "0.3"
5
+ s.version = "0.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["David Smalley, Caius Durling, Rahoul Baruah"]
9
- s.date = %q{2009-11-05}
9
+ s.date = %q{2009-11-09}
10
10
  s.description = %q{A daemon that listens to an AMQP queue and responds to messages by invoking commands from a set of plugins}
11
11
  s.email = %q{}
12
12
  s.executables = ["bigwig", "bigwig-ping", "bigwig-push"]
13
- s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README.markdown", "bin/bigwig", "bin/bigwig-ping", "bin/bigwig-push", "lib/bigwig.rb", "lib/bigwig/internal_plugins/ping_plugin.rb", "lib/bigwig/job.rb", "lib/bigwig/pinger.rb", "lib/bigwig/plugin.rb", "lib/bigwig/plugins.rb", "lib/bigwig/push.rb", "lib/bigwig/runner.rb"]
14
- s.files = ["CHANGELOG", "LICENSE", "Manifest", "README.markdown", "Rakefile", "bigwig.yml", "bigwig.yml.example", "bin/bigwig", "bin/bigwig-ping", "bin/bigwig-push", "lib/bigwig.rb", "lib/bigwig/internal_plugins/ping_plugin.rb", "lib/bigwig/job.rb", "lib/bigwig/pinger.rb", "lib/bigwig/plugin.rb", "lib/bigwig/plugins.rb", "lib/bigwig/push.rb", "lib/bigwig/runner.rb", "bigwig.gemspec"]
13
+ s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README.markdown", "bin/bigwig", "bin/bigwig-ping", "bin/bigwig-push", "lib/bigwig.rb", "lib/bigwig/init_scripts.rb", "lib/bigwig/internal_plugins/ping_plugin.rb", "lib/bigwig/job.rb", "lib/bigwig/pinger.rb", "lib/bigwig/plugin.rb", "lib/bigwig/plugins.rb", "lib/bigwig/push.rb", "lib/bigwig/runner.rb"]
14
+ s.files = ["CHANGELOG", "LICENSE", "Manifest", "README.markdown", "Rakefile", "bigwig.gemspec", "bigwig.yml", "bigwig.yml.example", "bin/bigwig", "bin/bigwig-ping", "bin/bigwig-push", "lib/bigwig.rb", "lib/bigwig/init_scripts.rb", "lib/bigwig/internal_plugins/ping_plugin.rb", "lib/bigwig/job.rb", "lib/bigwig/pinger.rb", "lib/bigwig/plugin.rb", "lib/bigwig/plugins.rb", "lib/bigwig/push.rb", "lib/bigwig/runner.rb"]
15
15
  s.homepage = %q{http://www.brightbox.co.uk/}
16
16
  s.post_install_message = %q{Welcome to bigwig. Please set up a configuration file and a plugins folder before starting bigwig...}
17
17
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Bigwig", "--main", "README.markdown"]
@@ -5,4 +5,5 @@ server: my.amqpserver.com
5
5
  port: 5672
6
6
  queue: myqueue
7
7
  warren_logging: false
8
- plugins_folder: /full/path/to/a/folder
8
+ plugins_folder: /full/path/to/a/folder
9
+ # init_folder: /full/path/to/a/folder # Optional
@@ -0,0 +1,23 @@
1
+ module BigWig
2
+ class InitScripts
3
+ class << self
4
+ attr_accessor :root
5
+
6
+ def load_all
7
+ BigWig.logger.info "Loading #{all_scripts.size} init scripts"
8
+ all_scripts.each do |script|
9
+ # Log n load
10
+ BigWig.logger.info "init script: #{script}"
11
+ require script
12
+ end
13
+ end
14
+
15
+ protected
16
+
17
+ def all_scripts
18
+ Dir["#{self.root}/**/*.rb"]
19
+ end
20
+
21
+ end
22
+ end
23
+ end
@@ -21,6 +21,7 @@ module BigWig
21
21
  Daemons.run_proc('bigwig', :dir => @options.log_folder, :dir_mode => :normal, :log_output => true, :ARGV => self.args) do |*args|
22
22
  @config = YAML.load(File.open(@options.config))
23
23
  load_plugins_from @config["plugins_folder"]
24
+ load_init_scripts_from @config["init_folder"]
24
25
  begin
25
26
  BigWig::logger.info("Starting Bigwig job worker")
26
27
 
@@ -88,6 +89,12 @@ module BigWig
88
89
  BigWig::Plugins.load_all
89
90
  end
90
91
 
92
+ def load_init_scripts_from folder
93
+ return unless folder
94
+ BigWig::InitScripts.root = folder
95
+ BigWig::InitScripts.load_all
96
+ end
97
+
91
98
  def trap_signals
92
99
  trap('TERM') do
93
100
  BigWig::logger.info('Bigwig exiting due to TERM signal')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bigwig
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.3"
4
+ version: "0.4"
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Smalley, Caius Durling, Rahoul Baruah
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-05 00:00:00 +00:00
12
+ date: 2009-11-09 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -48,6 +48,7 @@ extra_rdoc_files:
48
48
  - bin/bigwig-ping
49
49
  - bin/bigwig-push
50
50
  - lib/bigwig.rb
51
+ - lib/bigwig/init_scripts.rb
51
52
  - lib/bigwig/internal_plugins/ping_plugin.rb
52
53
  - lib/bigwig/job.rb
53
54
  - lib/bigwig/pinger.rb
@@ -61,12 +62,14 @@ files:
61
62
  - Manifest
62
63
  - README.markdown
63
64
  - Rakefile
65
+ - bigwig.gemspec
64
66
  - bigwig.yml
65
67
  - bigwig.yml.example
66
68
  - bin/bigwig
67
69
  - bin/bigwig-ping
68
70
  - bin/bigwig-push
69
71
  - lib/bigwig.rb
72
+ - lib/bigwig/init_scripts.rb
70
73
  - lib/bigwig/internal_plugins/ping_plugin.rb
71
74
  - lib/bigwig/job.rb
72
75
  - lib/bigwig/pinger.rb
@@ -74,7 +77,6 @@ files:
74
77
  - lib/bigwig/plugins.rb
75
78
  - lib/bigwig/push.rb
76
79
  - lib/bigwig/runner.rb
77
- - bigwig.gemspec
78
80
  has_rdoc: true
79
81
  homepage: http://www.brightbox.co.uk/
80
82
  licenses: []