activerecord-postgres-json 0.1.0 → 0.2.2

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
- SHA1:
3
- metadata.gz: 2fa2ff434f05486be6458bac2bf2eb94f389acba
4
- data.tar.gz: 27b6a6c6c5abd025e246973aa221ace946442e27
2
+ SHA256:
3
+ metadata.gz: 407ecfb24032a8c34bce6bc34eb02e6ce4845b13ea1d663b41476d8cb59fa3f4
4
+ data.tar.gz: 1c8e108f8126b9831b20d8f78f2ccac0d00857b4f3c573345d6ebacaa727b43c
5
5
  SHA512:
6
- metadata.gz: 8427901febe5ad97f87b4b3ffc7320d8634242907f8c347a99fc7d2b357971bcf6f76c6b1ea41fe35d4253c1f4b56a1a1481c19e3368bdcd226cbca1825dbfd4
7
- data.tar.gz: b8cd3670f4761e7d8bdef9fd70f654732fac829fb8046b85f941eb33e0148205043c738877d1f415ad83f0b8bc6fd281edf64136e6da59fa74ad3219c1759c00
6
+ metadata.gz: f497075d5d89ff8b487d5dd13246cf11ec222d4b681f67b8a48c136f5b3cce4f1fe0edb2bbafe4b6be31630db8e34eca19ad56be72e80eca0415af8542a5329e
7
+ data.tar.gz: 8061bde4477a992fc2dbac854c2c378f88278eba07c97b531b76f36f3acc70bccd89f75449105a95efbcbceca882a555ffdec4a7eb14178a00674afcb9d36df0
@@ -0,0 +1,29 @@
1
+ LineLength:
2
+ Max: 200
3
+
4
+ HashSyntax:
5
+ EnforcedStyle: ruby19
6
+
7
+ Layout/SpaceBeforeFirstArg:
8
+ Enabled: false
9
+
10
+ Metrics/AbcSize:
11
+ Max: 26
12
+
13
+ Style/Documentation:
14
+ Enabled: false
15
+
16
+ Metrics/ClassLength:
17
+ Max: 150
18
+
19
+ Metrics/MethodLength:
20
+ Max: 20
21
+
22
+ Naming/FileName:
23
+ Enabled: false
24
+
25
+ AllCops:
26
+ Exclude:
27
+ - '**/*.gemspec'
28
+ - 'spec/**/*'
29
+ - '**/Rakefile'
data/Gemfile CHANGED
@@ -1,12 +1,18 @@
1
- source 'http://rubygems.org'
1
+ # frozen_string_literal: true
2
2
 
3
- gem 'activerecord', '>= 3.2', '< 4'
3
+ source 'https://rubygems.org'
4
+
5
+ gem 'activerecord', '>= 3.2', '< 4.2'
4
6
  gem 'multi_json'
5
- gem 'hashie'
6
7
 
7
- group :development do
8
+ group :development, :test do
9
+ gem 'pg', '~> 0.20.0'
8
10
  gem 'rspec'
9
- gem 'rdoc'
11
+ end
12
+
13
+ group :development do
10
14
  gem 'bundler'
11
15
  gem 'jeweler'
16
+ gem 'rdoc'
17
+ gem 'rubocop'
12
18
  end
data/README.md CHANGED
@@ -1,19 +1,20 @@
1
1
  # activerecord-postgres-json
2
2
 
3
- A minimal JSON column type support for ActiveRecord 3.2.x
3
+ A minimal JSON/JSONB column type support for ActiveRecord 3.2.x
4
4
  This gem adds the following support:
5
5
 
6
- 1. Using json column type in migrations, e.g. `add_column :foo, :bar, :json`
6
+ 1. Using json/jsonb column type in migrations, e.g. `add_column :foo, :bar, :json` or `add_column :foo, :bar, :jsonb`
7
7
  2. json field support in the schema definitions
8
8
  3. JSON coder for using with the `serialize` class method:
9
9
 
10
10
  ```ruby
11
11
  class User < ActiveRecord::Base
12
12
  serialize :settings, ActiveRecord::Coders::JSON
13
+ serialize :settings, ActiveRecord::Coders::JSON.new(symbolize_keys: true) # for symbolize keys
13
14
  end
14
15
 
15
- User.first.settings.class # => Hashie::Mash
16
- User.first.settings.show_popups # => true
16
+ User.first.settings.class # => Hash
17
+ User.first.settings[:show_popups] # => true
17
18
  ...
18
19
  ```
