Skip to content
This repository was archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
test signin feature for sync prop, make .gitpod.df has new pkgs
Browse files Browse the repository at this point in the history
  • Loading branch information
abdfnx committed Jan 9, 2021
1 parent 43ae9b7 commit dc216c8
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 18 deletions.
3 changes: 3 additions & 0 deletions .gitpod.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
FROM gitpod/workspace-full

RUN brew install gh
RUN /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Dev-x-Team/corgit/main/setup)"
RUN npm i -g @abdfnx/manx
RUN /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/abdfnx/secman/HEAD/packages/install_linux.sh)"
2 changes: 1 addition & 1 deletion .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ image:
file: .gitpod.Dockerfile

tasks:
- init: go get && go build ./... && go test ./...
- init: cd core && go get && go build ./...
command: go run
2 changes: 0 additions & 2 deletions .replit

This file was deleted.

3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
FROM ubuntu:latest
FROM ubuntu:latest

11 changes: 11 additions & 0 deletions core/secman.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/abdfnx/secman/v3/insert"
"github.com/abdfnx/secman/v3/pio"
"github.com/abdfnx/secman/v3/show"
"github.com/abdfnx/secman/v3/signin"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -85,6 +86,16 @@ Will prompt for confirmation when a site path is not unique.`,
},
}

signinCmd = &cobra.Command{
Use: "signin",
Example: "secman signin",
Short: "sigin in by github for sync",
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
signin
},
}

generateCmd = &cobra.Command{
Use: "generate",
Short: "Generate a secure password",
Expand Down
2 changes: 1 addition & 1 deletion core/tests/secman-sync
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

function repo() {
if [ -x "$(command -v gh)" ]; then
gh repo create -y --private
gh repo create $SM_GH_UN/.secman -y --private
fi
}

Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ require (
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/spf13/cobra v0.0.3
github.com/spf13/pflag v1.0.3 // indirect
github.com/tcnksm/go-latest v0.0.0-20170313132115-e3007ae9052e
golang.org/x/crypto v0.0.0-20190222235706-ffb98f73852f
golang.org/x/net v0.0.0-20201224014010-6772e930b67b // indirect
)
32 changes: 20 additions & 12 deletions packages/install_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ installBrew() {
}

installSecman() {
if [ -x "$(command -v sudo)" ]; then
if [ -x "$(command -x sudo)" ]; then
sudo wget -P $smLocLD $smUrl

sudo chmod 755 $smLocLD/secman
Expand All @@ -32,7 +32,7 @@ installSecman() {
}

installSecman_un() {
if [ -x "$(command -v sudo)" ]; then
if [ -x "$(command -x sudo)" ]; then
sudo wget -P $smLocLD $sm_unUrl

sudo chmod 755 $smLocLD/secman-un
Expand All @@ -44,14 +44,14 @@ installSecman_un() {
}

checkWget() {
if [ -x "$(command -v wget)" ]; then
if [ -x "$(command -x wget)" ]; then
installSecman

installSecman_un
else
brew install wget

if [ -x "$(command -v wget)" ]; then
if [ -x "$(command -x wget)" ]; then
installSecman

installSecman_un
Expand All @@ -60,17 +60,17 @@ checkWget() {
}

gitAndBrew() {
if [ -x "$(command -v git)" ]; then
if [ -x "$(command -x git)" ]; then
installBrew

if [ -x "$(command -v brew)" ]; then
if [ -x "$(command -x brew)" ]; then
checkWget
fi
fi
}

checkGit() {
if [ -x "$(command -v sudo)" ]; then
if [ -x "$(command -x sudo)" ]; then
sudo apt install git
gitAndBrew
else
Expand All @@ -81,14 +81,14 @@ checkGit() {
}

mainCheck() {
if [ -x "$(command -v brew)" ]; then
if [ -x "$(command -x brew)" ]; then
checkWget

else
if [ -x "$(command -v git)" ]; then
if [ -x "$(command -x git)" ]; then
installBrew

if [ -x "$(command -v brew)" ]; then
if [ -x "$(command -x brew)" ]; then
checkWget
fi
else
Expand All @@ -97,10 +97,10 @@ mainCheck() {
fi
}

if [ -x "$(command -v curl)" ]; then
if [ -x "$(command -x curl)" ]; then
mainCheck

if [ -x "$(command -v secman)" ]; then
if [ -x "$(command -x secman)" ]; then
successInstall
else
echo "Download failed 😔"
Expand All @@ -110,3 +110,11 @@ else
echo "You should install curl"
exit 0
fi

if [ -x "$(command -x secman)" ]; then
echo "Enter your github username: "
echo " "
read sgu

echo "export $SM_GH_UN=$sgu"
fi
20 changes: 20 additions & 0 deletions signin/signin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package signin

import "os/exec"
import . "fmt"

func main() {
gh := "gh"
auth := "auth"
login := "login"

cmd := exec.Command(gh, auth, login)
stdout, err := cmd.Output()

if err != nil {
Println(err.Error())
return
}

Print(string(stdout))
}

0 comments on commit dc216c8

Please sign in to comment.