eac_rails_utils 0.1.14 → 0.1.15

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
  SHA1:
3
- metadata.gz: 0acb126d8a37db24cadabca226c2cae0561e291a
4
- data.tar.gz: 81c7abb501d61470387caceb3b2abacd6cd0b480
3
+ metadata.gz: e2bba119f4803e55e20c3a9bf915965ae821847d
4
+ data.tar.gz: 1493145cd715c349b3f9debbccb1cf18e2cb34cf
5
5
  SHA512:
6
- metadata.gz: de160a44e1e44c421790d7d53868045b3ca6de43339ef6b785be919dc475f3fbea5460efe2559323bf202118c8df8b5d7f3b49775b5e9c2e771e6a005340801b
7
- data.tar.gz: 447f7f7cd0b6cd7cda62fd30706327329cb2a2c2a0bc5a1430338c72495c2591292e877cbda5460c66e6346b13f71ce1cbb968a543e3a51acc357d0a991eb2e7
6
+ metadata.gz: d97cbae07e0d8c6101324db441377322cebe01d6e191b38b9bc6a6d8a7b14b8175b61f716f7d5c060a753109101a0892adccf25c81478fcf64d9442061c0d19f
7
+ data.tar.gz: 8cc81ac1dfc2f727b0dcb80fe64400bef7c573d9aa329a9d90d2ec26b0ff440529290bea53364b94a4ad90cf1d365c37561d961c679ab06c0df270b7914c2278
@@ -38,7 +38,22 @@ module Eac
38
38
  end
39
39
 
40
40
  def content_get
41
- HTTPClient.new.get_content(@url, follow_redirect: true)
41
+ content_get_fetch(@url)
42
+ end
43
+
44
+ def content_get_fetch(uri, limit = 10)
45
+ raise 'too many HTTP redirects' if limit == 0
46
+
47
+ response = Net::HTTP.get_response(URI(uri))
48
+
49
+ case response
50
+ when Net::HTTPSuccess then
51
+ response.body
52
+ when Net::HTTPRedirection then
53
+ content_get_fetch(response['location'], limit - 1)
54
+ else
55
+ response.value
56
+ end
42
57
  end
43
58
 
44
59
  def content_hash
@@ -14,12 +14,16 @@ module Eac
14
14
 
15
15
  protected
16
16
 
17
+ def source_data(source_file)
18
+ parser_class.new(source_file).data
19
+ end
20
+
17
21
  def test_results
18
22
  sts = source_target_fixtures.source_target_files
19
23
  assert_not_equal 0, sts.count, 'Source/target files count cannot be zero'
20
24
  sts.each do |st|
21
25
  assert_source_target_complete(st)
22
- sd = parser_class.new(st.source).data
26
+ sd = source_data(st.source)
23
27
  td = YAML.load_file(st.target)
24
28
  assert_equal sort_results(td), sort_results(sd)
25
29
  end
@@ -27,7 +31,7 @@ module Eac
27
31
 
28
32
  def write_results
29
33
  source_target_fixtures.source_files.each do |source_file|
30
- sd = sort_results(parser_class.new(source_file).data)
34
+ sd = sort_results(source_data(source_file))
31
35
  basename = ::Eac::SourceTargetFixtures.source_target_basename(source_file)
32
36
  target_file = File.expand_path("../#{basename}.target.yaml", source_file)
33
37
  File.write(target_file, sd.to_yaml)
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module EacRailsUtils
3
- VERSION = '0.1.14'
3
+ VERSION = '0.1.15'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_rails_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.14
4
+ version: 0.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - E.A.C.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-26 00:00:00.000000000 Z
11
+ date: 2018-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel-associations
@@ -234,43 +234,43 @@ required_rubygems_version: !ruby/object:Gem::Requirement
234
234
  version: '0'
235
235
  requirements: []
236
236
  rubyforge_project:
237
- rubygems_version: 2.4.8
237
+ rubygems_version: 2.6.14
238
238
  signing_key:
