Sha256: f3f289dc8ec3b6d79c3ca04540c9236dc6404c9aa22973ddab0d3ec1233e44d1

Contents?: true

Size: 593 Bytes

Versions: 71

Compression:

Stored size: 593 Bytes

Contents

module KnapsackPro
  module Crypto
    class BranchEncryptor
      NON_ENCRYPTABLE_BRANCHES = %w(develop development dev master staging)

      def self.call(branch)
        if KnapsackPro::Config::Env.branch_encrypted?
          new(branch).call
        else
          branch
        end
      end

      def initialize(branch)
        @branch = branch
      end

      def call
        if NON_ENCRYPTABLE_BRANCHES.include?(branch)
          branch
        else
          Digestor.salt_hexdigest(branch)[0..6]
        end
      end

      private

      attr_reader :branch
    end
  end
end

Version data entries

71 entries across 71 versions & 1 rubygems

Version Path
knapsack_pro-0.42.0 lib/knapsack_pro/crypto/branch_encryptor.rb
knapsack_pro-0.41.0 lib/knapsack_pro/crypto/branch_encryptor.rb
knapsack_pro-0.40.0 lib/knapsack_pro/crypto/branch_encryptor.rb
knapsack_pro-0.39.0 lib/knapsack_pro/crypto/branch_encryptor.rb
knapsack_pro-0.38.0 lib/knapsack_pro/crypto/branch_encryptor.rb
knapsack_pro-0.37.0 lib/knapsack_pro/crypto/branch_encryptor.rb
knapsack_pro-0.36.0 lib/knapsack_pro/crypto/branch_encryptor.rb
knapsack_pro-0.35.0 lib/knapsack_pro/crypto/branch_encryptor.rb
knapsack_pro-0.34.0 lib/knapsack_pro/crypto/branch_encryptor.rb
knapsack_pro-0.33.0 lib/knapsack_pro/crypto/branch_encryptor.rb
knapsack_pro-0.32.0 lib/knapsack_pro/crypto/branch_encryptor.rb