Sha256: 53048707cb6b31ca6c01edce1afa14264780ad751d7e9be1a3be4aeae75bd4a7

Contents?: true

Size: 735 Bytes

Versions: 1

Compression:

Stored size: 735 Bytes

Contents

module EySecrets
  class Repository < Struct.new(:remotes, :files, :ready_for_update)
    class NotReadyForUpdate < Error
    end

    def ready_for_update?
      ready_for_update
    end

    def glob(pattern)
      files.select { |file| File.fnmatch(pattern, file) }
    end

    def assert_ready_for_update
      unless ready_for_update?
        raise(NotReadyForUpdate,
              'Commit on master and push your changes before updating config.' \
              "\n\n" \
              'Config can only be updated from the master branch. ' \
              'This helps ensure that the credentials found on a production ' \
              'system always reflect the current state of the master branch.')
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ey_secrets-1.0.0 lib/ey_secrets/models/repository.rb