greased-rails 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/greased-rails.gemspec +0 -1
- data/lib/greased/applicator.rb +1 -1
- data/lib/greased/options.rb +16 -25
- data/lib/greased/rails/version.rb +1 -1
- data/templates/greased.yml +19 -19
- data/templates/greased_partial.yml +3 -0
- metadata +2 -18
data/greased-rails.gemspec
CHANGED
data/lib/greased/applicator.rb
CHANGED
@@ -8,7 +8,7 @@ module Greased
|
|
8
8
|
attr_accessor :app, :env, :groups
|
9
9
|
|
10
10
|
def initialize(application, options = {})
|
11
|
-
@options = Options.
|
11
|
+
@options = Options.defaults.merge(options)
|
12
12
|
@app = application#@options[:app]
|
13
13
|
@env = @options[:env]
|
14
14
|
@groups = @options[:groups]
|
data/lib/greased/options.rb
CHANGED
@@ -18,38 +18,26 @@ module Greased
|
|
18
18
|
ENV_VARS_FILENAME_BASE = "variables.yml"
|
19
19
|
ENV_VARS_FILENAME = "greased_#{ENV_VARS_FILENAME_BASE}"
|
20
20
|
# options to load from YAML
|
21
|
-
|
22
|
-
|
21
|
+
OPTIONS_FILENAME = "greased.yml"
|
22
|
+
DEFAULT_OPTIONS_FILE = Greased.file_path(File.dirname(__FILE__), '..', '..', 'templates', OPTIONS_FILENAME)
|
23
23
|
# default Greased template with application settings
|
24
24
|
DEFAULT_SETTINGS_FILE = Greased.file_path(File.dirname(__FILE__), '..', '..', 'templates', APP_SETTINGS_FILENAME)
|
25
25
|
DEFAULT_ENV = "development"
|
26
26
|
|
27
27
|
class << self
|
28
28
|
|
29
|
-
def
|
30
|
-
load_options(
|
29
|
+
def defaults
|
30
|
+
load_options(DEFAULT_OPTIONS_FILE).deep_merge!(:app_filename => DEFAULT_SETTINGS_FILE)
|
31
31
|
end
|
32
32
|
|
33
|
-
def
|
34
|
-
default_config[:options].deep_merge!(:app_filename => DEFAULT_SETTINGS_FILE)
|
35
|
-
end
|
36
|
-
|
37
|
-
def find(path, options = {})
|
33
|
+
def find(path)
|
38
34
|
#Greased.logger.debug "Find application options in: #{path}"
|
39
35
|
|
40
|
-
|
36
|
+
options = defaults
|
41
37
|
|
42
38
|
if Dir.exists? path
|
43
|
-
# load custom config
|
44
|
-
config = load_options([
|
45
|
-
Greased.file_path(path, CONFIG_FILENAME),
|
46
|
-
Greased.file_path(path, "greased", CONFIG_FILENAME),
|
47
|
-
Greased.file_path(path, "config", CONFIG_FILENAME),
|
48
|
-
Greased.file_path(path, "config", "greased", CONFIG_FILENAME)
|
49
|
-
])
|
50
|
-
|
51
39
|
# load rails defaults
|
52
|
-
|
40
|
+
options = merge_options options, {
|
53
41
|
#:env => ::Rails.env || DEFAULT_ENV,
|
54
42
|
#:groups => ["application"],
|
55
43
|
:app_filename => [
|
@@ -71,14 +59,17 @@ module Greased
|
|
71
59
|
Greased.file_path(path, "config", ENV_VARS_FILENAME),
|
72
60
|
Greased.file_path(path, "config", "greased", ENV_VARS_FILENAME_BASE)
|
73
61
|
]
|
74
|
-
}
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
62
|
+
},
|
63
|
+
# load custom options
|
64
|
+
load_options([
|
65
|
+
Greased.file_path(path, OPTIONS_FILENAME),
|
66
|
+
Greased.file_path(path, "greased", OPTIONS_FILENAME),
|
67
|
+
Greased.file_path(path, "config", OPTIONS_FILENAME),
|
68
|
+
Greased.file_path(path, "config", "greased", OPTIONS_FILENAME)
|
69
|
+
])
|
79
70
|
end
|
80
71
|
|
81
|
-
|
72
|
+
options
|
82
73
|
end
|
83
74
|
|
84
75
|
protected
|
data/templates/greased.yml
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
1
|
+
|
2
|
+
# Where to look for the environment settings file(s).
|
3
|
+
# By default, Greased will try several file path permuations to find the file dynamically.
|
4
|
+
# app_filename: <%= File.join(Rails.root, 'greased_settings.yml') %>
|
5
|
+
|
6
|
+
# Where to look for the environment settings override file(s).
|
7
|
+
# By default, Greased will try several file path permuations to find the file dynamically.
|
8
|
+
# partial_filename: <%= File.join(Rails.root, 'greased_partial.yml') %>
|
9
|
+
|
10
|
+
# Where to look for the environment variable file(s).
|
11
|
+
# By default, Greased will try several file path permuations to find the file dynamically.
|
12
|
+
# env_filename: <%= File.join(Rails.root, 'greased_variables.yml') %>
|
13
|
+
|
14
|
+
# Envirionment (e.g. development, staging, production)
|
15
|
+
env: <%= ENV['RAILS_ENV'] || ENV['RACK_ENV'] || "development" %>
|
16
|
+
|
17
|
+
# Groups within the environment variables to load up.
|
18
|
+
groups: ["application"]
|
19
|
+
|
@@ -18,6 +18,9 @@ defaults: &defaults
|
|
18
18
|
# suppose you want to use all defaults in greased_settings.yml
|
19
19
|
# and only change the SSL settings for all environments
|
20
20
|
force_ssl: true
|
21
|
+
# eager load lib directory in threadsafe mode
|
22
|
+
# eager_load_paths +=:
|
23
|
+
# - "<%= Rails.root %>/lib"
|
21
24
|
|
22
25
|
development:
|
23
26
|
<<: *defaults
|
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.12
|
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-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -43,22 +43,6 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: 3.2.0
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: minigit
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ! '>='
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: 0.0.3
|
54
|
-
type: :runtime
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 0.0.3
|
62
46
|
description: Reusable default application settings, environment variables, and deployment
|
63
47
|
tasks.
|
64
48
|
email:
|