cloud-crowd 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/cloud-crowd.gemspec +2 -2
- data/lib/cloud-crowd.rb +1 -1
- data/lib/cloud_crowd/asset_store.rb +11 -11
- data/test/config/config.yml +1 -0
- data/test/unit/test_configuration.rb +15 -8
- metadata +2 -2
data/cloud-crowd.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'cloud-crowd'
|
3
|
-
s.version = '0.3.
|
4
|
-
s.date = '2010-01-
|
3
|
+
s.version = '0.3.3' # Keep version in sync with cloud-cloud.rb
|
4
|
+
s.date = '2010-01-27'
|
5
5
|
|
6
6
|
s.homepage = "http://wiki.github.com/documentcloud/cloud-crowd"
|
7
7
|
s.summary = "Parallel Processing for the Rest of Us"
|
data/lib/cloud-crowd.rb
CHANGED
@@ -44,7 +44,7 @@ module CloudCrowd
|
|
44
44
|
autoload :WorkUnit, 'cloud_crowd/models'
|
45
45
|
|
46
46
|
# Keep this version in sync with the gemspec.
|
47
|
-
VERSION = '0.3.
|
47
|
+
VERSION = '0.3.3'
|
48
48
|
|
49
49
|
# Increment the schema version when there's a backwards incompatible change.
|
50
50
|
SCHEMA_VERSION = 3
|
@@ -2,40 +2,40 @@ require 'tmpdir'
|
|
2
2
|
|
3
3
|
module CloudCrowd
|
4
4
|
|
5
|
-
# The AssetStore provides a common API for storing files and returning URLs
|
5
|
+
# The AssetStore provides a common API for storing files and returning URLs
|
6
6
|
# that can access them. At the moment, the files can be saved to either S3, or
|
7
|
-
# the local filesystem. You shouldn't need to use the AssetStore directly --
|
7
|
+
# the local filesystem. You shouldn't need to use the AssetStore directly --
|
8
8
|
# Action's +download+ and +save+ methods use it behind the scenes.
|
9
9
|
#
|
10
|
-
# To implement a new back-end for the AssetStore, you must provide
|
11
|
-
# <tt>save(local_path, save_path)</tt>, <tt>cleanup(job)</tt>, and optionally,
|
10
|
+
# To implement a new back-end for the AssetStore, you must provide
|
11
|
+
# <tt>save(local_path, save_path)</tt>, <tt>cleanup(job)</tt>, and optionally,
|
12
12
|
# a <tt>setup</tt> method that will be called once at initialization.
|
13
13
|
class AssetStore
|
14
|
-
|
14
|
+
|
15
15
|
autoload :S3Store, 'cloud_crowd/asset_store/s3_store'
|
16
16
|
autoload :FilesystemStore, 'cloud_crowd/asset_store/filesystem_store'
|
17
|
-
|
18
|
-
# Configure the AssetStore with the specific storage implementation
|
17
|
+
|
18
|
+
# Configure the AssetStore with the specific storage implementation
|
19
19
|
# specified by 'storage' in <tt>config.yml</tt>.
|
20
20
|
case CloudCrowd.config[:storage]
|
21
21
|
when 's3' then include S3Store
|
22
22
|
when 'filesystem' then include FilesystemStore
|
23
23
|
else raise Error::StorageNotFound, "#{CloudCrowd.config[:storage]} is not a valid storage back end"
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
# Creating the AssetStore ensures that its scratch directory exists.
|
27
27
|
def initialize
|
28
28
|
FileUtils.mkdir_p temp_storage_path unless File.exists? temp_storage_path
|
29
29
|
raise Error::StorageNotWritable, "#{temp_storage_path} is not writable" unless File.writable?(temp_storage_path)
|
30
30
|
setup if respond_to? :setup
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
# Get the path to CloudCrowd's temporary local storage. All actions run
|
34
34
|
# in subdirectories of this.
|
35
35
|
def temp_storage_path
|
36
|
-
"#{Dir.tmpdir}/cloud_crowd_tmp"
|
36
|
+
@temp_storage_path ||= CloudCrowd.config[:temp_storage_path] || "#{Dir.tmpdir}/cloud_crowd_tmp"
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
end
|
40
40
|
|
41
41
|
end
|
data/test/config/config.yml
CHANGED
@@ -3,39 +3,46 @@ require 'test_helper'
|
|
3
3
|
class ConfigurationTest < Test::Unit::TestCase
|
4
4
|
|
5
5
|
context "CloudCrowd Configuration" do
|
6
|
-
|
6
|
+
|
7
7
|
setup { CloudCrowd.instance_variable_set("@actions", nil) }
|
8
8
|
|
9
9
|
should "have read in config.yml" do
|
10
10
|
assert CloudCrowd.config[:max_workers] == 10
|
11
11
|
assert CloudCrowd.config[:storage] == 'filesystem'
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
should "allow config.yml to configure the implementation of AssetStore" do
|
15
15
|
assert CloudCrowd::AssetStore.ancestors.include?(CloudCrowd::AssetStore::FilesystemStore)
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
should "have properly configured the ActiveRecord database" do
|
19
19
|
assert ActiveRecord::Base.connection.active?
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
should "have loaded in the default set of actions" do
|
23
23
|
assert CloudCrowd.actions['word_count'] == WordCount
|
24
24
|
assert CloudCrowd.actions['process_pdfs'] == ProcessPdfs
|
25
25
|
assert CloudCrowd.actions['graphics_magick'] == GraphicsMagick
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
should "not find custom actions unless 'actions_path' is set" do
|
29
29
|
CloudCrowd.config[:actions_path] = nil
|
30
30
|
assert CloudCrowd.actions.keys.length == 4
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
should "find custom actions when 'actions_path' is set" do
|
34
34
|
CloudCrowd.config[:actions_path] = "#{CloudCrowd::ROOT}/test/config/actions/custom"
|
35
35
|
assert CloudCrowd.actions['echo_action'] == EchoAction
|
36
36
|
assert CloudCrowd.actions.keys.length == 5
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
|
+
should "be able to set the temporary storage path" do
|
40
|
+
store = CloudCrowd::AssetStore.new
|
41
|
+
path = '/tmp/cloud_crowd_tests'
|
42
|
+
assert store.temp_storage_path == path
|
43
|
+
assert File.exists?(path) && File.writable?(path)
|
44
|
+
end
|
45
|
+
|
39
46
|
end
|
40
|
-
|
47
|
+
|
41
48
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloud-crowd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Ashkenas
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-27 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|