gina-conveyor 0.0.2 → 0.1.0

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/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gina-conveyor (0.0.2)
4
+ gina-conveyor (0.1.0)
5
5
  activemodel (~> 3.2.0)
6
6
  activesupport (~> 3.2.0)
7
7
  em-websocket (~> 0.3.6)
@@ -9,6 +9,7 @@ PATH
9
9
  listen (~> 0.4.2)
10
10
  rainbow (~> 1.1.4)
11
11
  rb-readline (~> 0.4.2)
12
+ tinder
12
13
 
13
14
  GEM
14
15
  remote: http://rubygems.org/
@@ -25,13 +26,24 @@ GEM
25
26
  addressable (>= 2.1.1)
26
27
  eventmachine (>= 0.12.9)
27
28
  eventmachine (0.12.10)
29
+ faraday (0.7.6)
30
+ addressable (~> 2.2)
31
+ multipart-post (~> 1.1)
32
+ rack (~> 1.1)
33
+ faraday_middleware (0.7.0)
34
+ faraday (~> 0.7.3)
28
35
  ffi (1.0.11)
36
+ hashie (1.2.0)
37
+ http_parser.rb (0.5.3)
29
38
  i18n (0.6.0)
30
39
  listen (0.4.2)
31
40
  rb-fchange (~> 0.0.5)
32
41
  rb-fsevent (~> 0.9.1)
33
42
  rb-inotify (~> 0.8.8)
43
+ mime-types (1.18)
34
44
  multi_json (1.3.5)
45
+ multipart-post (1.1.5)
46
+ rack (1.4.1)
35
47
  rainbow (1.1.4)
36
48
  rake (0.9.2.2)
37
49
  rb-fchange (0.0.5)
@@ -40,6 +52,21 @@ GEM
40
52
  rb-inotify (0.8.8)
41
53
  ffi (>= 0.5.0)
42
54
  rb-readline (0.4.2)
55
+ simple_oauth (0.1.8)
56
+ tinder (1.8.0)
57
+ activesupport (>= 2.3, < 4)
58
+ eventmachine (~> 0.12)
59
+ faraday (>= 0.6, < 0.8)
60
+ faraday_middleware (>= 0.6, < 0.8)
61
+ hashie (~> 1.0)
62
+ mime-types (~> 1.16)
63
+ multi_json (~> 1.0)
64
+ multipart-post (~> 1.1)
65
+ twitter-stream (~> 0.1)
66
+ twitter-stream (0.1.15)
67
+ eventmachine (>= 0.12.8)
68
+ http_parser.rb (~> 0.5.1)
69
+ simple_oauth (~> 0.1.4)
43
70
 
44
71
  PLATFORMS
45
72
  ruby
data/README.md CHANGED
@@ -6,17 +6,35 @@ Start of a thought on some code to handle moving data around when it shows up on
6
6
  Installation
7
7
  ------------
8
8
 
9
+ Using rubygems
10
+
11
+ gem install gina-conveyor
12
+
13
+ From source
14
+
9
15
  git clone https://github.com/gina-alaska/conveyor.git
10
16
  cd conveyor
11
- bundle install
17
+ rake install
12
18
 
13
19
  Usage
14
20
  -----
15
21
 
16
- thor list # list available commands
17
- thor help [command] # show help for the given command
18
- thor belt list # list the currently active belts
19
- thor worker watch # tell the workers to start watching directories!
22
+ Just run the executable to start the conveyor process. Currently since no daemon mode is available it's best to start conveyor in a screen/tmux session
23
+
24
+ $ screen conveyor
25
+ [2012-05-24 13:39:52 -0800] Starting Conveyor v0.0.2
26
+ [2012-05-24 13:39:52 -0800] Loading workers from /home/wfisher/.workers
27
+ [2012-05-24 13:39:52 -0800] Waiting for files
28
+ [2012-05-24 13:39:52 -0800] Press CTRL-C to stop
29
+ [2012-05-24 13:39:52 -0800] Starting websocket on 0.0.0.0:9876
30
+
31
+ Todo
32
+ ----
33
+
34
+ 1. Add daemon mode
35
+ 2. Document worker syntax
36
+ 3. Finish email notifications
37
+ 4. Add additional cli options
20
38
 
21
39
  License
22
40
  -------
data/conveyor.gemspec CHANGED
@@ -27,4 +27,5 @@ Gem::Specification.new do |gem|
27
27
  gem.add_dependency('rb-readline', '~> 0.4.2')
28
28
  gem.add_dependency('eventmachine', '~> 0.12.10')
29
29
  gem.add_dependency('em-websocket', '~> 0.3.6')
30
+ gem.add_dependency('tinder')
30
31
  end
@@ -35,6 +35,12 @@ module Conveyor
35
35
  "disabled" => false,
36
36
  "host" => "0.0.0.0",
37
37
  "port" => 9876
38
+ },
39
+ "campfire" => {
40
+ "subdomain" => "",
41
+ "use_ssl" => true,
42
+ "token" => "",
43
+ "room" => ""
38
44
  }
39
45
  }
40
46
 
@@ -56,6 +62,7 @@ module Conveyor
56
62
 
57
63
  @config.symbolize_keys!
58
64
  @config[:websocket].symbolize_keys!
65
+ @config[:campfire].symbolize_keys!
59
66
  end
60
67
 
