Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ out/
test_sync/
# Dependency directories (remove the comment below to include it)
# vendor/
tests/fixtures/ver
tests/fixtures/cache
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.PHONY: build

build:
go build -v .

.PHONY: test
18 changes: 5 additions & 13 deletions cmd/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/khorevaa/r2gitsync/log"
"github.com/khorevaa/r2gitsync/plugin"
p "github.com/khorevaa/r2gitsync/plugins"
"github.com/v8platform/designer/repository"
"io/ioutil"
"os"
"path"
Expand Down Expand Up @@ -43,12 +44,13 @@ type configApp struct {
TempDir string
Workspace string
disableIncrement bool
workdir string
Repository *repository.Repository
}

func NewApp(version string) *Application {

config := &configApp{}

var config = &configApp{}
app := &Application{
config: config,
}
Expand Down Expand Up @@ -119,17 +121,7 @@ func NewApp(version string) *Application {
}

func (app *Application) cmdInit(cmd *cli.Cmd) {

cmd.LongDesc = `Данный режим работает по HTTP (REST API) с базой данных.
Возможности:
* самостоятельно получает список информационных баз к обновления;
* поддержание нескольких потоков обновления
* переодический/разовый опрос необходимости обновления
* отправка журнала обновления на url.`

cmd.Action = func() {
//fmt.Printf("display account info for %s\n", *account)
}
app.CmdInit2(cmd)
}

func loadPlugins() {
Expand Down
66 changes: 59 additions & 7 deletions cmd/cmdInit.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,72 @@
package cmd

import (
"fmt"
cli "github.com/jawher/mow.cli"
"github.com/khorevaa/r2gitsync/cmd/flags"
"github.com/khorevaa/r2gitsync/manager"
"github.com/v8platform/designer/repository"
)

// Sample use: vault creds reddit.com
func (app *Application) CmdInit2(cmd *cli.Cmd) {

cmd.LongDesc = `Данный режим работает по HTTP (REST API) с базой данных.
Возможности:
* самостоятельно получает список информационных баз к обновления;
* поддержание нескольких потоков обновления
* переодический/разовый опрос необходимости обновления
* отправка журнала обновления на url.`
app.config.Repository = new(repository.Repository)
cmd.Spec = "[ -U=<storage-user> ] [ -P=<storage-pwd> ] PATH WORKDIR"
cmd.LongDesc = `Инициализация структуры нового хранилища git. Подготовка к синхронизации`

flags.StringOpt("U storage-user",
"Администратор",
"пользователь хранилища конфигурации").
Env("GITSYNC_STORAGE_USER").
Ptr(&app.config.Repository.User).Apply(cmd, app.ctx)

flags.StringOpt("P storage-pwd",
"",
"пароль пользователя хранилища конфигурации").
Env("GITSYNC_STORAGE_PASSWORD $GITSYNC_STORAGE_PWD").
Ptr(&app.config.Repository.Password).Apply(cmd, app.ctx)

//flags.StringOpt(" E ext extension",
// "",
// " имя расширения для работы с хранилищем расширения").
// Env("GITSYNC_EXTENSION").
// Ptr(&app.config.Repository.Extension).Apply(cmd, app.ctx)

flags.StringArg("PATH",
"",
"Путь к хранилищу конфигурации 1С.").
Env("GITSYNC_STORAGE_USER").
Ptr(&app.config.Repository.Path).Apply(cmd, app.ctx)

flags.StringArg("WORKDIR",
".",
" Адрес локального репозитория GIT.\n"+
"Каталог исходников внутри локальной копии git-репозитория. По умолчанию текущий каталог").
Env("GITSYNC_WORKDIR").
Ptr(&app.config.workdir).Apply(cmd, app.ctx)

cmd.Action = func() {
//fmt.Printf("display account info for %s\n", *account)
initProject(app)
}
}

func initProject(app *Application) {
CreateFileVersion(app)
}

func CreateFileVersion(app *Application) {
// Get storage user
repo := manager.SyncRepository{
Repository: *app.config.Repository,
Workdir: app.config.workdir,
}
repo.GetRepositoryHistory()

fmt.Print("INIT!!")
// Vrite storage user to Autors
}

func (app *Application) createFileAutors() {
// Create file Version
}
16 changes: 16 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
sonar.projectKey=r2gitsync
sonar.projectName=r2gitsync
sonar.host.url=https://open.sonar.checkbsl.org/
sonar.projectVersion=0.0.0.1
# GoLint report path, default value is report.xml
sonar.golint.reportPath=report.xml
# Cobertura like coverage report path, default value is coverage.xml
sonar.coverage.reportPath=coverage.xml
# if you want disabled the DTD verification for a proxy problem for example, true by default
sonar.coverage.dtdVerification=false
# JUnit like test report, default value is test.xml
sonar.test.reportPath=test.xml
sonar.sources=./
sonar.tests=./
sonar.test.inclusions=**/**_test.go
sonar.sources.inclusions=**/**.go
Binary file modified tests/fixtures/1cv8ddb.1CD
Binary file not shown.