factbook 1.2.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +1,11 @@
1
- # encoding: utf-8
2
-
3
- ## $:.unshift(File.dirname(__FILE__))
4
-
5
- ## minitest setup
6
- require 'minitest/autorun'
7
-
8
-
9
- ## our own code
10
- require 'factbook'
11
-
1
+ # encoding: utf-8
2
+
3
+ ## $:.unshift(File.dirname(__FILE__))
4
+
5
+ ## minitest setup
6
+ require 'minitest/autorun'
7
+
8
+
9
+ ## our own code
10
+ require 'factbook'
11
+
@@ -1,52 +1,52 @@
1
- # encoding: utf-8
2
-
3
- ###
4
- # to run use
5
- # ruby -I ./lib -I ./test test/test_fields.rb
6
-
7
- require 'helper'
8
-
9
-
10
- class TestFields < MiniTest::Test
11
-
12
- def read_test_page( code )
13
- html = File.read( "#{Factbook.root}/test/data/src/#{code}.html" )
14
- page = Factbook::Page.new( code, html: html )
15
- page
16
- end
17
-
18
- def test_fields_full
19
- ## Factbook::Page.new( 'au', fields: 'full' )
20
- page = read_test_page( 'au' ) # use builtin test page (do NOT fetch via internet)
21
-
22
- assert_equal '-1.1% of GDP (2015 est.)', page['Economy']['Budget surplus (+) or deficit (-)']['text']
23
- assert_equal '0.7%', page['Economy']['Labor force - by occupation']['agriculture']['text']
24
-
25
- assert_equal 'Enns, Krems, Linz, Vienna (Danube)', page['Transportation']['Ports and terminals']['river port(s)']['text']
26
- end
27
-
28
- def fix_xxx_test_fields_full_w_header
29
- page = Factbook::OldPage.new( 'au', header: true, fields: 'full' )
30
- page.html = read_test_page( 'au' ) # use builtin test page (do NOT fetch via internet)
31
-
32
- assert_equal 'au', page['Header']['code']
33
- assert_equal "factbook/#{Factbook::VERSION}", page['Header']['generator']
34
-
35
- assert_equal '-2.4% of GDP (2014 est.)', page['Economy']['Budget surplus (+) or deficit (-)']['text']
36
- assert_equal '5.5%', page['Economy']['Labor force - by occupation']['agriculture']
37
-
38
- assert_equal 'Enns, Krems, Linz, Vienna (Danube)', page['Transportation']['Ports and terminals']['river port(s)']
39
- end
40
-
41
- def fix_xxx_test_fields_std
42
- page = Factbook::OldPage.new( 'au' )
43
- page.html = read_test_page( 'au' ) # use builtin test page (do NOT fetch via internet)
44
-
45
- assert_equal '-2.4% of GDP (2014 est.)', page['econ']['budget_surplus_or_deficit']['text']
46
- assert_equal '5.5%', page['econ']['labor_force_by_occupation']['agriculture']
47
-
48
- assert_equal 'Enns, Krems, Linz, Vienna (Danube)', page['trans']['ports_and_terminals']['river_ports']
49
- end
50
-
51
-
52
- end # class TestFields
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_fields.rb
6
+
7
+ require 'helper'
8
+
9
+
10
+ class TestFields < MiniTest::Test
11
+
12
+ def read_test_page( code )
13
+ html = File.read( "#{Factbook.root}/test/data/src/#{code}.html" )
14
+ page = Factbook::Page.new( code, html: html )
15
+ page
16
+ end
17
+
18
+ def test_fields_full
19
+ ## Factbook::Page.new( 'au', fields: 'full' )
20
+ page = read_test_page( 'au' ) # use builtin test page (do NOT fetch via internet)
21
+
22
+ assert_equal '-1.1% of GDP (2015 est.)', page['Economy']['Budget surplus (+) or deficit (-)']['text']
23
+ assert_equal '0.7%', page['Economy']['Labor force - by occupation']['agriculture']['text']
24
+
25
+ assert_equal 'Enns, Krems, Linz, Vienna (Danube)', page['Transportation']['Ports and terminals']['river port(s)']['text']
26
+ end
27
+
28
+ def fix_xxx_test_fields_full_w_header
29
+ page = Factbook::OldPage.new( 'au', header: true, fields: 'full' )
30
+ page.html = read_test_page( 'au' ) # use builtin test page (do NOT fetch via internet)
31
+
32
+ assert_equal 'au', page['Header']['code']
33
+ assert_equal "factbook/#{Factbook::VERSION}", page['Header']['generator']
34
+
35
+ assert_equal '-2.4% of GDP (2014 est.)', page['Economy']['Budget surplus (+) or deficit (-)']['text']
36
+ assert_equal '5.5%', page['Economy']['Labor force - by occupation']['agriculture']
37
+
38
+ assert_equal 'Enns, Krems, Linz, Vienna (Danube)', page['Transportation']['Ports and terminals']['river port(s)']
39
+ end
40
+
41
+ def fix_xxx_test_fields_std
42
+ page = Factbook::OldPage.new( 'au' )
43
+ page.html = read_test_page( 'au' ) # use builtin test page (do NOT fetch via internet)
44
+
45
+ assert_equal '-2.4% of GDP (2014 est.)', page['econ']['budget_surplus_or_deficit']['text']
46
+ assert_equal '5.5%', page['econ']['labor_force_by_occupation']['agriculture']
47
+
48
+ assert_equal 'Enns, Krems, Linz, Vienna (Danube)', page['trans']['ports_and_terminals']['river_ports']
49
+ end
50
+
51
+
52
+ end # class TestFields
@@ -1,45 +1,45 @@
1
- # encoding: utf-8
2
-
3
- ###
4
- # to run use
5
- # ruby -I ./lib -I ./test test/test_json.rb
6
-
7
-
8
- require 'helper'
9
-
10
-
11
- class TestJson < MiniTest::Test
12
-
13
-
14
- def test_json
15
- Dir.mkdir( 'tmp' ) unless Dir.exists?( 'tmp' )
16
-
17
- codes = [ 'au',
18
- 'ag',
19
- 'be',
20
- #'br',
21
- #'mx',
22
- #'ls',
23
- #'vt',
24
- #'ee',
25
- #'xx'
26
- ]
27
-
28
- codes.each do |code|
29
-
30
- html = File.read( "#{Factbook.root}/test/data/src/#{code}.html" )
31
- page = Factbook::Page.new( code, html: html )
32
-
33
- h = page.data
34
- pp h
35
-
36
- ### save to json
37
- puts "saving a copy to #{code}.json for debugging"
38
- File.open( "tmp/#{code}.json", 'w' ) do |f|
39
- f.write JSON.pretty_generate( h )
40
- ## f.write page.to_json
41
- end
42
- end
43
- end
44
-
45
- end # class TestJson
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_json.rb
6
+
7
+
8
+ require 'helper'
9
+
10
+
11
+ class TestJson < MiniTest::Test
12
+
13
+
14
+ def test_json
15
+ Dir.mkdir( 'tmp' ) unless Dir.exists?( 'tmp' )
16
+
17
+ codes = [ 'au',
18
+ 'ag',
19
+ 'be',
20
+ #'br',
21
+ #'mx',
22
+ #'ls',
23
+ #'vt',
24
+ #'ee',
25
+ #'xx'
26
+ ]
27
+
28
+ codes.each do |code|
29
+
30
+ html = File.read( "#{Factbook.root}/test/data/src/#{code}.html" )
31
+ page = Factbook::Page.new( code, html: html )
32
+
33
+ h = page.data
34
+ pp h
35
+
36
+ ### save to json
37
+ puts "saving a copy to #{code}.json for debugging"
38
+ File.open( "tmp/#{code}.json", 'w' ) do |f|
39
+ f.write JSON.pretty_generate( h )
40
+ ## f.write page.to_json
41
+ end
42
+ end
43
+ end
44
+
45
+ end # class TestJson
@@ -1,38 +1,38 @@
1
- # encoding: utf-8
2
-
3
- ###
4
- # to run use
5
- # ruby -I ./lib -I ./test test/test_page.rb
6
-
7
-
8
- require 'helper'
9
-
10
-
11
- class TestPage < MiniTest::Test
12
-
13
-
14
- def test_sects
15
- pages = [
16
- [ 'au', 10 ],
17
- [ 'be', 10 ],
18
- # [ 'br', 10 ],
19
- # [ 'ee', 10 ],
20
- # [ 'mx', 10 ],
21
- # [ 'xx', 10 ],
22
- # [ 'ls', 9 ],
23
- # [ 'vt', 8 ],
24
- ]
25
-
26
- pages.each do |rec|
27
- code = rec[0]
28
- sects_size = rec[1]
29
-
30
- html = File.read( "#{Factbook.root}/test/data/src/#{code}.html" )
31
- page = Factbook::Page.new( code, html: html )
32
-
33
- assert_equal sects_size, page.sects.size
34
- end
35
- end
36
-
37
-
38
- end # class TestPage
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_page.rb
6
+
7
+
8
+ require 'helper'
9
+
10
+
11
+ class TestPage < MiniTest::Test
12
+
13
+
14
+ def test_sects
15
+ pages = [
16
+ [ 'au', 10 ],
17
+ [ 'be', 10 ],
18
+ # [ 'br', 10 ],
19
+ # [ 'ee', 10 ],
20
+ # [ 'mx', 10 ],
21
+ # [ 'xx', 10 ],
22
+ # [ 'ls', 9 ],
23
+ # [ 'vt', 8 ],
24
+ ]
25
+
26
+ pages.each do |rec|
27
+ code = rec[0]
28
+ sects_size = rec[1]
29
+
30
+ html = File.read( "#{Factbook.root}/test/data/src/#{code}.html" )
31
+ page = Factbook::Page.new( code, html: html )
32
+
33
+ assert_equal sects_size, page.sects.size
34
+ end
35
+ end
36
+
37
+
38
+ end # class TestPage
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: factbook
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-08 00:00:00.000000000 Z
11
+ date: 2020-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logutils
@@ -25,7 +25,21 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: fetcher
28
+ name: csvreader
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: webget
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - ">="
@@ -70,41 +84,47 @@ dependencies:
70
84
  name: rdoc
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - "~>"
87
+ - - ">="
74
88
  - !ruby/object:Gem::Version
