epitools 0.5.55 → 0.5.56

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/.gemspec +1 -1
  3. data/VERSION +1 -1
  4. data/lib/epitools/path.rb +32 -6
  5. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 147bfa8d564c4f6e84d969ad3c283004c2db2ffc
4
- data.tar.gz: 5e81187a0567ae2007fb75da433bfb1dae9b53b2
3
+ metadata.gz: e99c4c632bed20d594d0be23de1a3e4acc1614b9
4
+ data.tar.gz: 5b57af34cea2a3525ca2e517b5a5713599a56439
5
5
  SHA512:
6
- metadata.gz: b7af6a01c40cb110947c9f2647032e4ad1d5c5873d9ab6402ac873eb6dbbd24c89d218335d8026f9d4f3c6038c17e341998abefc7fa04c13d9562ebee2e1fd57
7
- data.tar.gz: cc1f0733b2f27c3c5fe42bac7b4b6490db08502609fde10877029b6c424b411d764d34f3c8b57d80f766d1ba5ef6633a0095a3b9394022e71a7cd0faed3cf3a3
6
+ metadata.gz: 2c7774db6661a079c9b1b8fff5c15359f824547c1f1c0700c202dc33a95e15b590ec64f5c62e4cde257254e7cedf6b51299f1446cb157bd423f35a05012890a6
7
+ data.tar.gz: 0173053ec0038c3066fe04cc5c5bc0ce9120172269c5559fc084c7b7ee7263f43dad514aee643bc8e28db8e2f9d5bac75a119684ee87f76853b0d9975a13c4a2
data/.gemspec CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
  s.specification_version = 3
24
24
  end
25
25
 
26
- s.add_development_dependency "rspec"
26
+ s.add_development_dependency "rspec", "~> 2"
27
27
  #s.add_dependency "mechanize", "~> 1.0.0"
28
28
  #s.add_dependency "sqlite3-ruby", ">= 0"
29
29
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.55
1
+ 0.5.56
@@ -366,9 +366,10 @@ class Path
366
366
  end
367
367
 
368
368
  def symlink_target
369
- Path.new File.readlink(path.gsub(/\/$/, ''))
369
+ Path[dir] / File.readlink(path.gsub(/\/$/, ''))
370
370
  end
371
371
  alias_method :readlink, :symlink_target
372
+ alias_method :target, :symlink_target
372
373
 
373
374
  def uri?
374
375
  false
@@ -920,36 +921,61 @@ class Path
920
921
  alias_method :md5sum, :md5
921
922
 
922
923
 
923
- # http://ruby-doc.org/stdlib/libdoc/zlib/rdoc/index.html
924
+ ## http://ruby-doc.org/stdlib/libdoc/zlib/rdoc/index.html
924
925
 
926
+ #
927
+ # gzip the file, returning the result as a string
928
+ #
929
+ def gzip(level=nil)
930
+ Zlib.deflate(read, level)
931
+ end
932
+
933
+ #
934
+ # gunzip the file, returning the result as a string
935
+ #
936
+ def gunzip(level=nil)
937
+ Zlib.inflate(read, level)
938
+ end
939
+
940
+ #
941
+ # Quickly gzip a file, creating a new .gz file, without removing the original,
942
+ # and returning a Path to that new file.
943
+ #
925
944
  def gzip!(level=nil)
926
945
  gz_file = self.with(:filename=>filename+".gz")
927
946
 
928
947
  raise "#{gz_file} already exists" if gz_file.exists?
929
948
 
930
949
  open("rb") do |input|
931
- Zlib::GzipWriter.open(gz_file) do |output|
932
- IO.copy_stream(input, output)
950
+ Zlib::GzipWriter.open(gz_file) do |gzwriter|
951
+ IO.copy_stream(input, gzwriter)
933
952
  end
934
953
  end
935
954
 
936
955
  update(gz_file)
937
956
  end
938
957
 
958
+ #
959
+ # Quickly gunzip a file, creating a new file, without removing the original,
960
+ # and returning a Path to that new file.
961
+ #
939
962
  def gunzip!
940
963
  raise "Not a .gz file" unless ext == "gz"
941
964
 
942
965
  regular_file = self.with(:ext=>nil)
943
966
 
944
967
  regular_file.open("wb") do |output|
945
- Zlib::GzipReader.open(self) do |input|
946
- IO.copy_stream(input, output)
968
+ Zlib::GzipReader.open(self) do |gzreader|
969
+ IO.copy_stream(gzreader, output)
947
970
  end
948
971
  end
949
972
 
950
973
  update(regular_file)
951
974
  end
952
975
 
976
+ #
977
+ # Match the full path against a regular expression
978
+ #
953
979
  def =~(pattern)
954
980
  to_s =~ pattern
955
981
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epitools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.55
4
+ version: 0.5.56
5
5
  platform: ruby
6
6
  authors:
7
7
  - epitron
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-12 00:00:00.000000000 Z
11
+ date: 2014-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '2'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '2'
27
27
  description: Miscellaneous utility libraries to make my life easier.
28
28
  email: chris@ill-logic.com
29
29
  executables: []