epitools 0.5.133 → 0.5.134

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db1a5a887e1a937b76e39d061a8865503f7bfeb33f03094f5d7b8ce3749420e7
4
- data.tar.gz: b5075843f8bd030de2e5313e9af3f53f97cae26fc0b52a609a06137fc015324c
3
+ metadata.gz: 2aefbc7936ad578ce3f2ae8806e67be1815f4e2a55ddf43a915bcdaa0ca9f68a
4
+ data.tar.gz: 6d09789e434d7cda9b66e25ecf1ebf9db61d6236f1342b83743330e42d9ab09f
5
5
  SHA512:
6
- metadata.gz: 0f13ae895b759edc3612970e335b743301bd102a4c73f619c16028acab0792a1d229d65ff40626d6c11334f95b020b055f9a18e6afc70a37ae74824b439c2f24
7
- data.tar.gz: 8bac272ee77ee4bd4c493b2b6f6c394e1143bd57e73b77196f9798326e73749b1c940622e22ea792875718b59e7a01380d2766296df5c19a3a259a3f7e34fcd3
6
+ metadata.gz: 4c98a36281937b7dd6e8f6154af595f5153d51803da0587eafc1a8dec26c96adac899e73c9ef49157b8fadcdf01fb845b60095d9ceb9722b5107c0eeaf6f8550
7
+ data.tar.gz: ccf09c13ef7df31e8d6994ba1c5550dc606fd61ac909c14f00c53788160a69cb53e7c425156a373732f4fbc7e021bde12c27e850be0ca1cf4735b86d9cf01285
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.133
1
+ 0.5.134
@@ -98,8 +98,11 @@ autoreq :Mechanize, 'mechanize'
98
98
  autoreq :HTTP, 'http'
99
99
 
100
100
  autoreq :Nokogiri, 'nokogiri'
101
- autoreq :Oga, 'oga'
102
101
  autoreq :Ox, 'ox'
102
+ autoreq :Oga do
103
+ require 'oga'
104
+ require 'epitools/gem_ext/oga'
105
+ end
103
106
 
104
107
  autoreq :ANSI, 'ansi'
105
108
 
@@ -247,3 +247,13 @@ end
247
247
  def curl_json(url)
248
248
  JSON.parse(curl(url))
249
249
  end
250
+
251
+ def cached_curl(url)
252
+ cache = "/tmp/curl-#{url.sha1}.cache"
253
+ if File.exist?(cache)
254
+ $stderr.puts "cached! => #{cache}"
255
+ else
256
+ File.write(cache, curl(url))
257
+ end
258
+ File.read(cache)
259
+ end
@@ -0,0 +1,31 @@
1
+
2
+ module Oga
3
+ module XML
4
+ # Serialize this node to HAML
5
+ module ElementToHAML
6
+ def to_haml
7
+ require 'html2haml'
8
+ require 'html2haml/html'
9
+ Html2haml::HTML.new(to_xml, {}).render.rstrip
10
+ end
11
+ alias_method :haml, :to_haml
12
+
13
+ def pretty
14
+ require 'coderay'
15
+ puts CodeRay.scan(haml, :haml).term
16
+ end
17
+ #alias_method :pp, :pretty
18
+ end
19
+
20
+ module PrettyNodeSet
21
+ def pretty
22
+ require 'coderay'
23
+ lesspipe(wrap: true) { |less| each { |node| less.puts CodeRay.scan(node.to_haml, :haml).term; less.puts; less.puts } }
24
+ end
25
+ end
26
+
27
+ end
28
+ end
29
+
30
+ Oga::XML::Element.include Oga::XML::ElementToHAML
31
+ Oga::XML::NodeSet.include Oga::XML::PrettyNodeSet
data/lib/epitools/path.rb CHANGED
@@ -939,7 +939,7 @@ class Path
939
939
 
940
940
  # Parse the file as CSV
941
941
  def read_csv(io=self.io, opts={})
942
- open { |io| CSV.new(io.read, opts).each }
942
+ CSV.new(io.read, **opts).each
943
943
  end
944
944
  alias_method :from_csv, :read_csv
945
945
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epitools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.133
4
+ version: 0.5.134
5
5
  platform: ruby
6
6
  authors:
7
7
  - epitron
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-30 00:00:00.000000000 Z
11
+ date: 2021-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -69,6 +69,7 @@ files:
69
69
  - lib/epitools/core_ext/truthiness.rb
70
70
  - lib/epitools/core_ext/uri.rb
71
71
  - lib/epitools/daemonize.rb
72
+ - lib/epitools/gem_ext/oga.rb
72
73
  - lib/epitools/hexdump.rb
73
74
  - lib/epitools/iter.rb
74
75
  - lib/epitools/its.rb
@@ -142,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
143
  - !ruby/object:Gem::Version
143
144
  version: '0'
144
145
  requirements: []
145
- rubygems_version: 3.2.15
146
+ rubygems_version: 3.2.21
146
147
  signing_key:
147
148
  specification_version: 3
148
149
  summary: Not utils... METILS!