conf

package
v0.0.0-...-43a0c9e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2015 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package conf includes configurations related manipulations.

Index

Constants

View Source
const (
	// PathSeparator holds the OS-specific path separator.
	PathSeparator = string(os.PathSeparator)
	// PathListSeparator holds the OS-specific path list separator.
	PathListSeparator = string(os.PathListSeparator)

	// WideVersion holds the current wide version.
	WideVersion = "1.1.0"
	// CodeMirrorVer holds the current editor version.
	CodeMirrorVer = "4.10"
)

Variables

View Source
var Docker bool

Indicates whether runs via Docker.

View Source
var Users []*User

configurations of users.

View Source
var Wide *conf

Wide configurations.

Functions

func CreateWorkspaceDir

func CreateWorkspaceDir(path string)

CreateWorkspaceDir creates (if not exists) directories on the path.

  1. root directory:{path}
  2. src directory: {path}/src
  3. package directory: {path}/pkg
  4. binary directory: {path}/bin

func FixedTimeCheckEnv

func FixedTimeCheckEnv()

FixedTimeCheckEnv checks Wide runtime enviorment periodically (7 minutes).

Exits process if found fatal issues (such as not found $GOPATH), Notifies user by notification queue if found warning issues (such as not found gocode).

func GetEditorThemes

func GetEditorThemes() []string

GetEditorThemes gets the names of editor themes.

func GetGoFmt

func GetGoFmt(username string) string

GetGoFmt gets the path of Go format tool, returns "gofmt" if not found "goimports".

func GetOwner

func GetOwner(path string) string

GetOwner gets the user the specified path belongs to. Returns "" if not found.

func GetThemes

func GetThemes() []string

GetThemes gets the names of themes.

func GetUserWorkspace

func GetUserWorkspace(username string) string

GetUserWorkspace gets workspace path with the specified username, returns "" if not found.

func Load

func Load(confPath, confIP, confPort, confServer, confLogLevel, confStaticServer, confContext, confChannel string, confDocker bool)

Load loads the Wide configurations from wide.json and users' configurations from users/{username}.json.

func Salt

func Salt(password, salt string) string

Salt salts the specified password with the specified salt.

func UpdateCustomizedConf

func UpdateCustomizedConf(username string)

UpdateCustomizedConf creates (if not exists) or updates user customized configuration files.

  1. /static/user/{username}/style.css

Types

type LatestSessionContent

type LatestSessionContent struct {
	FileTree    []string // paths of expanding nodes of file tree
	Files       []string // paths of files of opening editor tabs
	CurrentFile string   // path of file of the current focused editor tab
}

LatestSessionContent represents the latest session content.

type User

type User struct {
	Name                 string
	Password             string
	Salt                 string
	Email                string
	Gravatar             string // see http://gravatar.com
	Workspace            string // the GOPATH of this user
	Locale               string
	GoFormat             string
	FontFamily           string
	FontSize             string
	Theme                string
	Created              int64 // user create time in unix nano
	Updated              int64 // preference update time in unix nano
	Lived                int64 // the latest session activity in unix nano
	Editor               *editor
	LatestSessionContent *LatestSessionContent
}

User configuration.

func GetUser

func GetUser(username string) *User

GetUser gets configuration of the user specified by the given username, returns nil if not found.

func NewUser

func NewUser(username, password, email, workspace string) *User

NewUser creates a user with the specified username, password, email and workspace.

func (*User) GetWorkspace

func (u *User) GetWorkspace() string

GetWorkspace gets workspace path of the user.

Compared to the use of Wide.Workspace, this function will be processed as follows:

  1. Replace {WD} variable with the actual directory path
  2. Replace ${GOPATH} with enviorment variable GOPATH
  3. Replace "/" with "\\" (Windows)

func (*User) Save

func (u *User) Save() bool

Save saves the user's configurations in conf/users/{username}.json.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL