runways 0.1.4 → 0.1.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4c44e551943aa21fadd18e8d9bf80819b77c481d1e69eb8505ab9dd18b4497dd
4
- data.tar.gz: 1374345cf8042f35132361dfe9a0d33dc2e75a0c045e33627a9b729e3c5a4f5f
3
+ metadata.gz: b8643600c0d33e46d69b23ab93f84ef082e908a830dc59ae34a0658366e9de4c
4
+ data.tar.gz: 1d365e31477a4d5107f268ff85f886cfa02f2935dd84f599e4cf667b0909bf57
5
5
  SHA512:
6
- metadata.gz: 11dff89b2e5582f36bafa7bd40cf73e144e2ce52f74b97acd89fc7c98bacb5e2d877c03384e9c910a859976c488b75ceae3c1d6a4582bc38d3d6bf7666e74b19
7
- data.tar.gz: 458c4dcd22cd38d043023bb031bf45088cae978d52372ae04a234998222718b7e899960f711a44463cc443b39e44c0433e0127d17b2590101b3397bd8bee3758
6
+ metadata.gz: 8b3bc75c7778c983af7f9549dd5344556e6a66d7771233e99de4406648698943011875a98f0e55b3cb56baa0a3ff9ef5fcae027aa9d4929a498de6d19475e75e
7
+ data.tar.gz: b663acca7e013ab696f3259bbf8dcb8019acddea5f12e215f2f9fbc1d0d9b93770e83dc4f1f02ed3f51b9a9b196cae2ad9c2e9ad347e24920e2cdd34fbb72ae8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- runways (0.1.4)
4
+ runways (0.1.5)
5
5
  activerecord (~> 5.2)
6
6
  grpc (~> 1.16)
7
7
  grpc-tools (~> 1.16)
@@ -34,7 +34,7 @@ GEM
34
34
  concurrent-ruby (~> 1.0)
35
35
  minitest (5.11.3)
36
36
  rake (10.5.0)
37
- thor (0.20.0)
37
+ thor (0.20.3)
38
38
  thread_safe (0.3.6)
39
39
  tzinfo (1.2.5)
40
40
  thread_safe (~> 0.1)
data/README.md CHANGED
@@ -8,11 +8,11 @@ Install Runways at the command prompt:
8
8
 
9
9
  $ gem install runways
10
10
 
11
- Create a new runways application
11
+ Create a new runways application:
12
12
 
13
13
  $ runways hello
14
14
 
15
- Run the following rake task to update protobuf files
15
+ Run the following rake task to update protobuf files:
16
16
  ```ruby
17
17
  rake protobuf_files:update
18
18
  ```
@@ -35,5 +35,16 @@ The gem is available as open source under the terms of the [MIT License](https:/
35
35
  Everyone interacting in the Runways project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/runways/blob/master/CODE_OF_CONDUCT.md).
36
36
 
37
37
  ## TODO
38
- - [*] Setup rake tasks for active record migrations
38
+ - [x] Setup rake tasks for active record migrations
39
+ - [x] Create a sample RPC
40
+ - [ ] Setup logging
39
41
  - [ ] Use ActiveRecord generators to handle ActiveRecord related tasks ( ex: generate migration, migrate, rollback )
42
+ - [ ] Create runways controller
43
+ - [ ] Refactor generator code
44
+ - [ ] Refactor code to generate protobuf files when the application is initialized
45
+ - [ ] Handle loading the server without DbConfig setup
46
+ - [ ] Handle DbConfig in the ActiveRecord style
47
+ - [ ] Modify rake task to replace `require` with `require_relative` in the services pb file
48
+ - [ ] Handle file loading like how rails handles it
49
+ - [ ] Accept package name from command line
50
+ - [ ] Don't hard code port
@@ -20,12 +20,13 @@ class AppStructure < Thor::Group
20
20
  lib_protos_directory = lib_directory + "/protos"
21
21
  tasks_directory = lib_directory + "/tasks"
