hadron 0.1.9 → 0.2.0

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: bb4ca11e52b69b419fec21b50deba543360b52c44fa9fc1dbd89b37cb2941b20
4
- data.tar.gz: d55188ebdc16519b0fea96d2fed192606441d05cf6648ac865cbe77cdfa3e8d1
3
+ metadata.gz: 836d0642c237e54d4d4282d17a161a278597de0100cecd1fa78b9f4655bd4083
4
+ data.tar.gz: e5bae8b65d85a3c2853dae5ea7f1d9495a1ed13f5b0b41c0f5dbd3645ba85719
5
5
  SHA512:
6
- metadata.gz: 898126e184f02d412c73a6dcd341a5df9eb615df3e6ff11128ab9006a8a9abd8a96c86b312ea904944463f04848c162ae3170bb371ea9918ad16a9229db5a92b
7
- data.tar.gz: 66a948bb3491226ddca6ff5fc3918562304cf4a20d3b44b50c5a2a80c19c0bc9e68e437781cebc2ae1937ce9cd9f835e9b549380d3f7c2c3597ef2d7f7b3b1f7
6
+ metadata.gz: 59a91ebd5dbf14b587b7f542f80494713ac2a74e538c6a708151337eb6c8bc3c96c8ea7c0f5c5adda40d16278d5e28db45950bce95536207221915384080e478
7
+ data.tar.gz: de4427b653f5adfa0c87dfba6efdaaeb5ec25cdaff0c4a57414cb46ccd7dbfe12b0966ab3b874a79fafc90822965339356478031f7356e3afe5f354a5e9e9fc1
data/Gemfile CHANGED
@@ -5,10 +5,9 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in hadron.gemspec
6
6
  gemspec
7
7
 
8
+ gem "fileutils", "~> 1.7"
8
9
  gem "pry", "~> 0.14.1"
9
10
  gem "rake", "~> 13.0"
10
11
  gem "rspec", "~> 3.0"
11
12
  gem "rubocop", "~> 1.21"
12
-
13
13
  gem "thor", "~> 1.2"
14
- gem "fileutils", "~> 1.7"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hadron (0.1.9)
4
+ hadron (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Hadron
4
- VERSION = "0.1.9"
4
+ VERSION = "0.2.0"
5
5
  end
@@ -0,0 +1,27 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ pull_request:
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+ name: Ruby ${{ matrix.ruby }}
14
+ strategy:
15
+ matrix:
16
+ ruby:
17
+ - '3.1.2'
18
+
19
+ steps:
20
+ - uses: actions/checkout@v3
21
+ - name: Set up Ruby
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby }}
25
+ bundler-cache: true
26
+ - name: Run the default task
27
+ run: bundle exec rake
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2022-12-31
4
+
5
+ - Initial release
@@ -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 kerandisylvance@gmail.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.
@@ -0,0 +1,54 @@
1
+ # Project
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/project`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Install the gem and add to the application's Gemfile by executing:
10
+
11
+ $ bundle add project
12
+
13
+ If bundler is not being used to manage dependencies, install the gem by executing:
14
+
15
+ $ gem install project
16
+
17
+ ## Usage
18
+
19
+ ### Running the Server
20
+ To start the gRPC server, run the following command in the root directory of the project:
21
+
22
+ ```bash
23
+ bundle exec server run
24
+ ```
25
+
26
+ This will start the server and listen for incoming gRPC requests on port 50051.
27
+
28
+ ### Customizing the Server
29
+
30
+ To customize the gRPC server, you can modify the helloworld.proto file in the lib/proto directory to define your own gRPC service and messages. You can then regenerate the Ruby code for the service using the grpc_tools_ruby_protoc command:
31
+
32
+ ```bash
33
+ bundle exec grpc_tools_ruby_protoc -I lib/proto --ruby_out=lib --grpc_out=lib lib/proto/helloworld.proto
34
+ ```
35
+
36
+ You can also modify the helloworld_services.rb file in the lib directory to define the logic for handling gRPC requests and responses.
37
+
38
+ ### Testing the Server
39
+
40
+ To test the gRPC server, you can use a gRPC client to send requests to the server and verify the responses. You can find more information about creating gRPC clients in Ruby in the gRPC documentation.
41
+
42
+ ## Development
43
+
44
+ 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.
45
+
46
+ 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).
47
+
48
+ ## Contributing
49
+
50
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/project. 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]/project/blob/main/CODE_OF_CONDUCT.md).
51
+
52
+ ## Code of Conduct
53
+
54
+ Everyone interacting in the Project project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/project/blob/main/CODE_OF_CONDUCT.md).
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "project"
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
@@ -1,4 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
 
5
+ # Specify your gem's dependencies in project.gemspec
6
+ gemspec
7
+
3
8
  gem "grpc"
4
9
  gem "grpc-tools"
10
+ gem "pry", "~> 0.14.1"
11
+ gem "rake", "~> 13.0"
12
+ gem "rspec", "~> 3.0"
13
+ gem "rubocop", "~> 1.21"
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Project
4
+ class Server
5
+ attr_accessor :port
6
+
7
+ def initialize(port: "50051")
8
+ @port = port
9
+ end
10
+
11
+ def call
12
+ s = GRPC::RpcServer.new
13
+ http_port = "0.0.0.0:" + port
14
+ s.add_http2_port(http_port, :this_port_is_insecure)
15
+ s.handle(Project::Services::GreeterServer)
16
+ s.run_till_terminated_or_interrupted([1, "int", "SIGQUIT"])
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "grpc"
4
+
5
+ module Project
6
+ module Services
7
+ class GreeterService < Helloworld::Greeter::Service
8
+ def say_hello(hello_req, _unused_call)
9
+ Helloworld::HelloResponse.new(message: "Hello \#{hello_req.name}")
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Project
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ Dir[File.join(__dir__, "project", "*.rb")].sort.each { |file| require file }
4
+
5
+ module Project
6
+ class Error < StandardError; end
7
+ end
@@ -0,0 +1,13 @@
1
+ syntax = "proto3";
2
+
3
+ service Greeter {
4
+ rpc SayHello (HelloRequest) returns (HelloResponse) {}
5
+ }
6
+
7
+ message HelloRequest {
8
+ string name = 1;
9
+ }
10
+
11
+ message HelloResponse {
12
+ string message = 1;
13
+ }
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/project/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "project"
7
+ spec.version = Project::VERSION
8
+ spec.authors = ["project"]
9
+ spec.email = ["project@email.com"]
10
+
11
+ spec.summary = "Project summary."
12
+ spec.description = "Project description."
13
+ spec.homepage = "Project homepage URL."
14
+ spec.required_ruby_version = ">= 2.6.0"
15
+
16
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
17
+
18
+ spec.metadata["homepage_uri"] = spec.homepage
19
+ spec.metadata["source_code_uri"] = "https://example.com"
20
+ spec.metadata["changelog_uri"] = "https://example.com"
21
+
22
+ # Specify which files should be added to the gem when it is released.
23
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
+ spec.files = Dir.chdir(__dir__) do
25
+ `git ls-files -z`.split("\x0").reject do |f|
26
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
27
+ end
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ # Uncomment to register a new dependency of your gem
34
+ # spec.add_dependency "example-gem", "~> 1.0"
35
+
36
+ # For more information and examples about making a new gem, check out our
37
+ # guide at: https://bundler.io/guides/creating_gem.html
38
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe Project do
4
+ it "has a version number" do
5
+ expect(Project::VERSION).not_to be nil
6
+ end
7
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "project"
4
+
5
+ RSpec.configure do |config|
6
+ # Enable flags like --only-failures and --next-failure
7
+ config.example_status_persistence_file_path = ".rspec_status"
8
+
9
+ # Disable RSpec exposing methods globally on `Module` and `main`
10
+ config.disable_monkey_patching!
11
+
12
+ config.expect_with :rspec do |c|
13
+ c.syntax = :expect
14
+ end
15
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hadron
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvance
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-30 00:00:00.000000000 Z
11
+ date: 2022-12-31 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ruby framework called Hadron that allows you to work with gRPC Ruby output
14
14
  easily.
@@ -32,11 +32,26 @@ files:
32
32
  - lib/hadron.rb
33
33
  - lib/hadron/cli.rb
34
34
  - lib/hadron/version.rb
35
+ - templates/.github/workflows/main.yml.erb
36
+ - templates/.gitignore.erb
37
+ - templates/.rspec.erb
38
+ - templates/.rubocop.yml.erb
39
+ - templates/CHANGELOG.md.erb
40
+ - templates/CODE_OF_CONDUCT.md.erb
41
+ - templates/README.md.erb
42
+ - templates/Rakefile.erb
43
+ - templates/bin/console.erb
44
+ - templates/bin/setup.erb
35
45
  - templates/gemfile.erb
46
+ - templates/lib/project.rb.erb
47
+ - templates/lib/project/server.rb.erb
48
+ - templates/lib/project/services/greeter_service.rb.erb
49
+ - templates/lib/project/version.rb.erb
50
+ - templates/lib/proto.erb
51
+ - templates/project.gemspec.erb
36
52
  - templates/proto.erb
37
- - templates/readme.md
38
- - templates/server.rb.erb
39
- - templates/services.rb.erb
53
+ - templates/spec/project_spec.rb.erb
54
+ - templates/spec/spec_helper.rb.erb
40
55
  homepage: https://github.com/Sylvance/hadron
41
56
  licenses: []
42
57
  metadata:
data/templates/readme.md DELETED
@@ -1,53 +0,0 @@
1
- # Welcome to the gRPC Ruby Server Project
2
-
3
- This project is a template for creating a gRPC Ruby server using the [gRPC gem](https://github.com/grpc/grpc). It includes the necessary dependencies and files to get started with building a gRPC server in Ruby.
4
-
5
- ## Prerequisites
6
-
7
- Before getting started, make sure you have the following installed on your machine:
8
-
9
- - [Ruby](https://www.ruby-lang.org/) (version 2.6 or higher)
10
- - [Bundler](https://bundler.io/) (for installing dependencies)
11
-
12
- ## Installation
13
-
14
- To install the dependencies for this project, run the following command in the root directory of the project:
15
-
16
- ```bash
17
- bundle install
18
- ```
19
-
20
- ## Running the Server
21
- To start the gRPC server, run the following command in the root directory of the project:
22
-
23
- ```bash
24
- ruby server.rb
25
- ```
26
-
27
- This will start the server and listen for incoming gRPC requests on port 50051.
28
-
29
- ## Customizing the Server
30
-
31
- To customize the gRPC server, you can modify the helloworld.proto file in the lib/proto directory to define your own gRPC service and messages. You can then regenerate the Ruby code for the service using the grpc_tools_ruby_protoc command:
32
-
33
- ```bash
34
- bundle exec grpc_tools_ruby_protoc -I lib/proto --ruby_out=lib --grpc_out=lib lib/proto/helloworld.proto
35
- ```
36
-
37
- You can also modify the helloworld_services.rb file in the lib directory to define the logic for handling gRPC requests and responses.
38
-
39
- ## Testing the Server
40
-
41
- To test the gRPC server, you can use a gRPC client to send requests to the server and verify the responses. You can find more information about creating gRPC clients in Ruby in the gRPC documentation.
42
-
43
- ## Deployment
44
-
45
- To deploy the gRPC server, you can follow the steps for deploying a gRPC server in your preferred environment. You can find more information about deploying gRPC servers in the gRPC documentation.
46
-
47
- ## Contributing
48
-
49
- We welcome contributions to this project! If you have an idea for how to improve the gRPC Ruby server template, please feel free to open an issue or pull request.
50
-
51
- ## License
52
-
53
- This project is licensed under the MIT License. See the LICENSE file for more information.
@@ -1,13 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "helloworld_services"
5
-
6
- def main
7
- s = GRPC::RpcServer.new
8
- s.add_http2_port("0.0.0.0:50051", :this_port_is_insecure)
9
- s.handle(Helloworld::GreeterServer)
10
- s.run_till_terminated_or_interrupted([1, "int", "SIGQUIT"])
11
- end
12
-
13
- main
@@ -1,9 +0,0 @@
1
- require "grpc"
2
-
3
- module Helloworld
4
- class GreeterServer < Helloworld::Greeter::Service
5
- def say_hello(hello_req, _unused_call)
6
- Helloworld::HelloResponse.new(message: "Hello \#{hello_req.name}")
7
- end
8
- end
9
- end