19
20
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.2
@@ -2,18 +2,18 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: activerecord-postgres-json 0.1.0 ruby lib
5
+ # stub: activerecord-postgres-json 0.2.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
- s.name = "activerecord-postgres-json"
9
- s.version = "0.1.0"
8
+ s.name = "activerecord-postgres-json".freeze
9
+ s.version = "0.2.2"
10
10
 
11
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
- s.require_paths = ["lib"]
13
- s.authors = ["Roman Shterenzon"]
14
- s.date = "2014-06-02"
15
- s.description = "Active Record support for PostgreSQL JSON type"
16
- s.email = "romanbsd@yahoo.com"
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib".freeze]
13
+ s.authors = ["Roman Shterenzon".freeze]
14
+ s.date = "2020-09-14"
15
+ s.description = "Active Record support for PostgreSQL JSON type".freeze
16
+ s.email = "romanbsd@yahoo.com".freeze
17
17
  s.extra_rdoc_files = [
18
18
  "LICENSE.txt",
19
19
  "README.md"
@@ -21,8 +21,8 @@ Gem::Specification.new do |s|
21
21
  s.files = [
22
22
  ".document",
23
23
  ".rspec",
24
+ ".rubocop.yml",
24
25
  "Gemfile",
25
- "Gemfile.lock",
26
26
  "LICENSE.txt",
27
27
  "README.md",
28
28
  "Rakefile",
@@ -32,41 +32,38 @@ Gem::Specification.new do |s|
32
32
  "lib/activerecord-postgres-json/activerecord.rb",
33
33
  "lib/activerecord-postgres-json/coders.rb",
34
34
  "spec/activerecord-postgres-json_spec.rb",
35
- "spec/spec_helper.rb"
35
+ "spec/coder_spec.rb",
36
+ "spec/database.yml",
37
+ "spec/spec_helper.rb",
38
+ "spec/support/database_setup.rb"
36
39
  ]
37
- s.homepage = "http://github.com/romanbsd/activerecord-postgres-json"
38
- s.licenses = ["MIT"]
39
- s.rubygems_version = "2.2.2"
40
- s.summary = "Active Record support for PostgreSQL JSON type"
40
+ s.homepage = "http://github.com/romanbsd/activerecord-postgres-json".freeze
41
+ s.licenses = ["MIT".freeze]
42
+ s.rubygems_version = "3.1.2".freeze
43
+ s.summary = "Active Record support for PostgreSQL JSON type".freeze
41
44
 
42
45
  if s.respond_to? :specification_version then
43
46
  s.specification_version = 4
47
+ end
44
48
 
45
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
46
- s.add_runtime_dependency(%q<activerecord>, ["< 4", ">= 3.2"])
47
- s.add_runtime_dependency(%q<multi_json>, [">= 0"])
48
- s.add_runtime_dependency(%q<hashie>, [">= 0"])
49
- s.add_development_dependency(%q<rspec>, [">= 0"])
50
- s.add_development_dependency(%q<rdoc>, [">= 0"])
51
- s.add_development_dependency(%q<bundler>, [">= 0"])
52
- s.add_development_dependency(%q<jeweler>, [">= 0"])
53
- else
54
- s.add_dependency(%q<activerecord>, ["< 4", ">= 3.2"])
55
- s.add_dependency(%q<multi_json>, [">= 0"])
56
- s.add_dependency(%q<hashie>, [">= 0"])
57
- s.add_dependency(%q<rspec>, [">= 0"])
58
- s.add_dependency(%q<rdoc>, [">= 0"])
59
- s.add_dependency(%q<bundler>, [">= 0"])
60
- s.add_dependency(%q<jeweler>, [">= 0"])
61
- end
49
+ if s.respond_to? :add_runtime_dependency then
50
+ s.add_runtime_dependency(%q<activerecord>.freeze, [">= 3.2", "< 4.2"])
51
+ s.add_runtime_dependency(%q<multi_json>.freeze, [">= 0"])
52
+ s.add_development_dependency(%q<pg>.freeze, ["~> 0.20.0"])
53
+ s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
54
+ s.add_development_dependency(%q<bundler>.freeze, [">= 0"])
55
+ s.add_development_dependency(%q<jeweler>.freeze, [">= 0"])
56
+ s.add_development_dependency(%q<rdoc>.freeze, [">= 0"])
57
+ s.add_development_dependency(%q<rubocop>.freeze, [">= 0"])
62
58
  else
63
- s.add_dependency(%q<activerecord>, ["< 4", ">= 3.2"])
64
- s.add_dependency(%q<multi_json>, [">= 0"])
65
- s.add_dependency(%q<hashie>, [">= 0"])
66
- s.add_dependency(%q<rspec>, [">= 0"])
67
- s.add_dependency(%q<rdoc>, [">= 0"])
68
- s.add_dependency(%q<bundler>, [">= 0"])
69
- s.add_dependency(%q<jeweler>, [">= 0"])
59
+ s.add_dependency(%q<activerecord>.freeze, [">= 3.2", "< 4.2"])
60
+ s.add_dependency(%q<multi_json>.freeze, [">= 0"])
61
+ s.add_dependency(%q<pg>.freeze, ["~> 0.20.0"])
62
+ s.add_dependency(%q<rspec>.freeze, [">= 0"])
63
+ s.add_dependency(%q<bundler>.freeze, [">= 0"])
64
+ s.add_dependency(%q<jeweler>.freeze, [">= 0"])
65
+ s.add_dependency(%q<rdoc>.freeze, [">= 0"])
66
+ s.add_dependency(%q<rubocop>.freeze, [">= 0"])
70
67
  end
71
68
  end
72
69
 
@@ -1,2 +1,6 @@
1
- require 'activerecord-postgres-json/activerecord'
1
+ # frozen_string_literal: true
2
+
3
+ ActiveSupport.on_load :active_record do
4
+ require 'activerecord-postgres-json/activerecord'
5
+ end
2
6
  require 'activerecord-postgres-json/coders'
@@ -1,50 +1,90 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_record'
2
4
  require 'active_record/connection_adapters/postgresql_adapter'
3
5
 
4
6
  module ActiveRecord
5
-
6
7
  module ConnectionAdapters
7
- PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:json] = {name: 'json'}
8
+ PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:json] = { name: 'json' }
9
+ PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:jsonb] = { name: 'jsonb' }
10
+
11
+ if ::ActiveRecord.version >= Gem::Version.new('4.0.0')
12
+ # As suggested here: http://www.innovationontherun.com/fixing-unknown-oid-geography-errors-with-postgis-and-rails-4-0/
13
+ # to prevent the Rails 4.0/4.1 error of
14
+ # "unknown OID: {field}"
15
+ PostgreSQLAdapter::OID.register_type('json', PostgreSQLAdapter::OID::Identity.new)
16
+ PostgreSQLAdapter::OID.register_type('jsonb', PostgreSQLAdapter::OID::Identity.new)
17
+ end
8
18
 
