當前位置: 首頁>>代碼示例>>Golang>>正文


Golang initialize.Initialize函數代碼示例

本文整理匯總了Golang中github.com/eris-ltd/eris-cli/initialize.Initialize函數的典型用法代碼示例。如果您正苦於以下問題:Golang Initialize函數的具體用法?Golang Initialize怎麽用?Golang Initialize使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Initialize函數的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: testsInit

func testsInit() error {
	var err error
	// TODO: make a reader/pipe so we can see what is written from tests.
	util.GlobalConfig, err = util.SetGlobalObject(os.Stdout, os.Stderr)
	if err != nil {
		ifExit(fmt.Errorf("TRAGIC. Could not set global config.\n"))
	}

	// common is initialized on import so
	// we have to manually override these
	// variables to ensure that the tests
	// run correctly.
	util.ChangeErisDir(erisDir)

	// init dockerClient
	util.DockerConnect(false, "eris")

	// this dumps the ipfs service def into the temp dir which
	// has been set as the erisRoot
	if err := ini.Initialize(true, false); err != nil {
		ifExit(fmt.Errorf("TRAGIC. Could not initialize the eris dir.\n"))
	}

	return nil
}
開發者ID:slowtokyo,項目名稱:eris-cli,代碼行數:25,代碼來源:chains_test.go

示例2: testsInit

func testsInit() error {
	var err error
	// TODO: make a reader/pipe so we can see what is written from tests.
	config.GlobalConfig, err = config.SetGlobalObject(os.Stdout, os.Stderr)
	ifExit(err)

	// common is initialized on import so
	// we have to manually override these
	// variables to ensure that the tests
	// run correctly.
	config.ChangeErisDir(erisDir)

	// init dockerClient
	util.DockerConnect(false, "eris")

	// this dumps the ipfs service def into the temp dir which
	// has been set as the erisRoot
	do := definitions.NowDo()
	do.Pull = true
	do.Services = true
	do.Actions = true
	ifExit(ini.Initialize(do))

	// dump a test file with some stuff
	f, err := os.Create(file)
	ifExit(err)
	f.Write([]byte(content))

	return nil
}
開發者ID:jumanjiman,項目名稱:eris-cli,代碼行數:30,代碼來源:files_test.go

示例3: testsInit

func testsInit() error {
	var err error
	// TODO: make a reader/pipe so we can see what is written from tests.
	config.GlobalConfig, err = config.SetGlobalObject(os.Stdout, os.Stderr)
	if err != nil {
		ifExit(fmt.Errorf("TRAGIC. Could not set global config.\n"))
	}

	// common is initialized on import so
	// we have to manually override these
	// variables to ensure that the tests
	// run correctly.
	config.ChangeErisDir(erisDir)

	// init dockerClient
	util.DockerConnect(false, "eris-test-nyc2-1.8.1")

	// this dumps the ipfs service def into the temp dir which
	// has been set as the erisRoot
	do := def.NowDo()
	do.Pull = true
	do.Services = true
	do.Actions = true
	if err := ini.Initialize(do); err != nil {
		ifExit(fmt.Errorf("TRAGIC. Could not initialize the eris dir.\n"))
	}

	// lay a chain service def
	testNewChain(chainName)

	return nil
}
開發者ID:jeffanthony,項目名稱:eris-cli,代碼行數:32,代碼來源:chains_test.go

示例4: TestsInit

//testType = one of each package, will switch over it for
//make additional tempDirs and vars as needed -> [zr] or not, TBD
func TestsInit(testType string) (err error) {
	// TODO: make a reader/pipe so we can see what is written from tests.
	config.GlobalConfig, err = config.SetGlobalObject(os.Stdout, os.Stderr)
	if err != nil {
		IfExit(fmt.Errorf("TRAGIC. Could not set global config.\n"))
	}

	// common is initialized on import so
	// we have to manually override these
	// variables to ensure that the tests
	// run correctly.
	config.ChangeErisDir(erisDir)

	util.DockerConnect(false, "eris")

	// this dumps the ipfs and keys services defs into the temp dir which
	// has been set as the erisRoot.
	do := def.NowDo()
	do.Pull = false //don't pull imgs
	do.Yes = true   //over-ride command-line prompts
	do.Quiet = true
	// do.Source = "toadserver" //use "rawgit" if ts down
	do.Source = "rawgit" //use "rawgit" if ts down
	if err := ini.Initialize(do); err != nil {
		IfExit(fmt.Errorf("TRAGIC. Could not initialize the eris dir: %s.\n", err))
	}

	log.Info("Test init completed. Starting main test sequence now")
	return nil
}
開發者ID:antonylewis,項目名稱:eris-cli,代碼行數:32,代碼來源:testing_utils.go

