コード例 #1
0
// TestCCCLoadConfig tests the testdata/home/.dockyard/repo.json file
func TestCCCLoadConfig(t *testing.T) {
	_, path, _, _ := runtime.Caller(0)
	testHome := "/testdata/home"
	savedHome := os.Getenv("HOME")
	defer os.Setenv("HOME", savedHome)
	os.Setenv("HOME", filepath.Join(filepath.Dir(path), testHome))

	var conf cutils.UpdateClientConfig
	err := conf.Load()
	assert.Nil(t, err, "Fail to load config")
	assert.Equal(t, conf.DefaultServer, "containerops.me", "Fail to load 'DefaultServer'")
}
コード例 #2
0
ファイル: client.go プロジェクト: pombredanne/dockyard
		}

		fmt.Printf("Success in removing %s.\n", url)
		return nil
	},
}

var listCommand = cli.Command{
	Name:  "list",
	Usage: "list the saved repositories or appliances of a certain repository",

	Action: func(context *cli.Context) error {
		var ucc cutils.UpdateClientConfig

		if len(context.Args()) == 0 {
			if err := ucc.Load(); err != nil {
				fmt.Println(err)
				return err
			}

			for _, repo := range ucc.Repos {
				fmt.Println(repo)
			}
		} else if len(context.Args()) == 1 {
			uc := new(cutils.UpdateClient)
			repoURL := context.Args().Get(0)
			apps, err := uc.List(repoURL)
			if err != nil {
				fmt.Println(err)
				return err
			}