proto_record 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 446ce008ceb80179bf14e34ff06fdd80638bc2a836a8ab6ee87b5ff8960a814e
4
+ data.tar.gz: 80e3410a1783856b143d41f214f82817cf3eabcd3e00ee9a41aadbab373c7f18
5
+ SHA512:
6
+ metadata.gz: db6d10a23e6163118d8174ba6c902f99a77343530cd991c3f08759aca2ccb56f30001b1fd38357755bd159300c1c88e7e75ad8d5d483455508a823196b52afcf
7
+ data.tar.gz: ddf3a30f1b19f4f06eee8100d3d7c6ffc1c4060bf9ebe43e7c871b32c9dc96461ee088b561f7df760606debee6602d8ac37af113bb2ba53c56fd0c383878fc37
@@ -0,0 +1,18 @@
1
+ name: Ruby
2
+
3
+ on: [push,pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v2
10
+ - name: Set up Ruby
11
+ uses: ruby/setup-ruby@v1
12
+ with:
13
+ ruby-version: 2.7.1
14
+ - name: Run the default task
15
+ run: |
16
+ gem install bundler -v 2.2.6
17
+ bundle install
18
+ bundle exec rake
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ *.gem
10
+ *.db
11
+
12
+ # rspec failure tracking
13
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,26 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+ Exclude:
4
+ - "spec/support/protos/**/*"
5
+
6
+ Style/StringLiterals:
7
+ Enabled: true
8
+ EnforcedStyle: double_quotes
9
+
10
+ Style/StringLiteralsInInterpolation:
11
+ Enabled: true
12
+ EnforcedStyle: double_quotes
13
+
14
+ Layout/LineLength:
15
+ Max: 120
16
+
17
+ Naming/MethodParameterName:
18
+ Enabled: false
19
+
20
+ Style/Documentation:
21
+ Enabled: false
22
+
23
+ Metrics/BlockLength:
24
+ Exclude:
25
+ - "spec/**/*"
26
+ - "*.gemspec"
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at david.sapiro@onfido.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in proto_record.gemspec
6
+ gemspec
@@ -0,0 +1,97 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ proto_record (0.1.0)
5
+ rake (~> 13.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activemodel (5.2.4.4)
11
+ activesupport (= 5.2.4.4)
12
+ activerecord (5.2.4.4)
13
+ activemodel (= 5.2.4.4)
14
+ activesupport (= 5.2.4.4)
15
+ arel (>= 9.0)
16
+ activesupport (5.2.4.4)
17
+ concurrent-ruby (~> 1.0, >= 1.0.2)
18
+ i18n (>= 0.7, < 2)
19
+ minitest (~> 5.1)
20
+ tzinfo (~> 1.1)
21
+ arel (9.0.0)
22
+ ast (2.4.1)
23
+ byebug (11.1.3)
24
+ coderay (1.1.3)
25
+ concurrent-ruby (1.1.8)
26
+ diff-lcs (1.4.4)
27
+ google-protobuf (3.14.0-universal-darwin)
28
+ googleapis-common-protos-types (1.0.5)
29
+ google-protobuf (~> 3.11)
30
+ grpc (1.35.0-universal-darwin)
31
+ google-protobuf (~> 3.14)
32
+ googleapis-common-protos-types (~> 1.0)
33
+ grpc-tools (1.35.0)
34
+ i18n (1.8.7)
35
+ concurrent-ruby (~> 1.0)
36
+ method_source (1.0.0)
37
+ minitest (5.14.3)
38
+ parallel (1.20.1)
39
+ parser (3.0.0.0)
40
+ ast (~> 2.4.1)
41
+ pry (0.13.1)
42
+ coderay (~> 1.1)
43
+ method_source (~> 1.0)
44
+ pry-byebug (3.9.0)
45
+ byebug (~> 11.0)
46
+ pry (~> 0.13.0)
47
+ rainbow (3.0.0)
48
+ rake (13.0.3)
49
+ regexp_parser (2.0.3)
50
+ rexml (3.2.4)
51
+ rspec (3.10.0)
52
+ rspec-core (~> 3.10.0)
53
+ rspec-expectations (~> 3.10.0)
54
+ rspec-mocks (~> 3.10.0)
55
+ rspec-core (3.10.1)
56
+ rspec-support (~> 3.10.0)
57
+ rspec-expectations (3.10.1)
58
+ diff-lcs (>= 1.2.0, < 2.0)
59
+ rspec-support (~> 3.10.0)
60
+ rspec-mocks (3.10.1)
61
+ diff-lcs (>= 1.2.0, < 2.0)
62
+ rspec-support (~> 3.10.0)
63
+ rspec-support (3.10.1)
64
+ rubocop (1.8.1)
65
+ parallel (~> 1.10)
66
+ parser (>= 3.0.0.0)
67
+ rainbow (>= 2.2.2, < 4.0)
68
+ regexp_parser (>= 1.8, < 3.0)
69
+ rexml
70
+ rubocop-ast (>= 1.2.0, < 2.0)
71
+ ruby-progressbar (~> 1.7)
72
+ unicode-display_width (>= 1.4.0, < 3.0)
73
+ rubocop-ast (1.4.0)
74
+ parser (>= 2.7.1.5)
75
+ ruby-progressbar (1.11.0)
76
+ sqlite3 (1.4.2)
77
+ thread_safe (0.3.6)
78
+ tzinfo (1.2.9)
79
+ thread_safe (~> 0.1)
80
+ unicode-display_width (2.0.0)
81
+
82
+ PLATFORMS
83
+ x86_64-darwin-19
84
+
85
+ DEPENDENCIES
86
+ activerecord (~> 5.0)
87
+ grpc (~> 1.35.0)
88
+ grpc-tools (~> 1.35.0)
89
+ proto_record!
90
+ pry (~> 0.13.1)
91
+ pry-byebug (~> 3.9)
92
+ rspec (~> 3.0)
93
+ rubocop (~> 1.7)
94
+ sqlite3 (~> 1.4)
95
+
96
+ BUNDLED WITH
97
+ 2.2.6
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 David Sapiro
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,156 @@
1
+ # ProtoRecord
2
+
3
+ ProtoRecord provides a simple way to build Protocol buffer messages from ActiveRecord objects based on the stubs generated by protocol buffer compiler.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'proto_record'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install proto_record
20
+
21
+ ## Usage
22
+
23
+ To make use of ProtoRecord you need have some messages defined in a `.proto` file and the stubs generated using using the protocol buffer compiler, for more information follow the [gRPC Ruby basic tutorial](https://grpc.io/docs/languages/ruby/basics).
24
+
25
+ For our exmpale we will use the following message:
26
+ ```proto
27
+ message PathMessage {
28
+ string name = 1;
29
+ string description = 2;
30
+ }
31
+ ```
32
+ With the stubs generated all you have to do is to include the `ProtoRecord` module and define a `proto_message` for your ActiveRecord object.
33
+ ```ruby
34
+ class Path < ActiveRecord::Base
35
+ include ProtoRecord
36
+
37
+ # 'PathMessage' will be used when resolving the object.
38
+ proto_message :path_message
39
+ end
40
+ ```
41
+ After including the module and defining a mesasge, a `to_proto` method would be added to instances of `Path`. Calling `to_proto` will return a message of type `PathMessage` that is built from the instance using only the fields defined on the message. A very simple scenario would be getting getting all `Path`s from the DB and returning them as messages. This would look something like:
42
+ ```ruby
43
+ Path.all.map(&:to_proto)
44
+ ```
45
+
46
+ #### Nested Mesasge
47
+ ProtoRecord also resolves nested messages, so if we have the following schema:
48
+ ```proto
49
+ message PathMessage {
50
+ string name = 1;
51
+ string description = 2;
52
+ repeated FeatureMessage features = 3;
53
+ }
54
+
55
+ message FeatureMessage {
56
+ string name = 1;
57
+ }
58
+ ```
59
+ And relation defined like this:
60
+ ```ruby
61
+ class Path < ActiveRecord::Base
62
+ include ProtoRecord
63
+
64
+ proto_message :path_message
65
+
66
+ has_many :features
67
+ end
68
+
69
+ class Feature < ActiveRecord::Base
70
+ include ProtoRecord
71
+
72
+ # 'FeatureMessage' will be used when resolving the object.
73
+ proto_message :feature_message
74
+
75
+ belongs_to :path
76
+ end
77
+ ```
78
+ Then invocking `to_proto` on an instance of `Path` will also create messages for all associated `features`.
79
+
80
+ #### Regular Classes
81
+ ProtoRecord will also handle the creation messages for non ActiveRecord objects that define a `proto_message`. The only differene is that you would need define a `fields_resolver` that will point to a method that returns a hash representation of the class which will be used to instantiate the message.
82
+ So with a message like this:
83
+ ```proto
84
+ message PointMessage {
85
+ int32 x = 1;
86
+ int32 y = 2;
87
+ }
88
+ ```
89
+ And class that implements `Point`:
90
+ ```ruby
91
+ class Point
92
+ include ProtoRecord
93
+
94
+ # 'PointMessage' will be created with the hash returned form the `:to_h` method.
95
+ proto_message :point_message, :fields_resolver => :to_h
96
+
97
+ def initialize(x: nil, y: nil)
98
+ @x = x
99
+ @y = y
100
+ end
101
+
102
+ def to_h
103
+ {
104
+ x: @x,
105
+ y: @y
106
+ }
107
+ end
108
+ end
109
+ ```
110
+ In cases when you don't want to define a message for class (e.g the class just represents a repeated message), you can simply define a `to_proto` method which will be invoked when creating the message.
111
+ ```ruby
112
+ class Points
113
+ attr_reader :points
114
+
115
+ def initialize(points: [])
116
+ @points = points
117
+ end
118
+
119
+ def to_proto
120
+ @points.map(&:to_proto)
121
+ end
122
+ end
123
+ ```
124
+ * Notice that you don't need to include `ProtoRecord` or define a `proto_message` in cases like this.
125
+
126
+ #### Dates
127
+ Protocol Buffer messages don't support sending dates, `ProtoRecord` will transform all types of dates into `Time` by calling `to_time` on them. In your `.proto` file you will need to add the following:
128
+ ```proto
129
+ import "google/protobuf/timestamp.proto";
130
+
131
+ message ObjectWithDateMessage {
132
+ google.protobuf.Timestamp created_at = 1;
133
+ }
134
+ ```
135
+
136
+ ## TODO
137
+ - [ ] Support custom field transformation.
138
+ - [ ] Add a `from_proto` for creating and updating records.
139
+
140
+ ## Development
141
+
142
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
143
+
144
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
145
+
146
+ ## Contributing
147
+
148
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/proto_record. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/proto_record/blob/master/CODE_OF_CONDUCT.md).
149
+
150
+ ## License
151
+
152
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
153
+
154
+ ## Code of Conduct
155
+
156
+ Everyone interacting in the ProtoRecord project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/proto_record/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+ require "rubocop/rake_task"
6
+
7
+ PROTOS_PATH = "spec/support/protos"
8
+
9
+ RSpec::Core::RakeTask.new(:spec)
10
+
11
+ RuboCop::RakeTask.new
12
+
13
+ task :delete_protos do
14
+ FileUtils.rm(Dir.glob("#{PROTOS_PATH}/*.rb"))
15
+ puts "Generated protobuf classes have been deleted"
16
+ end
17
+
18
+ task :compile_protos, [] => :delete_protos do
19
+ protos = Dir.glob("spec/support/protos/*.proto").join(" ")
20
+ sh "grpc_tools_ruby_protoc -I #{PROTOS_PATH} --ruby_out=#{PROTOS_PATH} --grpc_out=#{PROTOS_PATH} #{protos}"
21
+ puts "Generated new protobuf classes"
22
+ end
23
+
24
+ task default: %i[delete_protos compile_protos spec rubocop]
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "proto_record"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ProtoRecord
4
+ require "proto_record/errors"
5
+ require "proto_record/version"
6
+ require "proto_record/proto_record"
7
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ProtoRecord
4
+ class MissingProtoMessage < StandardError
5
+ def initialize(class_name)
6
+ super("'proto_message' hasn't been defined for #{class_name}.")
7
+ end
8
+ end
9
+
10
+ class MissingFieldsResolver < StandardError
11
+ def initialize(class_name)
12
+ super("'fields_resolver' hasn't been defined for #{class_name}.")
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,97 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support/concern"
4
+
5
+ require "proto_record/errors"
6
+
7
+ module ProtoRecord
8
+ extend ActiveSupport::Concern
9
+
10
+ included do
11
+ class << self
12
+ def proto_message(message = nil, options = {})
13
+ unless message.nil?
14
+ @proto_message = message.to_s.classify.constantize
15
+ @proto_options = options
16
+ end
17
+
18
+ @proto_message ||= superclass.proto_message if @proto_message.nil? && superclass.respond_to?(:proto_message)
19
+
20
+ @proto_message
21
+ end
22
+
23
+ def proto_options
24
+ @proto_options ||= {}
25
+ end
26
+
27
+ def proto_message_fields
28
+ @proto_message_fields = @proto_message.new.to_h.keys.map(&:to_s)
29
+ end
30
+ end
31
+ end
32
+
33
+ def to_proto
34
+ raise MissingProtoMessage, self.class.name if proto_message.nil?
35
+
36
+ message_args = is_a?(ActiveRecord::Base) ? resolve_active_record_object : resolve_class_object
37
+
38
+ proto_message.new(message_args)
39
+ end
40
+
41
+ private
42
+
43
+ def proto_options
44
+ self.class.proto_options
45
+ end
46
+
47
+ def proto_message
48
+ self.class.proto_message
49
+ end
50
+
51
+ def proto_fields
52
+ self.class.proto_message_fields
53
+ end
54
+
55
+ def resolve_class_object
56
+ resolver = self.class.proto_options[:fields_resolver]
57
+
58
+ raise MissingFieldsResolver, self.class if resolver.nil?
59
+
60
+ send(resolver)
61
+ end
62
+
63
+ def resolve_active_record_object
64
+ proto_fields.map { |field| [field, resolve_field(field)] }.to_h
65
+ end
66
+
67
+ def resolve_field(field)
68
+ value = try(field) || self[field]
69
+
70
+ return value if value.nil?
71
+
72
+ if reflection?(field)
73
+ collection?(field) ? value.map(&:to_proto) : value.to_proto
74
+ else
75
+ handle_special_fields(value)
76
+ end
77
+ end
78
+
79
+ def reflection?(field)
80
+ self.class.reflections.keys.include?(field)
81
+ end
82
+
83
+ def collection?(field)
84
+ self.class.reflect_on_association(field).collection?
85
+ end
86
+
87
+ def handle_special_fields(value)
88
+ return value.to_proto if value.respond_to?(:to_proto)
89
+ return value.to_time if value.respond_to?(:strftime)
90
+
91
+ value
92
+ end
93
+
94
+ def collection_association?(field)
95
+ self.class.reflect_on_association(field).try(:collection?)
96
+ end
97
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ProtoRecord
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/proto_record/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "proto_record"
7
+ spec.version = ProtoRecord::VERSION
8
+ spec.authors = ["David Sapiro"]
9
+ spec.email = ["david.sapiro@gmail.com"]
10
+
11
+ spec.summary = "Transforms ActiveRecord object to Protocol Buffer messages"
12
+ # spec.description = "TODO: Write a longer description or delete this line."
13
+ spec.homepage = "https://github.com/davids868/proto-record"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
16
+
17
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
18
+
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ spec.metadata["source_code_uri"] = spec.homepage
21
+ # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
22
+
23
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
25
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
26
+ end
27
+ spec.bindir = "exe"
28
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
29
+ spec.require_paths = ["lib"]
30
+
31
+ spec.add_dependency "rake", "~> 13.0"
32
+
33
+ spec.add_development_dependency "activerecord", "~> 5.0"
34
+ spec.add_development_dependency "grpc", "~> 1.35.0"
35
+ spec.add_development_dependency "grpc-tools", "~> 1.35.0"
36
+ spec.add_development_dependency "pry", "~> 0.13.1"
37
+ spec.add_development_dependency "pry-byebug", "~> 3.9"
38
+ spec.add_development_dependency "rspec", "~> 3.0"
39
+ spec.add_development_dependency "rubocop", "~> 1.7"
40
+ spec.add_development_dependency "sqlite3", "~> 1.4"
41
+ end
metadata ADDED
@@ -0,0 +1,189 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: proto_record
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - David Sapiro
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-01-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '13.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '13.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: activerecord
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: grpc
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.35.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.35.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: grpc-tools
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 1.35.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 1.35.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.13.1
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.13.1
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry-byebug
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.9'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.9'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '1.7'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '1.7'
125
+ - !ruby/object:Gem::Dependency
126
+ name: sqlite3
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '1.4'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '1.4'
139
+ description:
140
+ email:
141
+ - david.sapiro@gmail.com
142
+ executables: []
143
+ extensions: []
144
+ extra_rdoc_files: []
145
+ files:
146
+ - ".github/workflows/main.yml"
147
+ - ".gitignore"
148
+ - ".rspec"
149
+ - ".rubocop.yml"
150
+ - CODE_OF_CONDUCT.md
151
+ - Gemfile
152
+ - Gemfile.lock
153
+ - LICENSE.txt
154
+ - README.md
155
+ - Rakefile
156
+ - bin/console
157
+ - bin/setup
158
+ - lib/proto_record.rb
159
+ - lib/proto_record/errors.rb
160
+ - lib/proto_record/proto_record.rb
161
+ - lib/proto_record/version.rb
162
+ - proto_record.gemspec
163
+ homepage: https://github.com/davids868/proto-record
164
+ licenses:
165
+ - MIT
166
+ metadata:
167
+ allowed_push_host: https://rubygems.org
168
+ homepage_uri: https://github.com/davids868/proto-record
169
+ source_code_uri: https://github.com/davids868/proto-record
170
+ post_install_message:
171
+ rdoc_options: []
172
+ require_paths:
173
+ - lib
174
+ required_ruby_version: !ruby/object:Gem::Requirement
175
+ requirements:
176
+ - - ">="
177
+ - !ruby/object:Gem::Version
178
+ version: 2.4.0
179
+ required_rubygems_version: !ruby/object:Gem::Requirement
180
+ requirements:
181
+ - - ">="
182
+ - !ruby/object:Gem::Version
183
+ version: '0'
184
+ requirements: []
185
+ rubygems_version: 3.1.2
186
+ signing_key:
187
+ specification_version: 4
188
+ summary: Transforms ActiveRecord object to Protocol Buffer messages
189
+ test_files: []