airbrush 0.0.5.pre4 → 0.0.5.pre6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5.pre4
1
+ 0.0.5.pre6
data/lib/airbrush.rb CHANGED
@@ -3,6 +3,8 @@ $:.unshift File.dirname(__FILE__)
3
3
  # required gems
4
4
  require 'active_support'
5
5
  require 'active_support/dependencies'
6
+ require 'active_support/time'
7
+ require 'active_support/core_ext'
6
8
 
7
9
  ActiveSupport::Dependencies.autoload_paths << File.dirname(__FILE__)
8
10
 
@@ -14,17 +16,21 @@ ActiveSupport::Dependencies.autoload_paths << File.dirname(__FILE__)
14
16
  Dir[File.dirname(__FILE__) + '/airbrush/core_ext/*.rb'].each { |e| require e }
15
17
 
16
18
  module Airbrush
19
+
17
20
  end
18
21
 
19
22
  class Object
20
23
  def log(out=$stdout)
21
- @@__log__ ||= __create_logger__(out)
24
+ @@logger ||= __create_logger__(out)
22
25
  end
23
26
 
24
27
  private
25
28
 
26
29
  def __create_logger__(target)
27
- @@__log__ = ActiveSupport::BufferedLogger.new(target, ActiveSupport::BufferedLogger::Severity::INFO)
30
+ @@logger = Logger.new(target)
31
+ @@logger.level = Logger::INFO
32
+ @@logger.formatter = Logger::Formatter.new
33
+ @@logger
28
34
  end
29
35
 
30
36
  end
@@ -0,0 +1,58 @@
1
+ require 'zmq'
2
+
3
+ module Airbrush
4
+ module Listeners
5
+ class ZeroMQ < Listener
6
+ DEFAULT_POLL_FREQUENCY = 1 # seconds
7
+
8
+ attr_reader :host, :poll_frequency, :socket
9
+
10
+ def initialize(host, frequency = DEFAULT_POLL_FREQUENCY)
11
+ @host = host
12
+ @poll_frequency = frequency
13
+ catch_signals(:int)
14
+ end
15
+
16
+ def start
17
+ @running = true
18
+
19
+ z = ZMQ::Context.new
20
+ puts "Connecting to ZEROMQ socket..."
21
+ @socket = z.socket(ZMQ::UPSTREAM)
22
+ @socket.connect "tcp://127.0.0.1:4010"
23
+
24
+ log.debug 'Accepting incoming jobs'
25
+
26
+ loop do
27
+ poll do |operation|
28
+ process operation
29
+ end
30
+
31
+ break unless @running
32
+ sleep @poll_frequency
33
+ end
34
+ end
35
+
36
+ private
37
+
38
+ def poll
39
+ operation = @socket.recv #(DEFAULT_INCOMING_QUEUE)
40
+ yield operation if operation and block_given?
41
+ end
42
+
43
+ def publish(results)
44
+ @socket.send(results)
45
+ end
46
+
47
+ def catch_signals(*signals)
48
+ signals.each do |signal|
49
+ sig = signal.to_s.upcase
50
+ Signal.trap(sig) do
51
+ @running = false
52
+ log.debug "Intercepted SIG#{sig}, exiting"
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -1,12 +1,12 @@
1
1
  require File.dirname(__FILE__) + '/../../spec_helper.rb'
2
2
 
3
- describe ActiveSupport::BufferedLogger, 'log statements' do
3
+ describe 'log statements' do
4
4
 
5
5
  before do
6
6
  @time = Time.now
7
7
  Time.stub!(:now).and_return(@time)
8
8
  @target = StringIO.new
9
- @logger = ActiveSupport::BufferedLogger.new(@target)
9
+ @logger = Object.log(@target)
10
10
  @statement = 'this is a test'
11
11
  end
12
12
 
@@ -123,7 +123,7 @@ describe Airbrush::Processors::Image::Rmagick do
123
123
  end
124
124
 
125
125
  it 'should return an image cropped to the crop marks' do
126
- @rm_image.should_receive(:crop!).with(0,20,800,900).once
126
+ @rm_image.should_receive(:crop!).with(0,20,800,900, true).once
127
127
  @processor.resized_crop_mask(@image, {:x => 0, :y => 20, :width => 800, :height => 900 }, { :width => 2890, :height => 1940 }).should == {
128
128
  :format => "JPEG", :image => "blob", :width => 1500, :height => 1000}
129
129
  end
data/spec/spec.opts CHANGED
@@ -1 +1 @@
1
- --color
1
+ --colour
metadata CHANGED
@@ -1,125 +1,126 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: airbrush
3
- version: !ruby/object:Gem::Version
4
- hash: -223651703
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.5.pre6
5
5
  prerelease: 6