9
19
  class PostgreSQLColumn < Column
10
20
  # Adds the json type for the column.
11
21
  def simplified_type_with_json(field_type)
12
- field_type == 'json' ? :json : simplified_type_without_json(field_type)
22
+ case field_type
23
+ when 'json'
24
+ :json
25
+ when 'jsonb'
26
+ :jsonb
27
+ else
28
+ simplified_type_without_json(field_type)
29
+ end
13
30
  end
14
31
 
15
32
  alias_method_chain :simplified_type, :json
33
+
34
+ class << self
35
+ def extract_value_from_default_with_json(default)
36
+ case default
37
+ when "'{}'::json", "'{}'::jsonb"
38
+ '{}'
39
+ when "'[]'::json", "'[]'::jsonb"
40
+ '[]'
41
+ else
42
+ extract_value_from_default_without_json(default)
43
+ end
44
+ end
45
+
46
+ alias_method_chain :extract_value_from_default, :json
47
+ end
16
48
  end
17
- end
18
49
 
19
- class TableDefinition
20
-
21
- # Adds json type for migrations. So you can add columns to a table like:
22
- # create_table :people do |t|
23
- # ...
24
- # t.json :info
25
- # ...
26
- # end
27
- def json(*args)
28
- options = args.extract_options!
29
- column_names = args
30
- column_names.each { |name| column(name, 'json', options) }
50
+ class TableDefinition
51
+ # Adds json type for migrations. So you can add columns to a table like:
52
+ # create_table :people do |t|
53
+ # ...
54
+ # t.json :info
55
+ # ...
56
+ # end
57
+ def json(*args)
58
+ options = args.extract_options!
59
+ column_names = args
60
+ column_names.each { |name| column(name, 'json', options) }
61
+ end
62
+
63
+ def jsonb(*args)
64
+ options = args.extract_options!
65
+ column_names = args
66
+ column_names.each { |name| column(name, 'jsonb', options) }
67
+ end
31
68
  end
