Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed location of railtie.rb include so it works

  • Loading branch information...
commit 7c78c82296d8d30128c879853b8c31efde4edb08 1 parent e76678f
@scalabl3 authored
View
16 couchbase_settings.gemspec
@@ -11,7 +11,21 @@ Gem::Specification.new do |gem|
gem.description = %q{A Simple Couchbase Settings gem to read RAILS_ROOT/config/couchbase.yml file}
gem.summary = %q{A Simple Couchbase Settings gem to read RAILS_ROOT/config/couchbase.yml file}
gem.homepage = "https://github.com/scalabl3/couchbase-settings"
-
+
+ gem.extra_rdoc_files = [
+ "LICENSE.txt"
+ ]
+ gem.files = [
+ "Gemfile",
+ "LICENSE.txt",
+ "README.md",
+ "Rakefile",
+ "VERSION",
+ "lib/couchbase_settings.rb",
+ "lib/couchbase_settings/railtie.rb",
+ "couchbase_settings.gemspec"
+ ]
+
gem.files = `git ls-files`.split($/)
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
View
18 lib/couchbase_settings.rb
@@ -1,12 +1,8 @@
+require 'rails'
require 'yaml'
require 'erb'
require "couchbase_settings/version"
-COUCHBASE_PATH = "#{File.dirname(__FILE__)}/couchbase_settings"
-puts COUCHBASE_PATH
-require "#{COUCHBASE_PATH}/railtie.rb"
-
-
module CouchbaseSettings
class UndefinedCouchbaseSettings < StandardError; end
class << self
@@ -19,16 +15,16 @@ def setup!
def find_ymls
main_file = "#{Rails.root.to_s}/config/couchbase.yml"
couchbase_main_file = File.exists?(main_file) ? [main_file] : []
- couchbase_namespaced_files = Dir.glob("#{Rails.root.to_s}/config/couchbase/**/*.yml")
- couchbase_main_file.concat(couchbase_namespaced_files)
end
def create_cbsettings_class(yml_file)
hash = load_yml(yml_file)
- klass_name = File.basename(yml_file).gsub(".yml","").camelize
- klass_name = "#{klass_name}CouchbaseSettings" unless klass_name=="CouchbaseSettings"
+ #klass_name = File.basename(yml_file).gsub(".yml","").camelize
+ klass_name = "CouchbaseSetting"
+ #klass_name = "#{klass_name}CouchbaseSetting" unless klass_name=="CouchbaseSetting"
klass = Object.const_set(klass_name,Class.new)
hash.each do |key,value|
+ #Rails.logger.debug "hash: key = #{key}, value = #{value}"
klass.define_singleton_method(key){ value }
end
klass.class_eval do
@@ -44,3 +40,7 @@ def load_yml(yml_file)
end
end # class << self
end
+
+# Include Railtie after defining the module
+COUCHBASE_SETTINGS_PATH = "#{File.dirname(__FILE__)}/couchbase_settings"
+require "#{COUCHBASE_SETTINGS_PATH}/railtie.rb"
View
2  lib/couchbase_settings/version.rb
@@ -1,3 +1,3 @@
module CouchbaseSettings
- VERSION = "0.0.3"
+ VERSION = "0.1.1"
end
Please sign in to comment.
Something went wrong with that request. Please try again.