6
- segments:
7
- - 0
8
- - 0
9
- - 5
10
- - pre
11
- - 4
12
- version: 0.0.5.pre4
13
6
  platform: ruby
14
- authors:
7
+ authors:
15
8
  - Marcus Crafter
16
9
  - Nick Marfleet
17
10
  autorequire:
18
11
  bindir: bin
19
12
  cert_chain: []
20
-
21
- date: 2010-05-19 00:00:00 +10:00
22
- default_executable:
23
- dependencies:
24
- - !ruby/object:Gem::Dependency
25
- name: starling
26
- prerelease: false
27
- requirement: &id001 !ruby/object:Gem::Requirement
13
+ date: 2011-06-18 00:00:00.000000000Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: activerecord
17
+ requirement: &70293953083720 !ruby/object:Gem::Requirement
28
18
  none: false
29
- requirements:
30
- - - "="
31
- - !ruby/object:Gem::Version
32
- hash: 43
33
- segments:
34
- - 0
35
- - 9
36
- - 8
37
- version: 0.9.8
19
+ requirements:
20
+ - - =
21
+ - !ruby/object:Gem::Version
22
+ version: 3.0.10
38
23
  type: :runtime
39
- version_requirements: *id001
40
- - !ruby/object:Gem::Dependency
24
+ prerelease: false
25
+ version_requirements: *70293953083720
26
+ - !ruby/object:Gem::Dependency
41
27
  name: activesupport
28
+ requirement: &70293953082680 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - =
32
+ - !ruby/object:Gem::Version
33
+ version: 3.0.10
34
+ type: :runtime
42
35
  prerelease: false
43
- requirement: &id002 !ruby/object:Gem::Requirement
36
+ version_requirements: *70293953082680
37
+ - !ruby/object:Gem::Dependency
38
+ name: actionpack
39
+ requirement: &70293953081880 !ruby/object:Gem::Requirement
44
40
  none: false
45
- requirements:
46
- - - ~>
47
- - !ruby/object:Gem::Version
48
- hash: 19
49
- segments:
50
- - 3
51
- - 0
52
- - 10
41
+ requirements:
42
+ - - =
43
+ - !ruby/object:Gem::Version
53
44
  version: 3.0.10
54
45
  type: :runtime
55
- version_requirements: *id002
56
- - !ruby/object:Gem::Dependency
57
- name: ruby2ruby
58
46
  prerelease: false
59
- requirement: &id003 !ruby/object:Gem::Requirement
47
+ version_requirements: *70293953081880
48
+ - !ruby/object:Gem::Dependency
49
+ name: hpricot
50
+ requirement: &70293953079900 !ruby/object:Gem::Requirement
60
51
  none: false
61
- requirements:
62
- - - ">="
63
- - !ruby/object:Gem::Version
64
- hash: 3
65
- segments:
66
- - 0
67
- version: "0"
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
68
56
  type: :runtime
69
- version_requirements: *id003
70
- - !ruby/object:Gem::Dependency
71
- name: daemons
72
57
  prerelease: false
73
- requirement: &id004 !ruby/object:Gem::Requirement
58
+ version_requirements: *70293953079900
59
+ - !ruby/object:Gem::Dependency
60
+ name: curb
61
+ requirement: &70293953079140 !ruby/object:Gem::Requirement
74
62
  none: false
75
- requirements:
76
- - - ">="
77
- - !ruby/object:Gem::Version
78
- hash: 3
79
- segments:
80
- - 0
81
- version: "0"
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
82
67
  type: :runtime
83
- version_requirements: *id004
84
- - !ruby/object:Gem::Dependency
68
+ prerelease: false
69
+ version_requirements: *70293953079140
70
+ - !ruby/object:Gem::Dependency
85
71
  name: live_ast
72
+ requirement: &70293953078500 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ type: :runtime
86
79
  prerelease: false
87
- requirement: &id005 !ruby/object:Gem::Requirement
80
+ version_requirements: *70293953078500
81
+ - !ruby/object:Gem::Dependency
82
+ name: starling
83
+ requirement: &70293953077780 !ruby/object:Gem::Requirement
88
84
  none: false
89
- requirements:
90
- - - ">="
91
- - !ruby/object:Gem::Version
92
- hash: 3
93
- segments:
94
- - 0
95
- version: "0"
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ type: :runtime
90
+ prerelease: false
91
+ version_requirements: *70293953077780
92
+ - !ruby/object:Gem::Dependency
93
+ name: rmagick
94
+ requirement: &70293953076580 !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ! '>='
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
96
100
  type: :runtime
97
- version_requirements: *id005
98
- - !ruby/object:Gem::Dependency
99
- name: rspec
100
101
  prerelease: false
101
- requirement: &id006 !ruby/object:Gem::Requirement
102
+ version_requirements: *70293953076580
103
+ - !ruby/object:Gem::Dependency
104
+ name: rspec
105
+ requirement: &70293953075540 !ruby/object:Gem::Requirement
102
106
  none: false