22
22
  config_directory = root_directory + "/config"
23
+ test_directory = root_directory + "/test"
23
24
 
24
25
  create_following_dirs([
25
26
  root_directory, app_directory, config_directory,
26
27
  lib_directory, lib_protos_directory, tasks_directory,
27
28
  models_directory, controller_directory,
28
- db_directory, migration_directory,
29
+ db_directory, migration_directory, test_directory,
29
30
  ])
30
31
  end
31
32
 
@@ -82,6 +83,16 @@ class AppStructure < Thor::Group
82
83
  template("templates/protobuf_rake.tt", "#{name}/lib/tasks/generate_protobuf_files.rake")
83
84
  end
84
85
 
86
+ def generate_test_client_file
87
+ template("templates/test_client.tt", "#{name}/test/test_client.rb")
88
+ end
89
+
90
+ def run_protoc_cmd
91
+ inside(name) do
92
+ run ("grpc_tools_ruby_protoc -I proto --ruby_out=lib/protos --grpc_out=lib/protos proto/#{name.underscore}.proto")
93
+ end
94
+ end
95
+
85
96
  private
86
97
  def create_following_dirs(dir_paths)
87
98
  dir_paths.each do |dir_path|
@@ -3,14 +3,11 @@
3
3
  class DbConfig
4
4
  def self.config
5
5
  {
6
- adapter: '',
7
- host: '',
8
- username: '',
9
- password: '',
10
- database: '',
11
- pool: '',
12
- timeout: '',
13
- reconnect: true
6
+ adapter: 'sqlite3',
7
+ host: 'localhost',
8
+ database: 'db/development.sqlite3',
9
+ pool: 5,
10
+ timeout: 5000,
14
11
  }
15
12
  end
16
13
  end
@@ -1,3 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'runways', '<%= Runways::VERSION %>'
4
+ gem "sqlite3", "~> 1.3.6"
@@ -2,4 +2,13 @@ syntax = 'proto3';
2
2
  package <%= name %>;
3
3
 
4
4
  service <%= name.camelcase %>Service {
5
+ rpc Hello( HelloRequest ) returns ( HelloResponse ) {}
6
+ }
7
+
8
+ message HelloRequest {
9
+ string name = 1;
10
+ }
11
+
12
+ message HelloResponse {
13
+ string body = 1;
5
14
  }
@@ -9,8 +9,11 @@ ActiveRecord::Base.establish_connection(
9
9
  )
10
10
 
11
11
  require './lib/protos/<%= name.underscore %>_services_pb'
12
- require './config/initializers'
13
- require './app'
14
12
 
15
13
  class <%= name.camelcase %>Service < <%= name.camelcase %>::<%= name.camelcase %>Service::Service
14
+ def hello(request, _unused_call)
15
+ <%= name.camelcase %>::HelloResponse.new(
16
+ body: "Hello #{request.name}"
17
+ )
18
+ end
16
19
  end
@@ -0,0 +1,11 @@
1
+ require './lib/protos/<%= name.underscore %>_services_pb'
2
+
3
+ require 'grpc'
4
+
5
+ stub = <%= name.camelcase %>::<%= name.camelcase %>Service::Stub.new(
6
+ '0.0.0.0:50052', :this_channel_is_insecure
7
+ )
8
+
9
+ request = <%= name.camelcase %>::HelloRequest.new(name: "Aliens")
10
+ response = stub.hello(request)
11
+ puts response.body
@@ -1,3 +1,3 @@
1
1
  module Runways
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runways
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - NG
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-13 00:00:00.000000000 Z
11
+ date: 2018-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -126,6 +126,7 @@ files:
126
126
  - lib/runways/generators/templates/rakefile.tt
127
127
  - lib/runways/generators/templates/server.tt
128
128
  - lib/runways/generators/templates/service.tt
129
+ - lib/runways/generators/templates/test_client.tt
129
130
  - lib/runways/version.rb
130
131
  - runways.gemspec
131
132
  homepage: https://github.com