application_configuration 1.1.6 → 1.1.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -64,6 +64,8 @@ module Application
64
64
  attr_reader :last_reload_time #stores the last time settings were reloaded
65
65
  attr_reader :is_rails #stores whether or not we're in a rails app
66
66
  attr_reader :loaded_files
67
+ attr_reader :rails_root
68
+ attr_reader :rails_env
67
69
  attr_accessor :whiny_config_missing
68
70
 
69
71
  def initialize
@@ -73,9 +75,11 @@ module Application
73
75
  @last_reload_time = Time.now # set the first load time
74
76
  @is_rails = Object.const_defined?("RAILS_ENV") # set whether it's rails
75
77
  if self.is_rails
76
- self.whiny_config_missing = true unless RAILS_ENV == "production"
77
- self.loaded_files << Application::Configuration::Location.new("#{RAILS_ROOT}/config/application_configuration.yml")
78
- self.loaded_files << Application::Configuration::Location.new("#{RAILS_ROOT}/config/application_configuration_#{RAILS_ENV}.yml")
78
+ @rails_root = Object.const_defined?("RAILS_ROOT") ? RAILS_ROOT : ""
79
+ @rails_env = Object.const_defined?("RAILS_ENV") ? RAILS_ENV : ""
80
+ self.whiny_config_missing = true unless self.rails_env == "production"
81
+ self.loaded_files << Application::Configuration::Location.new("#{self.rails_root}/config/application_configuration.yml")
82
+ self.loaded_files << Application::Configuration::Location.new("#{self.rails_root}/config/application_configuration_#{self.rails_env}.yml")
79
83
  self.loaded_files.uniq!
80
84
  end
81
85
  reload # do the work!
@@ -111,7 +115,7 @@ module Application
111
115
 
112
116
  def reload
113
117
  puts "Loading Configuration Settings!"
114
- @final_configuration_settings = {:reload_settings_every => 1.minute} # reset the configuration
118
+ @final_configuration_settings = {:reload_settings_every => 20.minutes} # reset the configuration
115
119
 
116
120
  self.loaded_files.each do |lf|
117
121
  puts "Loading Configuration Settings from file: #{lf.file_location}"
@@ -134,7 +138,7 @@ module Application
134
138
  y
135
139
  end
136
140
 
137
- def dump_to_file(file_name = (self.is_rails ? "#{RAILS_ROOT}/config/application_configuration_dump.yml" : "application_configuration_dump.yml"))
141
+ def dump_to_file(file_name = (self.is_rails ? "#{self.rails_root}/config/application_configuration_dump.yml" : "application_configuration_dump.yml"))
138
142
  File.open(file_name, "w") {|file| file.puts self.final_configuration_settings.to_yaml}
139
143
  puts "Dumped configuration settings to: #{file_name}"
140
144
  dump_to_screen
@@ -2,4 +2,4 @@
2
2
  gem_name: application_configuration
3
3
  package: application_configuration
4
4
  project: magrathea
5
- version: 1.1.6
5
+ version: 1.1.9
metadata CHANGED
@@ -1,54 +1,60 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.2
3
- specification_version: 1
4
2
  name: application_configuration
5
3
  version: !ruby/object:Gem::Version
6
- version: 1.1.6
7
- date: 2007-12-21 00:00:00 -05:00
8
- summary: application_configuration
9
- require_paths:
10
- - lib
11
- - lib
12
- - lib
13
- - lib/tasks
14
- email:
15
- homepage:
16
- rubyforge_project: magrathea
17
- description: "application_configuration was developed by: markbates"
4
+ version: 1.1.9
5
+ platform: ruby
6
+ authors:
7
+ - markbates
18
8
  autorequire:
19
9
  - application_configuration
20
10
  - application_configuration
21
- default_executable:
22
11
  bindir: bin
23
- has_rdoc: false
24
- required_ruby_version: !ruby/object:Gem::Version::Requirement
25
- requirements:
26
- - - ">"
27
- - !ruby/object:Gem::Version
28
- version: 0.0.0
29
- version:
30
- platform: ruby
31
- signing_key:
32
- cert_chain:
33
- post_install_message:
34
- authors:
35
- - markbates
36
- files:
37
- - application_configuration-1.1.6.gem
38
- - init.rb
39
- - lib/application_configuration.rb
40
- - lib/tasks/rubyforge_config.yml
41
- test_files: []
12
+ cert_chain: []
42
13
 
43
- rdoc_options: []
44
-
45
- extra_rdoc_files: []
14
+ date: 2008-01-25 00:00:00 -05:00
15
+ default_executable:
16
+ dependencies: []
46
17
 
18
+ description: "application_configuration was developed by: markbates"
19
+ email:
47
20
  executables: []
48
21
 
49
22
  extensions: []
50
23
 
24
+ extra_rdoc_files: []
25
+
26
+ files:
27
+ - init.rb
28
+ - lib/application_configuration.rb
29
+ - lib/tasks/rubyforge_config.yml
30
+ has_rdoc: false
31
+ homepage:
32
+ post_install_message:
33
+ rdoc_options: []
34
+
35
+ require_paths:
36
+ - lib
37
+ - lib
38
+ - lib
39
+ - lib/tasks
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: "0"
45
+ version:
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: "0"
51
+ version:
51
52
  requirements: []
52
53
 
53
- dependencies: []
54
+ rubyforge_project: magrathea
55
+ rubygems_version: 1.0.1
56
+ signing_key:
57
+ specification_version: 2
58
+ summary: application_configuration
59
+ test_files: []
54
60
 
File without changes