micro_api 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- 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: cc1a5042c03d6876c5edbeb8ddd1c072a423fe23a2650cc031a9ac5ab7d22f9b
|
4
|
+
data.tar.gz: bca33067648dd51c2935af821d7c48b2354bcbbd8f609a6306757fe767da223e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f275553f4e4e33480f1c65b286959979a4c5a495fa403d84b2cbc58d93e4e69e3db10a2e9c820b63cafb0943b0db559b3a2f90a20dbeb691e4468c5d708d9882
|
7
|
+
data.tar.gz: fa7ec013f805bac122f7d48ae931753edb70dbd727d2d9e1890bc8fbee3a0b2d4c59a3be97f774d8d57fcb2d73e9385b6ccd51c3303fc22ce39cebf5e6508355
|
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.4
|
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
|