61
68
  def write_config(config)
@@ -0,0 +1,29 @@
1
+ module Conveyor
2
+ module Output
3
+ class Campfire
4
+ include Singleton
5
+
6
+ def initialize
7
+ @config = Conveyor::Foreman.instance.config[:campfire]
8
+ @host = Socket.gethostname
9
+
10
+ if enabled?
11
+ @campfire = Tinder::Campfire.new @config[:subdomain], :token => @config[:token]
12
+ end
13
+ end
14
+
15
+ def write(name, msgtype, *msg)
16
+ return false if !enabled? or msgtype != :announce
17
+
18
+ room = @campfire.find_room_by_name(@config[:room])
19
+ Array(msg).each do |m|
20
+ room.speak "[#{@host}::#{name}] #{m}"
21
+ end
22
+ end
23
+
24
+ def enabled?
25
+ !@config[:subdomain].empty? && !@config[:token].empty? && !@config[:room].empty?
26
+ end
27
+ end
28
+ end
29
+ end
@@ -2,6 +2,12 @@ module Conveyor
2
2
  module Output
3
3
  class Console
4
4
  class << self
5
+ def write(msgtype, *msg)
6
+ if respond_to?(msgtype)
7
+ self.send(msgtype, *msg)
8
+ end
9
+ end
10
+
5
11
  def output(*msg)
6
12
  options = msg.extract_options!
7
13
  options[:color] ||= :default
@@ -24,6 +24,12 @@ module Conveyor
24
24
  @msg_queue << msg
25
25
  end
26
26
 
27
+ def write(msgtype, *msg)
28
+ if respond_to?(msgtype)
29
+ self.send(msgtype, *msg)
30
+ end
31
+ end
32
+
27
33
  def mail
28
34
  return if @msg_queue.nil? || @msg_queue.empty?
29
35
  puts "Sending email to #{Conveyor::Foreman.instance.notify_list}"
@@ -2,6 +2,7 @@ require 'conveyor/output/console'
2
2
  require 'conveyor/output/email'
3
3
  require 'conveyor/output/logfile'
4
4
  require 'conveyor/output/channel'
5
+ require 'conveyor/output/campfire'
5
6
 
6
7
  module Conveyor
7
8
  module Output
@@ -9,7 +10,8 @@ module Conveyor
9
10
  :debug => 1,
10
11
  :info => 10,
11
12
  :warning => 20,
12
- :error => 30
13
+ :error => 30,
14
+ :announce => 40
13
15
  }
14
16
 
15
17
  def should_log?(lvl, maxlvl = nil)
@@ -57,12 +59,17 @@ module Conveyor
57
59
  output(:debug, *msg)
58
60
  end
59
61
 
62
+ def announce(*msg)
63
+ output(:announce, *msg)
64
+ end
65
+
60
66
  def output(msgtype, *msg)
61
67
  return false unless should_log?(msgtype)
62
- Console.send(msgtype, *msg)
68
+ Console.write(msgtype, *msg)
63
69
  Logfile.write(logfile, name, msgtype, *msg)
64
- Email.send(msgtype, *msg)
70
+ Email.write(msgtype, *msg)
65
71
  Channel.instance.write(name, msgtype, *msg)
72
+ Campfire.instance.write(name, msgtype, *msg)
66
73
  end
67
74
 
68
75
  def send_notifications
@@ -1,3 +1,3 @@
1
1
  module Conveyor
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1.0"
3
3
  end
data/lib/conveyor.rb CHANGED
@@ -4,6 +4,7 @@ $: << File.expand_path('../lib', File.dirname(__FILE__))
4
4
  require 'rubygems'
5
5
  require 'active_support/core_ext'
6
6
  require 'singleton'
7
+ require 'socket'
7
8
  require 'listen'
8
9
  require 'yaml'
9
10
  require 'rainbow'
@@ -11,6 +12,7 @@ require 'rb-readline'
11
12
  require 'fileutils'
12
13
  require 'eventmachine'
13
14
  require 'em-websocket'
15
+ require 'tinder'
14
16
  require "conveyor/version"
15
17
 
16
18
  module Conveyor
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gina-conveyor
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:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-24 00:00:00.000000000 Z
12
+ date: 2012-05-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -139,6 +139,22 @@ dependencies:
139
139
  - - ~>
140
140
  - !ruby/object:Gem::Version
141
141
  version: 0.3.6
142
+ - !ruby/object:Gem::Dependency
143
+ name: tinder
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ type: :runtime
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
142
158
  description: Conveyor is used for shuffling data around
143
159
  email:
144
160
  - will@gina.alaska.edu
@@ -163,6 +179,7 @@ files:
163
179
  - lib/conveyor/input/console.rb
164
180
  - lib/conveyor/job_state.rb
165
181
  - lib/conveyor/output.rb
182
+ - lib/conveyor/output/campfire.rb
166
183
  - lib/conveyor/output/channel.rb
167
184
  - lib/conveyor/output/console.rb
168
185
  - lib/conveyor/output/email.rb
@@ -253,7 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
253
270
  version: '0'
254
271
  requirements: []
255
272
  rubyforge_project:
256
- rubygems_version: 1.8.22
273
+ rubygems_version: 1.8.23
257
274
  signing_key:
258
275
  specification_version: 3
259
276
  summary: GINA Data Conveyor