epitools 0.5.15 → 0.5.16
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemspec +30 -0
- data/.gitignore +22 -0
- data/Rakefile +7 -34
- data/VERSION +1 -1
- data/lib/epitools/path.rb +15 -27
- data/spec/path_spec.rb +27 -17
- metadata +6 -37
- data/epitools.gemspec +0 -113
data/.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "epitools"
|
5
|
+
s.version = File.read("VERSION").strip
|
6
|
+
s.date = File.mtime("VERSION").strftime("%Y-%m-%d")
|
7
|
+
|
8
|
+
s.authors = ["epitron"]
|
9
|
+
s.description = "Miscellaneous utility libraries to make my life easier."
|
10
|
+
s.email = "chris@ill-logic.com"
|
11
|
+
s.extra_rdoc_files = [
|
12
|
+
"LICENSE",
|
13
|
+
"README.rdoc",
|
14
|
+
"TODO"
|
15
|
+
]
|
16
|
+
s.files = `git ls`.lines.map(&:strip)
|
17
|
+
s.homepage = "http://github.com/epitron/epitools"
|
18
|
+
s.licenses = ["WTFPL"]
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
s.summary = "Not utils... METILS!"
|
21
|
+
|
22
|
+
if s.respond_to? :specification_version
|
23
|
+
s.specification_version = 3
|
24
|
+
end
|
25
|
+
|
26
|
+
s.add_development_dependency "rspec"
|
27
|
+
#s.add_dependency "mechanize", "~> 1.0.0"
|
28
|
+
#s.add_dependency "sqlite3-ruby", ">= 0"
|
29
|
+
end
|
30
|
+
|
data/.gitignore
ADDED
data/Rakefile
CHANGED
@@ -1,36 +1,9 @@
|
|
1
|
-
|
1
|
+
VERSION = File.read("VERSION").strip
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
# $stderr.puts "Run `bundle install` to install missing gems"
|
10
|
-
# exit e.status_code
|
11
|
-
# end
|
12
|
-
require 'rake'
|
13
|
-
|
14
|
-
#
|
15
|
-
# Jewelerrrr
|
16
|
-
#
|
17
|
-
require 'jeweler'
|
18
|
-
Jeweler::Tasks.new do |gem|
|
19
|
-
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
20
|
-
gem.name = "epitools"
|
21
|
-
gem.summary = %Q{NOT UTILS... METILS!}
|
22
|
-
gem.description = %Q{Miscellaneous utility libraries to make my life easier.}
|
23
|
-
gem.email = "chris@ill-logic.com"
|
24
|
-
gem.homepage = "http://github.com/epitron/epitools"
|
25
|
-
gem.authors = ["epitron"]
|
26
|
-
gem.license = "WTFPL"
|
27
|
-
|
28
|
-
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
29
|
-
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
30
|
-
# gem.add_runtime_dependency 'jabber4r', '> 0.1'
|
31
|
-
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
32
|
-
gem.add_development_dependency "rspec", "~> 2.2.0"
|
33
|
-
gem.add_development_dependency "mechanize", "~> 1.0.0"
|
34
|
-
gem.add_development_dependency "sqlite3-ruby"
|
3
|
+
task :build do
|
4
|
+
system "gem build .gemspec"
|
5
|
+
end
|
6
|
+
|
7
|
+
task :release => :build do
|
8
|
+
system "gem push epitools-#{VERSION}.gem"
|
35
9
|
end
|
36
|
-
Jeweler::RubygemsDotOrgTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.16
|
data/lib/epitools/path.rb
CHANGED
@@ -686,9 +686,9 @@ class Path
|
|
686
686
|
File.unlink(self) == 1
|
687
687
|
end
|
688
688
|
end
|
689
|
-
alias_method :
|
690
|
-
alias_method :
|
691
|
-
alias_method :
|
689
|
+
alias_method :delete!, :rm
|
690
|
+
alias_method :unlink!, :rm
|
691
|
+
alias_method :remove!, :rm
|
692
692
|
|
693
693
|
def truncate(offset=0)
|
694
694
|
File.truncate(self, offset) if exists?
|
@@ -713,44 +713,32 @@ class Path
|
|
713
713
|
|
714
714
|
# http://ruby-doc.org/stdlib/libdoc/zlib/rdoc/index.html
|
715
715
|
|
716
|
-
def gzip(level=nil)
|
717
|
-
|
716
|
+
def gzip!(level=nil)
|
717
|
+
gz_file = self.with(:filename=>filename+".gz")
|
718
718
|
|
719
|
-
raise "#{
|
719
|
+
raise "#{gz_file} already exists" if gz_file.exists?
|
720
720
|
|
721
721
|
open("rb") do |input|
|
722
|
-
Zlib::GzipWriter.open(
|
723
|
-
IO.copy_stream(input,
|
722
|
+
Zlib::GzipWriter.open(gz_file) do |output|
|
723
|
+
IO.copy_stream(input, output)
|
724
724
|
end
|
725
725
|
end
|
726
726
|
|
727
|
-
|
728
|
-
end
|
729
|
-
|
730
|
-
def gzip!(level=nil)
|
731
|
-
gzipped = self.gzip(level)
|
732
|
-
self.rm
|
733
|
-
self.path = gzipped.path
|
727
|
+
update(gz_file)
|
734
728
|
end
|
735
729
|
|
736
|
-
def gunzip
|
730
|
+
def gunzip!
|
737
731
|
raise "Not a .gz file" unless ext == "gz"
|
738
732
|
|
739
|
-
|
733
|
+
regular_file = self.with(:ext=>nil)
|
740
734
|
|
741
|
-
|
742
|
-
Zlib::GzipReader.open(self) do |
|
743
|
-
IO.copy_stream(
|
735
|
+
regular_file.open("wb") do |output|
|
736
|
+
Zlib::GzipReader.open(self) do |input|
|
737
|
+
IO.copy_stream(input, output)
|
744
738
|
end
|
745
739
|
end
|
746
740
|
|
747
|
-
|
748
|
-
end
|
749
|
-
|
750
|
-
def gunzip!
|
751
|
-
gunzipped = self.gunzip
|
752
|
-
self.rm
|
753
|
-
self.path = gunzipped.path
|
741
|
+
update(regular_file)
|
754
742
|
end
|
755
743
|
|
756
744
|
def =~(pattern)
|
data/spec/path_spec.rb
CHANGED
@@ -233,16 +233,20 @@ describe Path do
|
|
233
233
|
end
|
234
234
|
|
235
235
|
it "truncates" do
|
236
|
-
|
236
|
+
tmp = Path.tmp
|
237
|
+
tmp.rm
|
238
|
+
tmp.touch
|
237
239
|
|
238
|
-
|
239
|
-
path.size.should == 100
|
240
|
+
tmp.exists?.should == true
|
240
241
|
|
241
|
-
|
242
|
-
|
242
|
+
tmp.write("1"*100)
|
243
|
+
tmp.size.should == 100
|
243
244
|
|
244
|
-
|
245
|
-
|
245
|
+
tmp.truncate(50)
|
246
|
+
tmp.size.should == 50
|
247
|
+
|
248
|
+
tmp.truncate
|
249
|
+
tmp.size.should == 0
|
246
250
|
end
|
247
251
|
|
248
252
|
it "checksums" do
|
@@ -273,20 +277,26 @@ describe Path do
|
|
273
277
|
end
|
274
278
|
|
275
279
|
it "gzips and gunzips" do
|
276
|
-
|
277
|
-
|
280
|
+
tmp = Path.tmp
|
281
|
+
|
282
|
+
data = ""
|
283
|
+
500.times { data << "whee" }
|
284
|
+
|
285
|
+
tmp.write data
|
286
|
+
|
287
|
+
tmp.size.should == data.size
|
288
|
+
|
289
|
+
tmp.ext.should_not == "gz"
|
278
290
|
|
279
|
-
|
280
|
-
|
291
|
+
before = tmp.size
|
292
|
+
tmp.gzip!
|
293
|
+
after = tmp.size
|
281
294
|
|
282
|
-
before = path.size
|
283
|
-
after = gzipped.size
|
284
295
|
before.should > after
|
285
|
-
|
296
|
+
tmp.ext.should == "gz"
|
286
297
|
|
287
|
-
|
288
|
-
|
289
|
-
gunzipped.should == path
|
298
|
+
tmp.gunzip!
|
299
|
+
tmp.size.should == before
|
290
300
|
end
|
291
301
|
|
292
302
|
it "exts" do
|
metadata
CHANGED
@@ -1,57 +1,24 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: epitools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.15
|
5
4
|
prerelease:
|
5
|
+
version: 0.5.16
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- epitron
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name: rspec
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 2.2.0
|
22
|
-
type: :development
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 2.2.0
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: mechanize
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ~>
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: 1.0.0
|
38
15
|
type: :development
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 1.0.0
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: sqlite3-ruby
|
48
16
|
requirement: !ruby/object:Gem::Requirement
|
49
17
|
none: false
|
50
18
|
requirements:
|
51
19
|
- - ! '>='
|
52
20
|
- !ruby/object:Gem::Version
|
53
21
|
version: '0'
|
54
|
-
type: :development
|
55
22
|
prerelease: false
|
56
23
|
version_requirements: !ruby/object:Gem::Requirement
|
57
24
|
none: false
|
@@ -59,6 +26,7 @@ dependencies:
|
|
59
26
|
- - ! '>='
|
60
27
|
- !ruby/object:Gem::Version
|
61
28
|
version: '0'
|
29
|
+
name: rspec
|
62
30
|
description: Miscellaneous utility libraries to make my life easier.
|
63
31
|
email: chris@ill-logic.com
|
64
32
|
executables: []
|
@@ -69,13 +37,14 @@ extra_rdoc_files:
|
|
69
37
|
- TODO
|
70
38
|
files:
|
71
39
|
- .document
|
40
|
+
- .gemspec
|
41
|
+
- .gitignore
|
72
42
|
- Guardfile
|
73
43
|
- LICENSE
|
74
44
|
- README.rdoc
|
75
45
|
- Rakefile
|
76
46
|
- TODO
|
77
47
|
- VERSION
|
78
|
-
- epitools.gemspec
|
79
48
|
- lib/epitools.rb
|
80
49
|
- lib/epitools/autoloads.rb
|
81
50
|
- lib/epitools/browser.rb
|
@@ -159,5 +128,5 @@ rubyforge_project:
|
|
159
128
|
rubygems_version: 1.8.24
|
160
129
|
signing_key:
|
161
130
|
specification_version: 3
|
162
|
-
summary:
|
131
|
+
summary: Not utils... METILS!
|
163
132
|
test_files: []
|
data/epitools.gemspec
DELETED
@@ -1,113 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = "epitools"
|
8
|
-
s.version = "0.5.15"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["epitron"]
|
12
|
-
s.date = "2012-11-25"
|
13
|
-
s.description = "Miscellaneous utility libraries to make my life easier."
|
14
|
-
s.email = "chris@ill-logic.com"
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.rdoc",
|
18
|
-
"TODO"
|
19
|
-
]
|
20
|
-
s.files = [
|
21
|
-
".document",
|
22
|
-
"Guardfile",
|
23
|
-
"LICENSE",
|
24
|
-
"README.rdoc",
|
25
|
-
"Rakefile",
|
26
|
-
"TODO",
|
27
|
-
"VERSION",
|
28
|
-
"epitools.gemspec",
|
29
|
-
"lib/epitools.rb",
|
30
|
-
"lib/epitools/autoloads.rb",
|
31
|
-
"lib/epitools/browser.rb",
|
32
|
-
"lib/epitools/browser/cache.rb",
|
33
|
-
"lib/epitools/browser/mechanize_progressbar.rb",
|
34
|
-
"lib/epitools/clitools.rb",
|
35
|
-
"lib/epitools/colored.rb",
|
36
|
-
"lib/epitools/core_ext.rb",
|
37
|
-
"lib/epitools/core_ext/array.rb",
|
38
|
-
"lib/epitools/core_ext/enumerable.rb",
|
39
|
-
"lib/epitools/core_ext/hash.rb",
|
40
|
-
"lib/epitools/core_ext/misc.rb",
|
41
|
-
"lib/epitools/core_ext/numbers.rb",
|
42
|
-
"lib/epitools/core_ext/object.rb",
|
43
|
-
"lib/epitools/core_ext/string.rb",
|
44
|
-
"lib/epitools/core_ext/truthiness.rb",
|
45
|
-
"lib/epitools/ezdb.rb",
|
46
|
-
"lib/epitools/hexdump.rb",
|
47
|
-
"lib/epitools/iter.rb",
|
48
|
-
"lib/epitools/its.rb",
|
49
|
-
"lib/epitools/lcs.rb",
|
50
|
-
"lib/epitools/mimemagic.rb",
|
51
|
-
"lib/epitools/mimemagic_tables.rb",
|
52
|
-
"lib/epitools/minimal.rb",
|
53
|
-
"lib/epitools/niceprint.rb",
|
54
|
-
"lib/epitools/numwords.rb",
|
55
|
-
"lib/epitools/path.rb",
|
56
|
-
"lib/epitools/permutations.rb",
|
57
|
-
"lib/epitools/pretty_backtrace.rb",
|
58
|
-
"lib/epitools/progressbar.rb",
|
59
|
-
"lib/epitools/rails.rb",
|
60
|
-
"lib/epitools/rash.rb",
|
61
|
-
"lib/epitools/ratio.rb",
|
62
|
-
"lib/epitools/sys.rb",
|
63
|
-
"lib/epitools/term.rb",
|
64
|
-
"lib/epitools/trie.rb",
|
65
|
-
"lib/epitools/typed_struct.rb",
|
66
|
-
"lib/epitools/wm.rb",
|
67
|
-
"lib/epitools/zopen.rb",
|
68
|
-
"spec/autoreq_spec.rb",
|
69
|
-
"spec/browser_spec.rb",
|
70
|
-
"spec/clitools_spec.rb",
|
71
|
-
"spec/colored_spec.rb",
|
72
|
-
"spec/core_ext_spec.rb",
|
73
|
-
"spec/ezdb_spec.rb",
|
74
|
-
"spec/iter_spec.rb",
|
75
|
-
"spec/lcs_spec.rb",
|
76
|
-
"spec/numwords_spec.rb",
|
77
|
-
"spec/path_spec.rb",
|
78
|
-
"spec/permutations_spec.rb",
|
79
|
-
"spec/rash_spec.rb",
|
80
|
-
"spec/ratio_spec.rb",
|
81
|
-
"spec/spec.opts",
|
82
|
-
"spec/spec_helper.rb",
|
83
|
-
"spec/sys_spec.rb",
|
84
|
-
"spec/term_spec.rb",
|
85
|
-
"spec/typed_struct_spec.rb",
|
86
|
-
"spec/wm_spec.rb",
|
87
|
-
"spec/zopen_spec.rb"
|
88
|
-
]
|
89
|
-
s.homepage = "http://github.com/epitron/epitools"
|
90
|
-
s.licenses = ["WTFPL"]
|
91
|
-
s.require_paths = ["lib"]
|
92
|
-
s.rubygems_version = "1.8.24"
|
93
|
-
s.summary = "NOT UTILS... METILS!"
|
94
|
-
|
95
|
-
if s.respond_to? :specification_version then
|
96
|
-
s.specification_version = 3
|
97
|
-
|
98
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
99
|
-
s.add_development_dependency(%q<rspec>, ["~> 2.2.0"])
|
100
|
-
s.add_development_dependency(%q<mechanize>, ["~> 1.0.0"])
|
101
|
-
s.add_development_dependency(%q<sqlite3-ruby>, [">= 0"])
|
102
|
-
else
|
103
|
-
s.add_dependency(%q<rspec>, ["~> 2.2.0"])
|
104
|
-
s.add_dependency(%q<mechanize>, ["~> 1.0.0"])
|
105
|
-
s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
|
106
|
-
end
|
107
|
-
else
|
108
|
-
s.add_dependency(%q<rspec>, ["~> 2.2.0"])
|
109
|
-
s.add_dependency(%q<mechanize>, ["~> 1.0.0"])
|
110
|
-
s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|