greased-rails 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/greased/app_env.rb +37 -0
- data/lib/greased/rails/version.rb +1 -1
- data/release.sh +4 -0
- data/templates/greased_settings.yml +3 -0
- metadata +4 -2
@@ -0,0 +1,37 @@
|
|
1
|
+
module AppEnv
|
2
|
+
extend self
|
3
|
+
|
4
|
+
def [](key)
|
5
|
+
key = key.to_s.upcase
|
6
|
+
ENV[key]
|
7
|
+
end
|
8
|
+
|
9
|
+
def fetch(key)
|
10
|
+
self[key] or raise(IndexError, "#{key} missing from config", caller)
|
11
|
+
end
|
12
|
+
|
13
|
+
def guarded?
|
14
|
+
self[:guard_name] && self[:guard_password]
|
15
|
+
end
|
16
|
+
|
17
|
+
def requires(*keys)
|
18
|
+
keys.each do |key|
|
19
|
+
unless self[key]
|
20
|
+
raise RuntimeError, "AppEnv[#{key.inspect}] is required but missing", caller
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def url(key)
|
26
|
+
URI.parse(fetch("#{key}_url"))
|
27
|
+
end
|
28
|
+
|
29
|
+
def background(job, *args)
|
30
|
+
if AppEnv[:enable_backgrounding]
|
31
|
+
Resque.enqueue(job, *args)
|
32
|
+
else
|
33
|
+
job.perform(*args)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
data/release.sh
ADDED
@@ -3,6 +3,9 @@ defaults: &defaults
|
|
3
3
|
force_ssl: false
|
4
4
|
autoload_paths +=:
|
5
5
|
- "<%= Rails.root %>/lib"
|
6
|
+
# eager load lib directory in threadsafe mode
|
7
|
+
eager_load_paths +=:
|
8
|
+
- "<%= Rails.root %>/lib"
|
6
9
|
# See everything in the log (default is :info)
|
7
10
|
log_level: :debug
|
8
11
|
# Settings in config/environments/* take precedence over those specified here.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: greased-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -58,12 +58,14 @@ files:
|
|
58
58
|
- Rakefile
|
59
59
|
- greased-rails.gemspec
|
60
60
|
- lib/greased-rails.rb
|
61
|
+
- lib/greased/app_env.rb
|
61
62
|
- lib/greased/applicator.rb
|
62
63
|
- lib/greased/rails.rb
|
63
64
|
- lib/greased/rails/engine.rb
|
64
65
|
- lib/greased/rails/version.rb
|
65
66
|
- lib/greased/setting.rb
|
66
67
|
- lib/greased/settings.rb
|
68
|
+
- release.sh
|
67
69
|
- tasks/greased.rake
|
68
70
|
- templates/greased_settings.yml
|
69
71
|
- templates/greased_variables.yml
|