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
Added a version controller and used proper ruby gems to gather data. #103
Open
aaronlippold
wants to merge
7
commits into
master
Choose a base branch
from
disp_ver
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
aaronlippold
force-pushed
the
disp_ver
branch
3 times, most recently
from
April 22, 2019 03:16
9689866
to
f071566
Compare
TODO: Need to update rake tasks to use the controller on tagged releases. Signed-off-by: Aaron Lippold <[email protected]>
Signed-off-by: Aaron Lippold <[email protected]>
Signed-off-by: Aaron Lippold <[email protected]>
Signed-off-by: Aaron Lippold <[email protected]>
Signed-off-by: Aaron Lippold <[email protected]>
Signed-off-by: Aaron Lippold <[email protected]>
rbclark
reviewed
Apr 22, 2019
} | ||
|
||
File.open('config/VERSION','w') do |f| | ||
f.write(JSON.pretty_generate(version)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not quite sure this will work as intended. It actually might be completely impossible to add a version in this manner since adding the version to the hash itself will change what the hash should be. Also, any squashes or merges done on Github will all have the wrong SHA since rails is not run on those. Heroku used to provide a SOURCE_VERSION
ENV but is seems they have removed it.
Yes I was thinking about that last night. I think you're right. I think the
only thing we can do is manage it via a file. With perhaps a rake task. I
think it would be safe to get the branch and perhaps the sha that was built
from. I think in the final production build we don't actually have the get
database so we'll have to pull and write the information during the build
process.
…On Mon, Apr 22, 2019, 8:09 AM Robert Clark ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In config/initializers/version.rb
<mitre/heimdall-legacy#103 (comment)>:
> +# 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))
I'm not quite sure this will work as intended. It actually might be
completely impossible to add a version in this manner since adding the
version to the hash itself will change what the hash should be. Also, any
squashes or merges done on Github will all have the wrong SHA since rails
is not run on those. Heroku used to provide a SOURCE_VERSION ENV but is
seems they have removed it.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<mitre/heimdall-legacy#103 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AALK42AQAGDL67SBEWF4AKDPRWTHDANCNFSM4HHNB5WQ>
.
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
config/VERSION
file.git describe
like commands libgit2/rugged#793 is completed.I wanted to use
rugged
here as it is a fully cross platform solution with zero deps but still had to use thegit
gem due to above FR I put in at rugged.Fixes #95
Signed-off-by: Aaron Lippold [email protected]