thingfish 0.5.0.pre20160707192835
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.
- checksums.yaml +7 -0
- data/.simplecov +7 -0
- data/History.rdoc +5 -0
- data/LICENSE +29 -0
- data/Manifest.txt +39 -0
- data/Procfile +4 -0
- data/README.rdoc +92 -0
- data/Rakefile +92 -0
- data/bin/tfprocessord +6 -0
- data/bin/thingfish +10 -0
- data/etc/thingfish.conf.example +26 -0
- data/lib/strelka/app/metadata.rb +38 -0
- data/lib/strelka/httprequest/metadata.rb +70 -0
- data/lib/thingfish.rb +43 -0
- data/lib/thingfish/behaviors.rb +263 -0
- data/lib/thingfish/datastore.rb +55 -0
- data/lib/thingfish/datastore/memory.rb +93 -0
- data/lib/thingfish/handler.rb +728 -0
- data/lib/thingfish/metastore.rb +55 -0
- data/lib/thingfish/metastore/memory.rb +201 -0
- data/lib/thingfish/mixins.rb +57 -0
- data/lib/thingfish/processor.rb +79 -0
- data/lib/thingfish/processor/mp3.rb +167 -0
- data/lib/thingfish/processordaemon.rb +16 -0
- data/lib/thingfish/spechelpers.rb +165 -0
- data/spec/data/APIC-1-image.mp3 +0 -0
- data/spec/data/APIC-2-images.mp3 +0 -0
- data/spec/data/PIC-1-image.mp3 +0 -0
- data/spec/data/PIC-2-images.mp3 +0 -0
- data/spec/helpers.rb +67 -0
- data/spec/spec.opts +4 -0
- data/spec/thingfish/datastore/memory_spec.rb +19 -0
- data/spec/thingfish/datastore_spec.rb +64 -0
- data/spec/thingfish/handler_spec.rb +838 -0
- data/spec/thingfish/metastore/memory_spec.rb +17 -0
- data/spec/thingfish/metastore_spec.rb +96 -0
- data/spec/thingfish/mixins_spec.rb +63 -0
- data/spec/thingfish/processor/mp3_spec.rb +50 -0
- data/spec/thingfish/processor_spec.rb +65 -0
- data/spec/thingfish_spec.rb +23 -0
- metadata +244 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1cb359c51a202a06ce18845971fb239473b3b52f
|
4
|
+
data.tar.gz: 771be1e193d9d560f0669b8f5b2718684c673e70
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 407d223a9dd672b39cea0e0d98222710835e65525d5e2011f5964a39cd1a9a3c58ab4aecea83ac591219ef9277be8a481179fc82fe825b6572ecc762fffe3991
|
7
|
+
data.tar.gz: 4d58598b60d541b5e9deeeb1a7e06498c55e7828b8543f4baa0438c1a6b236ea61a993e2e041d5b4eb2a659463c15d7d081f16c99751b0650fa96bac186ee5ac
|
data/.simplecov
ADDED
data/History.rdoc
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
Copyright (c) 2014-2015, Michael Granger and Mahlon E. Smith.
|
2
|
+
|
3
|
+
All rights reserved.
|
4
|
+
|
5
|
+
Redistribution and use in source and binary forms, with or without modification, are
|
6
|
+
permitted provided that the following conditions are met:
|
7
|
+
|
8
|
+
* Redistributions of source code must retain the above copyright notice, this
|
9
|
+
list of conditions and the following disclaimer.
|
10
|
+
|
11
|
+
* Redistributions in binary form must reproduce the above copyright notice, this
|
12
|
+
list of conditions and the following disclaimer in the documentation and/or
|
13
|
+
other materials provided with the distribution.
|
14
|
+
|
15
|
+
* Neither the name of the authors, nor the names of its contributors may be used to
|
16
|
+
endorse or promote products derived from this software without specific prior
|
17
|
+
written permission.
|
18
|
+
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
20
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
21
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
22
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
23
|
+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
24
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
25
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
26
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
27
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
28
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
29
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/Manifest.txt
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
.simplecov
|
2
|
+
History.rdoc
|
3
|
+
LICENSE
|
4
|
+
Manifest.txt
|
5
|
+
Procfile
|
6
|
+
README.rdoc
|
7
|
+
Rakefile
|
8
|
+
bin/tfprocessord
|
9
|
+
bin/thingfish
|
10
|
+
etc/thingfish.conf.example
|
11
|
+
lib/strelka/app/metadata.rb
|
12
|
+
lib/strelka/httprequest/metadata.rb
|
13
|
+
lib/thingfish.rb
|
14
|
+
lib/thingfish/behaviors.rb
|
15
|
+
lib/thingfish/datastore.rb
|
16
|
+
lib/thingfish/datastore/memory.rb
|
17
|
+
lib/thingfish/handler.rb
|
18
|
+
lib/thingfish/metastore.rb
|
19
|
+
lib/thingfish/metastore/memory.rb
|
20
|
+
lib/thingfish/mixins.rb
|
21
|
+
lib/thingfish/processor.rb
|
22
|
+
lib/thingfish/processor/mp3.rb
|
23
|
+
lib/thingfish/processordaemon.rb
|
24
|
+
lib/thingfish/spechelpers.rb
|
25
|
+
spec/data/APIC-1-image.mp3
|
26
|
+
spec/data/APIC-2-images.mp3
|
27
|
+
spec/data/PIC-1-image.mp3
|
28
|
+
spec/data/PIC-2-images.mp3
|
29
|
+
spec/helpers.rb
|
30
|
+
spec/spec.opts
|
31
|
+
spec/thingfish/datastore/memory_spec.rb
|
32
|
+
spec/thingfish/datastore_spec.rb
|
33
|
+
spec/thingfish/handler_spec.rb
|
34
|
+
spec/thingfish/metastore/memory_spec.rb
|
35
|
+
spec/thingfish/metastore_spec.rb
|
36
|
+
spec/thingfish/mixins_spec.rb
|
37
|
+
spec/thingfish/processor/mp3_spec.rb
|
38
|
+
spec/thingfish/processor_spec.rb
|
39
|
+
spec/thingfish_spec.rb
|
data/Procfile
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
= Thingfish
|
2
|
+
|
3
|
+
* http://bitbucket.org/ged/thingfish
|
4
|
+
|
5
|
+
== Description
|
6
|
+
|
7
|
+
Thingfish is a extensible, web-based digital asset manager. It can be used to
|
8
|
+
store chunks of data on the network in an application-independent way, link the
|
9
|
+
chunks together with metadata, and then search for the chunk you need later and
|
10
|
+
fetch it, all through a REST API.
|
11
|
+
|
12
|
+
|
13
|
+
== Authors
|
14
|
+
|
15
|
+
* Michael Granger <ged@FaerieMUD.org>
|
16
|
+
* Mahlon E. Smith <mahlon@martini.nu>
|
17
|
+
|
18
|
+
== Contributors
|
19
|
+
|
20
|
+
* Jeremiah Jordan <phaedrus@perlreason.com>
|
21
|
+
* Ben Bleything <ben@bleything.net>
|
22
|
+
* Jeff Davis <jeff-thingfish@j-davis.com>
|
23
|
+
|
24
|
+
|
25
|
+
== Installation
|
26
|
+
|
27
|
+
=== Requirements
|
28
|
+
|
29
|
+
Thingfish is written in ruby, and is tested using version 2.0.0.
|
30
|
+
|
31
|
+
* Ruby (>= 2.0.0): http://www.ruby-lang.org/en/downloads/
|
32
|
+
|
33
|
+
Other versions may work, but are not tested.
|
34
|
+
|
35
|
+
=== Ruby Modules
|
36
|
+
|
37
|
+
You can install Thingfish via the Rubygems package manager:
|
38
|
+
|
39
|
+
$ sudo gem install thingfish
|
40
|
+
|
41
|
+
This will install the basic server and its dependencies. You can also install a collection of useful plugins via the 'thingfish-plugins' gem.
|
42
|
+
|
43
|
+
|
44
|
+
== Contributing
|
45
|
+
|
46
|
+
You can check out the current development source
|
47
|
+
{with Mercurial}[http://bitbucket.org/ged/thingfish], or
|
48
|
+
if you prefer Git, via the project's
|
49
|
+
{Github mirror}[https://github.com/ged/thingfish].
|
50
|
+
|
51
|
+
After checking out the source, run:
|
52
|
+
|
53
|
+
$ rake newb
|
54
|
+
|
55
|
+
This task will install any missing dependencies, run the tests/specs, and
|
56
|
+
generate the API documentation.
|
57
|
+
|
58
|
+
You can submit bug reports, suggestions, and read more about future plans at
|
59
|
+
{the project page}[http://bitbucket.org/ged/thingfish].
|
60
|
+
|
61
|
+
|
62
|
+
== License
|
63
|
+
|
64
|
+
Copyright (c) 2007-2014, Michael Granger and Mahlon E. Smith
|
65
|
+
All rights reserved.
|
66
|
+
|
67
|
+
Redistribution and use in source and binary forms, with or without
|
68
|
+
modification, are permitted provided that the following conditions are met:
|
69
|
+
|
70
|
+
* Redistributions of source code must retain the above copyright notice,
|
71
|
+
this list of conditions and the following disclaimer.
|
72
|
+
|
73
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
74
|
+
this list of conditions and the following disclaimer in the documentation
|
75
|
+
and/or other materials provided with the distribution.
|
76
|
+
|
77
|
+
* Neither the name of the author/s, nor the names of the project's
|
78
|
+
contributors may be used to endorse or promote products derived from this
|
79
|
+
software without specific prior written permission.
|
80
|
+
|
81
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
82
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
83
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
84
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
85
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
86
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
87
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
88
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
89
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
90
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
91
|
+
|
92
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
#encoding: utf-8
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'hoe'
|
6
|
+
rescue LoadError
|
7
|
+
abort "This Rakefile requires hoe (gem install hoe)"
|
8
|
+
end
|
9
|
+
|
10
|
+
GEMSPEC = 'thingfish.gemspec'
|
11
|
+
|
12
|
+
|
13
|
+
Hoe.plugin :mercurial
|
14
|
+
Hoe.plugin :signing
|
15
|
+
Hoe.plugin :deveiate
|
16
|
+
|
17
|
+
Hoe.plugins.delete :rubyforge
|
18
|
+
|
19
|
+
hoespec = Hoe.spec 'thingfish' do
|
20
|
+
self.readme_file = 'README.rdoc'
|
21
|
+
self.history_file = 'History.rdoc'
|
22
|
+
self.extra_rdoc_files = Rake::FileList[ '*.rdoc' ]
|
23
|
+
self.license 'BSD'
|
24
|
+
|
25
|
+
self.developer 'Michael Granger', 'ged@FaerieMUD.org'
|
26
|
+
self.developer 'Mahlon E. Smith', 'mahlon@martini.nu'
|
27
|
+
self.license "BSD"
|
28
|
+
|
29
|
+
self.dependency 'strelka', '~> 0.9'
|
30
|
+
self.dependency 'mongrel2', '~> 0.43'
|
31
|
+
|
32
|
+
self.dependency 'hoe-deveiate', '~> 0.3', :development
|
33
|
+
self.dependency 'simplecov', '~> 0.7', :development
|
34
|
+
self.dependency 'ruby-mp3info', '~> 0.8', :development
|
35
|
+
|
36
|
+
self.require_ruby_version( '>=2.0.0' )
|
37
|
+
|
38
|
+
self.hg_sign_tags = true if self.respond_to?( :hg_sign_tags= )
|
39
|
+
spec.check_history_on_release = true if spec.respond_to?( :check_history_on_release= )
|
40
|
+
|
41
|
+
self.rdoc_locations << "deveiate:/usr/local/www/public/code/#{remote_rdoc_dir}"
|
42
|
+
end
|
43
|
+
|
44
|
+
ENV['VERSION'] ||= hoespec.spec.version.to_s
|
45
|
+
|
46
|
+
# Run the tests before checking in
|
47
|
+
task 'hg:precheckin' => [ :check_history, :check_manifest, :gemspec, :spec ]
|
48
|
+
|
49
|
+
task :test => :spec
|
50
|
+
|
51
|
+
# Rebuild the ChangeLog immediately before release
|
52
|
+
task :prerelease => 'ChangeLog'
|
53
|
+
CLOBBER.include( 'ChangeLog' )
|
54
|
+
|
55
|
+
desc "Build a coverage report"
|
56
|
+
task :coverage do
|
57
|
+
ENV["COVERAGE"] = 'yes'
|
58
|
+
Rake::Task[:spec].invoke
|
59
|
+
end
|
60
|
+
CLOBBER.include( 'coverage' )
|
61
|
+
|
62
|
+
|
63
|
+
# Use the fivefish formatter for docs generated from development checkout
|
64
|
+
if File.directory?( '.hg' )
|
65
|
+
require 'rdoc/task'
|
66
|
+
|
67
|
+
Rake::Task[ 'docs' ].clear
|
68
|
+
RDoc::Task.new( 'docs' ) do |rdoc|
|
69
|
+
rdoc.main = "README.rdoc"
|
70
|
+
rdoc.markup = 'markdown'
|
71
|
+
rdoc.rdoc_files.include( "*.rdoc", "ChangeLog", "lib/**/*.rb" )
|
72
|
+
rdoc.generator = :fivefish
|
73
|
+
rdoc.title = 'Thingfish'
|
74
|
+
rdoc.rdoc_dir = 'doc'
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
task :gemspec => GEMSPEC
|
79
|
+
file GEMSPEC => __FILE__
|
80
|
+
task GEMSPEC do |task|
|
81
|
+
spec = $hoespec.spec
|
82
|
+
spec.files.delete( '.gemtest' )
|
83
|
+
spec.signing_key = nil
|
84
|
+
spec.cert_chain = ['certs/ged.pem']
|
85
|
+
spec.version = "#{spec.version}.pre#{Time.now.strftime("%Y%m%d%H%M%S")}"
|
86
|
+
File.open( task.name, 'w' ) do |fh|
|
87
|
+
fh.write( spec.to_ruby )
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
CLOBBER.include( GEMSPEC.to_s )
|
92
|
+
|
data/bin/tfprocessord
ADDED
data/bin/thingfish
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
---
|
2
|
+
logging:
|
3
|
+
__default__: debug STDERR
|
4
|
+
thingfish: info (color)
|
5
|
+
|
6
|
+
# Thingfish specific configuration.
|
7
|
+
#
|
8
|
+
thingfish:
|
9
|
+
datastore: memory
|
10
|
+
metastore: memory
|
11
|
+
|
12
|
+
# The path to the Mongrel2 config database.
|
13
|
+
#
|
14
|
+
mongrel2:
|
15
|
+
configdb: example/mongrel2.sqlite
|
16
|
+
|
17
|
+
# Strelka configuration knobs that influence Thingfish's handler.
|
18
|
+
#
|
19
|
+
app:
|
20
|
+
devmode: false
|
21
|
+
app_glob_pattern: '{apps,handlers}/**/*'
|
22
|
+
local_data_dirs: data/*
|
23
|
+
multipartparser:
|
24
|
+
bufsize: 524288
|
25
|
+
spooldir: /var/folders/1f/6ymhh79s0n3gjdw16fj7tp480000gp/T/strelka-mimeparts
|
26
|
+
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
#encoding: utf-8
|
3
|
+
|
4
|
+
require 'strelka'
|
5
|
+
require 'strelka/plugins'
|
6
|
+
require 'strelka/httprequest/metadata'
|
7
|
+
|
8
|
+
require 'thingfish'
|
9
|
+
|
10
|
+
|
11
|
+
# A Strelka plugin for setting up requests to be able to carry Thingfish metadata
|
12
|
+
# with it.
|
13
|
+
module Strelka::App::Metadata
|
14
|
+
extend Strelka::Plugin
|
15
|
+
|
16
|
+
|
17
|
+
run_outside :routing, :filters
|
18
|
+
run_inside :templating, :parameters
|
19
|
+
|
20
|
+
|
21
|
+
### Extension callback -- extend the HTTPRequest classes with Metadata
|
22
|
+
### support when this plugin is loaded.
|
23
|
+
def self::included( object )
|
24
|
+
self.log.debug "Extending Request with Metadata mixins"
|
25
|
+
Strelka::HTTPRequest.class_eval { include Strelka::HTTPRequest::Metadata }
|
26
|
+
super
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
### Start content-negotiation when the response has returned.
|
31
|
+
def handle_request( request )
|
32
|
+
self.log.debug "[:metadata] Attaching Thingfish metadata to request."
|
33
|
+
super
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
end # module Strelka::App::Metadata
|
38
|
+
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
# vim: set nosta noet ts=4 sw=4:
|
3
|
+
# encoding: utf-8
|
4
|
+
|
5
|
+
require 'strelka/constants'
|
6
|
+
require 'strelka/httprequest' unless defined?( Strelka::HTTPRequest )
|
7
|
+
|
8
|
+
require 'thingfish'
|
9
|
+
require 'thingfish/mixins'
|
10
|
+
|
11
|
+
|
12
|
+
# The mixin that adds methods to Strelka::HTTPRequest for Thingfish metadata.
|
13
|
+
#
|
14
|
+
# request.metadata
|
15
|
+
# request.add_metadata
|
16
|
+
#
|
17
|
+
module Strelka::HTTPRequest::Metadata
|
18
|
+
include Strelka::Constants,
|
19
|
+
Thingfish::Normalization
|
20
|
+
|
21
|
+
|
22
|
+
### Set up some data structures for metadata.
|
23
|
+
def initialize( * )
|
24
|
+
super
|
25
|
+
|
26
|
+
@metadata = {}
|
27
|
+
@related_resources = {}
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
######
|
32
|
+
public
|
33
|
+
######
|
34
|
+
|
35
|
+
# The Hash of Thingfish metadata associated with the request
|
36
|
+
attr_reader :metadata
|
37
|
+
|
38
|
+
# The Hash of related resources
|
39
|
+
attr_reader :related_resources
|
40
|
+
|
41
|
+
|
42
|
+
### Merge the metadata in the given +metadata+ hash into the request's current
|
43
|
+
### metadata.
|
44
|
+
def add_metadata( metadata )
|
45
|
+
self.log.debug "Adding metadata to the request: %p" % [ metadata ]
|
46
|
+
metadata = normalize_keys( metadata )
|
47
|
+
self.metadata.merge!( metadata )
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
### Add a resource that's related to the one in the request.
|
52
|
+
def add_related_resource( io, metadata )
|
53
|
+
metadata = normalize_keys( metadata )
|
54
|
+
metadata.merge!( self.extract_related_metadata(io) )
|
55
|
+
self.log.debug "Adding related resource: %p %p" % [ io, metadata ]
|
56
|
+
self.related_resources[ io ] = metadata
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
### Extract some default metadata from related resources.
|
61
|
+
def extract_related_metadata( io )
|
62
|
+
metadata = {}
|
63
|
+
|
64
|
+
metadata['extent'] = io.size
|
65
|
+
|
66
|
+
return metadata
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|