32
69
 
33
- end
70
+ class Table
71
+ # Adds json type for migrations. So you can add columns to a table like:
72
+ # change_table :people do |t|
73
+ # ...
74
+ # t.json :info
75
+ # ...
76
+ # end
77
+ def json(*args)
78
+ options = args.extract_options!
79
+ column_names = args
80
+ column_names.each { |name| column(name, 'json', options) }
81
+ end
34
82
 
35
- class Table
36
-
37
- # Adds json type for migrations. So you can add columns to a table like:
38
- # change_table :people do |t|
39
- # ...
40
- # t.json :info
41
- # ...
42
- # end
43
- def json(*args)
44
- options = args.extract_options!
45
- column_names = args
46
- column_names.each { |name| column(name, 'json', options) }
83
+ def jsonb(*args)
84
+ options = args.extract_options!
85
+ column_names = args
86
+ column_names.each { |name| column(name, 'jsonb', options) }
87
+ end
47
88
  end
48
89
  end
49
-
50
90
  end
@@ -1,5 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'multi_json'
2
- require 'hashie'
3
4
 
4
5
  module ActiveRecord
5
6
  module Coders
@@ -12,12 +13,20 @@ module ActiveRecord
12
13
  new.dump(json)
13
14
  end
14
15
 
15
- def initialize(default = Hashie::Mash.new)
16
- @default = default
16
+ def initialize(params = {})
17
+ @default = {}
18
+ return unless params.class.name == 'Hash'
19
+
20
+ @default = params[:default] if params[:default]
21
+ @symbolize_keys = params[:symbolize_keys] if params[:symbolize_keys]
17
22
  end
18
23
 
19
24
  def dump(obj)
20
- obj.nil? ? (@default.nil? ? nil : to_json(@default)) : to_json(obj)
25
+ if obj.nil?
26
+ @default.nil? ? nil : to_json(@default)
27
+ else
28
+ to_json(obj)
29
+ end
21
30
  end
22
31
 
23
32
  def load(json)
@@ -25,13 +34,22 @@ module ActiveRecord
25
34
  end
26
35
 
27
36
  private
37
+
28
38
  def to_json(obj)
29
39
  MultiJson.dump(obj)
30
40
  end
31
41
 
32
- # FIXME: support arrays
33
42
  def from_json(json)
34
- Hashie::Mash.new MultiJson.load(json)
43
+ convert_object MultiJson.load(json, symbolize_keys: @symbolize_keys)
44
+ end
45
+
46
+ def convert_object(obj)
47
+ case obj
48
+ when Array
49
+ obj.map { |member| convert_object(member) }
50
+ else
51
+ obj
52
+ end
35
53
  end
36
54
  end
37
55
  end
@@ -1,4 +1,103 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+ require File.expand_path(File.dirname(__FILE__) + '/support/database_setup')
2
3
 
