Skip to content

Commit

Permalink
simplify manifest generation code by using git ls-files
Browse files Browse the repository at this point in the history
this is a cherry-pick of b9eef89
  • Loading branch information
mislav committed Feb 10, 2009
1 parent df23a9e commit 5c462bb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 27 deletions.
13 changes: 4 additions & 9 deletions .manifest
@@ -1,18 +1,18 @@
.autotest
.gitignore
.gitmodules
.manifest
CHANGELOG.rdoc
LICENSE
README.rdoc
Rakefile
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/deprecation.rb
lib/will_paginate/finders
lib/will_paginate/finders.rb
lib/will_paginate/finders/active_record
lib/will_paginate/finders/active_record.rb
lib/will_paginate/finders/active_record/named_scope.rb
lib/will_paginate/finders/active_record/named_scope_patch.rb
Expand All @@ -21,19 +21,16 @@ lib/will_paginate/finders/base.rb
lib/will_paginate/finders/data_mapper.rb
lib/will_paginate/finders/sequel.rb
lib/will_paginate/version.rb
lib/will_paginate/view_helpers
lib/will_paginate/view_helpers.rb
lib/will_paginate/view_helpers/action_view.rb
lib/will_paginate/view_helpers/base.rb
lib/will_paginate/view_helpers/link_renderer.rb
lib/will_paginate/view_helpers/link_renderer_base.rb
lib/will_paginate/view_helpers/merb.rb
spec
spec/collection_spec.rb
spec/console
spec/console_fixtures.rb
spec/database.yml
spec/finders
spec/finders/active_record_spec.rb
spec/finders/active_resource_spec.rb
spec/finders/activerecord_test_connector.rb
Expand All @@ -42,7 +39,6 @@ spec/finders/data_mapper_test_connector.rb
spec/finders/sequel_spec.rb
spec/finders/sequel_test_connector.rb
spec/finders_spec.rb
spec/fixtures
spec/fixtures/admin.rb
spec/fixtures/developer.rb
spec/fixtures/developers_projects.yml
Expand All @@ -59,7 +55,6 @@ spec/rcov.opts
spec/spec.opts
spec/spec_helper.rb
spec/tasks.rake
spec/view_helpers
spec/view_helpers/action_view_spec.rb
spec/view_helpers/base_spec.rb
spec/view_helpers/link_renderer_base_spec.rb
Expand Down
20 changes: 4 additions & 16 deletions Rakefile
Expand Up @@ -35,31 +35,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 -x *.gemspec -x website`.chomp.split("\n")

ignores = File.read('.gitignore').to_a
ignores << 'website'

ignores.each 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|spec)\//) : 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 :website do
Expand Down
4 changes: 2 additions & 2 deletions will_paginate.gemspec
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 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/deprecation.rb lib/will_paginate/finders lib/will_paginate/finders.rb lib/will_paginate/finders/active_record lib/will_paginate/finders/active_record.rb lib/will_paginate/finders/active_record/named_scope.rb lib/will_paginate/finders/active_record/named_scope_patch.rb lib/will_paginate/finders/active_resource.rb lib/will_paginate/finders/base.rb lib/will_paginate/finders/data_mapper.rb lib/will_paginate/finders/sequel.rb lib/will_paginate/version.rb lib/will_paginate/view_helpers lib/will_paginate/view_helpers.rb lib/will_paginate/view_helpers/action_view.rb lib/will_paginate/view_helpers/base.rb lib/will_paginate/view_helpers/link_renderer.rb lib/will_paginate/view_helpers/link_renderer_base.rb lib/will_paginate/view_helpers/merb.rb spec spec/collection_spec.rb spec/console spec/console_fixtures.rb spec/database.yml spec/finders spec/finders/active_record_spec.rb spec/finders/active_resource_spec.rb spec/finders/activerecord_test_connector.rb spec/finders/data_mapper_spec.rb spec/finders/data_mapper_test_connector.rb spec/finders/sequel_spec.rb spec/finders/sequel_test_connector.rb spec/finders_spec.rb spec/fixtures spec/fixtures/admin.rb spec/fixtures/developer.rb spec/fixtures/developers_projects.yml spec/fixtures/project.rb spec/fixtures/projects.yml spec/fixtures/replies.yml spec/fixtures/reply.rb spec/fixtures/schema.rb spec/fixtures/topic.rb spec/fixtures/topics.yml spec/fixtures/user.rb spec/fixtures/users.yml spec/rcov.opts spec/spec.opts spec/spec_helper.rb spec/tasks.rake spec/view_helpers spec/view_helpers/action_view_spec.rb spec/view_helpers/base_spec.rb spec/view_helpers/link_renderer_base_spec.rb spec/view_helpers/view_example_group.rb)
s.test_files = %w(spec/collection_spec.rb spec/console spec/console_fixtures.rb spec/database.yml spec/finders spec/finders/active_record_spec.rb spec/finders/active_resource_spec.rb spec/finders/activerecord_test_connector.rb spec/finders/data_mapper_spec.rb spec/finders/data_mapper_test_connector.rb spec/finders/sequel_spec.rb spec/finders/sequel_test_connector.rb spec/finders_spec.rb spec/fixtures spec/fixtures/admin.rb spec/fixtures/developer.rb spec/fixtures/developers_projects.yml spec/fixtures/project.rb spec/fixtures/projects.yml spec/fixtures/replies.yml spec/fixtures/reply.rb spec/fixtures/schema.rb spec/fixtures/topic.rb spec/fixtures/topics.yml spec/fixtures/user.rb spec/fixtures/users.yml spec/rcov.opts spec/spec.opts spec/spec_helper.rb spec/tasks.rake spec/view_helpers spec/view_helpers/action_view_spec.rb spec/view_helpers/base_spec.rb spec/view_helpers/link_renderer_base_spec.rb spec/view_helpers/view_example_group.rb)
s.files = %w(.autotest .gitignore .gitmodules .manifest CHANGELOG.rdoc LICENSE README.rdoc Rakefile 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/deprecation.rb lib/will_paginate/finders.rb lib/will_paginate/finders/active_record.rb lib/will_paginate/finders/active_record/named_scope.rb lib/will_paginate/finders/active_record/named_scope_patch.rb lib/will_paginate/finders/active_resource.rb lib/will_paginate/finders/base.rb lib/will_paginate/finders/data_mapper.rb lib/will_paginate/finders/sequel.rb lib/will_paginate/version.rb lib/will_paginate/view_helpers.rb lib/will_paginate/view_helpers/action_view.rb lib/will_paginate/view_helpers/base.rb lib/will_paginate/view_helpers/link_renderer.rb lib/will_paginate/view_helpers/link_renderer_base.rb lib/will_paginate/view_helpers/merb.rb spec/collection_spec.rb spec/console spec/console_fixtures.rb spec/database.yml spec/finders/active_record_spec.rb spec/finders/active_resource_spec.rb spec/finders/activerecord_test_connector.rb spec/finders/data_mapper_spec.rb spec/finders/data_mapper_test_connector.rb spec/finders/sequel_spec.rb spec/finders/sequel_test_connector.rb spec/finders_spec.rb spec/fixtures/admin.rb spec/fixtures/developer.rb spec/fixtures/developers_projects.yml spec/fixtures/project.rb spec/fixtures/projects.yml spec/fixtures/replies.yml spec/fixtures/reply.rb spec/fixtures/schema.rb spec/fixtures/topic.rb spec/fixtures/topics.yml spec/fixtures/user.rb spec/fixtures/users.yml spec/rcov.opts spec/spec.opts spec/spec_helper.rb spec/tasks.rake spec/view_helpers/action_view_spec.rb spec/view_helpers/base_spec.rb spec/view_helpers/link_renderer_base_spec.rb spec/view_helpers/view_example_group.rb)
s.test_files = %w(spec/collection_spec.rb spec/console spec/console_fixtures.rb spec/database.yml spec/finders/active_record_spec.rb spec/finders/active_resource_spec.rb spec/finders/activerecord_test_connector.rb spec/finders/data_mapper_spec.rb spec/finders/data_mapper_test_connector.rb spec/finders/sequel_spec.rb spec/finders/sequel_test_connector.rb spec/finders_spec.rb spec/fixtures/admin.rb spec/fixtures/developer.rb spec/fixtures/developers_projects.yml spec/fixtures/project.rb spec/fixtures/projects.yml spec/fixtures/replies.yml spec/fixtures/reply.rb spec/fixtures/schema.rb spec/fixtures/topic.rb spec/fixtures/topics.yml spec/fixtures/user.rb spec/fixtures/users.yml spec/rcov.opts spec/spec.opts spec/spec_helper.rb spec/tasks.rake spec/view_helpers/action_view_spec.rb spec/view_helpers/base_spec.rb spec/view_helpers/link_renderer_base_spec.rb spec/view_helpers/view_example_group.rb)
end

0 comments on commit 5c462bb

Please sign in to comment.