Skip to content

Commit

Permalink
ensure that gemspec ignored files are properly ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
saturnflyer committed Nov 5, 2011
1 parent 86d8d0f commit 97fdbb5
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions radiant-archive-extension.gemspec
Expand Up @@ -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.