data_package 0.0.10 → 0.0.11

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 82a81fd9c748fb4d2a4d138aa4a10303356762bf
4
- data.tar.gz: e0748ef555fad62c84b42396d04a69c2bd4ecb85
3
+ metadata.gz: 8ad6cf50c1fb9c79e9716c1759a8f22a06a938a1
4
+ data.tar.gz: 2e042771bed18b05c3565251eae90a90abc00c57
5
5
  SHA512:
6
- metadata.gz: 82c9b285089afd248a35d4367111a237db709036f3e32fa1a91553a0db5e62fb48a75a935c33e0cdd695056dcc229e57a658becb3feec72602b8a01be974197f
7
- data.tar.gz: 98bd24c91b056ec3cf7ca3de2ce7f6f81326bddb3975a2fb1db7ca6db22388277730dce07e0ed24b1084a5cc17e9b16edfa82a8a251599df1884ad96ef2d3931
6
+ metadata.gz: ad22ab12a886cda11fbc789f2899d9e356c2cacb942a0238ddc742ae5e660d2306c77be0d814ccbe14725886fab9d9223ac43943f504de509157fa7501d12bee
7
+ data.tar.gz: 8e8ae9e91a8836632db62eee6ba8bacf9534d528291e987cd827786596c007c3d161008211ff11148d239605cdd39e024b38349c1174aec4175862fbe4577e5a
data/data_package.gemspec CHANGED
@@ -19,8 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  # Runtime Dependencies
22
- spec.add_runtime_dependency 'rcsv'
23
- spec.add_runtime_dependency 'yajl-ruby'
22
+ spec.add_runtime_dependency 'json'
24
23
  spec.add_runtime_dependency 'data_kit'
25
24
 
26
25
  # Development Dependencies
@@ -1,4 +1,4 @@
1
- require 'yajl'
1
+ require 'json'
2
2
 
3
3
  module AttrHelper
4
4
  module Serialization
@@ -19,8 +19,11 @@ module AttrHelper
19
19
  end
20
20
 
21
21
  def to_json(options = {})
22
- options = {:pretty => true}.merge(options)
23
- Yajl::Encoder.encode(to_hash, options)
22
+ if options[:pretty].nil? || options[:pretty]
23
+ JSON.pretty_generate(to_hash)
24
+ else
25
+ JSON.generate(to_hash)
26
+ end
24
27
  end
25
28
  end
26
29
  end
@@ -96,7 +96,7 @@ module DataPackage
96
96
 
97
97
  if File.exist?(full_path)
98
98
  file = File.open(full_path)
99
- new(base_path, Yajl::Parser.parse(file))
99
+ new(base_path, JSON.parse(File.read(file)))
100
100
  else
101
101
  raise "Couldn't find datapackage.json at #{path}"
102
102
  end
@@ -1,3 +1,3 @@
1
1
  module DataPackage
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
@@ -4,6 +4,6 @@ require 'klass_helper'
4
4
  describe AttrHelper do
5
5
  it "should serialize" do
6
6
  obj = KlassHelper::BaseKlass.new(:name => 'myvalue')
7
- obj.to_json.should == Yajl::Encoder.encode({:name => 'myvalue'}, :pretty => true)
7
+ obj.to_json.should == JSON.pretty_generate({:name => 'myvalue'})
8
8
  end
9
9
  end
@@ -30,6 +30,6 @@ describe DataPackage::Dialect do
30
30
  dialect.quote_char.should == "\""
31
31
  dialect.skip_initial_space.should == true
32
32
 
33
- dialect.to_json.should == Yajl::Encoder.encode(json, :pretty => true)
33
+ dialect.to_json.should == JSON.pretty_generate(json)
34
34
  end
35
35
  end
@@ -19,7 +19,7 @@ describe DataPackage::Field do
19
19
  field.description.should == json['description']
20
20
 
21
21
  field.to_hash.should == json
22
- field.to_json.should == Yajl::Encoder.encode(field.to_hash, :pretty => true)
22
+ field.to_json.should == JSON.pretty_generate(field.to_hash)
23
23
  end
24
24
 
25
25
  it "should require a name" do
@@ -13,6 +13,6 @@ describe DataPackage::License do
13
13
 
14
14
  license.id.should == 'PDDL'
15
15
  license.url.should == 'http://opendatacommons.org/licenses/pddl/'
16
- license.to_json.should == Yajl::Encoder.encode(json, :pretty => true)
16
+ license.to_json.should == JSON.pretty_generate(json)
17
17
  end
18
18
  end
@@ -16,6 +16,6 @@ describe DataPackage::Person do
16
16
  person.email.should == 'josh@modeanalytics.com'
17
17
  person.web.should == 'http://www.modeanalytics.com/josh'
18
18
 
19
- person.to_json.should == Yajl::Encoder.encode(json, :pretty => true)
19
+ person.to_json.should == JSON.pretty_generate(json)
20
20
  end
21
21
  end
@@ -23,7 +23,7 @@ describe DataPackage::Schema do
23
23
  schema.has_primary_key?.should == true
24
24
 
25
25
  modified_json = json.merge('primaryKey' => 'income')
26
- schema.to_json.should == Yajl::Encoder.encode(modified_json, :pretty => true)
26
+ schema.to_json.should == JSON.pretty_generate(modified_json)
27
27
  end
28
28
 
29
29
  it "should initialize with string primaryKey" do
@@ -35,7 +35,7 @@ describe DataPackage::Schema do
35
35
  schema.fields.first.name.should == 'income'
36
36
  schema.primary_key.should == ['income']
37
37
  schema.has_primary_key?.should == true
38
- schema.to_json.should == Yajl::Encoder.encode(modified_json, :pretty => true)
38
+ schema.to_json.should == JSON.pretty_generate(modified_json)
39
39
  end
40
40
 
41
41
  it "should have primary key accessor" do
@@ -47,6 +47,6 @@ describe DataPackage::Schema do
47
47
  schema.fields.first.name.should == 'income'
48
48
  schema.primary_key.should == []
49
49
  schema.has_primary_key?.should == false
50
- schema.to_json.should == Yajl::Encoder.encode(modified_json, :pretty => true)
50
+ schema.to_json.should == JSON.pretty_generate(modified_json)
51
51
  end
52
52
  end
@@ -17,6 +17,6 @@ describe DataPackage::Source do
17
17
  person.web.should == 'http://www.modeanalytics.com/josh'
18
18
 
19
19
  person.to_hash.should == json
20
- person.to_json.should == Yajl::Encoder.encode(person.to_hash, :pretty => true)
20
+ person.to_json.should == JSON.pretty_generate(person.to_hash)
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,31 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: data_package
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mode Analytics
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-12 00:00:00.000000000 Z
11
+ date: 2014-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rcsv
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '>='
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '>='
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: yajl-ruby
14
+ name: json
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - '>='