Skip to content
Browse files

ensure that gemspec ignored files are properly ignored

  • Loading branch information...
1 parent 86d8d0f commit 97fdbb5245e680591114684e32d1c55d57870a0f @saturnflyer saturnflyer committed
Showing with 13 additions and 8 deletions.
  1. +13 −8 radiant-archive-extension.gemspec
View
21 radiant-archive-extension.gemspec
@@ -12,14 +12,19 @@ Gem::Specification.new do |s|
s.summary = %q{Archive for Radiant CMS}
s.description = %q{Provides page types for news or blog archives.}
- ignores = if File.exist?('.gitignore')
- File.read('.gitignore').split("\n").inject([]) {|a,p| a + Dir[p] }
- else
- []
- end
- s.files = Dir['**/*'] - ignores
- s.test_files = Dir['test/**/*','spec/**/*','features/**/*'] - ignores
- # s.executables = Dir['bin/*'] - ignores
+ ignoreable_commands = File.read('.gitignore').split("\n").delete_if{|line| line.match(/^##/) || line.empty? }
+ ignoreable_files = ignoreable_commands.collect{|line|
+ if File.directory?(line)
+ line + "/**/*"
+ elsif File.file?(line)
+ line
+ end
+ }.compact
+
+ s.files = Dir['**/*','.gitignore'] - Dir[*ignoreable_files]
+
+ s.test_files = Dir['test/**/*','spec/**/*','features/**/*'] - Dir[*ignoreable_files]
+
s.require_paths = ["lib"]
end

0 comments on commit 97fdbb5

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