twirp_rails 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c15c4b218c46da9e9f08c384e93da00dcf10ba7602163c215fe9749185e63ff3
4
+ data.tar.gz: a424ca0bb2c0b6402a90d0f622226dca43aba275c586be1e3803d58fdc379763
5
+ SHA512:
6
+ metadata.gz: bc6e02b51beaa955f42a8846392e1bb9439e4a59b358105188b91f6952e91a7fd1ce5e5c9cc1702389a358e0a6d3ea27c936d4f042c6f2d59e73b309d7d6d104
7
+ data.tar.gz: 462a4d94ad07bc7974a4053db981c02b93b76af412934f6747fbcec42430de31e999b757fc6ca1e1fae5c49956209f968eb430e12f518a1f3d4467fd2857f832
@@ -0,0 +1,57 @@
1
+ version: 2.1
2
+
3
+ parameters:
4
+ project_name:
5
+ type: string
6
+ default: twirp_rails
7
+ ruby_image:
8
+ type: string
9
+ default: circleci/ruby:2.6.5
10
+
11
+ commands:
12
+ gen_version:
13
+ steps:
14
+ - run:
15
+ name: Set project vars
16
+ command: |
17
+ echo "" > vars.sh
18
+ GEM_VERSION=$(ruby -r./lib/twirp_rails/version.rb -e "print TwirpRails::VERSION")
19
+ echo "export GEM_VERSION=$GEM_VERSION" >> vars.sh
20
+
21
+
22
+ jobs:
23
+ test_app_code:
24
+ parameters:
25
+ cache_name:
26
+ type: string
27
+ default: << pipeline.parameters.project_name >>-cache-{{ checksum "<< pipeline.parameters.project_name >>.gemspec" }}
28
+ working_directory: ~/src
29
+ docker:
30
+ - image: << pipeline.parameters.ruby_image >>
31
+ steps:
32
+ - checkout
33
+ - setup_remote_docker:
34
+ docker_layer_caching: true
35
+ - restore_cache:
36
+ keys:
37
+ - << parameters.cache_name >>
38
+ - run:
39
+ name: Bundle install
40
+ command: bundle install --path ~/.bundler
41
+ - save_cache:
42
+ key: << parameters.cache_name >>
43
+ paths:
44
+ - ~/.bundler
45
+ - run:
46
+ name: Rspec
47
+ command: bundle exec rspec -f progress -f RspecJunitFormatter --out /tmp/test-results/rspec.xml
48
+
49
+ workflows:
50
+ version: 2
51
+ app:
52
+ jobs:
53
+ - test_app_code:
54
+ filters:
55
+ tags:
56
+ only: /.*/
57
+
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /.idea/
10
+
11
+ .rspec_status
12
+
13
+ /spec/dummy/tmp
14
+ /spec/dummy/log
15
+
16
+ twirp_rails-*.gem
17
+
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.5
7
+ before_install: gem install bundler -v 1.17.3
data/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [0.1.0] - 2020-01-24
8
+
9
+ ### Added
10
+ - mount_twirp route helper
11
+ - rails g twirp generator
12
+
13
+
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at a.zimin@talenttech.ru. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in twirp_rails.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,114 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ twirp_rails (0.1.0)
5
+ railties (~> 6.0)
6
+ twirp (~> 1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionpack (6.0.2.1)
12
+ actionview (= 6.0.2.1)
13
+ activesupport (= 6.0.2.1)
14
+ rack (~> 2.0, >= 2.0.8)
15
+ rack-test (>= 0.6.3)
16
+ rails-dom-testing (~> 2.0)
17
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
18
+ actionview (6.0.2.1)
19
+ activesupport (= 6.0.2.1)
20
+ builder (~> 3.1)
21
+ erubi (~> 1.4)
22
+ rails-dom-testing (~> 2.0)
23
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
24
+ activesupport (6.0.2.1)
25
+ concurrent-ruby (~> 1.0, >= 1.0.2)
26
+ i18n (>= 0.7, < 2)
27
+ minitest (~> 5.1)
28
+ tzinfo (~> 1.1)
29
+ zeitwerk (~> 2.2)
30
+ builder (3.2.4)
31
+ coderay (1.1.2)
32
+ concurrent-ruby (1.1.5)
33
+ crass (1.0.6)
34
+ diff-lcs (1.3)
35
+ erubi (1.9.0)
36
+ faraday (0.17.3)
37
+ multipart-post (>= 1.2, < 3)
38
+ generator_spec (0.9.4)
39
+ activesupport (>= 3.0.0)
40
+ railties (>= 3.0.0)
41
+ google-protobuf (3.11.2-universal-darwin)
42
+ i18n (1.8.2)
43
+ concurrent-ruby (~> 1.0)
44
+ loofah (2.4.0)
45
+ crass (~> 1.0.2)
46
+ nokogiri (>= 1.5.9)
47
+ method_source (0.9.2)
48
+ mini_portile2 (2.4.0)
49
+ minitest (5.14.0)
50
+ multipart-post (2.1.1)
51
+ nokogiri (1.10.7)
52
+ mini_portile2 (~> 2.4.0)
53
+ pry (0.12.2)
54
+ coderay (~> 1.1.0)
55
+ method_source (~> 0.9.0)
56
+ rack (2.1.1)
57
+ rack-test (1.1.0)
58
+ rack (>= 1.0, < 3)
59
+ rails-dom-testing (2.0.3)
60
+ activesupport (>= 4.2.0)
61
+ nokogiri (>= 1.6)
62
+ rails-html-sanitizer (1.3.0)
63
+ loofah (~> 2.3)
64
+ railties (6.0.2.1)
65
+ actionpack (= 6.0.2.1)
66
+ activesupport (= 6.0.2.1)
67
+ method_source
68
+ rake (>= 0.8.7)
69
+ thor (>= 0.20.3, < 2.0)
70
+ rake (10.5.0)
71
+ rspec (3.9.0)
72
+ rspec-core (~> 3.9.0)
73
+ rspec-expectations (~> 3.9.0)
74
+ rspec-mocks (~> 3.9.0)
75
+ rspec-core (3.9.1)
76
+ rspec-support (~> 3.9.1)
77
+ rspec-expectations (3.9.0)
78
+ diff-lcs (>= 1.2.0, < 2.0)
79
+ rspec-support (~> 3.9.0)
80
+ rspec-mocks (3.9.1)
81
+ diff-lcs (>= 1.2.0, < 2.0)
82
+ rspec-support (~> 3.9.0)
83
+ rspec-rails (3.9.0)
84
+ actionpack (>= 3.0)
85
+ activesupport (>= 3.0)
86
+ railties (>= 3.0)
87
+ rspec-core (~> 3.9.0)
88
+ rspec-expectations (~> 3.9.0)
89
+ rspec-mocks (~> 3.9.0)
90
+ rspec-support (~> 3.9.0)
91
+ rspec-support (3.9.2)
92
+ thor (1.0.1)
93
+ thread_safe (0.3.6)
94
+ twirp (1.4.1)
95
+ faraday (~> 0)
96
+ google-protobuf (~> 3.0, >= 3.0.0)
97
+ tzinfo (1.2.6)
98
+ thread_safe (~> 0.1)
99
+ zeitwerk (2.2.2)
100
+
101
+ PLATFORMS
102
+ ruby
103
+
104
+ DEPENDENCIES
105
+ bundler (~> 1.17)
106
+ generator_spec (~> 0.9)
107
+ pry (~> 0.12)
108
+ rake (~> 10.0)
109
+ rspec (~> 3.0)
110
+ rspec-rails (~> 3.0)
111
+ twirp_rails!
112
+
113
+ BUNDLED WITH
114
+ 1.17.3
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Alexandr Zimin
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.
data/README.md ADDED
@@ -0,0 +1,92 @@
1
+ # TwirpRails
2
+
3
+ TwirpRails helps to use [twirp-ruby gem](https://github.com/twitchtv/twirp-ruby) with rails and to
4
+ automate code generation from ```.proto``` files.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'twirp_rails'
12
+ ```
13
+
14
+ See the [twirp-ruby code generation documentation](https://github.com/twitchtv/twirp-ruby/wiki/Code-Generation)
15
+ to install required protoc and twirp-ruby plugin.
16
+
17
+ ## Usage
18
+
19
+ ### Generator
20
+
21
+ Create a proto file ```app/protos/people.proto```:
22
+ ```proto
23
+ syntax = "proto3";
24
+
25
+ service People {
26
+ rpc getName(GetNameRequest) returns (GetNameResponse);
27
+ }
28
+
29
+ message GetNameRequest {
30
+ string uid = 1;
31
+ }
32
+
33
+ message GetNameResponse {
34
+ string name = 1;
35
+ }
36
+ ```
37
+
38
+ and run
39
+
40
+ ```sh
41
+ rails g twirp people
42
+ ```
43
+
44
+ This command will generate ```lib/twirp/people_pb.rb```, ```lib/twirp/people_twirp.rb``` and ```app/rpc/people_handler.rb``` and add the route.
45
+ ```ruby
46
+ # app/rpc/people_handler.rb
47
+
48
+ class PeopleHandler
49
+
50
+ def get_name(req, _env)
51
+ GetNameResponse.new
52
+ end
53
+ end
54
+ ```
55
+
56
+ ### Call RPC
57
+
58
+ Modify ```app/rpc/people_handler.rb```:
59
+ ```ruby
60
+ def get_name(req, _env)
61
+ GetNameResponse.new name: "Name of #{req.uid}"
62
+ end
63
+ ```
64
+
65
+ Run rails server
66
+ ```sh
67
+ rails s
68
+ ```
69
+
70
+ And check it from rails console.
71
+ ```ruby
72
+ PeopleClient.new('http://localhost:3000').get_name(GetNameRequest.new uid: '1').data.name
73
+ => "Name of 1"
74
+ ```
75
+
76
+ ## Development
77
+
78
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
79
+
80
+ 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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
81
+
82
+ ## Contributing
83
+
84
+ Bug reports and pull requests are welcome on GitHub at https://github.com/severgroup-tt/twirp_rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
85
+
86
+ ## License
87
+
88
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
89
+
90
+ ## Code of Conduct
91
+
92
+ Everyone interacting in the TwirpRails project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/twirp_rails/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :default => :test
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "twirp_rails"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/push ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -v
5
+
6
+ rspec
7
+
8
+ gem build twirp_rails.gemspec
9
+
10
+ gem push twirp_rails-$(ruby -r./lib/twirp_rails/version.rb -e "print TwirpRails::VERSION").gem
data/bin/setup ADDED
@@ -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,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'twirp_rails/version'
4
+ require 'twirp_rails/engine'
5
+ require 'twirp_rails/generators/twirp/twirp_generator'
6
+
7
+ module TwirpRails
8
+ class Error < StandardError; end
9
+ end
@@ -0,0 +1,17 @@
1
+ require 'rails/engine'
2
+ require 'twirp_rails/routes'
3
+ require 'twirp_rails/twirp'
4
+
5
+ module TwirpRails
6
+ module Routes
7
+ class Engine < ::Rails::Engine
8
+ initializer 'twirp_rails.routes' do
9
+ TwirpRails::Routes::Helper.install
10
+ end
11
+
12
+ initializer 'twirp_rails.require_generated_files' do
13
+ TwirpRails::Twirp.auto_require_twirp_files
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,11 @@
1
+ Description:
2
+ Generate twirp and handler files from proto file.
3
+
4
+ Example:
5
+ rails generate twirp org
6
+
7
+ This will create:
8
+ lib/twirp
9
+ lib/twirp/org_pb.rb
10
+ lib/twirp/org_twirp.rb
11
+ app/rpc/org_handler.rb
@@ -0,0 +1,91 @@
1
+ require 'rails/generators'
2
+
3
+ class TwirpGenerator < Rails::Generators::NamedBase
4
+ source_root File.expand_path('templates', __dir__)
5
+
6
+ PLUGIN_PATH = ENV.fetch('TWIRP_PLUGIN_PATH') { File.expand_path('~/go/bin/protoc-gen-twirp_ruby') }
7
+ PROTOC_PATH = `which protoc`.chomp
8
+
9
+ def check_requirements
10
+ in_root do
11
+ puts `pwd`
12
+ unless File.exists?(proto_file_name)
13
+ raise "#{proto_file_name} not found #{`pwd`} #{`ls`}"
14
+ end
15
+ end
16
+
17
+ raise 'protoc not found - install protobuf (brew/apt/yum install protobuf)' unless File.exists?(PROTOC_PATH)
18
+
19
+ unless File.exists?(PLUGIN_PATH)
20
+ raise <<~TEXT
21
+ protoc-gen-twirp_ruby not found - install go (brew install go)
22
+ and run "go get github.com/twitchtv/twirp-ruby/protoc-gen-twirp_ruby
23
+ or set TWIRP_PLUGIN_PATH environment variable to right location.
24
+ TEXT
25
+ end
26
+ end
27
+
28
+ def generate_twirp_files
29
+ cmd = protoc_cmd
30
+
31
+ in_root do
32
+ `#{cmd}`
33
+ end
34
+ end
35
+
36
+ PROTO_RPC_REGEXP = /\brpc\s+(\S+)\s*\(\s*(\S+)\s*\)\s*returns\s*\(\s*(\S+)\s*\)/m.freeze
37
+ def generate_handler
38
+ calls = proto_content.scan(PROTO_RPC_REGEXP).map do |method, arg_type, result_type|
39
+ <<-RUBY
40
+ def #{method.underscore}(req, _env)
41
+ #{result_type}.new
42
+ end
43
+ RUBY
44
+ end.join("\n")
45
+
46
+ # Пока считаем, что имя сервиса совпадает с именем файла,
47
+ create_file "app/rpc/#{file_name}_handler.rb", <<~RUBY
48
+ class #{class_name}Handler
49
+
50
+ #{calls}end
51
+ RUBY
52
+ end
53
+
54
+ def generate_route
55
+ route "mount_twirp :#{file_name}"
56
+ end
57
+
58
+ def generate_rspec_files
59
+ puts 'RSpec TODO'
60
+ end
61
+
62
+ private
63
+
64
+ def from_rails_root(&block)
65
+ old_dir = Dir.pwd
66
+ Dir.chdir Rails.root
67
+ yield
68
+ ensure
69
+ Dir.chdir old_dir
70
+ end
71
+
72
+ def protoc_cmd
73
+ FileUtils.mkdir_p 'lib/twirp'
74
+ flags = "--proto_path=app/protos --ruby_out=lib/twirp --twirp_ruby_out=lib/twirp --plugin=#{PLUGIN_PATH}"
75
+
76
+ "#{PROTOC_PATH} #{flags} app/protos/#{file_name}.proto"
77
+ end
78
+
79
+ def proto_content
80
+ unless @proto_content
81
+ in_root do
82
+ @proto_content = File.read proto_file_name
83
+ end
84
+ end
85
+ @proto_content
86
+ end
87
+
88
+ def proto_file_name
89
+ "app/protos/#{file_name}.proto"
90
+ end
91
+ end
@@ -0,0 +1,30 @@
1
+ require 'action_dispatch'
2
+
3
+ module TwirpRails
4
+ module Routes # :nodoc:
5
+ module Helper
6
+ def mount_twirp(name, handler: nil)
7
+ case name
8
+ when Class
9
+ raise 'handler param required when name is a class' unless handler&.is_a?(Class)
10
+
11
+ service_class = name
12
+
13
+ when String, Symbol
14
+ service_class = "#{name}_service".camelize.constantize rescue name.camelize.constantize
15
+ handler ||= "#{name}_handler".camelize.constantize
16
+
17
+ else
18
+ raise 'twirp service name required'
19
+ end
20
+
21
+ service = service_class.new(handler.new)
22
+ mount service, at: service.full_name
23
+ end
24
+
25
+ def self.install
26
+ ActionDispatch::Routing::Mapper.send :include, TwirpRails::Routes::Helper
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,9 @@
1
+ module TwirpRails
2
+ module Twirp
3
+ def self.auto_require_twirp_files
4
+ Dir.glob(Rails.root.join('lib/twirp/*_twirp.rb')).sort.each do |file|
5
+ require file
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module TwirpRails
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,34 @@
1
+
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'twirp_rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'twirp_rails'
8
+ spec.version = TwirpRails::VERSION
9
+ spec.authors = ['Alexandr Zimin']
10
+ spec.email = ['a.zimin@talenttech.ru']
11
+
12
+ spec.summary = %q{Use twirp-ruby from rails.}
13
+ spec.homepage = 'https://github.com/severgroup-tt/twirp_rails'
14
+ spec.license = 'MIT'
15
+
16
+ # Specify which files should be added to the gem when it is released.
17
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
18
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
19
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ end
21
+ spec.bindir = 'exe'
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ['lib']
24
+
25
+ spec.add_dependency 'twirp', '~> 1'
26
+ spec.add_dependency 'railties', '~> 6.0'
27
+
28
+ spec.add_development_dependency 'bundler', '~> 1.17'
29
+ spec.add_development_dependency 'rake', '~> 10.0'
30
+ spec.add_development_dependency 'rspec', '~> 3.0'
31
+ spec.add_development_dependency 'rspec-rails', '~> 3.0'
32
+ spec.add_development_dependency 'generator_spec', '~> 0.9'
33
+ spec.add_development_dependency 'pry', '~> 0.12'
34
+ end
metadata ADDED
@@ -0,0 +1,176 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: twirp_rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Alexandr Zimin
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-01-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: twirp
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: railties
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '6.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '6.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.17'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.17'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec-rails
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: generator_spec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.9'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.9'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.12'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.12'
125
+ description:
126
+ email:
127
+ - a.zimin@talenttech.ru
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - ".circleci/config.yml"
133
+ - ".gitignore"
134
+ - ".travis.yml"
135
+ - CHANGELOG.md
136
+ - CODE_OF_CONDUCT.md
137
+ - Gemfile
138
+ - Gemfile.lock
139
+ - LICENSE.txt
140
+ - README.md
141
+ - Rakefile
142
+ - bin/console
143
+ - bin/push
144
+ - bin/setup
145
+ - lib/twirp_rails.rb
146
+ - lib/twirp_rails/engine.rb
147
+ - lib/twirp_rails/generators/twirp/USAGE
148
+ - lib/twirp_rails/generators/twirp/twirp_generator.rb
149
+ - lib/twirp_rails/routes.rb
150
+ - lib/twirp_rails/twirp.rb
151
+ - lib/twirp_rails/version.rb
152
+ - twirp_rails.gemspec
153
+ homepage: https://github.com/severgroup-tt/twirp_rails
154
+ licenses:
155
+ - MIT
156
+ metadata: {}
157
+ post_install_message:
158
+ rdoc_options: []
159
+ require_paths:
160
+ - lib
161
+ required_ruby_version: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - ">="
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ required_rubygems_version: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - ">="
169
+ - !ruby/object:Gem::Version
170
+ version: '0'
171
+ requirements: []
172
+ rubygems_version: 3.0.6
173
+ signing_key:
174
+ specification_version: 4
175
+ summary: Use twirp-ruby from rails.
176
+ test_files: []