Module: S3

Defined in:
lib/sinatra-s3/s3.rb,
lib/sinatra-s3/base.rb,
lib/sinatra-s3/admin.rb,
lib/sinatra-s3/errors.rb,
lib/sinatra-s3/helpers.rb,
lib/sinatra-s3/tracker.rb,
lib/sinatra-s3/helpers/acp.rb,
lib/sinatra-s3/helpers/tracker.rb,
lib/sinatra-s3/helpers/versioning.rb

Defined Under Namespace

Modules: Helpers, TrackerHelper Classes: Admin, Application, ServiceError, Tracker, TrackerError

Constant Summary collapse

S3_ENV =
:production
VERSION =
"0.99"
DEFAULT_PASSWORD =
'pass@word1'
BUFSIZE =
(4 * 1024)
ROOT_DIR =
File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
PUBLIC_PATH =
File.expand_path(S3.config[:public_path] || File.join(ROOT_DIR, 'public'))
STORAGE_PATH =
File.expand_path(S3.config[:storage_path] || 'storage')
RESOURCE_TYPES =
%w[acl versioning torrent]
CANNED_ACLS =
{
  'private' => 0600,
  'public-read' => 0644,
  'public-read-write' => 0666,
  'authenticated-read' => 0640,
  'authenticated-read-write' => 0660
}
READABLE =
0004
WRITABLE =
0002
READABLE_BY_AUTH =
0040
WRITABLE_BY_AUTH =
0020
POST =
%{if(!this.title||confirm(this.title+'?')){var f = document.createElement('form'); this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href; f.submit();}return false;}
%{window.open(this.href,'changelog','height=600,width=500,scrollbars=1');return false;}
TRACKER_INTERVAL =
10.minutes
EVENT_CODES =
{
  'started' => 200,
  'completed' => 201,
  'stopped' => 202
}

Class Method Summary collapse

Class Method Details

.configObject



35
36
37
# File 'lib/sinatra-s3/s3.rb', line 35

def self.config
  @config ||= YAML.load_file("s3.yml")[S3_ENV] rescue { :db => { :adapter => 'sqlite3', :database => "db/s3.db" } }
end