示例5: TestsInit

//testType = one of each package, will switch over it for
//make additional tempDirs and vars as needed -> [zr] or not, TBD
func TestsInit(testType string) (err error) {
	// TODO: make a reader/pipe so we can see what is written from tests.
	config.GlobalConfig, err = config.SetGlobalObject(os.Stdout, os.Stderr)
	if err != nil {
		IfExit(fmt.Errorf("TRAGIC. Could not set global config.\n"))
	}

	// common is initialized on import so
	// we have to manually override these
	// variables to ensure that the tests
	// run correctly.
	config.ChangeErisDir(erisDir)

	util.DockerConnect(false, "eris")

	// this dumps the ipfs and keys services defs into the temp dir which
	// has been set as the erisRoot.
	do := def.NowDo()
	do.Pull = true
	do.Services = true
	do.Actions = true
	do.Yes = true
	if err := ini.Initialize(do); err != nil {
		IfExit(fmt.Errorf("TRAGIC. Could not initialize the eris dir.\n"))
	}

	if testType == "services" {
		checkIPFSnotRunning() //TODO make more general & use for other things?
	}

	logger.Infoln("Test init completed. Starting main test sequence now.")
	return nil
}
開發者ID:alexandrev,項目名稱:eris-cli,代碼行數:35,代碼來源:testing_utils.go

示例6: testsInit

func testsInit() error {
	var err error
	// TODO: make a reader/pipe so we can see what is written from tests.
	config.GlobalConfig, err = config.SetGlobalObject(os.Stdout, os.Stderr)
	ifExit(err)

	// common is initialized on import so
	// we have to manually override these
	// variables to ensure that the tests
	// run correctly.
	config.ChangeErisDir(erisDir)

	// init dockerClient
	util.DockerConnect(false, "eris")

	// this dumps the ipfs service def into the temp dir which
	// has been set as the erisRoot
	ifExit(ini.Initialize(true, false))

	// set ipfs endpoint
	// os.Setenv("ERIS_IPFS_HOST", "http://0.0.0.0") // conflicts with docker-machine based testing

	// dump a test file with some stuff
	f, err := os.Create(file)
	ifExit(err)
	f.Write([]byte(content))

	return nil
}
開發者ID:kustomzone,項目名稱:eris-cli,代碼行數:29,代碼來源:files_test.go

示例7: testsInit

func testsInit() error {
	var err error
	// TODO: make a reader/pipe so we can see what is written from tests.
	config.GlobalConfig, err = config.SetGlobalObject(os.Stdout, os.Stderr)
	ifExit(err)

	// common is initialized on import so
	// we have to manually override these
	// variables to ensure that the tests
	// run correctly.
	config.ChangeErisDir(erisDir)

	// init dockerClient
	util.DockerConnect(false, "eris")

	// this dumps the ipfs service def into the temp dir which
	// has been set as the erisRoot
	do := def.NowDo()
	do.Pull = true
	do.Services = true
	do.Actions = true
	ifExit(ini.Initialize(do))

	// set ipfs endpoint
	//os.Setenv("ERIS_IPFS_HOST", "http://0.0.0.0") //conflicts with docker-machine

	// make sure ipfs not running
	do = def.NowDo()
	do.Quiet = true
	logger.Debugln("Finding the running services.")
	if err := ListRunning(do); err != nil {
		ifExit(err)
	}
	res := strings.Split(do.Result, "\n")
	for _, r := range res {
		if r == "ipfs" {
			ifExit(fmt.Errorf("IPFS service is running.\nPlease stop it with.\neris services stop -rx ipfs\n"))
		}
	}
	// make sure ipfs container does not exist
	do = def.NowDo()
	do.Quiet = true
	if err := ListExisting(do); err != nil {
		ifExit(err)
	}
	res = strings.Split(do.Result, "\n")
	for _, r := range res {
		if r == "ipfs" {
			ifExit(fmt.Errorf("IPFS service exists.\nPlease remove it with\neris services rm ipfs\n"))
		}
	}

	logger.Infoln("Test init completed. Starting main test sequence now.")
	return nil
}
開發者ID:jumanjiman,項目名稱:eris-cli,代碼行數:55,代碼來源:services_test.go

