gyoza-languages 1.0.3 → 1.0.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 +4 -4
- data/README.md +3 -1
- data/bin/gyoza-languages +1 -1
- data/lib/gyoza-languages/gyoza_app.rb +13 -0
- data/lib/gyoza-languages/gyoza_language_app.rb +17 -0
- data/lib/gyoza-languages/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb3dd52e122dd5b970318e4653aa30f866ddc0f7ece1421bab82dae1f764f85e
|
4
|
+
data.tar.gz: bf57d011ef5d17c49483eb6f0d08f52a951c38f61540ab6487db142495388630
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f525c6f0db20b39ad08c5b4fe58d318e88c37d8d1706a3ab8acad3920d2ef5b2d146be15da62b67ca3a9496d284759d3ad68da90c88c6805ae724bba8f42e511
|
7
|
+
data.tar.gz: eb6feb07057f4f7facdf5ab1649531eec48a04cec55bbcf5a503525d53f50b9643a0521ce253998956a36effe6d220f0b0ea3be3609c52d7fea892eb16aeff2f
|
data/README.md
CHANGED
@@ -25,13 +25,15 @@ A Ruby implementation of the Github linguist project with an integrated simple H
|
|
25
25
|
|
26
26
|
Usage: gyoza-languages [options]
|
27
27
|
|
28
|
-
-p, --port PORT Starts the server with the specified port.
|
28
|
+
-p, --port PORT Starts the server with the specified port (2015 by default).
|
29
29
|
-d, --directory DIRECTORY Manually specifies the repositories directory.
|
30
30
|
-h, --help Show this message
|
31
31
|
|
32
32
|
If the -d argument is not specified, a REPOSITORIES_DIRECTORY environment variable will be necessary.
|
33
33
|
```
|
34
34
|
|
35
|
+
Specifying a port is optional as the default value is `2015`.
|
36
|
+
|
35
37
|
The most important (and mandatory) parameter is the `--directory`:
|
36
38
|
this represents the directory where all the repositories are stored.
|
37
39
|
Defining a correct directory is crucial for **managing** the web server **endpoints**.
|
data/bin/gyoza-languages
CHANGED
@@ -12,7 +12,7 @@ def usage
|
|
12
12
|
|
13
13
|
Usage: #{binary_name} [options]
|
14
14
|
|
15
|
-
-p, --port PORT Starts the server with the specified port.
|
15
|
+
-p, --port PORT Starts the server with the specified port (#{GyozaLanguages::DEFAULT_PORT} by default).
|
16
16
|
-d, --directory DIRECTORY Manually specifies the repositories directory.
|
17
17
|
-h, --help Show this message
|
18
18
|
|
@@ -70,6 +70,8 @@ class GyozaApp
|
|
70
70
|
patch(path, query, env)
|
71
71
|
when 'DELETE'
|
72
72
|
delete(path, query, env)
|
73
|
+
when 'HEAD'
|
74
|
+
head(path, query, env)
|
73
75
|
else
|
74
76
|
response 405
|
75
77
|
end
|
@@ -130,6 +132,17 @@ class GyozaApp
|
|
130
132
|
response 405
|
131
133
|
end
|
132
134
|
|
135
|
+
# The response to a HEAD request.
|
136
|
+
# By default, returns the 405 HTTP status code.
|
137
|
+
#
|
138
|
+
# Arguments:
|
139
|
+
# path: the path of the repository
|
140
|
+
# query: a hash containing all the query parameters
|
141
|
+
# env: the environment variables at the time of receiving the request
|
142
|
+
protected def head(path, query, env)
|
143
|
+
response 405
|
144
|
+
end
|
145
|
+
|
133
146
|
# Formats a new HTTP response from the given HTTP status code.
|
134
147
|
#
|
135
148
|
# Arguments:
|
@@ -65,6 +65,23 @@ class GyozaLanguageApp < GyozaApp
|
|
65
65
|
response(200, languages)
|
66
66
|
end
|
67
67
|
|
68
|
+
# Executes a GET response using get(path, query, env),
|
69
|
+
# but removes the returned body from the final response.
|
70
|
+
#
|
71
|
+
# Arguments:
|
72
|
+
# path: the path of the repository
|
73
|
+
# query: a hash of arguments. If the "branch" argument is specified, then
|
74
|
+
# the languages will be looked for that particular branch. However,
|
75
|
+
# if not found a 404 'Not Found' error is returned
|
76
|
+
# env: the environment variables at the time of receiving the request
|
77
|
+
protected def head(path, query, env)
|
78
|
+
response = get(path, query, env)
|
79
|
+
headers = response[1]
|
80
|
+
headers.delete 'Content-Type'
|
81
|
+
response[2] = []
|
82
|
+
response
|
83
|
+
end
|
84
|
+
|
68
85
|
private def not_found(type, name)
|
69
86
|
response(404, {
|
70
87
|
'message' => "Could not find #{type}: #{name}"
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module GyozaLanguages
|
4
|
-
VERSION = '1.0.
|
4
|
+
VERSION = '1.0.5'
|
5
5
|
# The content sent as the HTTP Server header
|
6
6
|
SERVER_NAME = "Gyoza-Languages/#{VERSION}"
|
7
|
-
DEFAULT_PORT =
|
7
|
+
DEFAULT_PORT = 2015
|
8
8
|
|
9
9
|
SPEC_NAME = $PROGRAM_NAME.split('/').last
|
10
10
|
SPEC_DESCRIPTION = 'A Ruby implementation of the Github linguist project with an integrated simple HTTP web server'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gyoza-languages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fulminazzo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
11
|
+
date: 2025-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|