micro_api 0.1.2 → 0.1.3
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 +15 -1
- data/app/controllers/micro_api/static_controller.rb +9 -0
- data/lib/micro_api/version.rb +1 -1
- data/spec/dummy/config/application.rb +2 -0
- data/spec/requests/micro_api/static_version_spec.rb +2 -1
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99a6cfc6d82c9d35036f0b7fffb1a7076ad78593e731ee1a025e68fcb60d82dd
|
4
|
+
data.tar.gz: 41a25e79645d7f6bb5b9f3135bbb0436ab96ac15f2492512d47c4b6b7ecd9aca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d7f1a612213b649bbe000fef4878674733fa2834406d3151e64b0d8fc25d2575166832a6db26e435b6d1be1fa4ce78e23e82373e73da1d429ec28ca392dee5d
|
7
|
+
data.tar.gz: 917ab03be4c3901914ab3c1c21c339fa09eae405889891f7209fe0f70e965782f08fbfeecef2d5012baa76e8451b5153aaa3a9aff982f89afcbc2aa8f18b0995
|
data/README.md
CHANGED
@@ -2,7 +2,16 @@
|
|
2
2
|
This is a Rails plugin that would like to help the startup of rails applications oriented to microservices or, in general, application deployed on the cloud.
|
3
3
|
|
4
4
|
## Usage
|
5
|
-
How to use my plugin
|
5
|
+
How to use my plugin in a existing project
|
6
|
+
```bash
|
7
|
+
bundle add micro_api
|
8
|
+
```
|
9
|
+
|
10
|
+
|
11
|
+
```bash
|
12
|
+
gem install micro_api
|
13
|
+
```
|
14
|
+
|
6
15
|
|
7
16
|
## Installation
|
8
17
|
Add this line to your application's Gemfile:
|
@@ -10,6 +19,11 @@ Add this line to your application's Gemfile:
|
|
10
19
|
```ruby
|
11
20
|
gem "micro_api"
|
12
21
|
```
|
22
|
+
from localpath
|
23
|
+
```ruby
|
24
|
+
gem 'micro_api', path: '/gems/micro_api'
|
25
|
+
```
|
26
|
+
|
13
27
|
|
14
28
|
And then execute:
|
15
29
|
```bash
|
@@ -9,6 +9,7 @@ module MicroApi
|
|
9
9
|
ac: Rails.application.class.to_s.split("::").first, # app code
|
10
10
|
cenv: ENV.fetch("CLOUD_ENV", "local"), # cloud env
|
11
11
|
env: Rails.env, # rails env
|
12
|
+
av: app_version,
|
12
13
|
itag: ENV.fetch("IMAGE_TAG", nil), # image tag
|
13
14
|
}
|
14
15
|
end
|
@@ -17,5 +18,13 @@ module MicroApi
|
|
17
18
|
exception = ActionController::RoutingError.new("No route matches [#{request.method}] #{request.path}")
|
18
19
|
render json: { error: exception.message }, status: :not_found
|
19
20
|
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def app_version
|
25
|
+
Rails.application.class::VERSION
|
26
|
+
rescue StandardError
|
27
|
+
nil
|
28
|
+
end
|
20
29
|
end
|
21
30
|
end
|
data/lib/micro_api/version.rb
CHANGED
@@ -7,7 +7,8 @@ RSpec.describe "Statics" do
|
|
7
7
|
it "returns http success", type: :request do
|
8
8
|
expect(response).to have_http_status(:success)
|
9
9
|
expect(response.header['Content-Type']).to include 'application/json'
|
10
|
-
expect(json.keys).to contain_exactly('ac', 'cenv', 'env', 'itag')
|
10
|
+
expect(json.keys).to contain_exactly('ac', 'cenv', 'env', 'itag', 'av')
|
11
|
+
expect(json['av']).to eq('1.2.3'.freeze)
|
11
12
|
end
|
12
13
|
|
13
14
|
it "routes /micro_api/version to the static controller", type: :routing do
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: micro_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec-rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rubocop
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: simplecov
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -152,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
152
|
- !ruby/object:Gem::Version
|
153
153
|
version: '0'
|
154
154
|
requirements: []
|
155
|
-
rubygems_version: 3.4.
|
155
|
+
rubygems_version: 3.4.19
|
156
156
|
signing_key:
|
157
157
|
specification_version: 4
|
158
158
|
summary: Engine plugin for Ruby on Rails applications
|