示例8: Router

func Router(cmd *cobra.Command, args []string) {
	if do.Yes {
		do.Services = true
		do.Actions = true
	}

	if !do.Pull {
		util.CheckGitAndGo(true, false)
	}

	ini.Initialize(do)
}
開發者ID:alexandrev,項目名稱:eris-cli,代碼行數:12,代碼來源:init.go

示例9: testsInit

func testsInit() error {
	var err error
	// TODO: make a reader/pipe so we can see what is written from tests.
	config.GlobalConfig, err = config.SetGlobalObject(os.Stdout, os.Stderr)
	ifExit(err)

	config.ChangeErisDir(erisDir)

	// init dockerClient
	util.DockerConnect(false, "eris")

	// clone bank...for now.
	// TODO: add better tester

	// this dumps the ipfs service def into the temp dir which
	// has been set as the erisRoot
	ifExit(ini.Initialize(true, false))

	logger.Infoln("Test init completed. Starting main test sequence now.")
	return nil
}
開發者ID:kustomzone,項目名稱:eris-cli,代碼行數:21,代碼來源:contracts_test.go

示例10: Router

func Router(cmd *cobra.Command, args []string) {
	switch {
	case do.Yes:
		do.Services = true
		do.Actions = true
	case do.All:
		do.Services = true
		do.Actions = true
		do.Tool = true
	}

	if do.Tool {
		util.UpdateEris(do.Branch)

		if !do.All {
			return
		}
	}

	ini.Initialize(do)
}
開發者ID:jumanjiman,項目名稱:eris-cli,代碼行數:21,代碼來源:init.go

示例11: Router

func Router(cmd *cobra.Command, args []string) {
	ini.Initialize(do)
}
開發者ID:mxjxn,項目名稱:eris-cli,代碼行數:3,代碼來源:init.go

示例12:

package commands

import (
	"github.com/eris-ltd/eris-cli/Godeps/_workspace/src/github.com/spf13/cobra"
	ini "github.com/eris-ltd/eris-cli/initialize"
)

// flags to add: --no-clone
var Init = &cobra.Command{
	Use:   "init",
	Short: "Initialize the ~/.eris directory with some default services and actions",
	Long: `Create the ~/.eris directory with actions and services subfolders
and clone eris-ltd/eris-actions eris-ltd/eris-services into them, respectively.
`,
	Run: func(cmd *cobra.Command, args []string) {
		ini.Initialize(do.SkipPull, do.Verbose)
	},
}
開發者ID:slowtokyo,項目名稱:eris-cli,代碼行數:18,代碼來源:init.go

示例13:

package commands

import (
	"github.com/eris-ltd/eris-cli/Godeps/_workspace/src/github.com/spf13/cobra"
	ini "github.com/eris-ltd/eris-cli/initialize"
)

// flags to add: --no-clone
var Init = &cobra.Command{
	Use:   "init",
	Short: "Initialize the ~/.eris directory with some default services and actions",
	Long: `Create the ~/.eris directory with actions and services subfolders
and clone eris-ltd/eris-actions eris-ltd/eris-services into them, respectively.
`,
	Run: func(cmd *cobra.Command, args []string) {
		ini.Initialize(do.Pull, do.Verbose)
	},
}
開發者ID:kustomzone,項目名稱:eris-cli,代碼行數:18,代碼來源:init.go

示例14: UpdateTool

func UpdateTool(cmd *cobra.Command, args []string) {
	util.UpdateEris(do.Branch, true, true)
	initialize.Initialize(do)
}
開發者ID:antonylewis,項目名稱:eris-cli,代碼行數:4,代碼來源:update.go


注:本文中的github.com/eris-ltd/eris-cli/initialize.Initialize函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。