code_version 0.1.5 → 0.1.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5080c884468a1e7990372416d0480b25970e4c37
4
- data.tar.gz: 8ed2ef560e1116a0cd979cc20f933c321c498774
3
+ metadata.gz: 24ded9236a6e12600e615a3f18fd027997e92e7d
4
+ data.tar.gz: 46f95e2082b73d5fbf7bdff76a635188655a0091
5
5
  SHA512:
6
- metadata.gz: 4a6f64f96fb534fd57e60eafcd15e377fa88a40b88126afa539b8372e8de3fd336d96e577cf32608ede0d961a03584bfed6c50b4a4f7cd541b2268453fff4448
7
- data.tar.gz: fb484c22007c6a1ddf505a52a5111577c918de1945f8a965e6a209e87f648ad87f08a7798fca2ceb60665476541e4b6465800b4396570ee79b1e7236911526a8
6
+ metadata.gz: 62743528cb80799ede477e99c48391d6e514e76db17cd7a78a4417fd05661858658224609537591d0e98ee43cdebae4897112dee20965ef1097ec173d01357ac
7
+ data.tar.gz: 7a814d454183e537adf6ef3059b2e6470ede13341377220cceae3a441589d57ba3800a20ae251789b38b74ce32ed52ff9d47e5f9e0d91d91c08e3f04bd07ad26
data/README.md CHANGED
@@ -3,13 +3,13 @@ The mountable rails engine that provide api call to get the git commit number on
3
3
 
4
4
  ## Usage
5
5
  After install you can go to the url to get a git commit number of code that deploy on server.
6
- Url example: http://your_domain/code_version/show
6
+ Url example: http://your_domain/api/metadata
7
7
 
8
8
  ## Installation
9
9
  Add this line to your application's Gemfile:
10
10
 
11
11
  ```ruby
12
- gem 'code_version', '~> 0.1.1'
12
+ gem 'code_version', '~> 0.1.5'
13
13
  ```
14
14
 
15
15
  And then execute:
@@ -21,7 +21,7 @@ And mount rails engine routes to your application routes by putting
21
21
  ```ruby
22
22
  Rails.application.routes.draw do
23
23
  ...
24
- mount CodeVersion::Engine => "/code_version"
24
+ mount CodeVersion::Engine => "api/metadata"
25
25
  ...
26
26
  end
27
27
  ```
@@ -1,15 +1,20 @@
1
1
  module CodeVersion
2
- class CodeVersionsController < ApplicationController
2
+ class CodeVersionsController < ActionController::Base
3
3
  def show
4
4
  file_path = "#{Rails.root}/REVISION"
5
5
  info = {}
6
+
6
7
  if File.exists? file_path
7
- File.open(file_path).each_line do |line|
8
- info["Git Commit Number"] = line
9
- end
8
+ info["deploy_time"] = File.mtime(file_path)
9
+ info["git_commit_hash"] = File.open(file_path).each_line.first.to_s.chomp
10
10
  else
11
- info = {"Error" => "No file REVISION in Rails root directory"}
12
- end
11
+ info["deploy_time"] = "NOT_FOUND"
12
+ info["git_commit_hash"] = "NOT_FOUND"
13
+ end
14
+
15
+ info["environment"] = Rails.env
16
+
17
+
13
18
  render :json => info
14
19
  end
15
20
  end
data/config/routes.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  CodeVersion::Engine.routes.draw do
2
- get '/show', to: 'code_versions#show'
2
+ get '/', to: 'code_versions#show'
3
3
  end
@@ -1,3 +1,3 @@
1
1
  module CodeVersion
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code_version
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kraiyanat Tee