brand2csv 0.2.7 → 0.2.8
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/.travis.yml +8 -0
- data/History.txt +6 -0
- data/README.md +5 -0
- data/Rakefile +1 -1
- data/lib/brand2csv.rb +13 -12
- data/lib/brand2csv/version.rb +1 -1
- data/spec/csv_spec.rb +2 -4
- data/spec/detail_spec.rb +2 -4
- data/spec/short_spec.rb +2 -4
- data/spec/simple_search.rb +2 -4
- data/spec/spec_helper.rb +11 -2
- data/spec/utilities_spec.rb +2 -4
- metadata +89 -98
data/.travis.yml
CHANGED
data/History.txt
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# brand2csv
|
2
2
|
|
3
|
+
[](http://travis-ci.org/zdavatz/brand2csv)
|
4
|
+
|
3
5
|
brand2csv using swissreg.ch to get addresses.
|
4
6
|
|
5
7
|
## Usage
|
@@ -20,3 +22,6 @@ Usage:
|
|
20
22
|
The results are stored in the file <date_selected>.csv.
|
21
23
|
The trademark name is either a real brand name or a link to an image.
|
22
24
|
```
|
25
|
+
## Travis
|
26
|
+
You can find Travis builds here:
|
27
|
+
* https://travis-ci.org/zdavatz/brand2csv
|
data/Rakefile
CHANGED
@@ -6,7 +6,7 @@ require 'hoe'
|
|
6
6
|
|
7
7
|
Hoe.spec "brand2csv" do
|
8
8
|
self.author = "Niklaus Giger, Zeno R.R. Davatz" # gem.authors
|
9
|
-
self.email = "
|
9
|
+
self.email = "ngiger@ywesee.com, zdavatz@ywesee.com"
|
10
10
|
self.description = "brand2csv creates csv files for swiss brand registered in a specific time period.
|
11
11
|
The csv contains the brand, link to image (if present), link to the detailinfo at swissreg.ch, name and address of owner (Inhaber)"
|
12
12
|
self.summary = "brand2csv creates csv files for swiss brands."
|
data/lib/brand2csv.rb
CHANGED
@@ -227,20 +227,21 @@ module Brand2csv
|
|
227
227
|
# the number is only passed to facilitate debugging
|
228
228
|
# lines are the address lines
|
229
229
|
def Swissreg::parseAddress(number, inhaber)
|
230
|
-
lines = CGI.unescapeHTML(inhaber).split(LineSplit)
|
231
230
|
ort = nil
|
232
231
|
plz = nil
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
lines[cnt
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
232
|
+
if inhaber
|
233
|
+
lines = CGI.unescapeHTML(inhaber).split(LineSplit)
|
234
|
+
# Search for plz/address
|
235
|
+
1.upto(lines.length-1).each {
|
236
|
+
|cnt|
|
237
|
+
if m = AddressRegexp.match(lines[cnt])
|
238
|
+
lines[cnt+1] = nil
|
239
|
+
plz = m[1]; ort = m[2]
|
240
|
+
cnt.upto(MaxZeilen-1).each{ |cnt2| lines[cnt2] = nil }
|
241
|
+
break
|
242
|
+
end
|
243
|
+
}
|
244
|
+
end
|
244
245
|
unless plz
|
245
246
|
puts "Achtung! Konnte Marke #{number} mit Inhaber #{lines.inspect} nicht parsen" if $VERBOSE
|
246
247
|
return nil, nil, nil, nil, nil, nil, nil, nil
|
data/lib/brand2csv/version.rb
CHANGED
data/spec/csv_spec.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
#encoding : utf-8
|
2
|
-
require '
|
3
|
-
require 'pp'
|
2
|
+
require 'spec_helper'
|
4
3
|
require 'tempfile'
|
5
|
-
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib/','brand2csv.rb'))
|
6
4
|
|
7
5
|
include Brand2csv
|
8
6
|
|
@@ -26,4 +24,4 @@ describe 'Csv' do
|
|
26
24
|
inhalte[2].should == nil
|
27
25
|
end
|
28
26
|
|
29
|
-
end
|
27
|
+
end
|
data/spec/detail_spec.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
#encoding : utf-8
|
2
|
-
require '
|
3
|
-
require 'pp'
|
4
|
-
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib/','brand2csv.rb'))
|
2
|
+
require 'spec_helper'
|
5
3
|
|
6
4
|
include Brand2csv
|
7
5
|
|
@@ -27,4 +25,4 @@ describe 'Detail' do
|
|
27
25
|
@marke.name.should == 'https://www.swissreg.ch/srclient/images/loadImage?Action=LoadImg&ItemType=tm&ImageType=print&ImageHash=F431E13A9D8F363BD06604796634142A18A5BA7C.jpeg'
|
28
26
|
end
|
29
27
|
|
30
|
-
end
|
28
|
+
end
|
data/spec/short_spec.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
require '
|
2
|
-
require 'pp'
|
3
|
-
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib/','brand2csv.rb'))
|
1
|
+
require 'spec_helper'
|
4
2
|
|
5
3
|
include Brand2csv
|
6
4
|
|
@@ -54,4 +52,4 @@ describe 'Short (e.g. corvatsch*)' do
|
|
54
52
|
Swissreg::inputValue(data, 'id_swissreg:mainContent:scroll_1').should == ''
|
55
53
|
Swissreg::inputValue(data, 'id_swissreg:_idcl').should == "id_swissreg:mainContent:data:#{position}:tm_no_detail:id_detail"
|
56
54
|
end
|
57
|
-
end
|
55
|
+
end
|
data/spec/simple_search.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
require '
|
2
|
-
require 'pp'
|
3
|
-
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib/','brand2csv.rb'))
|
1
|
+
require 'spec_helper'
|
4
2
|
|
5
3
|
include Brand2csv
|
6
4
|
|
@@ -42,4 +40,4 @@ describe 'simple search with > 500 results' do
|
|
42
40
|
@einfach.nrSubPages.should == 26
|
43
41
|
end
|
44
42
|
|
45
|
-
end
|
43
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -6,9 +6,15 @@ require 'bundler/setup'
|
|
6
6
|
Bundler.require
|
7
7
|
|
8
8
|
require 'rspec'
|
9
|
-
require
|
9
|
+
require "webmock/rspec"
|
10
10
|
|
11
|
-
Dir[File.join(File.dirname(__FILE__), "
|
11
|
+
Dir[File.join(File.dirname(__FILE__), "support/**/*.rb")].each { |f| require f }
|
12
|
+
|
13
|
+
require 'brand2csv'
|
14
|
+
begin
|
15
|
+
capture(:stdout) { load File.expand_path("../../bin/brand2csv", __FILE__) }
|
16
|
+
rescue LoadError
|
17
|
+
end
|
12
18
|
|
13
19
|
RSpec.configure do |config|
|
14
20
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
@@ -22,4 +28,7 @@ RSpec.configure do |config|
|
|
22
28
|
# the seed, which is printed after each run.
|
23
29
|
# --seed 1234
|
24
30
|
config.order = 'random'
|
31
|
+
|
32
|
+
# Helper
|
33
|
+
config.include(ServerMockHelper)
|
25
34
|
end
|
data/spec/utilities_spec.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
#encoding : utf-8
|
2
|
-
require '
|
3
|
-
require 'pp'
|
4
|
-
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib/','brand2csv.rb'))
|
2
|
+
require 'spec_helper'
|
5
3
|
|
6
4
|
include Brand2csv
|
7
5
|
|
@@ -69,4 +67,4 @@ describe 'Tests parsing adress line' do
|
|
69
67
|
plz.should == '3018'
|
70
68
|
ort.should == 'Bern'
|
71
69
|
end
|
72
|
-
end
|
70
|
+
end
|
metadata
CHANGED
@@ -1,109 +1,109 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: brand2csv
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.8
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
- 7
|
10
|
-
version: 0.2.7
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Niklaus Giger, Zeno R.R. Davatz
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-08-28 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: mechanize
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 2
|
31
|
-
- 6
|
32
|
-
version: "2.6"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2.6'
|
33
22
|
type: :runtime
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: rdoc
|
37
23
|
prerelease: false
|
38
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.6'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rdoc
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
39
33
|
none: false
|
40
|
-
requirements:
|
34
|
+
requirements:
|
41
35
|
- - ~>
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
segments:
|
45
|
-
- 4
|
46
|
-
- 0
|
47
|
-
version: "4.0"
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '4.0'
|
48
38
|
type: :development
|
49
|
-
version_requirements: *id002
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
name: rspec
|
52
39
|
prerelease: false
|
53
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '4.0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rspec
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
54
49
|
none: false
|
55
|
-
requirements:
|
56
|
-
- -
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
|
59
|
-
segments:
|
60
|
-
- 0
|
61
|
-
version: "0"
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
62
54
|
type: :development
|
63
|
-
version_requirements: *id003
|
64
|
-
- !ruby/object:Gem::Dependency
|
65
|
-
name: webmock
|
66
55
|
prerelease: false
|
67
|
-
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: webmock
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
68
65
|
none: false
|
69
|
-
requirements:
|
70
|
-
- -
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
|
73
|
-
segments:
|
74
|
-
- 0
|
75
|
-
version: "0"
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
76
70
|
type: :development
|
77
|
-
version_requirements: *id004
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: hoe
|
80
71
|
prerelease: false
|
81
|
-
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
82
73
|
none: false
|
83
|
-
requirements:
|
84
|
-
- -
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: hoe
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '3.4'
|
91
86
|
type: :development
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '3.4'
|
94
|
+
description: ! "brand2csv creates csv files for swiss brand registered in a specific
|
95
|
+
time period. \n The csv contains the brand, link to image (if present), link to
|
96
|
+
the detailinfo at swissreg.ch, name and address of owner (Inhaber)"
|
97
|
+
email: ngiger@ywesee.com, zdavatz@ywesee.com
|
98
|
+
executables:
|
98
99
|
- brand2csv
|
99
100
|
extensions: []
|
100
|
-
|
101
|
-
extra_rdoc_files:
|
101
|
+
extra_rdoc_files:
|
102
102
|
- History.txt
|
103
103
|
- LICENCE.txt
|
104
104
|
- Manifest.txt
|
105
105
|
- README.md
|
106
|
-
files:
|
106
|
+
files:
|
107
107
|
- .gitignore
|
108
108
|
- .rspec
|
109
109
|
- .travis.yml
|
@@ -151,37 +151,28 @@ files:
|
|
151
151
|
- .gemtest
|
152
152
|
homepage: https://github.com/zdavatz/brand2csv
|
153
153
|
licenses: []
|
154
|
-
|
155
154
|
post_install_message:
|
156
|
-
rdoc_options:
|
155
|
+
rdoc_options:
|
157
156
|
- --main
|
158
157
|
- README.md
|
159
|
-
require_paths:
|
158
|
+
require_paths:
|
160
159
|
- lib
|
161
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
160
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
162
161
|
none: false
|
163
|
-
requirements:
|
164
|
-
- -
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
|
167
|
-
|
168
|
-
- 0
|
169
|
-
version: "0"
|
170
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - ! '>='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
167
|
none: false
|
172
|
-
requirements:
|
173
|
-
- -
|
174
|
-
- !ruby/object:Gem::Version
|
175
|
-
|
176
|
-
segments:
|
177
|
-
- 0
|
178
|
-
version: "0"
|
168
|
+
requirements:
|
169
|
+
- - ! '>='
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
version: '0'
|
179
172
|
requirements: []
|
180
|
-
|
181
173
|
rubyforge_project: brand2csv
|
182
174
|
rubygems_version: 1.8.25
|
183
175
|
signing_key:
|
184
176
|
specification_version: 3
|
185
177
|
summary: brand2csv creates csv files for swiss brands.
|
186
178
|
test_files: []
|
187
|
-
|