Permalink
Browse files

Fail fast on non-directory entries in ~/.babushka/sources -- it's les…

…s surprising that way.
  • Loading branch information...
1 parent 49420a2 commit 5e10e2f821f326f3bd8c0427c8ec0d3857ff9dc2 @benhoskings committed Mar 26, 2013
Showing with 5 additions and 4 deletions.
  1. +2 −4 lib/babushka/source.rb
  2. +3 −0 spec/babushka/source_spec.rb
View
@@ -13,10 +13,8 @@ class Source
attr_reader :name, :uri, :deps, :templates
def self.present
- source_prefix.glob('*').map(&:p).select {|path|
- path.directory?
- }.map {|path|
- Source.for_path path
+ source_prefix.glob('*').map {|path|
+ Source.for_path(path.p)
}.select {|source|
source.present?
}
@@ -229,6 +229,9 @@
Source.for_path(Source.source_prefix / 'regular_file')
}.should raise_error(Errno::ENOTDIR, "Not a directory - #{Source.source_prefix / 'regular_file'}")
end
+ after {
+ `rm "#{tmp_prefix / 'sources/regular_file'}"`
+ }
end
context "on a dir" do
let(:source_path) { tmp_prefix / 'ad_hoc_source' }

0 comments on commit 5e10e2f

Please sign in to comment.