Skip to content

Commit 0419144

Browse files
committed
initial commit
0 parents  commit 0419144

File tree

177 files changed

+18890
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+18890
-0
lines changed

.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

.gitignore

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Logs
2+
logs
3+
*.log
4+
5+
# Runtime data
6+
pids
7+
*.pid
8+
*.seed
9+
10+
# Directory for instrumented libs generated by jscoverage/JSCover
11+
lib-cov
12+
13+
# Coverage directory used by tools like istanbul
14+
coverage
15+
16+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
17+
.grunt
18+
19+
# node-waf configuration
20+
.lock-wscript
21+
22+
# Compiled binary addons (http://nodejs.org/api/addons.html)
23+
build/Release
24+
25+
# Compiled moduels
26+
build
27+
28+
# Dependency directory
29+
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
30+
node_modules
31+
32+
# Bower
33+
bower_components/
34+
35+
### Vim
36+
# swap
37+
[._]*.s[a-w][a-z]
38+
[._]s[a-w][a-z]
39+
# session
40+
Session.vim
41+
# temporary
42+
.netrwhist
43+
*~
44+
# auto-generated tag files
45+
tags
46+
47+
# Others
48+
.DS_Store

api/api.go

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package api
2+
3+
// Constants for client.
4+
const (
5+
// DefaultVerions of Current REST API
6+
DefaultVersion string = "1.0"
7+
)

api/types/client.go

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package types
2+
3+
import (
4+
"io"
5+
)
6+
7+
// EngineBuildOptions holds the information
8+
// necessary to build engines.
9+
type EngineBuildOptions struct {
10+
Enginefile string
11+
}
12+
13+
// EngineBuildResponse holds information
14+
// returned by a server after building
15+
// an engine.
16+
type EngineBuildResponse struct {
17+
Body io.ReadCloser
18+
}

builder/builder.go

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
// Package builder defines interfaces for any Providence builder to implement.
2+
package builder
3+
4+
import (
5+
"io"
6+
"os"
7+
)
8+
9+
const (
10+
// DefaultEnginefileName is the Default filename with Engine commands, read by `prov engine build`
11+
DefaultEnginefileName string = "Enginefile"
12+
)
13+
14+
// Context represents a file system tree.
15+
type Context interface {
16+
// Close allows to signal that the filesystem tree won't be used anymore.
17+
// For Context implementations using a temporary directory, it is recommended to
18+
// delete the temporary directory in Close().
19+
Close() error
20+
// Stat returns an entry corresponding to path if any.
21+
// It is recommended to return an error if path was not found.
22+
// If path is a symlink it also returns the path to the target file.
23+
Stat(path string) (string, FileInfo, error)
24+
// Open opens path from the context and returns a readable stream of it.
25+
Open(path string) (io.ReadCloser, error)
26+
// Walk walks the tree of the context with the function passed to it.
27+
Walk(root string, walkFn WalkFunc) error
28+
}
29+
30+
// WalkFunc is the type of the function called for each file or directory visited by Context.Walk().
31+
type WalkFunc func(path string, fi FileInfo, err error) error
32+
33+
// ModifiableContext represents a modifiable Context.
34+
// TODO: remove this interface once we can get rid of Remove()
35+
type ModifiableContext interface {
36+
Context
37+
// Remove deletes the entry specified by `path`.
38+
// It is usual for directory entries to delete all its subentries.
39+
Remove(path string) error
40+
}
41+
42+
// FileInfo extends os.FileInfo to allow retrieving an absolute path to the file.
43+
// TODO: remove this interface once pkg/archive exposes a walk function that Context can use.
44+
type FileInfo interface {
45+
os.FileInfo
46+
Path() string
47+
}
48+
49+
// PathFileInfo is a convenience struct that implements the FileInfo interface.
50+
type PathFileInfo struct {
51+
os.FileInfo
52+
// FilePath holds the absolute path to the file.
53+
FilePath string
54+
// Name holds the basename for the file.
55+
FileName string
56+
}
57+
58+
// Path returns the absolute path to the file.
59+
func (fi PathFileInfo) Path() string {
60+
return fi.FilePath
61+
}
62+
63+
// Name returns the basename of the file.
64+
func (fi PathFileInfo) Name() string {
65+
if fi.FileName != "" {
66+
return fi.FileName
67+
}
68+
return fi.FileInfo.Name()
69+
}
70+
71+
// Hashed defines an extra method intended for implementations of os.FileInfo.
72+
type Hashed interface {
73+
// Hash returns the hash of a file.
74+
Hash() string
75+
SetHash(string)
76+
}
77+
78+
// HashedFileInfo is a convenient struct that augments FileInfo with a field.
79+
type HashedFileInfo struct {
80+
FileInfo
81+
// FileHash represents the hash of a file.
82+
FileHash string
83+
}
84+
85+
// Hash returns the hash of a file.
86+
func (fi HashedFileInfo) Hash() string {
87+
return fi.FileHash
88+
}
89+
90+
// SetHash sets the hash of a file.
91+
func (fi *HashedFileInfo) SetHash(h string) {
92+
fi.FileHash = h
93+
}
94+

0 commit comments

Comments
 (0)