greased-rails 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/greased/env.rb +37 -0
- data/lib/greased/rails/engine.rb +6 -1
- data/lib/greased/rails/version.rb +1 -1
- data/templates/greased_settings.yml +3 -3
- metadata +4 -4
- data/lib/greased/app_env.rb +0 -37
data/lib/greased/env.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
module Env
|
2
|
+
extend self
|
3
|
+
|
4
|
+
def [](key)
|
5
|
+
fetch(key)
|
6
|
+
end
|
7
|
+
|
8
|
+
def fetch(key)
|
9
|
+
ENV[format_key(key)] || raise(IndexError, "#{key} missing from config", caller)
|
10
|
+
end
|
11
|
+
|
12
|
+
# def guarded?
|
13
|
+
# self[:guard_name] && self[:guard_password]
|
14
|
+
# end
|
15
|
+
|
16
|
+
def requires(*keys)
|
17
|
+
keys.each do |key|
|
18
|
+
raise(RuntimeError, "AppEnv[#{key.inspect}] is required but missing", caller) unless self[key]
|
19
|
+
end
|
20
|
+
nil
|
21
|
+
end
|
22
|
+
|
23
|
+
# def background(job, *args)
|
24
|
+
# if self[:enable_backgrounding]
|
25
|
+
# Resque.enqueue(job, *args)
|
26
|
+
# else
|
27
|
+
# job.perform(*args)
|
28
|
+
# end
|
29
|
+
# end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def format_key(key)
|
34
|
+
key.to_s.upcase
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
data/lib/greased/rails/engine.rb
CHANGED
@@ -7,8 +7,13 @@ module Greased
|
|
7
7
|
|
8
8
|
Greased.logger.level = Logger::DEBUG if ::Rails.env.development?
|
9
9
|
|
10
|
+
# Config defaults
|
11
|
+
#config.greased_options =
|
12
|
+
#config.greased_applicator =
|
13
|
+
|
14
|
+
# Load rake tasks
|
10
15
|
rake_tasks do
|
11
|
-
path =
|
16
|
+
path = Greased.file_path(File.dirname(__FILE__), '../../../tasks/')
|
12
17
|
|
13
18
|
Dir["#{path}/*.rake"].each do |filename|
|
14
19
|
load filename
|
@@ -10,8 +10,8 @@ defaults: &defaults
|
|
10
10
|
autoload_paths +=:
|
11
11
|
- "<%= Rails.root %>/lib"
|
12
12
|
# eager load lib directory in threadsafe mode
|
13
|
-
eager_load_paths +=:
|
14
|
-
|
13
|
+
# eager_load_paths +=:
|
14
|
+
# - "<%= Rails.root %>/lib"
|
15
15
|
# See everything in the log (default is :info)
|
16
16
|
log_level: :debug
|
17
17
|
# Settings in config/environments/* take precedence over those specified here.
|
@@ -154,7 +154,7 @@ development:
|
|
154
154
|
perform_caching: false
|
155
155
|
action_mailer:
|
156
156
|
# Disable delivery errors, bad email addresses will be ignored
|
157
|
-
raise_delivery_errors:
|
157
|
+
raise_delivery_errors: true
|
158
158
|
# Use a different cache store in production
|
159
159
|
cache_store: :null_store
|
160
160
|
active_support:
|
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.10
|
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-04-
|
12
|
+
date: 2013-04-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -59,8 +59,8 @@ files:
|
|
59
59
|
- greased-rails.gemspec
|
60
60
|
- lib/greased-rails.rb
|
61
61
|
- lib/greased.rb
|
62
|
-
- lib/greased/app_env.rb
|
63
62
|
- lib/greased/applicator.rb
|
63
|
+
- lib/greased/env.rb
|
64
64
|
- lib/greased/loggable.rb
|
65
65
|
- lib/greased/method_caller.rb
|
66
66
|
- lib/greased/options.rb
|
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
96
|
version: '0'
|
97
97
|
requirements: []
|
98
98
|
rubyforge_project:
|
99
|
-
rubygems_version: 1.8.
|
99
|
+
rubygems_version: 1.8.23
|
100
100
|
signing_key:
|
101
101
|
specification_version: 3
|
102
102
|
summary: Replicate common Rails application settings and environment variables using
|
data/lib/greased/app_env.rb
DELETED
@@ -1,37 +0,0 @@
|
|
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
|