greased-rails 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,6 +14,7 @@ Gem::Specification.new do |gem|
14
14
 
15
15
  gem.add_dependency "activesupport", ">= 3.2.0"
16
16
  gem.add_dependency "railties", ">= 3.2.0"
17
+ gem.add_dependency "minigit", ">= 0.0.3"
17
18
  #figaro
18
19
 
19
20
  gem.files = `git ls-files`.split($/)
@@ -8,7 +8,7 @@ module Greased
8
8
  attr_accessor :app, :env, :groups
9
9
 
10
10
  def initialize(application, options = {})
11
- @options = Options.defaults.merge(options)
11
+ @options = Options.default_options.merge(options)
12
12
  @app = application#@options[:app]
13
13
  @env = @options[:env]
14
14
  @groups = @options[:groups]
@@ -18,26 +18,38 @@ 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
- OPTIONS_FILENAME = "greased.yml"
22
- DEFAULT_OPTIONS_FILE = Greased.file_path(File.dirname(__FILE__), '..', '..', 'templates', OPTIONS_FILENAME)
21
+ CONFIG_FILENAME = "greased.yml"
22
+ DEFAULT_CONFIG_FILENAME = Greased.file_path(File.dirname(__FILE__), '..', '..', 'templates', CONFIG_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 defaults
30
- load_options(DEFAULT_OPTIONS_FILE).deep_merge!(:app_filename => DEFAULT_SETTINGS_FILE)
29
+ def default_config
30
+ load_options(DEFAULT_CONFIG_FILENAME)
31
31
  end
32
32
 
33
- def find(path)
33
+ def default_options
34
+ default_config[:options].deep_merge!(:app_filename => DEFAULT_SETTINGS_FILE)
35
+ end
36
+
37
+ def find(path, options = {})
34
38
  #Greased.logger.debug "Find application options in: #{path}"
35
39
 
36
- options = defaults
40
+ merged_options = default_options
37
41
 
38
42
  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
+
39
51
  # load rails defaults
40
- options = merge_options options, {
52
+ default_paths = {
41
53
  #:env => ::Rails.env || DEFAULT_ENV,
42
54
  #:groups => ["application"],
43
55
  :app_filename => [
@@ -59,17 +71,14 @@ module Greased
59
71
  Greased.file_path(path, "config", ENV_VARS_FILENAME),
60
72
  Greased.file_path(path, "config", "greased", ENV_VARS_FILENAME_BASE)
61
73
  ]
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
- ])
74
+ }
75
+
76
+ # use custom options
77
+ merged_options = merge_options(merged_options, default_paths, config[:options])
78
+
70
79
  end
71
80
 
72
- options
81
+ merged_options.merge(options)
73
82
  end
74
83
 
75
84
  protected
@@ -1,5 +1,5 @@
1
1
  module Greased
2
2
  module Rails
3
- VERSION = "0.0.10"
3
+ VERSION = "0.0.11"
4
4
  end
5
5
  end
@@ -1,19 +1,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
-
1
+ options:
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
+
@@ -236,6 +236,9 @@ production:
236
236
  config:
237
237
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
238
238
  force_ssl: false
239
+ # eager load lib directory in threadsafe mode
240
+ eager_load_paths +=:
241
+ - "<%= Rails.root %>/lib"
239
242
  lograge:
240
243
  # more concise logging (one line per request)
241
244
  enabled: true
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.10
4
+ version: 0.0.11
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-07 00:00:00.000000000 Z
12
+ date: 2013-04-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -43,6 +43,22 @@ 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
46
62
  description: Reusable default application settings, environment variables, and deployment
47
63
  tasks.
48
64
  email:
@@ -96,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
112
  version: '0'
97
113
  requirements: []
98
114
  rubyforge_project:
99
- rubygems_version: 1.8.23
115
+ rubygems_version: 1.8.25
100
116
  signing_key:
101
117
  specification_version: 3
102
118
  summary: Replicate common Rails application settings and environment variables using