avromatic 0.7.1 → 0.8.0

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: b15b3dee8ab3f44ac0626a92ad4836acccf06910
4
- data.tar.gz: a6a816bf12c63afac2b65e4357debcb019cd1774
3
+ metadata.gz: c5cf8d1ba64c3de84625325553fbeeff017e3ac7
4
+ data.tar.gz: f536b77ce377759a8f70f7ba3d9d0ea4cb796815
5
5
  SHA512:
6
- metadata.gz: d258c7746c4a1aec29e1947220a7e6fd0b8e926b80989cb01bcbed43a8561ece1607c655945eef18cc90a2c24301bcfb96ba1466b2351215c2d7c51220799e0c
7
- data.tar.gz: c2983025ecd2f2b1e2dc7b918d2907162eb26ae74baf03bb51d4772903ff91d9d51c41c8ff77db132228c0b4f0a67cd32f61e76fe3243642bf3c86d8dc4cbbff
6
+ metadata.gz: 9241a4262287eda4cadfb2f636b3ee74c655863ccab6b779c0a6c28f12c7cce84cc3fcddc6bbdf7b8f3ce817b96c9cabd95f34afa8a0099c2fcb9daf7518ea40
7
+ data.tar.gz: 389244130b9ac99560219d2019222c5f7576f3b5df1b4795926569f0d6e158b4db1378ec33e9c8b0459836cf4d490dec58d26adae51f0c4131f498435a0889bf
data/.travis.yml CHANGED
@@ -2,15 +2,10 @@ language: ruby
2
2
  rvm:
3
3
  - 2.2.4
4
4
  - 2.3.1
5
- gemfile:
6
- - gemfiles/rails4_1.gemfile
7
- - gemfiles/rails4_2.gemfile
8
- matrix:
9
- exclude:
10
- - rvm: 2.2.4
11
- gemfile: gemfiles/rails4_2.gemfile
12
- - rvm: 2.3.1
13
- gemfile: gemfiles/rails4_1.gemfile
5
+ before_script:
6
+ - bundle exec appraisal install --jobs=3
14
7
  script:
15
8
  - bundle exec rubocop
16
- - bundle exec rspec
9
+ - bundle exec appraisal rails4_1 rake spec
10
+ - bundle exec appraisal rails4_2 rake spec
11
+ - bundle exec appraisal avro-salsify-fork rake spec
data/Appraisals ADDED
@@ -0,0 +1,17 @@
1
+ appraise 'rails4_1' do
2
+ gem 'avro', '1.8.1'
3
+ gem 'activesupport', '~> 4.1.15'
4
+ gem 'activemodel', '~> 4.1.15'
5
+ end
6
+
7
+ appraise 'rails4_2' do
8
+ gem 'avro', '1.8.1'
9
+ gem 'activesupport', '~> 4.2.6'
10
+ gem 'activemodel', '~> 4.2.6'
11
+ end
12
+
13
+ appraise 'avro-salsify-fork' do
14
+ gem 'avro-salsify-fork', '1.9.0.1', require: 'avro'
15
+ gem 'activesupport', '~> 4.2.6'
16
+ gem 'activemodel', '~> 4.2.6'
17
+ end
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # avromatic changelog
2
2
 
3
+ ## v0.8.0
4
+ - Add support for logical types. Currently this requires using the
5
+ `avro-salsify-fork` gem for logical types support with Ruby.
6
+
3
7
  ## v0.7.1
4
8
  - Raise a more descriptive error when attempting to generate a model for a
5
9
  non-record Avro type.
data/Rakefile CHANGED
@@ -1,8 +1,18 @@
1
1
  require 'bundler/gem_tasks'
2
2
  require 'rspec/core/rake_task'
3
+ require 'appraisal/task'
3
4
  require 'avro/builder'
4
5
 
5
- RSpec::Core::RakeTask.new(:spec)
6
+ RSpec::Core::RakeTask.new(:default_spec)
7
+
8
+ Appraisal::Task.new
9
+
10
+ if !ENV['APPRAISAL_INITIALIZED']
11
+ task default: :appraisal
12
+ task spec: :appraisal
13
+ else
14
+ task default: :default_spec
15
+ end
6
16
 
7
17
  namespace :avro do
8
18
  desc 'Generate Avro schema files used by specs'
@@ -18,5 +28,3 @@ namespace :avro do
18
28
  end
19
29
  end
20
30
  end
21
-
22
- task default: :spec
data/avromatic.gemspec CHANGED
@@ -30,9 +30,10 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency 'rspec', '~> 3.0'
31
31
  spec.add_development_dependency 'simplecov'
32
32
  spec.add_development_dependency 'webmock'
33
- spec.add_development_dependency 'avro-builder', '>= 0.7.0'
33
+ spec.add_development_dependency 'avro-builder', '>= 0.11.0'
34
34
  # For FakeSchemaRegistryServer
35
35
  spec.add_development_dependency 'sinatra'
