Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cleanup marksim's improvements.

  • Loading branch information...
commit d1ea5c4764112cf7d58fb8b98c92bb883d104a6d 1 parent c37a49c
@kindkid authored
View
15 lib/constantinople.rb
@@ -8,18 +8,23 @@ module Constantinople
def self.reload!
result = Map.new
+ ignore_files = []
caller_config_directories do |dir|
- result.deeper_merge!(load_from_directory(dir))
+ ignore_files += files_to_ignore(dir)
+ end
+ ignore_files.uniq!
@marksim
marksim added a note

You're passing all ignore files into all merges...

So..

mygem/config/.constantinopleignore
database.yml

would ignore the local config/database.yml, just by including it

Rather than limiting it to the directory it was in.... no?

You're saying most gems won't include an ignore file?

@kindkid Owner
kindkid added a note

That is my assumption, yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ caller_config_directories do |dir|
+ result.deeper_merge!(load_from_directory(dir, :ignore => ignore_files))
end
result # I'm the map, I'm the map, I'm the map, I'm the map...
end
private
- def self.load_from_directory(dir)
+ def self.load_from_directory(dir, args={})
env = environment
result = Map.new
- ignore_files = files_to_ignore(dir)
+ ignore_files = args[:ignore]
['.yml.default', '.yml', '.yml.override'].each do |ext|
Dir.glob(File.join(dir,"*#{ext}")) do |path|
next if ignore_files.include?(File.basename(path))
@@ -77,9 +82,11 @@ def self.caller_directories
end
def self.files_to_ignore(dir)
- File.open(File.join(dir,".conignore")) do |f|
+ File.open(File.join(dir,".constantinopleignore")) do |f|
f.readlines
end
+ rescue Exception => e
+ []
end
end
View
2  spec/config/error.yml
@@ -1,4 +1,4 @@
<%
-error = ".ymlignore my butt."
+error = ".constantinopleignore my butt."
%>
error: <%= error %>
View
6 spec/lib/constantinople_spec.rb
@@ -20,14 +20,12 @@
end
describe "ignore files" do
- it "should read .ymlignore if it exists" do
+ it "should read .constantinopleignore if it exists" do
Constantinople.send(:files_to_ignore, "spec/config").should == ['error.yml']
end
it "should not bother reading error.yml" do
- lambda {
- CONFIG.error
- }.should raise_exception
+ CONFIG.should_not include(:error)
end
end
end
@marksim

You're passing all ignore files into all merges...

So..

mygem/config/.constantinopleignore
database.yml

would ignore the local config/database.yml, just by including it

Rather than limiting it to the directory it was in.... no?

You're saying most gems won't include an ignore file?

@kindkid

That is my assumption, yes.

Please sign in to comment.
Something went wrong with that request. Please try again.