Skip to content
This repository has been archived by the owner on Jan 1, 2021. It is now read-only.

Commit

Permalink
simplify manifest generation code by using git ls-files
Browse files Browse the repository at this point in the history
  • Loading branch information
mislav committed Feb 10, 2009
1 parent df42582 commit b9eef89
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 21 deletions.
6 changes: 0 additions & 6 deletions .manifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@ CHANGELOG.rdoc
LICENSE
README.rdoc
Rakefile
examples
examples/apple-circle.gif
examples/index.haml
examples/index.html
examples/pagination.css
examples/pagination.sass
init.rb
lib
lib/will_paginate
lib/will_paginate.rb
lib/will_paginate/array.rb
lib/will_paginate/collection.rb
Expand All @@ -20,13 +17,11 @@ lib/will_paginate/named_scope.rb
lib/will_paginate/named_scope_patch.rb
lib/will_paginate/version.rb
lib/will_paginate/view_helpers.rb
test
test/boot.rb
test/collection_test.rb
test/console
test/database.yml
test/finder_test.rb
test/fixtures
test/fixtures/admin.rb
test/fixtures/developer.rb
test/fixtures/developers_projects.yml
Expand All @@ -40,7 +35,6 @@ test/fixtures/topics.yml
test/fixtures/user.rb
test/fixtures/users.yml
test/helper.rb
test/lib
test/lib/activerecord_test_case.rb
test/lib/activerecord_test_connector.rb
test/lib/load_fixtures.rb
Expand Down
17 changes: 4 additions & 13 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,19 @@ desc %{Update ".manifest" with the latest list of project filenames. Respect\
.gitignore by excluding everything that git ignores. Update `files` and\
`test_files` arrays in "*.gemspec" file if it's present.}
task :manifest do
list = Dir['**/*'].sort
spec_file = Dir['*.gemspec'].first
list -= [spec_file] if spec_file
list = `git ls-files --full-name --exclude=*.gemspec --exclude=.*`.chomp.split("\n")

File.read('.gitignore').each_line do |glob|
glob = glob.chomp.sub(/^\//, '')
list -= Dir[glob]
list -= Dir["#{glob}/**/*"] if File.directory?(glob) and !File.symlink?(glob)
puts "excluding #{glob}"
end

if spec_file
if spec_file = Dir['*.gemspec'].first
spec = File.read spec_file
spec.gsub! /^(\s* s.(test_)?files \s* = \s* )( \[ [^\]]* \] | %w\( [^)]* \) )/mx do
assignment = $1
bunch = $2 ? list.grep(/^test\//) : list
'%s%%w(%s)' % [assignment, bunch.join(' ')]
end

File.open(spec_file, 'w') {|f| f << spec }
File.open(spec_file, 'w') { |f| f << spec }
end
File.open('.manifest', 'w') {|f| f << list.join("\n") }
File.open('.manifest', 'w') { |f| f << list.join("\n") }
end

task :examples do
Expand Down
4 changes: 2 additions & 2 deletions will_paginate.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ Gem::Specification.new do |s|
s.rdoc_options << '--inline-source' << '--charset=UTF-8'
s.extra_rdoc_files = ['README.rdoc', 'LICENSE', 'CHANGELOG.rdoc']

s.files = %w(CHANGELOG.rdoc LICENSE README.rdoc Rakefile examples examples/apple-circle.gif examples/index.haml examples/index.html examples/pagination.css examples/pagination.sass init.rb lib lib/will_paginate lib/will_paginate.rb lib/will_paginate/array.rb lib/will_paginate/collection.rb lib/will_paginate/core_ext.rb lib/will_paginate/finder.rb lib/will_paginate/named_scope.rb lib/will_paginate/named_scope_patch.rb lib/will_paginate/version.rb lib/will_paginate/view_helpers.rb test test/boot.rb test/collection_test.rb test/console test/database.yml test/finder_test.rb test/fixtures test/fixtures/admin.rb test/fixtures/developer.rb test/fixtures/developers_projects.yml test/fixtures/project.rb test/fixtures/projects.yml test/fixtures/replies.yml test/fixtures/reply.rb test/fixtures/schema.rb test/fixtures/topic.rb test/fixtures/topics.yml test/fixtures/user.rb test/fixtures/users.yml test/helper.rb test/lib test/lib/activerecord_test_case.rb test/lib/activerecord_test_connector.rb test/lib/load_fixtures.rb test/lib/view_test_process.rb test/tasks.rake test/view_test.rb)
s.test_files = %w(test/boot.rb test/collection_test.rb test/console test/database.yml test/finder_test.rb test/fixtures test/fixtures/admin.rb test/fixtures/developer.rb test/fixtures/developers_projects.yml test/fixtures/project.rb test/fixtures/projects.yml test/fixtures/replies.yml test/fixtures/reply.rb test/fixtures/schema.rb test/fixtures/topic.rb test/fixtures/topics.yml test/fixtures/user.rb test/fixtures/users.yml test/helper.rb test/lib test/lib/activerecord_test_case.rb test/lib/activerecord_test_connector.rb test/lib/load_fixtures.rb test/lib/view_test_process.rb test/tasks.rake test/view_test.rb)
s.files = %w(CHANGELOG.rdoc LICENSE README.rdoc Rakefile examples/apple-circle.gif examples/index.haml examples/index.html examples/pagination.css examples/pagination.sass init.rb lib/will_paginate.rb lib/will_paginate/array.rb lib/will_paginate/collection.rb lib/will_paginate/core_ext.rb lib/will_paginate/finder.rb lib/will_paginate/named_scope.rb lib/will_paginate/named_scope_patch.rb lib/will_paginate/version.rb lib/will_paginate/view_helpers.rb test/boot.rb test/collection_test.rb test/console test/database.yml test/finder_test.rb test/fixtures/admin.rb test/fixtures/developer.rb test/fixtures/developers_projects.yml test/fixtures/project.rb test/fixtures/projects.yml test/fixtures/replies.yml test/fixtures/reply.rb test/fixtures/schema.rb test/fixtures/topic.rb test/fixtures/topics.yml test/fixtures/user.rb test/fixtures/users.yml test/helper.rb test/lib/activerecord_test_case.rb test/lib/activerecord_test_connector.rb test/lib/load_fixtures.rb test/lib/view_test_process.rb test/tasks.rake test/view_test.rb)
s.test_files = %w(test/boot.rb test/collection_test.rb test/console test/database.yml test/finder_test.rb test/fixtures/admin.rb test/fixtures/developer.rb test/fixtures/developers_projects.yml test/fixtures/project.rb test/fixtures/projects.yml test/fixtures/replies.yml test/fixtures/reply.rb test/fixtures/schema.rb test/fixtures/topic.rb test/fixtures/topics.yml test/fixtures/user.rb test/fixtures/users.yml test/helper.rb test/lib/activerecord_test_case.rb test/lib/activerecord_test_connector.rb test/lib/load_fixtures.rb test/lib/view_test_process.rb test/tasks.rake test/view_test.rb)
end

0 comments on commit b9eef89

Please sign in to comment.