class Rubygems::Manifest

Constants

VERSION

Public Class Methods

new(filename = ENV['MANIFEST'] || 'Manifest.txt') click to toggle source
# File lib/rubygems/manifest.rb, line 5
def initialize(filename = ENV['MANIFEST'] || 'Manifest.txt')
  @filename = filename
end

Public Instance Methods

check() click to toggle source
# File lib/rubygems/manifest.rb, line 33
def check
  str = diff_str

  unless str == ''
    fail "Difference:\n\n#{str}\n"
  end
end
diff() click to toggle source
# File lib/rubygems/manifest.rb, line 41
def diff
  [read - files, files - read]
end
diff_str() click to toggle source
# File lib/rubygems/manifest.rb, line 45
def diff_str
  additions, deletions = diff

  str = ''
  deletions.each { |file| str << "-#{file}\n" }
  additions.each { |file| str << "+#{file}\n" }
  str
end
executables() click to toggle source
# File lib/rubygems/manifest.rb, line 13
def executables
  files.grep(%r{^bin/}) { |f| File.basename(f) }
end
files() click to toggle source
# File lib/rubygems/manifest.rb, line 9
def files
  @files ||= `git ls-files`.split($/)
end
read() click to toggle source
# File lib/rubygems/manifest.rb, line 25
def read
  File.read(@filename).split("\n")
end
save() click to toggle source
# File lib/rubygems/manifest.rb, line 29
def save
  File.open(@filename, 'w') { |f| f.puts(files) }
end
test_files() click to toggle source
# File lib/rubygems/manifest.rb, line 17
def test_files
  files.grep(%r{^(test|spec|features)/})
end
tests() click to toggle source
# File lib/rubygems/manifest.rb, line 21
def tests
  files.grep(%r{^(test|spec|features)(.*)(_test.rb|_spec.rb|\.feature)$})
end