xupa_emec 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/bin/xupa_emec CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
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
- in_html = doc = Nokogiri::HTML(input)
23
- iess_to_search = in_html.css('table:nth-child(2) tbody tr')
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
- puts "Vamos importar #{iess_to_search.size} IESs..."
26
- puts
26
+ in_html = doc = Nokogiri::HTML(input)
27
+ iess_to_search = in_html.css('table:nth-child(2) tbody tr')
27
28
 
28
- iess_to_search.each_with_index do |line, index|
29
+ puts "Vamos importar #{iess_to_search.size} IESs..."
30
+ puts
29
31
 
30
- FasterCSV.open(opts[:saida], "w",
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
@@ -2,7 +2,7 @@ module XupaEmec
2
2
  module Version
3
3
  MAJOR = 1
4
4
  MINOR = 0
5
- PATCH = 1
5
+ PATCH = 2
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
8
8
  end
data/xupa_emec.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{xupa_emec}
8
- s.version = "1.0.1"
8
+ s.version = "1.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Bernardo de P\303\241dua"]
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: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 1
10
- version: 1.0.1
9
+ - 2
10
+ version: 1.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Bernardo de P\xC3\xA1dua"