diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-09-23 21:02:56 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-09-23 21:02:56 +0900 |
commit | 31a6eaabc165d8a222e176f2c809d90622d88ec2 (patch) | |
tree | b5333db2c13888ede5062ccd8ecca649ea261b4c /lib/rubygems/package | |
parent | f56fc720ee8cd4b79824a1c3843058b662a302bd (diff) | |
download | ruby-31a6eaabc165d8a222e176f2c809d90622d88ec2.tar.gz |
Manually merged from https://github.com/rubygems/rubygems/pull/2636
Enable Style/EmptyLinesAroundClassBody rubocop cop.
Diffstat (limited to 'lib/rubygems/package')
-rw-r--r-- | lib/rubygems/package/digest_io.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/package/file_source.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/package/io_source.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/package/old.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/package/tar_header.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/package/tar_reader.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/package/tar_reader/entry.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/package/tar_test_case.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/package/tar_writer.rb | 6 |
9 files changed, 22 insertions, 0 deletions
diff --git a/lib/rubygems/package/digest_io.rb b/lib/rubygems/package/digest_io.rb index 4736f76d93..d9e6c3c021 100644 --- a/lib/rubygems/package/digest_io.rb +++ b/lib/rubygems/package/digest_io.rb @@ -3,6 +3,7 @@ # IO wrapper that creates digests of contents written to the IO it wraps. class Gem::Package::DigestIO + ## # Collected digests for wrapped writes. # @@ -59,4 +60,5 @@ class Gem::Package::DigestIO result end + end diff --git a/lib/rubygems/package/file_source.rb b/lib/rubygems/package/file_source.rb index 114a950c77..8a4f9da6f2 100644 --- a/lib/rubygems/package/file_source.rb +++ b/lib/rubygems/package/file_source.rb @@ -7,6 +7,7 @@ # object to `Gem::Package.new`. class Gem::Package::FileSource < Gem::Package::Source # :nodoc: all + attr_reader :path def initialize(path) @@ -28,4 +29,5 @@ class Gem::Package::FileSource < Gem::Package::Source # :nodoc: all def with_read_io(&block) File.open path, 'rb', &block end + end diff --git a/lib/rubygems/package/io_source.rb b/lib/rubygems/package/io_source.rb index 7d7383110b..669a859d0a 100644 --- a/lib/rubygems/package/io_source.rb +++ b/lib/rubygems/package/io_source.rb @@ -8,6 +8,7 @@ # object to `Gem::Package.new`. class Gem::Package::IOSource < Gem::Package::Source # :nodoc: all + attr_reader :io def initialize(io) @@ -40,4 +41,5 @@ class Gem::Package::IOSource < Gem::Package::Source # :nodoc: all def path end + end diff --git a/lib/rubygems/package/old.rb b/lib/rubygems/package/old.rb index 25317ef23f..aeb6c999c0 100644 --- a/lib/rubygems/package/old.rb +++ b/lib/rubygems/package/old.rb @@ -12,6 +12,7 @@ # Please pretend this doesn't exist. class Gem::Package::Old < Gem::Package + undef_method :spec= ## @@ -165,4 +166,5 @@ class Gem::Package::Old < Gem::Package true end + end diff --git a/lib/rubygems/package/tar_header.rb b/lib/rubygems/package/tar_header.rb index f19aea549d..19927c0e27 100644 --- a/lib/rubygems/package/tar_header.rb +++ b/lib/rubygems/package/tar_header.rb @@ -28,6 +28,7 @@ # A header for a tar file class Gem::Package::TarHeader + ## # Fields in the tar header @@ -240,4 +241,5 @@ class Gem::Package::TarHeader def oct(num, len) "%0#{len}o" % num end + end diff --git a/lib/rubygems/package/tar_reader.rb b/lib/rubygems/package/tar_reader.rb index e7c5620533..b7b5e01e99 100644 --- a/lib/rubygems/package/tar_reader.rb +++ b/lib/rubygems/package/tar_reader.rb @@ -8,6 +8,7 @@ # TarReader reads tar files and allows iteration over their items class Gem::Package::TarReader + include Enumerable ## @@ -119,6 +120,7 @@ class Gem::Package::TarReader ensure rewind end + end require 'rubygems/package/tar_reader/entry' diff --git a/lib/rubygems/package/tar_reader/entry.rb b/lib/rubygems/package/tar_reader/entry.rb index 5865599d3a..d9c67ed8f2 100644 --- a/lib/rubygems/package/tar_reader/entry.rb +++ b/lib/rubygems/package/tar_reader/entry.rb @@ -8,6 +8,7 @@ # Class for reading entries out of a tar file class Gem::Package::TarReader::Entry + ## # Header for this tar entry @@ -164,4 +165,5 @@ class Gem::Package::TarReader::Entry @io.pos = @orig_pos @read = 0 end + end diff --git a/lib/rubygems/package/tar_test_case.rb b/lib/rubygems/package/tar_test_case.rb index 5fc34d2e8c..e4c408e416 100644 --- a/lib/rubygems/package/tar_test_case.rb +++ b/lib/rubygems/package/tar_test_case.rb @@ -6,6 +6,7 @@ require 'rubygems/package' # A test case for Gem::Package::Tar* classes class Gem::Package::TarTestCase < Gem::TestCase + def ASCIIZ(str, length) str + "\0" * (length - str.length) end @@ -136,4 +137,5 @@ class Gem::Package::TarTestCase < Gem::TestCase def util_symlink_entry util_entry tar_symlink_header("foo", "bar", 0, Time.now, "link") end + end diff --git a/lib/rubygems/package/tar_writer.rb b/lib/rubygems/package/tar_writer.rb index 877cc167c9..ed2577346d 100644 --- a/lib/rubygems/package/tar_writer.rb +++ b/lib/rubygems/package/tar_writer.rb @@ -8,12 +8,14 @@ # Allows writing of tar files class Gem::Package::TarWriter + class FileOverflow < StandardError; end ## # IO wrapper that allows writing a limited amount of data class BoundedStream + ## # Maximum number of bytes that can be written @@ -45,12 +47,14 @@ class Gem::Package::TarWriter @written += data.bytesize data.bytesize end + end ## # IO wrapper that provides only #write class RestrictedStream + ## # Creates a new RestrictedStream wrapping +io+ @@ -64,6 +68,7 @@ class Gem::Package::TarWriter def write(data) @io.write data end + end ## @@ -325,4 +330,5 @@ class Gem::Package::TarWriter return name, prefix end + end |