cid 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDI2ZmZhYWM1NDJkMTA0OTQ0OTE1YWU3OTA0NjE0ZDdhZjc3NWVhMA==
4
+ NWM0ZjJlZDdjNWE5ZTAwOWRmYzg2MDYzODcyN2JlMWU3ODFiNGY3Ng==
5
5
  data.tar.gz: !binary |-
6
- ZjE4ZmZkNjVjYjUzY2JmM2IzYWI4MmQxNmMyYmViNWFmNmM2YjNmZg==
6
+ MTFhMDE5N2RjMWI5YThkMjBiOGQ2NzM5OGNlMDU3N2M0ZWUwNTlkYQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MzcyMjQzYWEwYjNjM2NkYjBhOWM5ZjRkZDkxOTJlNTM1ZDA1OTJhZjRhZGEy
10
- NWI3N2ZjMzZhMWUxNGM5MGM4ZDRjM2Y2MDZkZmE4NjVkYTQzMjJlNWFlNDll
11
- OTg2ZDMwNTUzNTM0YjFkMzlmNmI2MmM3OTQzYjY2MzYxZjk4ZWU=
9
+ ZjZmZmVhMGY1ZDZhZDA5NDdhNWNiMjkxNDk1ZTM2YjBkYzc5MzJiMzBlNzQ0
10
+ OWMzYmVhODFjZDI2ZmU4MmUxZmYzYTRjMmFkZGU1MjIzYThiYjkxYTI1ODMy
11
+ YjQyNzhlNjFlMjM5ZGM4ODlmMjhjOGViM2E3NmFkODkyZTMyZDU=
12
12
  data.tar.gz: !binary |-
13
- OGNhMWVlMDhkMGQ2YmIwZGEyZGRiM2FhZTBmMWQ5Mzg2NDUxMTkzMjFlZTg4
14
- NjUxMTYzNjRiOWJhNjQwNjViMzY5MzAwMDQ4NWQwN2E4ZmI0ODhlZGY0OWE0
15
- OTNkYTcyZDM3OTY1NjgwNzViNDRkZjgzYmQzYzRjMzE3OGVmN2U=
13
+ ODk4NmVhYzMxZjI1NGVjNjhlODI3ODg4YzJkOTE4ZTEzMTYzOWUzMWUwNTdm
14
+ ZjRkMWMxMWFlNmMwMDRhZWMyOWY3NTZjMGY0OGIzZTE0N2U2ZThmODk3ZDEy
15
+ YmNkZWFiNTNiZjA2MmYwMGVjYjA5MmRkYTYyODkzMzVkMDE0MGE=
data/lib/cid.rb CHANGED
@@ -9,7 +9,6 @@ module Cid
9
9
  end
10
10
 
11
11
  require "cid/helpers/github"
12
- require "cid/helpers/file"
13
12
 
14
13
  require "cid/version"
15
14
  require "cid/validation"
@@ -5,8 +5,6 @@ module Cid
5
5
 
6
6
  class Datapackage
7
7
 
8
- include Cid::Helpers::File
9
-
10
8
  attr_accessor :json
11
9
 
12
10
  def initialize(path)
@@ -54,8 +52,7 @@ module Cid
54
52
  git.publish
55
53
  end
56
54
 
57
- def schema_for_file(file)
58
- path = clean_file(file)
55
+ def schema_for_file(path)
59
56
  begin
60
57
  schema = @datapackage["resources"].select { |r| r["path"] == path }.first["schema"]
61
58
  Csvlint::Schema.from_json_table(nil, schema)
@@ -19,11 +19,12 @@ module Cid
19
19
  end
20
20
 
21
21
  Dir["#{path}*.csv"].each do |csv|
22
- schema = Cid::Datapackage.new(root_path).schema_for_file(csv) if schema.nil?
22
+ ref = csv.split("/").last(2).join("/")
23
+
24
+ schema = Cid::Datapackage.new(root_path).schema_for_file(ref) if schema.nil?
23
25
 
24
26
  validator = Csvlint::Validator.new(File.new(csv), nil, schema)
25
27
 
26
- ref = csv.split("/").last(2).join("/")
27
28
  result[ref] = {}
28
29
 
29
30
  result[ref][:errors] = validator.errors
@@ -1,3 +1,3 @@
1
1
  module Cid
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - pezholio
@@ -328,7 +328,6 @@ files:
328
328
  - lib/cid.rb
329
329
  - lib/cid/bootstrap.rb
330
330
  - lib/cid/datapackage.rb
331
- - lib/cid/helpers/file.rb
332
331
  - lib/cid/helpers/github.rb
333
332
  - lib/cid/publish.rb
334
333
  - lib/cid/validation.rb
@@ -1,8 +0,0 @@
1
- module Cid::Helpers::File
2
-
3
- def clean_file(file)
4
- clean_file = file.gsub @path, ""
5
- clean_file.gsub! /^\//, ""
6
- end
7
-
8
- end