3
- describe "ActiverecordPostgresJson" do
4
+ class Post < ActiveRecord::Base
5
+ serialize :data, ActiveRecord::Coders::JSON.new(symbolize_keys: true)
6
+ end
7
+
8
+ class PostQuestions < ActiveRecord::Base
9
+ serialize :tags, ActiveRecord::Coders::JSON
10
+ end
11
+
12
+ describe 'ActiverecordPostgresJson', db: true do
13
+ before(:all) do
14
+ ActiveRecord::Schema.define do
15
+ create_table :posts, force: true do |t|
16
+ t.column :data, :jsonb
17
+ end
18
+ end
19
+
20
+ Post.reset_column_information
21
+
22
+ ActiveRecord::Base.connection.execute <<-SQL
23
+ CREATE INDEX index_posts_data_gin ON posts
24
+ USING gin (data);
25
+ SQL
26
+
27
+ ActiveRecord::Base.connection.execute <<-SQL
28
+ CREATE OR REPLACE VIEW post_questions as
29
+ SELECT
30
+ id,
31
+ data ->> 'title' AS title,
32
+ data #>> '{author,name}' AS author_name,
33
+ data #>> '{author,email}' AS author_email,
34
+ (data ->> 'tags')::jsonb AS tags,
35
+ (data ->> 'draft')::boolean AS draft
36
+ FROM posts
37
+ SQL
38
+ end
39
+
40
+ after(:all) do
41
+ ActiveRecord::Base.connection.execute 'DROP INDEX IF EXISTS index_posts_data_gin'
42
+ ActiveRecord::Base.connection.execute 'DROP VIEW IF EXISTS post_questions'
43
+ end
44
+
45
+ before { Post.delete_all }
46
+
47
+ let!(:hdd) do
48
+ Post.create!(data: [
49
+ {f1: 6, f2: 5, value: true, intencity: 2.0},
50
+ {f1: 9, f2: 3, value: false, intencity: 1.0}
51
+ ]).reload
52
+ end
53
+
54
+ let!(:tdd) do
55
+ Post.create!(data: [
56
+ {f1: 1, f2: 2, value: false, intencity: 2.0},
57
+ {f1: 1, f2: 4, value: true, intencity: 1.0}
58
+ ]).reload
59
+ end
60
+
61
+ let!(:bdd) do
62
+ Post.create!(data: {
63
+ title: 'BDD is woot',
64
+ author: { name: 'Philippe', email: 'philippe@example.com'},
65
+ tags: ['bdd', 'testing', 'woot', true],
66
+ word_count: 42
67
+ }).reload
68
+ end
69
+
70
+ let!(:foo) do
71
+ Post.create!(data: {
72
+ title: 'FOO is bar',
73
+ author: { name: 'Philippe', email: 'philippe@example.com'},
74
+ tags: ['foo', 'bar', 42],
75
+ draft: true
76
+ }).reload
77
+ end
78
+
79
+ it 'maps fields' do
80
+ post = PostQuestions.find_by_title! 'FOO is bar'
81
+ expect(post.author_name).to eq('Philippe')
82
+ expect(post.author_email).to eq('philippe@example.com')
83
+ expect(post.tags).to eq ['foo', 'bar', 42]
84
+ expect(post).to be_draft
85
+ end
86
+
87
+ it 'provides search as if it was a good old table' do
88
+ expect(PostQuestions.where(author_name: 'Philippe').pluck(:title)).to eq ['BDD is woot', 'FOO is bar']
89
+ expect(PostQuestions.where(draft: true).count).to eq(1)
90
+ end
91
+
92
+ it 'when retrieve objects as array' do
93
+ expect(Post.where('data @> \'[{"f1":1}]\'').first.data)
94
+ .to eq [
95
+ {f1: 1, f2: 2, value: false, intencity: 2.0},
96
+ {f1: 1, f2: 4, value: true, intencity: 1.0}
97
+ ]
98
+ end
99
+
100
+ it 'when search in objects array' do
101
+ expect(Post.where('data @> \'[{"f1":6}]\'').count).to eq(1)
102
+ end
4
103
  end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe ActiveRecord::Coders::JSON do
4
+ it 'converts hashes' do
5
+ res = described_class.load('{"foo":"bar", "bar":[1,2]}')
6
+ expect(res).to eq('foo' => 'bar', 'bar' => [1,2])
7
+ end
8
+
9
+ it 'converts arrays' do
10
+ res = described_class.load('[{"foo":"bar"}, [{"bar":"baz"}], [[1,2],{"baz":"foo"}]]')
11
+ expect(res).to eq([{'foo' => 'bar'}, [{'bar' => 'baz'}], [[1,2], {'baz' => 'foo'}]])
12
+ end
13
+ end
@@ -0,0 +1,4 @@
1
+ test:
2
+ adapter: postgresql
3
+ encoding: unicode
4
+ database: ar_postgres_json_test
@@ -1,29 +1,26 @@
1
- require 'simplecov'
2
-
3
- module SimpleCov::Configuration
4
- def clean_filters
5
- @filters = []
6
- end
7
- end
8
-
9
- SimpleCov.configure do
10
- clean_filters
11
- load_adapter 'test_frameworks'
12
- end
13
-
14
- ENV["COVERAGE"] && SimpleCov.start do
15
- add_filter "/.rvm/"
16
- end
17
1
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
18
2
  $LOAD_PATH.unshift(File.dirname(__FILE__))
19
3
 
20
4
  require 'rspec'
5
+ require 'active_record'
21
6
  require 'activerecord-postgres-json'
22
7
 
23
8
  # Requires supporting files with custom matchers and macros, etc,
24
9
  # in ./support/ and its subdirectories.
