postgres_ext-serializers 0.0.1 → 0.0.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
2
  SHA1:
3
- metadata.gz: bc2786f412177b97b379240e2c651b3af66b4529
4
- data.tar.gz: a593579437d26066cdc7ba5afce361447cd27bb5
3
+ metadata.gz: 61294d65edd43184592eb2ab0ca4e42c4690278a
4
+ data.tar.gz: cfd8ede4cb32dc07585a17444f63d169feb2fe9d
5
5
  SHA512:
6
- metadata.gz: dedcaefb8fa0a5228cd7221381550621eed39c63c7c031e88483e901ccf57aa587c4a79ffc4cc0f8a0420a15b7c42ebb8fe3c31cf1623a9bb2a8a94c3a81c4ac
7
- data.tar.gz: c7ef64efe1d96a3aa2171560b6d775b7706fc736c0d1840bd5ba1d1e56330bb973b996cc2d43e17082e1d4196ab9ff4b0fbbdac99f9174394a307a684c220040
6
+ metadata.gz: 0f509bce9cbdabc6d2bbce95f43e438ff52f8564133ed43adb9bad3b7f3a64f23d090c7870b411830f92593d3518ab2300b2e34a7b362b9a279c75641008934a
7
+ data.tar.gz: 52c02264863554eb1b7be75a98f004916a702347cdfa7df6b4bff1354b25ae320e02f202f05de824e794976456ff95e0f84fb35b247749f99f6957ea67f1e5d2
data/.gitignore CHANGED
@@ -17,3 +17,8 @@ test/version_tmp
17
17
  tmp
18
18
  bin/
19
19
  .env
