twirp_rails 0.1.0 → 0.1.1

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
  SHA256:
3
- metadata.gz: c15c4b218c46da9e9f08c384e93da00dcf10ba7602163c215fe9749185e63ff3
4
- data.tar.gz: a424ca0bb2c0b6402a90d0f622226dca43aba275c586be1e3803d58fdc379763
3
+ metadata.gz: 779e660390a93d455f017154d2accf76eefd7e41dffd90c2ad5fbba774167156
4
+ data.tar.gz: abef8778a5a29580fbf1dab96830d01bde5f132bbbba381b83496d2533ec50f7
5
5
  SHA512:
6
- metadata.gz: bc6e02b51beaa955f42a8846392e1bb9439e4a59b358105188b91f6952e91a7fd1ce5e5c9cc1702389a358e0a6d3ea27c936d4f042c6f2d59e73b309d7d6d104
7
- data.tar.gz: 462a4d94ad07bc7974a4053db981c02b93b76af412934f6747fbcec42430de31e999b757fc6ca1e1fae5c49956209f968eb430e12f518a1f3d4467fd2857f832
6
+ metadata.gz: 1e3b89a22aa4f6a7d6c6217ddc7f0b7e04e1dd0311f837ea69d8600b9fe6bcb4c22843c2974f1a9deaebca7e377e491710612d7a4aca0622932ba847208834f6
7
+ data.tar.gz: ea609977601a7920db1d8257ce8b94a51de09e30018e02f0aee90c0b4c0637cd6ae116c2dbb25b64f3748756128ff2a2550f4ba118b80ea12191cbfac1abfd3c
data/CHANGELOG.md CHANGED
@@ -4,7 +4,14 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
- ## [0.1.0] - 2020-01-24
7
+ ## 0.1.1 - 2020-01-27
8
+
9
+ ### Added
10
+ - import directive support
11
+ - generator always renews all generated _twirp and _pb files from all protos to support import directive
12
+ - lib/twirp added to $LOAD_PATH
13
+
14
+ ## 0.1.0 - 2020-01-24
8
15
 
9
16
  ### Added
10
17
  - mount_twirp route helper
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- twirp_rails (0.1.0)
4
+ twirp_rails (0.1.1)
5
5
  railties (~> 6.0)
6
6
  twirp (~> 1)
7
7
 
@@ -25,11 +25,14 @@ class TwirpGenerator < Rails::Generators::NamedBase
25
25
  end
26
26
  end
27
27
 
28
+ describe 'Generate twirp files'
28
29
  def generate_twirp_files
29
- cmd = protoc_cmd
30
-
31
30
  in_root do
31
+ cmd = protoc_cmd
32
+
32
33
  `#{cmd}`
34
+
35
+ raise "protoc failure: #{cmd}" unless $?.success?
33
36
  end
34
37
  end
35
38
 
@@ -73,7 +76,8 @@ class TwirpGenerator < Rails::Generators::NamedBase
73
76
  FileUtils.mkdir_p 'lib/twirp'
74
77
  flags = "--proto_path=app/protos --ruby_out=lib/twirp --twirp_ruby_out=lib/twirp --plugin=#{PLUGIN_PATH}"
75
78
 
76
- "#{PROTOC_PATH} #{flags} app/protos/#{file_name}.proto"
79
+ proto_files = Dir.glob 'app/protos/*.proto'
80
+ "#{PROTOC_PATH} #{flags} #{proto_files.join(' ')}"
77
81
  end
78
82
 
79
83
  def proto_content
@@ -1,6 +1,10 @@
1
1
  module TwirpRails
2
2
  module Twirp
3
3
  def self.auto_require_twirp_files
4
+ # protoc generates require without path in a _pb files
5
+ twirp_path = Rails.root.join('lib/twirp').to_s
6
+ $LOAD_PATH.unshift(twirp_path) if !$LOAD_PATH.include?(twirp_path)
7
+
4
8
  Dir.glob(Rails.root.join('lib/twirp/*_twirp.rb')).sort.each do |file|
5
9
  require file
6
10
  end
@@ -1,3 +1,3 @@
1
1
  module TwirpRails
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twirp_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandr Zimin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-24 00:00:00.000000000 Z
11
+ date: 2020-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: twirp