Sha256: 4c12fef88b023ac4b0aec0d4bfab5f9df1a0bd6fe8f8bdaa57ac9883eccd75e4

Contents?: true

Size: 453 Bytes

Versions: 15

Compression:

Stored size: 453 Bytes

Contents

module Jets::Cfn::Builder::Util
  class Source
    class << self
      def version
        return '' unless git_installed?
        sha = sh "git rev-parse HEAD 2>/dev/null"
        return '' if sha == ''  # if its not a git repo, it'll be an empty string
        sha[0..7]
      end

    private
      def git_installed?
        system("type git > /dev/null 2>&1")
      end

      def sh(command)
        `#{command}`.strip
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
jets-5.0.13 lib/jets/cfn/builder/util/source.rb
jets-5.0.12 lib/jets/cfn/builder/util/source.rb
jets-5.0.11 lib/jets/cfn/builder/util/source.rb
jets-5.0.10 lib/jets/cfn/builder/util/source.rb
jets-5.0.9 lib/jets/cfn/builder/util/source.rb
jets-5.0.8 lib/jets/cfn/builder/util/source.rb
jets-5.0.7 lib/jets/cfn/builder/util/source.rb
jets-5.0.6 lib/jets/cfn/builder/util/source.rb
jets-5.0.5 lib/jets/cfn/builder/util/source.rb
jets-5.0.4 lib/jets/cfn/builder/util/source.rb
jets-5.0.3 lib/jets/cfn/builder/util/source.rb
jets-5.0.2 lib/jets/cfn/builder/util/source.rb
jets-5.0.1 lib/jets/cfn/builder/util/source.rb
jets-5.0.0 lib/jets/cfn/builder/util/source.rb
jets-5.0.0.beta1 lib/jets/cfn/builder/util/source.rb