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-2.3.0 lib/knapsack_pro/crypto/branch_encryptor.rb
knapsack_pro-2.2.1 lib/knapsack_pro/crypto/branch_encryptor.rb
knapsack_pro-2.2.0 lib/knapsack_pro/crypto/branch_encryptor.rb
knapsack_pro-2.1.1 lib/knapsack_pro/crypto/branch_encryptor.rb
knapsack_pro-2.1.0 lib/knapsack_pro/crypto/branch_encryptor.rb
knapsack_pro-2.0.0 lib/knapsack_pro/crypto/branch_encryptor.rb
knapsack_pro-1.22.3 lib/knapsack_pro/crypto/branch_encryptor.rb
knapsack_pro-1.22.2 lib/knapsack_pro/crypto/branch_encryptor.rb
knapsack_pro-1.22.1 lib/knapsack_pro/crypto/branch_encryptor.rb
knapsack_pro-1.22.0 lib/knapsack_pro/crypto/branch_encryptor.rb
knapsack_pro-1.21.0 lib/knapsack_pro/crypto/branch_encryptor.rb
knapsack_pro-1.20.2 lib/knapsack_pro/crypto/branch_encryptor.rb
knapsack_pro-1.20.1 lib/knapsack_pro/crypto/branch_encryptor.rb
knapsack_pro-1.20.0 lib/knapsack_pro/crypto/branch_encryptor.rb
knapsack_pro-1.19.0 lib/knapsack_pro/crypto/branch_encryptor.rb
knapsack_pro-1.18.2 lib/knapsack_pro/crypto/branch_encryptor.rb
knapsack_pro-1.18.1 lib/knapsack_pro/crypto/branch_encryptor.rb
knapsack_pro-1.18.0 lib/knapsack_pro/crypto/branch_encryptor.rb
knapsack_pro-1.17.0 lib/knapsack_pro/crypto/branch_encryptor.rb
knapsack_pro-1.16.1 lib/knapsack_pro/crypto/branch_encryptor.rb