25
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
10
+ # Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
26
11
 
27
12
  RSpec.configure do |config|
28
-
13
+ config.around db: true do |example|
14
+ if example.metadata[:disable_transactions]
15
+ example.call
16
+ else
17
+ ActiveRecord::Base.transaction do
18
+ begin
19
+ example.call
20
+ ensure
21
+ raise ActiveRecord::Rollback
22
+ end
23
+ end
24
+ end
25
+ end
29
26
  end
@@ -0,0 +1,23 @@
1
+ require 'logger'
2
+ require 'pg'
3
+ require 'yaml'
4
+
5
+ db_config = YAML.load_file(File.expand_path('../../database.yml', __FILE__))
6
+
7
+ begin
8
+ ActiveRecord::Base.establish_connection db_config['test']
9
+ ActiveRecord::Base.connection.active?
10
+ rescue Exception => e
11
+ encoding = db_config['test']['encoding'] || ENV['CHARSET'] || 'utf8'
12
+ begin
13
+ ActiveRecord::Base.establish_connection(db_config['test'].merge('database' => 'postgres', 'schema_search_path' => 'public'))
14
+ ActiveRecord::Base.connection.create_database(db_config['test']['database'], db_config['test'].merge('encoding' => encoding))
15
+ ActiveRecord::Base.establish_connection(db_config['test'])
16
+ rescue Exception => ec
17
+ $stderr.puts ec, *(ec.backtrace)
18
+ $stderr.puts "Couldn't create database for #{db_config['test'].inspect}"
19
+ end
20
+ ensure
21
+ ActiveRecord::Base.logger = Logger.new(STDOUT)
22
+ ActiveRecord::Base.logger.formatter = ->(_, _, _, msg) { "#{msg}\n" }
23
+ end
metadata CHANGED
@@ -1,35 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-postgres-json
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Shterenzon
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-02 00:00:00.000000000 Z
11
+ date: 2020-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "<"
18
- - !ruby/object:Gem::Version
19
- version: '4'
20
17
  - - ">="
21
18
  - !ruby/object:Gem::Version
22
19
  version: '3.2'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '4.2'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - "<"
28
- - !ruby/object:Gem::Version
29
- version: '4'
30
27
  - - ">="
31
28
  - !ruby/object:Gem::Version
32
29
  version: '3.2'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '4.2'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: multi_json
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -45,13 +45,27 @@ dependencies:
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
47
  - !ruby/object:Gem::Dependency
48
- name: hashie
48
+ name: pg
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: 0.20.0
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: 0.20.0
61
+ - !ruby/object:Gem::Dependency
62
+ name: rspec
49
63
  requirement: !ruby/object:Gem::Requirement
50
64
  requirements:
51
65
  - - ">="
52
66
  - !ruby/object:Gem::Version
53
67
  version: '0'
54
- type: :runtime
68
+ type: :development
55
69
  prerelease: false
56
70
  version_requirements: !ruby/object:Gem::Requirement
57
71
  requirements:
@@ -59,7 +73,7 @@ dependencies:
59
73
  - !ruby/object:Gem::Version
60
74
  version: '0'
61
75
  - !ruby/object:Gem::Dependency
62
- name: rspec
76
+ name: bundler
63
77
  requirement: !ruby/object:Gem::Requirement
64
78
  requirements:
65
79
  - - ">="
@@ -73,7 +87,7 @@ dependencies:
73
87
  - !ruby/object:Gem::Version
74
88
  version: '0'
75
89
  - !ruby/object:Gem::Dependency
76
- name: rdoc
90
+ name: jeweler
77
91
  requirement: !ruby/object:Gem::Requirement
78
92
  requirements:
79
93
  - - ">="
@@ -87,7 +101,7 @@ dependencies:
87
101
  - !ruby/object:Gem::Version
88
102
  version: '0'
89
103
  - !ruby/object:Gem::Dependency
90
- name: bundler
104
+ name: rdoc
91
105
  requirement: !ruby/object:Gem::Requirement
92
106
  requirements:
93
107
  - - ">="
@@ -101,7 +115,7 @@ dependencies:
101
115
  - !ruby/object:Gem::Version
102
116
  version: '0'
103
117
  - !ruby/object:Gem::Dependency
104
- name: jeweler
118
+ name: rubocop
105
119
  requirement: !ruby/object:Gem::Requirement
106
120
  requirements:
107
121
  - - ">="
