souls 0.8.1 → 0.8.6

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.
@@ -1 +0,0 @@
1
- 2.7.2
@@ -1 +0,0 @@
1
- 2.7.2
@@ -1,16 +0,0 @@
1
- FROM ruby:2.7.2
2
- RUN apt-get update -qq && apt-get install -y nodejs postgresql-client
3
-
4
- USER root
5
-
6
- RUN mkdir /myapp
7
- WORKDIR /myapp
8
-
9
- COPY Gemfile /myapp/Gemfile
10
- COPY Gemfile.lock /myapp/Gemfile.lock
11
- RUN gem install bundler:2.1.4
12
- RUN bundle
13
- COPY . /myapp
14
-
15
- EXPOSE 50051
16
- CMD ["rake", "run_server"]
@@ -1,41 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "activerecord", require: "active_record"
4
- gem "dotenv", "2.7.6"
5
- gem "grpc", "1.34.0"
6
- gem "grpc-tools", "1.34.0"
7
- gem "jwt", "2.2.2"
8
- gem "rake", "13.0.3"
9
- gem "zeitwerk", "2.4.2"
10
-
11
- ## Select DB gem.
12
- # Firestore
13
- gem "google-cloud-firestore"
14
-
15
- # NoSQL
16
- # gem "mongoid", "7.2"
17
-
18
- # PostgreSQL
19
- # gem "pg", ">= 0.18", "< 2.0"
20
-
21
- group :development, :test do
22
- gem "byebug", platforms: %i[mri mingw x64_mingw]
23
- gem "capybara", "2.18.0"
24
- gem "capybara-user_agent", "0.0.3"
25
- gem "database_cleaner", "1.8.5"
26
- gem "factory_bot", "6.1.0"
27
- gem "faker", "2.15.1"
28
- gem "rack-test", "1.1.0"
29
- gem "rspec", "3.10.0"
30
- gem "rubocop", "1.7.0"
31
- gem "souls", "0.8.0"
32
- gem "webmock", "3.11.0"
33
- end
34
-
35
- group :development do
36
- gem "listen", "~> 3.2"
37
- gem "spring", "2.1.0"
38
- gem "spring-watcher-listen", "~> 2.0.0"
39
- end
40
-
41
- gem "tzinfo-data", platforms: %i[mingw mswin x64_mingw jruby]
@@ -1,191 +0,0 @@
1
- GEM
2
- remote: https://rubygems.org/
3
- specs:
4
- activemodel (6.1.1)
5
- activesupport (= 6.1.1)
6
- activerecord (6.1.1)
7
- activemodel (= 6.1.1)
8
- activesupport (= 6.1.1)
9
- activesupport (6.1.1)
10
- concurrent-ruby (~> 1.0, >= 1.0.2)
11
- i18n (>= 1.6, < 2)
12
- minitest (>= 5.1)
13
- tzinfo (~> 2.0)
14
- zeitwerk (~> 2.3)
15
- addressable (2.7.0)
16
- public_suffix (>= 2.0.2, < 5.0)
17
- ast (2.4.1)
18
- byebug (11.1.3)
19
- capybara (2.18.0)
20
- addressable
21
- mini_mime (>= 0.1.3)
22
- nokogiri (>= 1.3.3)
23
- rack (>= 1.0.0)
24
- rack-test (>= 0.5.4)
25
- xpath (>= 2.0, < 4.0)
26
- capybara-user_agent (0.0.3)
27
- capybara (~> 2.0, >= 2.0.2)
28
- concurrent-ruby (1.1.7)
29
- crack (0.4.5)
30
- rexml
31
- database_cleaner (1.8.5)
32
- diff-lcs (1.4.4)
33
- dotenv (2.7.6)
34
- factory_bot (6.1.0)
35
- activesupport (>= 5.0.0)
36
- faker (2.15.1)
37
- i18n (>= 1.6, < 2)
38
- faraday (1.2.0)
39
- multipart-post (>= 1.2, < 3)
40
- ruby2_keywords
41
- ffi (1.14.2)
42
- foreman (0.87.2)
43
- gapic-common (0.3.4)
44
- google-protobuf (~> 3.12, >= 3.12.2)
45
- googleapis-common-protos (>= 1.3.9, < 2.0)
46
- googleapis-common-protos-types (>= 1.0.4, < 2.0)
47
- googleauth (~> 0.9)
48
- grpc (~> 1.25)
49
- google-cloud-core (1.5.0)
50
- google-cloud-env (~> 1.0)
51
- google-cloud-errors (~> 1.0)
52
- google-cloud-env (1.4.0)
53
- faraday (>= 0.17.3, < 2.0)
54
- google-cloud-errors (1.0.1)
55
- google-cloud-firestore (2.4.0)
56
- concurrent-ruby (~> 1.0)
57
- google-cloud-core (~> 1.5)
58
- google-cloud-firestore-v1 (~> 0.0)
59
- rbtree (~> 0.4.2)
60
- google-cloud-firestore-v1 (0.2.2)
61
- gapic-common (~> 0.3)
62
- google-cloud-errors (~> 1.0)
63
- google-protobuf (3.14.0)
64
- googleapis-common-protos (1.3.10)
65
- google-protobuf (~> 3.11)
66
- googleapis-common-protos-types (>= 1.0.5, < 2.0)
67
- grpc (~> 1.27)
68
- googleapis-common-protos-types (1.0.5)
69
- google-protobuf (~> 3.11)
70
- googleauth (0.14.0)
71
- faraday (>= 0.17.3, < 2.0)
72
- jwt (>= 1.4, < 3.0)
73
- memoist (~> 0.16)
74
- multi_json (~> 1.11)
75
- os (>= 0.9, < 2.0)
76
- signet (~> 0.14)
77
- grpc (1.34.0)
78
- google-protobuf (~> 3.13)
79
- googleapis-common-protos-types (~> 1.0)
80
- grpc-tools (1.34.0)
81
- hashdiff (1.0.1)
82
- i18n (1.8.7)
83
- concurrent-ruby (~> 1.0)
84
- jwt (2.2.2)
85
- listen (3.4.1)
86
- rb-fsevent (~> 0.10, >= 0.10.3)
87
- rb-inotify (~> 0.9, >= 0.9.10)
88
- memoist (0.16.2)
89
- mini_mime (1.0.2)
90
- mini_portile2 (2.5.0)
91
- minitest (5.14.3)
92
- multi_json (1.15.0)
93
- multipart-post (2.1.1)
94
- nokogiri (1.11.1)
95
- mini_portile2 (~> 2.5.0)
96
- racc (~> 1.4)
97
- os (1.1.1)
98
- parallel (1.20.1)
99
- parser (3.0.0.0)
100
- ast (~> 2.4.1)
101
- public_suffix (4.0.6)
102
- racc (1.5.2)
103
- rack (2.2.3)
104
- rack-test (1.1.0)
105
- rack (>= 1.0, < 3)
106
- rainbow (3.0.0)
107
- rake (13.0.3)
108
- rb-fsevent (0.10.4)
109
- rb-inotify (0.10.1)
110
- ffi (~> 1.0)
111
- rbtree (0.4.2)
112
- regexp_parser (2.0.2)
113
- rexml (3.2.4)
114
- rspec (3.10.0)
115
- rspec-core (~> 3.10.0)
116
- rspec-expectations (~> 3.10.0)
117
- rspec-mocks (~> 3.10.0)
118
- rspec-core (3.10.1)
119
- rspec-support (~> 3.10.0)
120
- rspec-expectations (3.10.1)
121
- diff-lcs (>= 1.2.0, < 2.0)
122
- rspec-support (~> 3.10.0)
123
- rspec-mocks (3.10.1)
124
- diff-lcs (>= 1.2.0, < 2.0)
125
- rspec-support (~> 3.10.0)
126
- rspec-support (3.10.1)
127
- rubocop (1.7.0)
128
- parallel (~> 1.10)
129
- parser (>= 2.7.1.5)
130
- rainbow (>= 2.2.2, < 4.0)
131
- regexp_parser (>= 1.8, < 3.0)
132
- rexml
133
- rubocop-ast (>= 1.2.0, < 2.0)
134
- ruby-progressbar (~> 1.7)
135
- unicode-display_width (>= 1.4.0, < 2.0)
136
- rubocop-ast (1.3.0)
137
- parser (>= 2.7.1.5)
138
- ruby-progressbar (1.10.1)
139
- ruby2_keywords (0.0.2)
140
- signet (0.14.0)
141
- addressable (~> 2.3)
142
- faraday (>= 0.17.3, < 2.0)
143
- jwt (>= 1.5, < 3.0)
144
- multi_json (~> 1.10)
145
- souls (0.8.0)
146
- spring (2.1.0)
147
- spring-watcher-listen (2.0.1)
148
- listen (>= 2.7, < 4.0)
149
- spring (>= 1.2, < 3.0)
150
- tzinfo (2.0.4)
151
- concurrent-ruby (~> 1.0)
152
- unicode-display_width (1.7.0)
153
- webmock (3.11.0)
154
- addressable (>= 2.3.6)
155
- crack (>= 0.3.2)
156
- hashdiff (>= 0.4.0, < 2.0.0)
157
- xpath (3.2.0)
158
- nokogiri (~> 1.8)
159
- zeitwerk (2.4.2)
160
-
161
- PLATFORMS
162
- ruby
163
-
164
- DEPENDENCIES
165
- activerecord
166
- byebug
167
- capybara (= 2.18.0)
168
- capybara-user_agent (= 0.0.3)
169
- database_cleaner (= 1.8.5)
170
- dotenv (= 2.7.6)
171
- factory_bot (= 6.1.0)
172
- faker (= 2.15.1)
173
- foreman (= 0.87.2)
174
- google-cloud-firestore
175
- grpc (= 1.34.0)
176
- grpc-tools (= 1.34.0)
177
- jwt (= 2.2.2)
178
- listen (~> 3.2)
179
- rack-test (= 1.1.0)
180
- rake (= 13.0.3)
181
- rspec (= 3.10.0)
182
- rubocop (= 1.7.0)
183
- souls (= 0.8.0)
184
- spring (= 2.1.0)
185
- spring-watcher-listen (~> 2.0.0)
186
- tzinfo-data
187
- webmock (= 3.11.0)
188
- zeitwerk (= 2.4.2)
189
-
190
- BUNDLED WITH
191
- 2.1.4
@@ -1,75 +0,0 @@
1
- # gRPC Ruby Server
2
- gRPC Ruby Server Boilerplate
3
-
4
- <p align="center">
5
-
6
- <a aria-label="Ruby logo" href="https://el-soul.com">
7
- <img src="https://badgen.net/badge/icon/Made%20by%20ELSOUL?icon=ruby&label&color=black&labelColor=black">
8
- </a>
9
- <br/>
10
- </p>
11
-
12
- ## Installation
13
-
14
- git clone
15
-
16
- ```
17
- git clone git@github.com:elsoul/grpc-ruby-server.git
18
- cd grpc-ruby-server
19
- bundle install
20
- ```
21
-
22
-
23
-
24
- ## Usage
25
-
26
- Check Rakefile to see what command is available
27
-
28
- ```ruby
29
- rake -T
30
- ```
31
-
32
-
33
- # Run Server on local
34
-
35
- ```ruby
36
- rake run_server
37
- ```
38
-
39
- # Run Server with Docker
40
-
41
- ```ruby
42
- rake run_test
43
- ```
44
-
45
- # Run Client to check response
46
-
47
- ```ruby
48
- rake run_client
49
- ```
50
-
51
- Then you will get response below;
52
-
53
- ```
54
- "Greeting: Hello world"
55
- "Greeting: Hello again, world"
56
- ```
57
-
58
-
59
- ## Development
60
-
61
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
62
-
63
- 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/gems/grpc-ruby-server).
64
-
65
- ## Contributing
66
-
67
- Bug reports and pull requests are welcome on GitHub at https://github.com/elsoul/grpc-ruby-server. 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.
68
-
69
- ## License
70
-
71
- The gem is available as open source under the terms of the [Apache-2.0 License](https://www.apache.org/licenses/LICENSE-2.0).
72
-
73
- ## Code of Conduct
74
-
75
- Everyone interacting in the HotelPrice project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/elsoul/grpc-ruby-server/blob/master/CODE_OF_CONDUCT.md).
@@ -1,34 +0,0 @@
1
- require "yaml"
2
- require "erb"
3
- require "logger"
4
-
5
- desc "Generate proto files"
6
- task :proto do
7
- system "grpc_tools_ruby_protoc -I ./protos --ruby_out=./app/services --grpc_out=./app/services ./protos/blog.proto"
8
- end
9
-
10
- desc "Run gRPC Server"
11
- task :run_server do
12
- system "ruby grpc_server.rb"
13
- end
14
-
15
- desc "Run gRPC Client"
16
- task :run_client do
17
- system "ruby greeter_client.rb"
18
- end
19
-
20
- desc "Run gRPC Server with Docker"
21
- task :run_test do
22
- system "docker build . -t souls_service:latest"
23
- system "docker rm -f web"
24
- system "docker run --name web -p 50051:50051 souls_service:latest"
25
- end
26
-
27
- desc "Update Google Container Registry"
28
- task :update do
29
- version = ARGV[1]
30
- project_id = "elsoul2"
31
- system("docker build . -t souls_service:#{version}")
32
- system("docker tag souls_service:#{version} asia.gcr.io/#{project_id}/souls_service:#{version}")
33
- system("docker push asia.gcr.io/#{project_id}/souls_service:#{version}")
34
- end
@@ -1,26 +0,0 @@
1
- require "grpc"
2
- require "yaml"
3
- require "erb"
4
- require "logger"
5
- require "zeitwerk"
6
- require "dotenv/load"
7
- require "google/cloud/firestore"
8
- require "./app"
9
-
10
- ENV["SOULS_ENV"] ||= "development"
11
-
12
- # NoSQL Conf
13
- # YAML.safe_load(ERB.new(File.new("./config/mongoid.yml").read).result)
14
-
15
- ## SQL Conf
16
- # db_conf = YAML.safe_load(ERB.new(File.read("./config/database.yml")).result, [], [], true)
17
- # ActiveRecord::Base.establish_connection(db_conf[ENV["RACK_ENV"]])
18
-
19
- loader = Zeitwerk::Loader.new
20
- loader.push_dir("#{Dir.pwd}/app/controllers")
21
- loader.push_dir("#{Dir.pwd}/app/services")
22
- loader.do_not_eager_load("#{Dir.pwd}/app/services")
23
- loader.collapse("#{__dir__}/app/services")
24
- loader.setup
25
-
26
- loader.eager_load
@@ -1,3 +0,0 @@
1
- class ApplicationController < Souls::Blog::Service
2
- include ArticleMethod, HelloMethod
3
- end
@@ -1,60 +0,0 @@
1
- module ArticleMethod
2
- def create_article(grpc_req, _unused_call)
3
- logger = Logger.new(STDOUT)
4
- firestore = Google::Cloud::Firestore.new
5
- article = firestore.col("articles").doc
6
- article.set({})
7
- data = firestore.col("articles").doc(article.document_id)
8
- article_hash = {
9
- id: article.document_id,
10
- user_id: grpc_req.user_id,
11
- title: grpc_req.title,
12
- body: grpc_req.body,
13
- thumnail_url: grpc_req.thumnail_url,
14
- public_date: grpc_req.public_date,
15
- is_public: grpc_req.is_public,
16
- tag: grpc_req.tag.to_a,
17
- created_at: Time.now.utc,
18
- updated_at: Time.now.utc
19
- }
20
- data.update article_hash
21
- res = Souls::CreateArticleReply.new(
22
- { article: article_hash }
23
- )
24
- logger.info res.article
25
- res
26
- rescue StandardError => error
27
- logger.debug error
28
- end
29
-
30
- def get_article(grpc_req, _unused_call)
31
- logger = Logger.new(STDOUT)
32
- article = Article.find(grpc_req.id)
33
- reply = JSON.parse(article.to_json)
34
- reply["created_at"] = article.created_at.to_s
35
- reply["updated_at"] = article.updated_at.to_s
36
- res = Souls::GetArticleReply.new(
37
- { article: Souls::Article.new(reply) }
38
- )
39
- logger.info res.article
40
- res
41
- rescue StandardError => error
42
- logger.debug error
43
- end
44
-
45
- def get_articles
46
- return enum_for(:get_articles) unless block_given?
47
- q = ::Article
48
- limit = 100
49
- q.limit(limit).each do |article|
50
- sleep(rand(0.01..0.3))
51
- Souls::Article.new article.to_proto
52
- end
53
- rescue StandardError => e
54
- fail!(:internal, :unknown, "Unknown error when listing Articles: #{e.message}")
55
- end
56
-
57
- def update_article(grpc_req, _unused_call); end
58
-
59
- def delete_article(grpc_req, _unused_call); end
60
- end