Module: Helene
- Defined in:
- lib/helene.rb,
lib/helene/s3.rb,
lib/helene/aws.rb,
lib/helene/sdb.rb,
lib/helene/util.rb,
lib/helene/error.rb,
lib/helene/rails.rb,
lib/helene/config.rb,
lib/helene/s3/key.rb,
lib/helene/attempt.rb,
lib/helene/logging.rb,
lib/helene/s3/owner.rb,
lib/helene/sdb/base.rb,
lib/helene/sdb/cast.rb,
lib/helene/s3/bucket.rb,
lib/helene/sdb/error.rb,
lib/helene/superhash.rb,
lib/helene/objectpool.rb,
lib/helene/sleepcycle.rb,
lib/helene/content_type.rb,
lib/helene/sdb/sentinel.rb,
lib/helene/sdb/base/type.rb,
lib/helene/sdb/interface.rb,
lib/helene/sdb/base/error.rb,
lib/helene/sdb/base/hooks.rb,
lib/helene/sdb/base/types.rb,
lib/helene/sdb/connection.rb,
lib/helene/sdb/base/literal.rb,
lib/helene/sdb/base/logging.rb,
lib/helene/sdb/base/attributes.rb,
lib/helene/sdb/base/connection.rb,
lib/helene/sdb/base/validations.rb,
lib/helene/sdb/base/associations.rb,
lib/helene/sdb/base/transactions.rb
Defined Under Namespace
Modules: Attempt, ContentType, NullLogger, S3, Sdb, Util
Classes: Config, Error, ObjectPool, SleepCycle, SuperHash, WTF
Constant Summary
collapse
- Objectpool =
ObjectPool
Class Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Class Attribute Details
.aws_access_key_id(*value) ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/helene/aws.rb', line 3
def aws_access_key_id(*value)
self.aws_access_key_id = value.first unless value.empty?
@aws_access_key_id ||= (
candidates = %w[ AWS_ACCESS_KEY_ID AMAZON_ACCESS_KEY_ID ACCESS_KEY_ID ]
candidates.each do |candidate|
return Object.const_get(candidate) if Object.const_defined?(candidate)
end
candidates.each do |candidate|
return ENV[candidate] if ENV[candidate]
end
raise Error, 'no configured aws_access_key_id'
)
end
|
.aws_ca_file(*value) ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/helene/aws.rb', line 35
def aws_ca_file(*value)
self.aws_ca_file = value.first unless value.empty?
@aws_ca_file ||= (
candidates = %w[ AWS_CA_FILE AMAZON_CA_FILE CA_FILE ]
candidates.each do |candidate|
return Object.const_get(candidate) if Object.const_defined?(candidate)
end
candidates.each do |candidate|
return ENV[candidate] if ENV[candidate]
end
)
end
|
.aws_secret_access_key(*value) ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/helene/aws.rb', line 19
def aws_secret_access_key(*value)
self.aws_secret_access_key = value.first unless value.empty?
@aws_secret_access_key ||= (
candidates = %w[ AWS_SECRET_ACCESS_KEY AMAZON_SECRET_ACCESS_KEY SECRET_ACCESS_KEY ]
candidates.each do |candidate|
return Object.const_get(candidate) if Object.const_defined?(candidate)
end
candidates.each do |candidate|
return ENV[candidate] if ENV[candidate]
end
raise Error, 'no configured aws_secret_access_key'
)
end
|
Class Method Details
.default_logger ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/helene/logging.rb', line 19
def default_logger
begin
if defined?(Rails)
Rails.logger
else
if((helene_log = ENV['HELENE_LOG']))
case helene_log.to_s.downcase.strip
when 'stderr'
Helene.logger_for(STDERR)
when 'stdout'
Helene.logger_for(STDOUT)
else
begin
Helene.logger_for open(helene_log, 'a+')
rescue
Helene.logger_for open(helene_log, 'w+')
end
end
else
NullLogger
end
end
rescue Object
NullLogger
end
end
|
.error!(*args, &block) ⇒ Object
5
6
7
|
# File 'lib/helene/error.rb', line 5
def Helene.error!(*args, &block)
raise Error.new(*args, &block)
end
|
32
33
34
|
# File 'lib/helene.rb', line 32
def Helene.lib
@lib = Pathname.new(__FILE__).realpath.to_s
end
|
.libdir(*args) ⇒ Object
36
37
38
39
40
41
42
43
|
# File 'lib/helene.rb', line 36
def Helene.libdir(*args)
@libdir ||= File.dirname(lib)
if args.empty?
@libdir
else
File.join(@libdir, *args.flatten.compact.map{|arg| arg.to_s})
end
end
|
.load_path(&block) ⇒ Object
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/helene.rb', line 49
def Helene.load_path(&block)
$LOAD_PATH.unshift(Helene.libdir)
$LOAD_PATH.unshift(Helene.libdir('helene'))
begin
block.call
ensure
$LOAD_PATH.shift
$LOAD_PATH.shift
end
end
|
.log(*args, &block) ⇒ Object
15
16
17
|
# File 'lib/helene/logging.rb', line 15
def log(*args, &block)
logger.send(*args, &block) if logger
end
|
3
4
5
|
# File 'lib/helene/logging.rb', line 3
def logger
@logger ||= nil
end
|
.logger=(logger) ⇒ Object
7
8
9
|
# File 'lib/helene/logging.rb', line 7
def logger= logger
@logger = logger.respond_to?(:debug) ? logger : logger_for(logger)
end
|
.logger_for(*args, &block) ⇒ Object
11
12
13
|
# File 'lib/helene/logging.rb', line 11
def logger_for(*args, &block)
defined?(Logging) ? Logging.logger(*args, &block) : Logger.new(*args, &block)
end
|
.rails? ⇒ Boolean
69
70
71
|
# File 'lib/helene.rb', line 69
def Helene.rails?
defined?(Rails)
end
|
.rails_root(*args) ⇒ Object
73
74
75
76
77
|
# File 'lib/helene.rb', line 73
def Helene.rails_root(*args)
if rails?
File.join(RAILS_ROOT, *args.flatten.map{|arg| arg.to_s})
end
end
|
45
46
47
|
# File 'lib/helene.rb', line 45
def Helene.reload!
Kernel.load lib
end
|
.rightscale_load_path(&block) ⇒ Object
60
61
62
63
64
65
66
67
|
# File 'lib/helene.rb', line 60
def Helene.rightscale_load_path(&block)
$LOAD_PATH.unshift(Helene.libdir('helene', 'rightscale'))
begin
block.call
ensure
$LOAD_PATH.shift
end
end
|
79
80
81
|
# File 'lib/helene.rb', line 79
def Helene.uuid
UUID.timestamp_create().to_s
end
|
5
|
# File 'lib/helene.rb', line 5
def Helene.version() Helene::VERSION end
|
.wtf!(*args, &block) ⇒ Object
9
10
11
|
# File 'lib/helene/error.rb', line 9
def Helene.wtf!(*args, &block)
raise WTF.new(*args, &block)
end
|
Instance Method Details
#ObjectPool(*args, &block) ⇒ Object
131
132
133
|
# File 'lib/helene/objectpool.rb', line 131
def ObjectPool(*args, &block)
ObjectPool.new(*args, &block)
end
|
#Objectpool(*args, &block) ⇒ Object
135
136
137
|
# File 'lib/helene/objectpool.rb', line 135
def Objectpool(*args, &block)
Objectpool.new(*args, &block)
end
|