datapackage 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -17,7 +17,9 @@ Add the gem into your Gemfile:
17
17
 
18
18
  gem 'datapackage.rb', :git => "git://github.com/theodi/datapackage.rb.git"
19
19
 
20
- Note: gem release to come
20
+ Or:
21
+
22
+ sudo gem install datapackage
21
23
 
22
24
  ## Basic Usage
23
25
 
data/bin/datapackage ADDED
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+ $:.unshift File.join( File.dirname(__FILE__), "..", "lib")
3
+
4
+ require 'datapackage'
5
+
6
+
7
+ if ARGV.length == 0
8
+ puts "Usage: datapackage <location>"
9
+ puts "<location> should be a datapackage.json file, directory, or url"
10
+ exit 1
11
+ end
12
+
13
+ package = DataPackage::Package.new(ARGV[0])
14
+
15
+ messages = package.validate
16
+
17
+ if messages[:errors].length == 0
18
+ puts "Package #{package.name} is valid"
19
+ else
20
+ puts "Package #{package.name} is invalid"
21
+ puts "Fix the following errors: "
22
+ messages[:errors].each_with_index do |error, idx|
23
+ msg = error[:message] if error.class == Hash
24
+ msg = error if error.class != Hash
25
+ puts "#{idx+1}. #{msg}"
26
+ end
27
+ end
28
+
29
+ if !messages[:warnings].empty?
30
+ puts "Warnings: "
31
+ messages[:warnings].each_with_index do |warning, idx|
32
+ puts "#{idx+1}. #{warning}"
33
+ end
34
+ end
@@ -1,3 +1,3 @@
1
1
  module DataPackage
2
- VERSION = "0.0.1"
3
- end
2
+ VERSION = "0.0.2"
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datapackage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -110,10 +110,12 @@ dependencies:
110
110
  description:
111
111
  email:
112
112
  - leigh@ldodds.com
113
- executables: []
113
+ executables:
114
+ - datapackage
114
115
  extensions: []
115
116
  extra_rdoc_files: []
116
117
  files:
118
+ - bin/datapackage
117
119
  - etc/jsontable-schema.json
118
120
  - etc/datapackage-schema.json
119
121
  - etc/README.md