Permalink
Browse files

changes for v1.0.0

  • Loading branch information...
rubiii committed Jun 15, 2011
1 parent 6918c31 commit 81ce71176e2bf1e9500493c20f260b717b7d7095
View
@@ -1,5 +1,9 @@
-.*
-nbproject
+.DS_Store
+.yardoc
doc
coverage
-
+tmp
+*~
+*.gem
+.bundle
+Gemfile.lock
View
2 .rspec
@@ -0,0 +1,2 @@
+--color
+
View
@@ -0,0 +1,8 @@
+script: "rake"
+rvm:
+ - 1.8.7
+ - 1.9.2
+ - ree
+ - rbx
+ - jruby
+
View
@@ -1,38 +1,50 @@
+== 1.0.0 (2011-06-15)
+
+ * Cleaned up the project's setup.
+ * Moved the config into a module. Instead of calling `Ambience.new`, you can now use
+ `Ambience.create` to create the config.
+ * Added a Railtie which gets loaded when `Rails` is defined. The Railtie creates an
+ `AppConfig` mash from `config/ambience.yml` if such a file exists.
+ * Added travis integration: http://travis-ci.org/#!/rubiii/ambience
+
== 0.3.1 (2010-05-27)
+
* Ambience now requires "java" (for JRuby support) if it's available.
== 0.3.0 (2010-05-13)
+
* Ambience now operates on the instance level. So after setting up a new Ambience config
like before:
-
- AppConfig = Ambience.new File.join(Rails.root, "config", "ambience.yml")
-
+
+ AppConfig = Ambience.new File.join(Rails.root, "config", "ambience.yml")
+
you now have to choose whether you like to have the config returned as a simple Hash
or a Hashie::Mash (which was the default since version 0.2.0):
-
- AppConfig.to_hash
- AppConfig.to_mash
-
+
+ AppConfig.to_hash
+ AppConfig.to_mash
+
* Along with support for a basic config and JVM properties, version 0.3.0 adds support
for local (user-specific) settings. By default, Ambience tries to load a local YAML
config from:
-
- File.join ENV["HOME"].to_s, ".ambience", "ambience.yml"
-
+
+ File.join ENV["HOME"].to_s, ".ambience", "ambience.yml"
+
Ambience will still work fine if the file does not exist. But if you want to use a
local config and change the default location, you can use the +local_config+ class
method to do so.
-
- Ambience.local_config # => "/Users/you/.ambience/ambience.yml"
-
- # Change the location of the local config file:
- Ambience.local_config = File.join "config", "user_config.yml"
+
+ Ambience.local_config # => "/Users/you/.ambience/ambience.yml"
+
+ # Change the location of the local config file:
+ Ambience.local_config = File.join "config", "user_config.yml"
== 0.2.0 (2010-03-06)
+
* Complete rewrite. Removed Rails-specific defaults and returning the Ambience config
as a Hashie::Mash (http://github.com/intridea/hashie). Take a look at the new Readme
and Specs for examples.
== 0.1.0 (2009-12-12)
- * Initial release.
+ * Initial release.
View
@@ -0,0 +1,2 @@
+source :rubygems
+gemspec
View
21 LICENSE
@@ -0,0 +1,21 @@
+Copyright (c) 2010 Daniel Harrington
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
View
@@ -0,0 +1,74 @@
+Ambience [![Build Status](http://travis-ci.org/rubiii/ambience.png)](http://travis-ci.org/rubiii/ambience)
+========
+
+App configuration feat. YAML and JVM properties. Lets you specify a default configuration in a YAML file
+and overwrite details via local settings and JVM properties for production.
+
+
+Installation
+------------
+
+Ambience is available through [Rubygems](http://rubygems.org/gems/ambience) and can be installed via:
+
+```
+$ gem install ambience
+```
+
+
+Getting started
+---------------
+
+Given you created a YAML config like this:
+
+``` yml
+auth:
+ address: http://example.com
+ username: ferris
+ password: test
+```
+
+You can instantiate an Ambience config by passing in the path to your config file:
+
+``` ruby
+AppConfig = Ambience.create Rails.root.join("config", "ambience.yml")
+```
+
+Ambience will load and convert your config into a Hash:
+
+``` ruby
+{ "auth" => { "address" => "http://example.com", "username" => "ferris", "password" => "test" } }
+```
+
+Afterwards it tries to merge these settings with local ones specified in an Ambience.local_config file.
+Finally it looks for any JVM properties (if your running JRuby) and merge these properties with your config:
+
+``` ruby
+auth.address = "http://live.example.com"
+auth.password = "topsecret"
+```
+
+The result would be something like this:
+
+``` ruby
+{ "auth" => { "address" => "http://live.example.com", "username" => "ferris", "password" => "topsecret" } }
+```
+
+In the end you can decide whether you want to return the config as a Hash:
+
+``` ruby
+AppConfig = Ambience.create(Rails.root.join("config", "ambience.yml")).to_hash
+```
+
+or a [Hashie::Mash](http://github.com/intridea/hashie):
+
+``` ruby
+AppConfig = Ambience.create(Rails.root.join("config", "ambience.yml")).to_mash
+```
+
+
+Railtie
+-------
+
+Ambience comes with a Railtie which looks for `config/ambience.yml` inside your Rails project.
+If the file exists, Ambience loads the config and stores it in an `AppConfig` constant.
+All this happens before Rails evaluates your environment config.
View
@@ -1,41 +0,0 @@
-= Ambience
-
-App configuration feat. YAML and JVM properties. Lets you specify a default configuration in a YAML file and overwrite details via local settings and JVM properties for production.
-
-== Installation
-
- $ gem install ambience
-
-== How it works
-
-Given you created a YAML config like this:
-
- auth:
- address: http://example.com
- username: ferris
- password: test
-
-You can instantiate an Ambience config by passing in the path to your config file:
-
- AppConfig = Ambience.new File.join(Rails.root, "config", "ambience.yml")
-
-Ambience will load and convert your config into a Hash:
-
- { "auth" => { "address" => "http://example.com", "username" => "ferris", "password" => "test" } }
-
-Afterwards it tries to merge these settings with local ones specified in an Ambience.local_config file. Finally it looks for any JVM properties (if your running JRuby) and merge these properties with your config:
-
- auth.address = "http://live.example.com"
- auth.password = "topsecret"
-
-The result would be something like this:
-
- { "auth" => { "address" => "http://live.example.com", "username" => "ferris", "password" => "topsecret" } }
-
-In the end you can decide whether you want to return the config as a Hash:
-
- AppConfig = Ambience.new(File.join(Rails.root, "config", "ambience.yml")).to_hash
-
-or a {Hashie::Mash}[http://github.com/intridea/hashie]:
-
- AppConfig = Ambience.new(File.join(Rails.root, "config", "ambience.yml")).to_mash
View
@@ -1,31 +1,11 @@
-require "rake"
-require "spec/rake/spectask"
-require "spec/rake/verify_rcov"
+require "bundler"
+Bundler::GemHelper.install_tasks
-task :default => :spec
-
-Spec::Rake::SpecTask.new do |spec|
- spec.spec_files = FileList["spec/**/*_spec.rb"]
- spec.spec_opts << "--color"
- spec.libs += ["lib", "spec"]
- spec.rcov = true
-end
+require "rspec/core/rake_task"
-RCov::VerifyTask.new(:spec_verify => :spec) do |verify|
- verify.threshold = 100.0
- verify.index_html = "rcov/index.html"
+RSpec::Core::RakeTask.new do |t|
+ t.rspec_opts = %w(-c)
end
-begin
- require "hanna/rdoctask"
-
- Rake::RDocTask.new do |rdoc|
- rdoc.title = "Ambience - App configuration feat. YAML and JVM properties"
- rdoc.rdoc_dir = "doc"
- rdoc.rdoc_files.include("**/*.rdoc").include("lib/**/*.rb")
- rdoc.options << "--line-numbers"
- rdoc.options << "--webcvs=http://github.com/rubiii/ambience/tree/master/"
- end
-rescue LoadError
- puts "'gem install hanna' for documentation"
-end
+task :default => :spec
+task :test => :spec
View
@@ -1,24 +1,25 @@
-require "rake"
+$:.push File.expand_path("../lib", __FILE__)
+require "ambience/version"
Gem::Specification.new do |s|
- s.name = "ambience"
- s.version = "0.3.1"
- s.date = "2010-05-27"
+ s.name = "ambience"
+ s.version = Ambience::VERSION
+ s.author = "Daniel Harrington"
+ s.email = "me@rubiii.com"
+ s.homepage = "http://github.com/rubiii/#{s.name}"
+ s.summary = %q{App configuration feat. YAML and JVM properties}
+ s.description = s.summary
- s.authors = "Daniel Harrington"
- s.email = "me@rubiii.com"
- s.homepage = "http://github.com/rubiii/ambience"
- s.summary = "App configuration feat. YAML and JVM properties"
-
- s.files = FileList["[A-Z]*", "{lib,spec}/**/*.{rb,yml}"]
- s.test_files = FileList["spec/**/*.rb"]
-
- s.extra_rdoc_files = ["README.rdoc"]
- s.rdoc_options = ["--charset=UTF-8", "--line-numbers", "--inline-source"]
- s.rdoc_options += ["--title", "Ambience - App configuration feat. YAML and JVM properties"]
+ s.rubyforge_project = s.name
s.add_dependency "hashie", ">= 0.2.0"
- s.add_development_dependency "rspec", ">= 1.2.8"
- s.add_development_dependency "mocha", ">= 0.9.7"
+ s.add_development_dependency "rspec", "~> 2.6.0"
+ s.add_development_dependency "mocha", "~> 0.9.12"
+ s.add_development_dependency "autotest"
+
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ s.require_paths = ["lib"]
end
View
@@ -1,7 +1,16 @@
-require "yaml" unless defined? YAML
-require "erb" unless defined? ERB
+require "ambience/config"
+require "ambience/version"
-require "hashie"
+require "ambience/railtie" if defined? Rails
-require "ambience/core_ext"
-require "ambience/ambience"
+module Ambience
+
+ def self.create(config_file, env = nil)
+ Config.new(config_file, env)
+ end
+
+ def self.jruby?
+ RUBY_PLATFORM =~ /java/
+ end
+
+end
Oops, something went wrong.

0 comments on commit 81ce711

Please sign in to comment.