Skip to content

Commit

Permalink
get with the times
Browse files Browse the repository at this point in the history
  • Loading branch information
binarylogic committed Dec 30, 2012
1 parent c510aff commit 08792a6
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 178 deletions.
27 changes: 0 additions & 27 deletions CHANGELOG.rdoc

This file was deleted.

15 changes: 2 additions & 13 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,2 @@
source "http://rubygems.org"

group :development do
gem 'rake'
gem 'jeweler'
gem 'rspec', :require => 'spec'
gem 'rcov'
if RUBY_VERSION < "1.9"
gem 'ruby-debug'
else
gem 'ruby-debug19'
end
end
source :rubygems
gemspec
42 changes: 15 additions & 27 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,38 +1,26 @@
PATH
remote: .
specs:
settingslogic (2.0.9)

GEM
remote: http://rubygems.org/
specs:
columnize (0.3.6)
diff-lcs (1.1.3)
git (1.2.5)
jeweler (1.6.4)
bundler (~> 1.0)
git (>= 1.2.5)
rake
linecache (0.46)
rbx-require-relative (> 0.0.4)
rake (0.9.2.2)
rbx-require-relative (0.0.5)
rcov (0.9.11)
rspec (2.8.0)
rspec-core (~> 2.8.0)
rspec-expectations (~> 2.8.0)
rspec-mocks (~> 2.8.0)
rspec-core (2.8.0)
rspec-expectations (2.8.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.8.0)
ruby-debug (0.10.4)
columnize (>= 0.1)
ruby-debug-base (~> 0.10.4.0)
ruby-debug-base (0.10.4)
linecache (>= 0.3)
rake (10.0.3)
rspec (2.12.0)
rspec-core (~> 2.12.0)
rspec-expectations (~> 2.12.0)
rspec-mocks (~> 2.12.0)
rspec-core (2.12.2)
rspec-expectations (2.12.1)
diff-lcs (~> 1.1.3)
rspec-mocks (2.12.1)

PLATFORMS
ruby

DEPENDENCIES
jeweler
rake
rcov
rspec
ruby-debug
settingslogic!
28 changes: 9 additions & 19 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
Settingslogic is a simple configuration / settings solution that uses an ERB enabled YAML file. It has been great for
our apps, maybe you will enjoy it too. Settingslogic works with Rails, Sinatra, or any Ruby project.

So here is my question to you.....is Settingslogic a great settings solution or the greatest?

== Helpful links

* <b>Documentation:</b> http://rdoc.info/projects/binarylogic/settingslogic
Expand All @@ -13,15 +11,7 @@ So here is my question to you.....is Settingslogic a great settings solution or

== Installation

Install from rubyforge/gemcutter:

sudo gem install settingslogic

Or as a Rails plugin:

script/plugin install git://github.com/binarylogic/settingslogic.git

Settingslogic does not have any dependencies on Rails. Installing as a gem is recommended.
gem install settingslogic

== Usage

Expand Down Expand Up @@ -54,7 +44,7 @@ Using a namespace allows us to change our configuration depending on our environ
saweet: nested settings
neat_setting: 24
awesome_setting: <%= "Did you know 5 + 5 = #{5 + 5}?" %>

development:
<<: *defaults
neat_setting: 800
Expand All @@ -65,7 +55,7 @@ Using a namespace allows us to change our configuration depending on our environ
production:
<<: *defaults

_Note_: Certain Ruby/Bundler versions include a version of the Psych YAML parser which incorrectly handles merges (the `<<` in the example above.)
_Note_: Certain Ruby/Bundler versions include a version of the Psych YAML parser which incorrectly handles merges (the `<<` in the example above.)
If your default settings seem to be overwriting your environment-specific settings, including the following lines in your config/boot.rb file may solve the problem:

require 'yaml'
Expand All @@ -78,17 +68,17 @@ If your default settings seem to be overwriting your environment-specific settin

>> Settings.cool
=> "#<Settingslogic::Settings ... >"

>> Settings.cool.saweet
=> "nested settings"

>> Settings.neat_setting
=> 800

>> Settings.awesome_setting
=> "Did you know 5 + 5 = 10?"

You can use these settings anywhere, for example in a model:
You can use these settings anywhere, for example in a model:

class Post < ActiveRecord::Base
self.per_page = Settings.pagination.posts_per_page
Expand Down Expand Up @@ -116,7 +106,7 @@ Modifying our model example:
class Post < ActiveRecord::Base
self.per_page = Settings.posts['per_page'] || Settings.pagination.per_page
end