103
- requirements:
104
- - - ">="
105
- - !ruby/object:Gem::Version
106
- hash: 3
107
- segments:
108
- - 0
109
- version: "0"
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: 1.2.9
110
111
  type: :development
111
- version_requirements: *id006
112
- description: An Image Processing Server
113
- email: nick@whatevernext.org
114
- executables:
112
+ prerelease: false
113
+ version_requirements: *70293953075540
114
+ description:
115
+ email: nick@blocksglobal.com
116
+ executables:
115
117
  - airbrush
116
118
  - airbrush-example-client
117
119
  extensions: []
118
-
119
- extra_rdoc_files:
120
+ extra_rdoc_files:
120
121
  - LICENSE
121
122
  - README.txt
122
- files:
123
+ files:
123
124
  - .gitignore
124
125
  - History.txt
125
126
  - LICENSE
@@ -136,23 +137,18 @@ files:
136
137
  - lib/airbrush/handler.rb
137
138
  - lib/airbrush/listeners/listener.rb
138
139
  - lib/airbrush/listeners/memcache.rb
139
- - lib/airbrush/listeners/socket.rb
140
- - lib/airbrush/listeners/webservice.rb
140
+ - lib/airbrush/listeners/zeromq.rb
141
141
  - lib/airbrush/processors/image/image_processor.rb
142
142
  - lib/airbrush/processors/image/profiles/cmyk-profile.icc
143
143
  - lib/airbrush/processors/image/profiles/srgb-profile.icc
144
144
  - lib/airbrush/processors/image/rmagick.rb
145
145
  - lib/airbrush/processors/processor.rb
146
- - lib/airbrush/publishers/http.rb
147
- - lib/airbrush/publishers/memcache.rb
148
- - lib/airbrush/publishers/publisher.rb
149
146
  - lib/airbrush/server.rb
150
147
  - lib/airbrush/version.rb
151
148
  - log/debug.log
152
149
  - script/destroy
153
150
  - script/generate
154
151
  - script/txt2html
155
- - setup.rb
156
152
  - spec/airbrush/client_spec.rb
157
153
  - spec/airbrush/core_ext/get_args_spec.rb
158
154
  - spec/airbrush/core_ext/timestamped_logger_spec.rb
@@ -168,48 +164,33 @@ files:
168
164
  - spec/airbrush_spec.rb
169
165
  - spec/spec.opts
170
166
  - spec/spec_helper.rb
171
- - tasks/environment.rake
172
167
  - tasks/rspec.rake
173
- - website/index.html
174
- - website/index.txt
175
- - website/javascripts/rounded_corners_lite.inc.js
176
- - website/stylesheets/screen.css
177
- - website/template.rhtml
178
- has_rdoc: true
179
- homepage: http://github.com/square-circle-triangle/airbush
168
+ homepage: http://www.blocksglobal.com
180
169
  licenses: []
181
-
182
170
  post_install_message:
183
- rdoc_options:
171
+ rdoc_options:
184
172
  - --charset=UTF-8
185
- require_paths:
173
+ require_paths:
186
174
  - lib
187
- required_ruby_version: !ruby/object:Gem::Requirement
175
+ required_ruby_version: !ruby/object:Gem::Requirement
188
176
  none: false
189
- requirements:
190
- - - ">="
191
- - !ruby/object:Gem::Version
192
- hash: 3
193
- segments:
194
- - 0
195
- version: "0"
196
- required_rubygems_version: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ! '>='
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ required_rubygems_version: !ruby/object:Gem::Requirement
197
182
  none: false
198
- requirements:
199
- - - ">="
200
- - !ruby/object:Gem::Version
201
- hash: 3
202
- segments:
203
- - 0
204
- version: "0"
183
+ requirements:
184
+ - - ! '>='
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
205
187
  requirements: []
206
-
207
188
  rubyforge_project:
208
- rubygems_version: 1.4.2
189
+ rubygems_version: 1.8.10
209
190
  signing_key:
210
191
  specification_version: 3
211
- summary: Image Processing Server
212
- test_files:
192
+ summary: Gem for providing messaging system for media processing
193
+ test_files:
213
194
  - spec/airbrush/client_spec.rb
214
195
  - spec/airbrush/core_ext/get_args_spec.rb
215
196
  - spec/airbrush/core_ext/timestamped_logger_spec.rb
File without changes
File without changes
@@ -1,13 +0,0 @@
1
- module Airbrush
2
- module Publishers
3
- class Http < Publisher
4
- def initialize(target)
5
- @target = target
6
- end
7
-
8
- def publish(result)
9
- # http post/put to target
10
- end
11
- end
12
- end
13
- end