ruby-conf 2.6.4 → 2.6.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/ruby-conf.rb +4 -4
- data/ruby-conf.gemspec +2 -2
- data/spec/lib/ruby-conf_spec.rb +13 -4
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.6.
|
1
|
+
2.6.5
|
data/lib/ruby-conf.rb
CHANGED
@@ -12,7 +12,7 @@ module RubyConf
|
|
12
12
|
def self.out(*objs) self.puts($stdout, *objs) end
|
13
13
|
|
14
14
|
class Loader < BasicObject
|
15
|
-
EXTENTIONS = %w{rbc rbcnf rbconf rbconfig rubyconf rubyconfig ruby-conf ruby-config}
|
15
|
+
EXTENTIONS = %w{\\.rbc \\.rbcnf \\.rconf rbconf rbconfig rubyconf rubyconfig ruby-conf ruby-config}
|
16
16
|
|
17
17
|
@@conf = @@path = @@mtime = @@md5 = nil
|
18
18
|
|
@@ -37,8 +37,8 @@ module RubyConf
|
|
37
37
|
__rc_reload
|
38
38
|
if @@conf.nil?
|
39
39
|
Find.find('.') do |path|
|
40
|
-
next unless @@conf.nil? && path =~
|
41
|
-
if path =~
|
40
|
+
next unless @@conf.nil? && path =~ /(?:\.rb|\.config|\.conf|#{EXTENTIONS.join('|')})$/
|
41
|
+
if path =~ /(?:#{EXTENTIONS.join('|')})$/ || File.read(path) =~ /^\s*\#\s*\:\s*ruby-conf\s*$/mi
|
42
42
|
break if __rc_load(path)
|
43
43
|
end
|
44
44
|
end
|
@@ -288,6 +288,6 @@ module RubyConf
|
|
288
288
|
end
|
289
289
|
|
290
290
|
RUBY_CONF = RubyConf::Loader
|
291
|
-
|
291
|
+
RUBYCONF = RUBY_CONF
|
292
292
|
|
293
293
|
|
data/ruby-conf.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "ruby-conf"
|
8
|
-
s.version = "2.6.
|
8
|
+
s.version = "2.6.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Curtis Schofield & Hollin Wilkins & Mason"]
|
12
|
-
s.date = "2013-01-
|
12
|
+
s.date = "2013-01-17"
|
13
13
|
s.description = "rubyconf is a ruby configuration dsl that aims to make it simple to write and read configurations for ruby apps without a yaml or xml file"
|
14
14
|
s.email = "blazingpair@blazingcloud.net"
|
15
15
|
s.extra_rdoc_files = [
|
data/spec/lib/ruby-conf_spec.rb
CHANGED
@@ -429,11 +429,11 @@ TEXT
|
|
429
429
|
end
|
430
430
|
end
|
431
431
|
|
432
|
-
describe "Automatically sets the
|
432
|
+
describe "Automatically sets the RUBY_CONF variable" do
|
433
433
|
|
434
434
|
after do
|
435
435
|
dir = Dir["./**/test_conf.rb.tmpl"].first[/^(.*?)\/test_conf.rb.tmpl$/, 1]
|
436
|
-
File.delete("#{dir}/test_conf.
|
436
|
+
File.delete("#{dir}/test_conf.rbc") if File.exists?("#{dir}/test_conf.rbc")
|
437
437
|
end
|
438
438
|
|
439
439
|
it "will autoload the first ruby-conf that it can find if none is provided" do
|
@@ -441,7 +441,7 @@ TEXT
|
|
441
441
|
dir = Dir["./**/test_conf.rb.tmpl"].first[/^(.*?)\/test_conf.rb.tmpl$/, 1]
|
442
442
|
|
443
443
|
val = Random.rand.to_s
|
444
|
-
File.write("#{dir}/test_conf.
|
444
|
+
File.write("#{dir}/test_conf.rbc", File.read("#{dir}/test_conf.rb.tmpl").gsub('{{VALUE}}', val))
|
445
445
|
|
446
446
|
RUBY_CONF.should be_nil
|
447
447
|
RUBY_CONF.ident.should == "FOUND AND LOADED BASIC CONFIG #{val}"
|
@@ -453,7 +453,7 @@ TEXT
|
|
453
453
|
RUBY_CONF.__rc_loaded_conf[:mtime].should == loaded[:mtime]
|
454
454
|
|
455
455
|
val = Random.rand.to_s
|
456
|
-
File.write("#{dir}/test_conf.
|
456
|
+
File.write("#{dir}/test_conf.rbc", File.read("#{dir}/test_conf.rb.tmpl").gsub('{{VALUE}}', val))
|
457
457
|
FileUtils.touch(loaded[:path], mtime: 100)
|
458
458
|
RUBY_CONF.ident.should == "FOUND AND LOADED BASIC CONFIG #{val}"
|
459
459
|
RUBY_CONF.__rc_loaded_conf[:mtime].should_not == loaded[:mtime]
|
@@ -465,6 +465,15 @@ TEXT
|
|
465
465
|
::Object.const_defined?(:Rails).should be_true
|
466
466
|
RUBY_CONF.should be_nil
|
467
467
|
RUBY_CONF.ident.should == "FOUND AND LOADED RAILS ENV CONFIG #{val}"
|
468
|
+
|
469
|
+
RubyConf.clear
|
470
|
+
module ::Rails
|
471
|
+
def self.env() "bar" end
|
472
|
+
end
|
473
|
+
::Object.const_defined?(:Rails).should be_true
|
474
|
+
RUBY_CONF.should be_nil
|
475
|
+
RUBY_CONF.ident.should == "FOUND AND LOADED BASIC CONFIG #{val}"
|
476
|
+
|
468
477
|
end
|
469
478
|
|
470
479
|
it "sets the first unnamed config as default" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-conf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -115,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
115
115
|
version: '0'
|
116
116
|
segments:
|
117
117
|
- 0
|
118
|
-
hash:
|
118
|
+
hash: 3203519069117960759
|
119
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
120
|
none: false
|
121
121
|
requirements:
|