239
239
  specification_version: 4
240
240
  summary: Código reutilizável para as aplicações Rails da E.A.C..
241
241
  test_files:
242
+ - test/dummy/Rakefile
243
+ - test/dummy/config.ru
244
+ - test/dummy/config/boot.rb
245
+ - test/dummy/config/database.yml
246
+ - test/dummy/config/secrets.yml
247
+ - test/dummy/config/locales/pt-BR.yml
248
+ - test/dummy/config/application.rb
249
+ - test/dummy/config/environments/test.rb
250
+ - test/dummy/config/environment.rb
251
+ - test/dummy/config/routes.rb
252
+ - test/dummy/db/schema.rb
253
+ - test/dummy/db/migrate/20160415143123_create_jobs.rb
254
+ - test/dummy/db/migrate/20160415143229_add_job_to_users.rb
255
+ - test/dummy/db/migrate/20160415125333_create_users.rb
256
+ - test/dummy/app/models/job.rb
257
+ - test/dummy/app/models/user.rb
258
+ - test/test_helper.rb
242
259
  - test/lib/eac_rails_utils/patches/model_attribute_required_test.rb
243
- - test/lib/eac/formatter_helper_test.rb
244
260
  - test/lib/eac/common_form_helper_test.rb
245
261
  - test/lib/eac/source_target_fixtures_test.rb
262
+ - test/lib/eac/parsers/files_test_test.rb
263
+ - test/lib/eac/parsers/ok_test_files/a.source.yaml
264
+ - test/lib/eac/parsers/ok_test_files/a.target.yaml
265
+ - test/lib/eac/parsers/ok_test_files/b.source.yaml
266
+ - test/lib/eac/parsers/ok_test_files/b.target.yaml
246
267
  - test/lib/eac/cpf_validator_test.rb
247
- - test/lib/eac/model_test.rb
248
268
  - test/lib/eac/data_table_test_helper.rb
249
- - test/lib/eac/source_target_fixtures_test_files/a.source.html
269
+ - test/lib/eac/simple_cache_test.rb
270
+ - test/lib/eac/formatter_helper_test.rb
250
271
  - test/lib/eac/source_target_fixtures_test_files/c.target.yaml
251
- - test/lib/eac/source_target_fixtures_test_files/a.target.yaml
252
272
  - test/lib/eac/source_target_fixtures_test_files/b.source.html
253
- - test/lib/eac/simple_cache_test.rb
273
+ - test/lib/eac/source_target_fixtures_test_files/a.target.yaml
274
+ - test/lib/eac/source_target_fixtures_test_files/a.source.html
254
275
  - test/lib/eac/listable_test.rb
255
- - test/lib/eac/parsers/ok_test_files/a.source.yaml
256
- - test/lib/eac/parsers/ok_test_files/a.target.yaml
257
- - test/lib/eac/parsers/ok_test_files/b.target.yaml
258
- - test/lib/eac/parsers/ok_test_files/b.source.yaml
259
- - test/lib/eac/parsers/files_test_test.rb
260
- - test/dummy/config.ru
261
- - test/dummy/db/migrate/20160415143229_add_job_to_users.rb
262
- - test/dummy/db/migrate/20160415143123_create_jobs.rb
263
- - test/dummy/db/migrate/20160415125333_create_users.rb
264
- - test/dummy/db/schema.rb
265
- - test/dummy/app/models/user.rb
266
- - test/dummy/app/models/job.rb
267
- - test/dummy/Rakefile
268
- - test/dummy/config/environments/test.rb
269
- - test/dummy/config/application.rb
270
- - test/dummy/config/boot.rb
271
- - test/dummy/config/locales/pt-BR.yml
272
- - test/dummy/config/secrets.yml
273
- - test/dummy/config/database.yml
274
- - test/dummy/config/routes.rb
275
- - test/dummy/config/environment.rb
276
- - test/test_helper.rb
276
+ - test/lib/eac/model_test.rb