コード例 #1
0
ファイル: config.go プロジェクト: ChaitanyaRanade/force
package main

import (
	"github.com/devangel/config"
	"os"
	"path/filepath"
	"strings"
	//"fmt"
)

var Config = config.NewConfig("force")

func GetSourceDir() (src string, err error) {
	// Last element is default
	var sourceDirs = []string{
		"src",
		"metadata",
	}

	wd, err := os.Getwd()

	err = nil
	for _, src = range sourceDirs {
		if strings.Contains(wd, src) {
			// our working directory contains a src dir above us, we need to move up the file syste
			nsrc := wd
			for {
				nsrc = filepath.Dir(nsrc)
				if filepath.Base(nsrc) == src {
					src = nsrc
					return
コード例 #2
0
ファイル: logins_test.go プロジェクト: ChaitanyaRanade/force
package main

import (
	"github.com/bmizerany/assert"
	"github.com/devangel/config"
	"testing"
)

var TestConfig = config.NewConfig("force")

// test that SetActiveLogin in turn sets the "current account"
func TestSetActiveLogin(t *testing.T) {
	SetActiveLogin("clint")
	account, _ := TestConfig.Load("current", "account")
	assert.Equal(t, account, "clint")
}