36
36
  spec.add_development_dependency 'salsify_rubocop', '~> 0.42.0'
37
37
  spec.add_development_dependency 'overcommit'
38
+ spec.add_development_dependency 'appraisal'
38
39
  end
data/bin/setup CHANGED
@@ -4,5 +4,5 @@ IFS=$'\n\t'
4
4
  set -vx
5
5
 
6
6
  bundle install
7
-
7
+ appraisal install
8
8
  # Do any other automated setup that you need to do here
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "avro-salsify-fork", "1.9.0.1", :require => "avro"
6
+ gem "activesupport", "~> 4.2.6"
7
+ gem "activemodel", "~> 4.2.6"
8
+
9
+ gemspec :path => "../"
@@ -1,6 +1,9 @@
1
- source 'https://rubygems.org'
1
+ # This file was generated by Appraisal
2
2
 
3
- gem 'activesupport', '~> 4.1.15'
4
- gem 'activemodel', '~> 4.1.15'
3
+ source "https://rubygems.org"
5
4
 
6
- gemspec path: '..'
5
+ gem "avro", "1.8.1"
6
+ gem "activesupport", "~> 4.1.15"
7
+ gem "activemodel", "~> 4.1.15"
8
+
9
+ gemspec :path => "../"
@@ -1,6 +1,9 @@
1
- source 'https://rubygems.org'
1
+ # This file was generated by Appraisal
2
2
 
3
- gem 'activesupport', '~> 4.2.6'
4
- gem 'activemodel', '~> 4.2.6'
3
+ source "https://rubygems.org"
5
4
 
6
- gemspec path: '..'
5
+ gem "avro", "1.8.1"
6
+ gem "activesupport", "~> 4.2.6"
7
+ gem "activemodel", "~> 4.2.6"
8
+
9
+ gemspec :path => "../"
@@ -100,6 +100,11 @@ module Avromatic
100
100
  custom_type = Avromatic.type_registry.fetch(field_type)
101
101
  return custom_type.value_class if custom_type.value_class
102
102
 
103
+ if field_type.respond_to?(:logical_type)
104
+ value_class = Avromatic::Model::LogicalTypes.value_class(field_type.logical_type)
105
+ return value_class if value_class
106
+ end
107
+
103
108
  case field_type.type_sym
104
109
  when :string, :bytes, :fixed
105
110
  String
@@ -0,0 +1,16 @@
1
+ module Avromatic
2
+ module Model
3
+ module LogicalTypes
4
+
5
+ LOGICAL_TYPE_MAP = {
6
+ 'date' => Date,
7
+ 'timestamp-micros' => Time,
8
+ 'timestamp-millis' => Time
9
+ }.freeze
10
+
11
+ def self.value_class(logical_type)
12
+ LOGICAL_TYPE_MAP[logical_type]
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,6 +1,7 @@
1
1
  require 'avromatic/model/builder'
2
2
  require 'avromatic/model/message_decoder'
3
3
  require 'avromatic/model/type_registry'
4
+ require 'avromatic/model/logical_types'
4
5
 
5
6
  module Avromatic
6
7
  module Model
@@ -1,3 +1,3 @@
1
1
  module Avromatic
2
- VERSION = '0.7.1'.freeze
2
+ VERSION = '0.8.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avromatic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Salsify Engineering
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-19 00:00:00.000000000 Z
11
+ date: 2016-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avro
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - ">="
158
158
  - !ruby/object:Gem::Version
159
- version: 0.7.0
159
+ version: 0.11.0
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
- version: 0.7.0
166
+ version: 0.11.0
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: sinatra
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -206,6 +206,20 @@ dependencies:
206
206
  - - ">="
207
207
  - !ruby/object:Gem::Version
208
208
  version: '0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: appraisal
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
209
223
  description: Generate Ruby models from Avro schemas
210
224
  email:
211
225
  - engineering@salsify.com
@@ -218,6 +232,7 @@ files:
218
232
  - ".rspec"
219
233
  - ".rubocop.yml"
220
234
  - ".travis.yml"
235
+ - Appraisals
221
236
  - CHANGELOG.md
222
237
  - Gemfile
223
238
  - LICENSE.txt
@@ -226,6 +241,7 @@ files:
226
241
  - avromatic.gemspec
227
242
  - bin/console
228
243
  - bin/setup
244
+ - gemfiles/avro_salsify_fork.gemfile
229
245
  - gemfiles/rails4_1.gemfile
230
246
  - gemfiles/rails4_2.gemfile
231
247
  - lib/avromatic.rb
@@ -235,6 +251,7 @@ files:
235
251
  - lib/avromatic/model/configurable.rb
236
252
  - lib/avromatic/model/configuration.rb
237
253
  - lib/avromatic/model/custom_type.rb
254
+ - lib/avromatic/model/logical_types.rb
238
255
  - lib/avromatic/model/message_decoder.rb
239
256
  - lib/avromatic/model/messaging_serialization.rb
240
257
  - lib/avromatic/model/null_custom_type.rb