75
89
  version: '4.0'
90
+ - - "<"
91
+ - !ruby/object:Gem::Version
92
+ version: '7'
76
93
  type: :development
77
94
  prerelease: false
78
95
  version_requirements: !ruby/object:Gem::Requirement
79
96
  requirements:
80
- - - "~>"
97
+ - - ">="
81
98
  - !ruby/object:Gem::Version
82
99
  version: '4.0'
100
+ - - "<"
101
+ - !ruby/object:Gem::Version
102
+ version: '7'
83
103
  - !ruby/object:Gem::Dependency
84
104
  name: hoe
85
105
  requirement: !ruby/object:Gem::Requirement
86
106
  requirements:
87
107
  - - "~>"
88
108
  - !ruby/object:Gem::Version
89
- version: '3.15'
109
+ version: '3.22'
90
110
  type: :development
91
111
  prerelease: false
92
112
  version_requirements: !ruby/object:Gem::Requirement
93
113
  requirements:
94
114
  - - "~>"
95
115
  - !ruby/object:Gem::Version
96
- version: '3.15'
116
+ version: '3.22'
97
117
  description: factbook - scripts for the world factbook (get open structured data e.g
98
118
  JSON etc.)
99
119
  email: openmundi@googlegroups.com
100
120
  executables: []
101
121
  extensions: []
102
122
  extra_rdoc_files:
103
- - HISTORY.md
123
+ - CHANGELOG.md
104
124
  - Manifest.txt
105
125
  - README.md
106
126
  files:
107
- - HISTORY.md
127
+ - CHANGELOG.md
108
128
  - Manifest.txt
109
129
  - README.md
110
130
  - Rakefile
@@ -184,7 +204,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
184
204
  requirements:
185
205
  - - ">="
186
206
  - !ruby/object:Gem::Version
187
- version: 1.9.2
207
+ version: 2.2.2
188
208
  required_rubygems_version: !ruby/object:Gem::Requirement
189
209
  requirements:
190
210
  - - ">="
@@ -192,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
192
212
  version: '0'
193
213
  requirements: []
194
214
  rubyforge_project:
195
- rubygems_version: 2.6.7
215
+ rubygems_version: 2.5.2
196
216
  signing_key:
197
217
  specification_version: 4
198
218
  summary: factbook - scripts for the world factbook (get open structured data e.g JSON