mirror of https://github.com/sobolevn/git-secret
Publish
commit
d6f01b8ee6
@ -0,0 +1,26 @@
|
|||||||
|
FROM centos:latest
|
||||||
|
|
||||||
|
MAINTAINER Nikita Sobolev (mail@sobolevn.me)
|
||||||
|
|
||||||
|
ENV HOME /root
|
||||||
|
|
||||||
|
RUN yum update -y && \
|
||||||
|
yum install -y epel-release && \
|
||||||
|
yum install -y dnf && \
|
||||||
|
dnf update -y && \
|
||||||
|
rpm -U "http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-2.noarch.rpm" && \
|
||||||
|
dnf install -y gnupg man make gcc git tar > /dev/null && \
|
||||||
|
dnf install -y which pciutils redhat-rpm-config rpm-build zlib-devel && \
|
||||||
|
dnf -y group install 'Development tools' && \
|
||||||
|
dnf install -y ruby ruby-devel rubygems && \
|
||||||
|
dnf -y autoremove && \
|
||||||
|
mkdir /code
|
||||||
|
|
||||||
|
WORKDIR /code
|
||||||
|
|
||||||
|
# Removing `origin` for good:
|
||||||
|
|
||||||
|
RUN git clone -q https://github.com/sobolevn/git-secret.git && \
|
||||||
|
cd git-secret && git remote rm origin
|
||||||
|
|
||||||
|
WORKDIR /code/git-secret
|
@ -1,3 +1,3 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
GITSECRET_VERSION='0.2.1' # shellcheck disable=2034
|
GITSECRET_VERSION='0.2.2' # shellcheck disable=2034
|
||||||
|
@ -1,3 +1,67 @@
|
|||||||
#!/usr/bin/env bats
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
# TODO: create tests for this command.
|
load _test_base
|
||||||
|
|
||||||
|
FIRST_FILE="file_to_hide1"
|
||||||
|
SECOND_FILE="file_to_hide2"
|
||||||
|
|
||||||
|
FOLDER="somedir"
|
||||||
|
FILE_IN_FOLDER="${FOLDER}/file_to_hide3"
|
||||||
|
|
||||||
|
|
||||||
|
function setup {
|
||||||
|
install_fixture_key "$TEST_DEFAULT_USER"
|
||||||
|
|
||||||
|
set_state_initial
|
||||||
|
set_state_git
|
||||||
|
set_state_secret_init
|
||||||
|
set_state_secret_tell "$TEST_DEFAULT_USER"
|
||||||
|
set_state_secret_add "$FIRST_FILE" "somecontent"
|
||||||
|
set_state_secret_add "$SECOND_FILE" "somecontent2"
|
||||||
|
set_state_secret_hide
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function teardown {
|
||||||
|
uninstall_fixture_key "$TEST_DEFAULT_USER"
|
||||||
|
unset_current_state
|
||||||
|
|
||||||
|
# This also needs to be cleaned:
|
||||||
|
rm -f "$FIRST_FILE" "$SECOND_FILE"
|
||||||
|
rm -rf "$FOLDER"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function _secret_files_exists {
|
||||||
|
local result=$(find . -type f -name "*.$SECRETS_EXTENSION" \
|
||||||
|
-print0 2>/dev/null | grep -q .; echo "$?")
|
||||||
|
echo "$result"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@test "run 'clean' normally" {
|
||||||
|
run git secret clean
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
|
||||||
|
# There must be no .secret files:
|
||||||
|
local exists=$(_secret_files_exists)
|
||||||
|
[ "$exists" -ne 0 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@test "run 'clean' with '-v'" {
|
||||||
|
run git secret clean -v
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
|
||||||
|
# There must be no .secret files:
|
||||||
|
local exists=$(_secret_files_exists)
|
||||||
|
[ "$exists" -ne 0 ]
|
||||||
|
|
||||||
|
local first_filename=$(_get_encrypted_filename "$FIRST_FILE")
|
||||||
|
local second_filename=$(_get_encrypted_filename "$SECOND_FILE")
|
||||||
|
|
||||||
|
# Output must be verbose:
|
||||||
|
[[ "$output" == *"cleaning"* ]]
|
||||||
|
[[ "$output" == *"$first_filename"* ]]
|
||||||
|
[[ "$output" == *"$second_filename"* ]]
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue