Skip to content

Commit

Permalink
Export the Git revision to an environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
jefmathiot committed Jan 16, 2015
1 parent edca52e commit 2d34853
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ Rake::TestTask.new do |t|
end

task :default => [:test]

1 change: 1 addition & 0 deletions build/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ source 'https://rubygems.org'
# Install omnibus software
gem 'omnibus', github: 'servebox/omnibus', branch: 'package-name-override'
gem 'omnibus-software', github: 'servebox/omnibus-software', branch: 'pin-cacerts'
gem 'git_rev'
4 changes: 3 additions & 1 deletion build/config/software/electric_sheep.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require File.join(File.dirname(__FILE__), '../build')
require 'git_rev'

name "electric_sheep"

Expand All @@ -13,12 +14,13 @@
relative_path "electric_sheep"

build do
revision = GitRev::Sha.new(repository: packaging_directories[:root]).full
env = with_standard_compiler_flags(with_embedded_path)
gem "build electric_sheep.gemspec", env: env
gem "install electric_sheep-#{ElectricSheep::VERSION}.gem \
-n #{install_dir}/bin --no-ri --no-rdoc", env: env
erb source: 'ruby_wrapper.erb',
dest: "#{install_dir}/bin/ruby_wrapper",
vars: {install_dir: install_dir},
vars: {install_dir: install_dir, revision: revision},
mode: 0755
end
2 changes: 2 additions & 0 deletions build/config/templates/electric_sheep/ruby_wrapper.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ export RUBY_GC_MALLOC_LIMIT_MAX=16777216
export RUBY_GC_OLDMALLOC_LIMIT_MIN=16777216
export RUBY_GC_OLDMALLOC_LIMIT_MAX=33554432

export ELECTRIC_SHEEP_REVISION=<%= revision %>

exec <%= install_dir %>/embedded/bin/ruby <%= install_dir %>/bin/electric_sheep "$@"

0 comments on commit 2d34853

Please sign in to comment.