This would allow you to specify a custom value for per_page just for posts, or
to fall back to your default value if not specified.

Expand Down Expand Up @@ -145,7 +135,7 @@ in the global Object namespace:

This can cause collisions with Settingslogic, since those methods are global. Luckily, the
solution is to just add a call to load! in your class:

class Settings < Settingslogic
source "#{Rails.root}/config/application.yml"
namespace Rails.env
Expand Down
27 changes: 4 additions & 23 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,7 @@
require 'rubygems'
require 'rake'

begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "settingslogic"
gem.summary = "A simple and straightforward settings solution that uses an ERB enabled YAML file and a singleton design pattern."
gem.email = "bjohnson@binarylogic.com"
gem.homepage = "http://github.com/binarylogic/settingslogic"
gem.authors = ["Ben Johnson of Binary Logic"]
end
Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
end
require 'bundler'
Bundler::GemHelper.install_tasks

require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)

RSpec::Core::RakeTask.new(:rcov) do |spec|
spec.pattern = 'spec/**/*_spec.rb'
spec.rcov = true
end
RSpec::Core::RakeTask.new

task :default => :spec
task :default => :spec
5 changes: 0 additions & 5 deletions VERSION.yml

This file was deleted.

1 change: 0 additions & 1 deletion init.rb

This file was deleted.

1 change: 0 additions & 1 deletion rails/init.rb

This file was deleted.

78 changes: 16 additions & 62 deletions settingslogic.gemspec
Original file line number Diff line number Diff line change
@@ -1,67 +1,21 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)

Gem::Specification.new do |s|
s.name = "settingslogic"
s.version = "2.0.8"
s.name = "settingslogic"
s.version = "2.0.9"
s.platform = Gem::Platform::RUBY
s.authors = ["Ben Johnson"]
s.email = ["bjohnson@binarylogic.com"]
s.homepage = "http://github.com/binarylogic/settingslogic"
s.summary = %q{A simple and straightforward settings solution that uses an ERB enabled YAML file and a singleton design pattern.}
s.description = %q{A simple and straightforward settings solution that uses an ERB enabled YAML file and a singleton design pattern.}

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Ben Johnson of Binary Logic"]
s.date = "2012-01-09"
s.email = "bjohnson@binarylogic.com"
s.extra_rdoc_files = [
"LICENSE",
"README.rdoc"
]
s.files = [
"CHANGELOG.rdoc",
"Gemfile",
"Gemfile.lock",
"LICENSE",
"README.rdoc",
"Rakefile",
"VERSION.yml",
"init.rb",
"lib/settingslogic.rb",
"rails/init.rb",
"settingslogic.gemspec",
"spec/settings.rb",
"spec/settings.yml",
"spec/settings2.rb",
"spec/settings3.rb",
"spec/settings4.rb",
"spec/settingslogic_spec.rb",
"spec/spec_helper.rb"
]
s.homepage = "http://github.com/binarylogic/settingslogic"
s.require_paths = ["lib"]
s.rubygems_version = "1.8.10"
s.summary = "A simple and straightforward settings solution that uses an ERB enabled YAML file and a singleton design pattern."

if s.respond_to? :specification_version then
s.specification_version = 3

if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_development_dependency(%q<rake>, [">= 0"])
s.add_development_dependency(%q<jeweler>, [">= 0"])
s.add_development_dependency(%q<rspec>, [">= 0"])
s.add_development_dependency(%q<rcov>, [">= 0"])
s.add_development_dependency(%q<ruby-debug19>, [">= 0"])
else
s.add_dependency(%q<rake>, [">= 0"])
s.add_dependency(%q<jeweler>, [">= 0"])
s.add_dependency(%q<rspec>, [">= 0"])
s.add_dependency(%q<rcov>, [">= 0"])
s.add_dependency(%q<ruby-debug19>, [">= 0"])
end
else
s.add_dependency(%q<rake>, [">= 0"])
s.add_dependency(%q<jeweler>, [">= 0"])
s.add_dependency(%q<rspec>, [">= 0"])
s.add_dependency(%q<rcov>, [">= 0"])
s.add_dependency(%q<ruby-debug19>, [">= 0"])
end
end
s.add_development_dependency 'rake'
s.add_development_dependency 'rspec'

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

0 comments on commit 08792a6

Please sign in to comment.