20
+ .ruby-version
21
+ .ruby-gemset
22
+ gemfiles/*.lock
23
+ *.swp
24
+ *.un~
data/.travis.yml ADDED
@@ -0,0 +1,19 @@
1
+ rvm:
2
+ - 2.0.0
3
+ - 2.1.2
4
+
5
+ gemfile:
6
+ - gemfiles/Gemfile.activerecord-4.0.x
7
+ - gemfiles/Gemfile.activerecord-4.1.x
8
+
9
+ env: DATABASE_URL=postgres://postgres@localhost/postgres_ext_test
10
+
11
+ before_script:
12
+ - psql -c 'create database postgres_ext_test;' -U postgres -h localhost
13
+ - bundle exec rake db:migrate
14
+
15
+ notifications:
16
+ email:
17
+ - git@danmcclain.net
18
+ addons:
19
+ postgresql: '9.3'
data/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ # CHANGELOG
2
+
3
+ ## 0.0.2 - 2014-08-22
4
+
5
+ ### Added
6
+ - Rails 4.1 support
7
+
8
+ ### Deprecated
9
+ - Nothing.
10
+
11
+ ### Removed
12
+ - Nothing.
13
+
14
+ ### Fixed
15
+ - Nothing.
data/README.md CHANGED
@@ -8,6 +8,9 @@ Climate](https://codeclimate.com/github/dockyard/postgres_ext-serializers.png)](
8
8
  [![Gem
9
9
  Version](https://badge.fury.io/rb/postgres_ext-serializers.png)](http://badge.fury.io/rb/postgres_ext-serializers)
10
10
 
11
+ # Note: Current release is Rails 4.0.x compatible
12
+ There will be updates to postgres_ext coming soon to make it 4.1 compatible
13
+
11
14
  ## Looking for help? ##
12
15
 
13
16
  If it is a bug [please open an issue on
@@ -51,7 +54,7 @@ class MySerializer < ActiveModel::Serializer
51
54
  end
52
55
 
53
56
  def self.full_name__sql(scope)
54
- 'first_name || ' ' || last_name'
57
+ "first_name || ' ' || last_name"
55
58
  end
56
59
  end
57
60
  ```
@@ -65,18 +68,38 @@ change before the 1.0 release, if a cleaner implementation is found.
65
68
 
66
69
  ## Developing
67
70
 
68
- To work on postgres\_ext locally, follow these steps:
71
+ To work on postgres\_ext-serializers locally, follow these steps:
69
72
 
70
- 1. Run `bundle install`, this will install all the development
73
+ 1. Run `bundle install`, this will install (almost) all the development
71
74
  dependencies
72
- 2. Run `rake setup`, this will set up the `.env` file necessary to run
75
+ 2. Run `gem install byebug` (not a declared dependency to not break CI)
76
+ 3. Run `bundle exec rake setup`, this will set up the `.env` file necessary to run
73
77
  the tests and set up the database
74
- 3. Run `rake db:create`, this will create the test database
75
- 4. Run `rake db:migrate`, this will set up the database tables required
78
+ 4. Run `bundle exec rake db:create`, this will create the test database
79
+ 5. Run `bundle exec rake db:migrate`, this will set up the database tables required
76
80
  by the test
81
+ 6. Run `BUNDLE_GEMFILE='gemfiles/Gemfile.activerecord-4.0.x' bundle install --quiet` to create the Gemfile.lock.
82
+ 7. Run `bundle exec rake test:all` to run tests against all supported versions of Active Record (currently only 4.0.x)
77
83
 
78
84
  ## Authors
79
85
 
80
86
  Dan McClain [twitter](http://twitter.com/_danmcclain)
81
87
  [github](http://github.com/danmcclain)
82
88
 
89
+ [We are very thankful for the many contributors](https://github.com/dockyard/postgres_ext-serializers/graphs/contributors)
90
+
91
+ ## Versioning ##
92
+
93
+ This gem follows [Semantic Versioning](http://semver.org)
94
+
95
+ ## Want to help? ##
96
+
97
+ Please do! We are always looking to improve this gem.
98
+
99
+ ## Legal ##
100
+
101
+ [DockYard](http://dockyard.com), Inc &copy; 2014
102
+
103
+ [@dockyard](http://twitter.com/dockyard)
104
+
105
+ [Licensed under the MIT license](http://www.opensource.org/licenses/mit-license.php)
data/Rakefile CHANGED
@@ -86,3 +86,14 @@ namespace :db do
86
86
  puts 'Database migrated'
87
87
  end
88
88
  end
89
+
90
+ namespace :test do
91
+ desc 'Test against all supported ActiveRecord versions'
92
+ task :all do
93
+ # Currently only supports Active Record v4.0
94
+ %w(4.0.x).each do |version|
95
+ sh "BUNDLE_GEMFILE='gemfiles/Gemfile.activerecord-#{version}' bundle install --quiet"
96
+ sh "BUNDLE_GEMFILE='gemfiles/Gemfile.activerecord-#{version}' bundle exec rake test"
97
+ end
98
+ end
99
+ end
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec :path => '..'
4
+
5
+ gem "activerecord", "~>4.0.0"
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec :path => '..'
4
+
5
+ gem "activerecord", "~>4.1.0"
@@ -1,5 +1,5 @@
1
1
  module PostgresExt
2
2
  module Serializers
3
- VERSION = "0.0.1"
3
+ VERSION = '0.0.2'
4
4
  end
5
5
  end
@@ -18,14 +18,13 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_runtime_dependency 'postgres_ext', '~> 2.1.0'
21
+ spec.add_runtime_dependency 'postgres_ext', '~> 2.1'
22
22
  spec.add_runtime_dependency 'active_model_serializers'
23
23
 
24
24
  spec.add_development_dependency 'bundler', '~> 1.3'
25
- spec.add_development_dependency 'actionpack', '~> 4.0.0'
25
+ spec.add_development_dependency 'actionpack', '~> 4.0'
26
26
  spec.add_development_dependency 'rake'
27
27
  spec.add_development_dependency 'minitest'
28
- spec.add_development_dependency 'm'
29
28
  spec.add_development_dependency 'bourne', '~> 1.3.0'
30
29
  spec.add_development_dependency 'database_cleaner'
31
30
  spec.add_development_dependency 'dotenv'
@@ -20,9 +20,10 @@ describe 'ArraySerializer patch' do
20
20
  end
21
21
 
22
22
  it 'does not instantiate ruby objects for relations' do
23
- relation.stubs(:to_a).returns([])
24
- json_data
25
- assert_received(relation, :to_a) { |expect| expect.never}
23
+ relation.stub(:to_a,
24
+ -> { raise Exception.new('#to_a should never be called') }) do
25
+ json_data
26
+ end
26
27
  end
27
28
  end
28
29
 
@@ -44,9 +45,10 @@ describe 'ArraySerializer patch' do
44
45
  end
45
46
 
46
47
  it 'does not instantiate ruby objects for relations' do
47
- relation.stubs(:to_a).returns([])
48
- json_data
49
- assert_received(relation, :to_a) { |expect| expect.never}
48
+ relation.stub(:to_a,
49
+ -> { raise Exception.new('#to_a should never be called') }) do
50
+ json_data
51
+ end
50
52
  end
51
53
  end
52
54
  end
data/test/test_helper.rb CHANGED
@@ -1,18 +1,16 @@
1
1
  require 'active_record'
2
2
  require 'minitest/autorun'
3
- require 'test/unit'
4
- require 'mocha/setup'
5
3
  require 'bourne'
6
4
  require 'database_cleaner'
5
+ require 'postgres_ext/serializers'
7
6
  unless ENV['CI'] || RUBY_PLATFORM =~ /java/
8
7
  require 'byebug'
9
8
  end
10
- require 'postgres_ext/serializers'
11
9
 
12
10
  require 'dotenv'
13
11
  Dotenv.load
14
12
 
15
- ActiveRecord::Base.establish_connection
13
+ ActiveRecord::Base.establish_connection(ENV['DATABASE_URL'])
16
14
 
17
15
  class TestController < ActionController::Base
18
16
  def url_options
@@ -66,7 +64,7 @@ end
66
64
 
67
65
  DatabaseCleaner.strategy = :deletion
68
66
 
69
- class MiniTest::Spec
67
+ class Minitest::Spec
70
68
  class << self
71
69
  alias :context :describe
72
70
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postgres_ext-serializers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan McClain
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-12 00:00:00.000000000 Z
11
+ date: 2014-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: postgres_ext
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.1.0
19
+ version: '2.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.1.0
26
+ version: '2.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: active_model_serializers
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 4.0.0
61
+ version: '4.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 4.0.0
68
+ version: '4.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -94,20 +94,6 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: m
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: bourne
113
99
  requirement: !ruby/object:Gem::Requirement
@@ -172,10 +158,14 @@ extensions: []
172
158
  extra_rdoc_files: []
173
159
  files:
174
160
  - ".gitignore"
161
+ - ".travis.yml"
162
+ - CHANGELOG.md
175
163
  - Gemfile
176
164
  - LICENSE.txt
177
165
  - README.md
178
166
  - Rakefile
167
+ - gemfiles/Gemfile.activerecord-4.0.x
168
+ - gemfiles/Gemfile.activerecord-4.1.x
179
169
  - lib/postgres_ext/serializers.rb
180
170
  - lib/postgres_ext/serializers/active_model.rb
181
171
  - lib/postgres_ext/serializers/active_model/array_serializer.rb