@@ -124,8 +138,8 @@ extra_rdoc_files:
124
138
  files:
125
139
  - ".document"
126
140
  - ".rspec"
141
+ - ".rubocop.yml"
127
142
  - Gemfile
128
- - Gemfile.lock
129
143
  - LICENSE.txt
130
144
  - README.md
131
145
  - Rakefile
@@ -135,12 +149,15 @@ files:
135
149
  - lib/activerecord-postgres-json/activerecord.rb
136
150
  - lib/activerecord-postgres-json/coders.rb
137
151
  - spec/activerecord-postgres-json_spec.rb
152
+ - spec/coder_spec.rb
153
+ - spec/database.yml
138
154
  - spec/spec_helper.rb
155
+ - spec/support/database_setup.rb
139
156
  homepage: http://github.com/romanbsd/activerecord-postgres-json
140
157
  licenses:
141
158
  - MIT
142
159
  metadata: {}
143
- post_install_message:
160
+ post_install_message:
144
161
  rdoc_options: []
145
162
  require_paths:
146
163
  - lib
@@ -155,9 +172,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
172
  - !ruby/object:Gem::Version
156
173
  version: '0'
157
174
  requirements: []
158
- rubyforge_project:
159
- rubygems_version: 2.2.2
160
- signing_key:
175
+ rubygems_version: 3.1.2
176
+ signing_key:
161
177
  specification_version: 4
162
178
  summary: Active Record support for PostgreSQL JSON type
163
179
  test_files: []
@@ -1,81 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- activemodel (3.2.18)
5
- activesupport (= 3.2.18)
6
- builder (~> 3.0.0)
7
- activerecord (3.2.18)
8
- activemodel (= 3.2.18)
9
- activesupport (= 3.2.18)
10
- arel (~> 3.0.2)
11
- tzinfo (~> 0.3.29)
12
- activesupport (3.2.18)
13
- i18n (~> 0.6, >= 0.6.4)
14
- multi_json (~> 1.0)
15
- addressable (2.3.6)
16
- arel (3.0.3)
17
- builder (3.0.4)
18
- descendants_tracker (0.0.4)
19
- thread_safe (~> 0.3, >= 0.3.1)
20
- diff-lcs (1.2.5)
21
- faraday (0.9.0)
22
- multipart-post (>= 1.2, < 3)
23
- git (1.2.6)
24
- github_api (0.11.3)
25
- addressable (~> 2.3)
26
- descendants_tracker (~> 0.0.1)
27
- faraday (~> 0.8, < 0.10)
28
- hashie (>= 1.2)
29
- multi_json (>= 1.7.5, < 2.0)
30
- nokogiri (~> 1.6.0)
31
- oauth2
32
- hashie (2.1.1)
33
- highline (1.6.21)
34
- i18n (0.6.9)
35
- jeweler (2.0.1)
36
- builder
37
- bundler (>= 1.0)
38
- git (>= 1.2.5)
39
- github_api
40
- highline (>= 1.6.15)
41
- nokogiri (>= 1.5.10)
42
- rake
43
- rdoc
44
- jwt (1.0.0)
45
- mini_portile (0.6.0)
46
- multi_json (1.10.1)
47
- multi_xml (0.5.5)
48
- multipart-post (2.0.0)
49
- nokogiri (1.6.2.1)
50
- mini_portile (= 0.6.0)
51
- oauth2 (0.9.4)
52
- faraday (>= 0.8, < 0.10)
53
- jwt (~> 1.0)
54
- multi_json (~> 1.3)
55
- multi_xml (~> 0.5)
56
- rack (~> 1.2)
57
- rack (1.5.2)
58
- rake (10.3.2)
59
- rdoc (4.1.0)
60
- rspec (2.14.1)
61
- rspec-core (~> 2.14.0)
62
- rspec-expectations (~> 2.14.0)
63
- rspec-mocks (~> 2.14.0)
64
- rspec-core (2.14.8)
65
- rspec-expectations (2.14.5)
66
- diff-lcs (>= 1.1.3, < 2.0)
67
- rspec-mocks (2.14.6)
68
- thread_safe (0.3.4)
69
- tzinfo (0.3.39)
70
-
71
- PLATFORMS
72
- ruby
73
-
74
- DEPENDENCIES
75
- activerecord (>= 3.2, < 4)
76
- bundler
77
- hashie
78
- jeweler
79
- multi_json
80
- rdoc
81
- rspec