xupa_emec 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/xupa_emec +9 -9
- data/lib/xupa_emec/version.rb +1 -1
- data/xupa_emec.gemspec +1 -1
- metadata +3 -3
data/bin/xupa_emec
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
3
|
require 'xupa_emec'
|
4
4
|
|
5
5
|
opts = Trollop::options do
|
@@ -19,17 +19,17 @@ crawler = XupaEmec::Crawler.new
|
|
19
19
|
|
20
20
|
File.open(opts[:entrada], "r") do |input|
|
21
21
|
|
22
|
-
|
23
|
-
|
22
|
+
FasterCSV.open(opts[:saida], "w",
|
23
|
+
:write_headers => true,
|
24
|
+
:headers => ['nome', 'tipo', 'cidade', 'tel', 'site', 'email', 'mantenedora', 'representante_nome', 'representante_primeiro_nome', 'representante_cargo']) do |out_csv|
|
24
25
|
|
25
|
-
|
26
|
-
|
26
|
+
in_html = doc = Nokogiri::HTML(input)
|
27
|
+
iess_to_search = in_html.css('table:nth-child(2) tbody tr')
|
27
28
|
|
28
|
-
|
29
|
+
puts "Vamos importar #{iess_to_search.size} IESs..."
|
30
|
+
puts
|
29
31
|
|
30
|
-
|
31
|
-
:write_headers => true,
|
32
|
-
:headers => ['nome', 'tipo', 'cidade', 'tel', 'site', 'email', 'mantenedora', 'representante_nome', 'representante_primeiro_nome', 'representante_cargo']) do |out_csv|
|
32
|
+
iess_to_search.each_with_index do |line, index|
|
33
33
|
|
34
34
|
raw_name = line.css('td:nth-child(2)').text.strip
|
35
35
|
ies_search_name = raw_name.split('-').max{|a,b| a.length <=> b.length } #pega o nome maior
|
data/lib/xupa_emec/version.rb
CHANGED
data/xupa_emec.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xupa_emec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 2
|
10
|
+
version: 1.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Bernardo de P\xC3\xA1dua"
|