This repository has been archived by the owner on Jul 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a version controller and used proper ruby gems to gather data.
TODO: Need to update rake tasks to use the controller on tagged releases. Signed-off-by: Aaron Lippold <[email protected]>
- Loading branch information
1 parent
c553782
commit 751f551
Showing
14 changed files
with
146 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"addons": [ | ||
"mongolab", | ||
"tunemygc" | ||
], | ||
"buildpacks": [ | ||
{ | ||
"url": "heroku/ruby" | ||
} | ||
], | ||
"description": "InSpec Results Viewer", | ||
"env": { | ||
"CIPHER_PASSWORD": { | ||
"generator": "secret" | ||
}, | ||
"CIPHER_SALT": { | ||
"required": true | ||
}, | ||
"LANG": { | ||
"required": true | ||
}, | ||
"MONGODB_URI": { | ||
"required": true | ||
}, | ||
"RACK_ENV": { | ||
"required": true | ||
}, | ||
"RAILS_ENV": { | ||
"required": true | ||
}, | ||
"RAILS_LOG_TO_STDOUT": { | ||
"required": true | ||
}, | ||
"RAILS_SERVE_STATIC_FILES": { | ||
"required": true | ||
}, | ||
"RUBY_GC_TOKEN": { | ||
"required": true | ||
}, | ||
"SECRET_KEY_BASE": { | ||
"generator": "secret" | ||
}, | ||
" CIPHER_SALT": { | ||
"generator": "secret" | ||
} | ||
}, | ||
"formation": { | ||
"web": { | ||
"quantity": 1 | ||
} | ||
}, | ||
"name": "heimdall", | ||
"scripts": { | ||
}, | ||
"stack": "heroku-18" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Place all the behaviors and hooks related to the matching controller here. | ||
# All this logic will automatically be available in application.js. | ||
# You can use CoffeeScript in this file: http://coffeescript.org/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Place all the styles related to the version controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class VersionController < ApplicationController | ||
def index | ||
g = Git.open(Rails.root, :log => Logger.new(STDOUT)) | ||
repo = Rugged::Repository.discover(Rails.root) | ||
version = { | ||
version: g.describe, | ||
branch: repo.head.name.split('/').last, | ||
sha: repo.head.target_id | ||
} | ||
render json: version | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module VersionHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"version": "v2.0.3-29-gc553782", | ||
"branch": "disp_ver", | ||
"sha": "c553782b9186500b08e7fb9e74b0a17388be4747" | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# config/initializers/version.rb | ||
|
||
if Rails.env.development? | ||
# we will hae to use both the `git` and `rugged` gem until | ||
# rugged implaments `git describe` | ||
g = Git.open(Rails.root) | ||
repo = Rugged::Repository.discover(Rails.root) | ||
|
||
version = { | ||
version: g.describe, | ||
branch: repo.head.name.split('/').last, | ||
sha: repo.head.target_id | ||
} | ||
|
||
File.open('config/VERSION','w') do |f| | ||
f.write(JSON.pretty_generate(version)) | ||
end | ||
end | ||
|
||
module MyApp | ||
# Read JSON from a file, iterate over objects | ||
parsed = JSON.parse(File.read('config/VERSION'), :symbolize_names => true) | ||
VERSION = parsed[:version] | ||
BRANCH = parsed[:branch] | ||
SHA = parsed[:sha] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe VersionController, type: :controller do | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'rails_helper' | ||
|
||
# Specs in this file have access to a helper object that includes | ||
# the VersionHelper. For example: | ||
# | ||
# describe VersionHelper do | ||
# describe "string concat" do | ||
# it "concats two strings with spaces" do | ||
# expect(helper.concat_strings("this","that")).to eq("this that") | ||
# end | ||
# end | ||
# end | ||
RSpec.describe VersionHelper, type: :helper do | ||
pending "add some examples to (or delete) #{__FILE__}" | ||
end |