configloader 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
data/configloader.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{configloader}
8
- s.version = "0.3.0"
8
+ s.version = "0.3.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Vinicius Teles"]
12
- s.date = %q{2011-02-07}
12
+ s.date = %q{2011-02-08}
13
13
  s.description = %q{If you need to create a custom config file for you project, ConfigLoader will help you to load the contents of this file.}
14
14
  s.email = %q{vinicius@improveit.com.br}
15
15
  s.extra_rdoc_files = [
data/lib/config_loader.rb CHANGED
@@ -47,7 +47,7 @@ module ConfigLoader
47
47
  # server: <%= `hostname` %>
48
48
  # port: 5984
49
49
  # database_name: addressbook_test
50
- def self.load(file_name, running_env = Rails.env, project_root = Rails.root.to_s)
50
+ def self.load(file_name, running_env = ENV['RAILS_ENV'], project_root = ENV['RAILS_ROOT'])
51
51
  ConfigLoader::Map.new(file_name, running_env, project_root).load
52
52
  end
53
53
  end
@@ -1,12 +1,6 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
3
  describe "ConfigLoader" do
4
- before(:each) do
5
- @root_dir = File.expand_path(File.join(File.dirname(__FILE__), "..", "spec", "root_dir"))
6
- Rails.stub!(:root).and_return(@root_dir)
7
- Rails.stub!(:env).and_return('development')
8
- end
9
-
10
4
  describe ".load" do
11
5
  it "raises exception when no config file name is given" do
12
6
  lambda { ConfigLoader.load(nil) }.should raise_error(ConfigLoader::MissingConfigFileNameError)
@@ -17,11 +11,11 @@ describe "ConfigLoader" do
17
11
  end
18
12
 
19
13
  it "loads keys for Rails.env from the config file located in Rails.root/config" do
20
- ConfigLoader.load('database')['name'].should == 'customers_development'
14
+ ConfigLoader.load('database')['name'].should == 'customers_test'
21
15
  end
22
16
 
23
17
  it "loads keys for the given environament from the config file located in Rails.root/config" do
24
- ConfigLoader.load('database', 'test')['name'].should == 'customers_test'
18
+ ConfigLoader.load('database', 'development')['name'].should == 'customers_development'
25
19
  end
26
20
 
27
21
  it "loads keys for the given environmanent from the config file located under the given directory/config" do
data/spec/spec_helper.rb CHANGED
@@ -4,5 +4,5 @@ require 'configloader'
4
4
  require 'spec'
5
5
  require 'spec/autorun'
6
6
 
7
- class Rails
8
- end
7
+ ENV['RAILS_ENV'] = 'test'
8
+ ENV['RAILS_ROOT'] = File.expand_path(File.join(File.dirname(__FILE__), "..", "spec", "root_dir"))
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: configloader
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 0
10
- version: 0.3.0
9
+ - 1
10
+ version: 0.3.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Vinicius Teles
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-07 00:00:00 -03:00
18
+ date: 2011-02-08 00:00:00 -03:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency