tcp-server 1.0.1-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4b24ec50845ec5dac9b5d06a19a27575620319981f812f929e234506c8fbce9d
4
+ data.tar.gz: 1fd77e294ea65d8a69d04c25c10b829d649cfda9d745baca45389605c918b4f9
5
+ SHA512:
6
+ metadata.gz: e6c68d68dc1d5f062d3febb563064730680ffe1099358bb6da27238eca58a7f5e6f221f82d9591b0015e0f1252d20fadf2fc2e70098951bc4da50417d070d85e
7
+ data.tar.gz: e2129c54272cd36c5dbf7aa71d54abc0ed082dcd0cd5ad6f3c267aeb0b2c2b6b8475b4273f8fc8b0927f421fb36db95e8abc006f4120397a711462d574da6949
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Nels Nelson
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 all
13
+ 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 THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,123 @@
1
+ # tcp-server-jruby
2
+
3
+ [![License](https://img.shields.io/badge/license-MIT--2.0-blue.svg?style=flat)][license]
4
+
5
+ This is a small tcp server for [JRuby].
6
+
7
+ It is based on the [Netty project]. Netty is written in java, but I wanted to write ruby.
8
+
9
+
10
+ ## Quick-start
11
+
12
+ Follow these instructions to get a tcp server echo program running.
13
+
14
+
15
+ ### Docker
16
+
17
+ You may run the websocket server in a container.
18
+
19
+ ```sh
20
+ colima start
21
+ docker-compose up
22
+ ```
23
+
24
+ Building the image or running the container:
25
+
26
+ ```sh
27
+ docker build --squash --tag tcp-server-jruby .
28
+ docker run --detach --publish 4000:4000 --name tcp-server-jruby tcp-server-jruby
29
+ ```
30
+
31
+
32
+ ## Manually
33
+
34
+ If one insists, one may run everything directly with the required dependencies installed.
35
+
36
+ ### Install asdf
37
+
38
+ The [asdf] CLI tool used to manage multiple runtime versions.
39
+
40
+ ```sh
41
+ git clone https://github.com/asdf-vm/asdf.git "${HOME}/.asdf" --branch release-v0.10.0
42
+ pushd "${HOME}/.asdf"; git fetch origin; popd
43
+ source "${HOME}/.asdf/asdf.sh"; source "${HOME}/.asdf/completions/asdf.bash"
44
+ ```
45
+
46
+ ### Install required runtime software
47
+
48
+ Download and install the latest version of the [Java JDK].
49
+
50
+ ```sh
51
+ asdf plugin add java
52
+ asdf install java openjdk-17.0.2
53
+ ```
54
+
55
+
56
+ Download and install the latest version of [JRuby].
57
+
58
+ ```sh
59
+ asdf plugin add ruby
60
+ pushd "${HOME}/.asdf/plugins/ruby/ruby-build"; git fetch origin; git pull origin master; popd
61
+ # ~/.asdf/plugins/ruby/bin/list-all
62
+ asdf list all ruby
63
+ asdf install ruby jruby-9.3.4.0
64
+ ```
65
+
66
+
67
+ Install the project dependencies.
68
+
69
+ ```sh
70
+ bundle install
71
+ ```
72
+
73
+
74
+ ## Run
75
+
76
+ The entrypoint for the web application service may now be invoked from a command line interface terminal shell.
77
+
78
+ ```sh
79
+ bundle exec ./server.rb
80
+ ```
81
+
82
+
83
+ ## Build the gem
84
+
85
+ To run linting, unit tests, build the gem file, execute:
86
+
87
+ ```sh
88
+ bundle exec rake
89
+ ```
90
+
91
+
92
+ ## Publish the gem
93
+
94
+ To publish the gem after first verifying that the built gem works, execute:
95
+
96
+ ```sh
97
+ bundle exec rake verify
98
+ bundle exec rake publish
99
+ ```
100
+
101
+
102
+ ## Clean up gem artifacts
103
+
104
+ To clean the project, execute:
105
+
106
+ ```sh
107
+ bundle exec rake clean clobber
108
+ ```
109
+
110
+
111
+ ## Project file tree
112
+
113
+ Here is a bird's-eye view of the project layout.
114
+
115
+ ```sh
116
+ # date && tree
117
+ ```
118
+
119
+ [license]: https://gitlab.com/nelsnelson/tcp-server-jruby/blob/master/LICENSE
120
+ [asdf]: https://asdf-vm.com/
121
+ [Netty project]: https://github.com/netty/netty
122
+ [Java JDK]: https://www.java.com/en/download/
123
+ [JRuby]: https://jruby.org/download
data/Rakefile ADDED
@@ -0,0 +1,56 @@
1
+ # encoding: utf-8
2
+ # frozen_string_literal: false
3
+
4
+ # -*- mode: ruby -*-
5
+ # vi: set ft=ruby :
6
+
7
+ require 'rake'
8
+ require 'rake/clean'
9
+
10
+ PROJECT = File.basename(__dir__) unless defined?(PROJECT)
11
+
12
+ load "#{PROJECT}.gemspec"
13
+
14
+ CLEAN.add File.join('tmp', '**', '*'), 'tmp'
15
+ CLOBBER.add '*.gem', 'pkg'
16
+
17
+ task default: %i[package]
18
+
19
+ desc 'Run the rubocop linter'
20
+ task :lint do
21
+ system('bundle', 'exec', 'rubocop') or abort
22
+ end
23
+
24
+ desc 'Run the spec tests'
25
+ task :test do
26
+ system('bundle', 'exec', 'rspec', '--exclude-pattern', 'spec/verify/**/*_spec.rb') or abort
27
+ end
28
+ task test: :lint
29
+
30
+ desc 'Explode the gem'
31
+ task :explode do
32
+ system('jgem', 'install', '--no-document', '--install-dir=tmp', '*.gem')
33
+ end
34
+ task explode: :clean
35
+
36
+ desc 'Package the gem'
37
+ task :package do
38
+ system('jgem', 'build')
39
+ end
40
+ task package: %i[clean clobber test]
41
+
42
+ desc 'Verify the gem'
43
+ task :verify do
44
+ system('bundle', 'exec', 'rspec', 'spec/verify') or abort
45
+ end
46
+ task verify: :explode
47
+
48
+ desc 'Publish the gem'
49
+ task :publish do
50
+ system('jgem', 'push', latest_gem)
51
+ end
52
+ task publish: :verify
53
+
54
+ def latest_gem
55
+ `ls -t #{PROJECT}*.gem`.strip.split("\n").first
56
+ end
data/exe/tcp_server ADDED
@@ -0,0 +1,17 @@
1
+ #! /usr/bin/env jruby
2
+
3
+ # encoding: utf-8
4
+ # frozen_string_literal: false
5
+
6
+ # -*- mode: ruby -*-
7
+ # vi: set ft=ruby :
8
+
9
+ # =begin
10
+
11
+ # Copyright Nels Nelson 2016-2022 but freely usable (see license)
12
+
13
+ # =end
14
+
15
+ require_relative '../lib/server'
16
+
17
+ Object.new.extend(Server).main