Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
c7d35e3a
Commit
c7d35e3a
authored
Nov 12, 2015
by
Jack Greenfield
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #44 from jackgr/require-schema
Require schema
parents
af8817ae
34c9e42d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
6 deletions
+17
-6
dm.go
dm/dm.go
+3
-3
github_registry.go
registry/github_registry.go
+14
-3
No files found.
dm/dm.go
View file @
c7d35e3a
...
...
@@ -98,15 +98,15 @@ func main() {
log
.
Fatalf
(
"Cannot list %v err"
)
}
fmt
.
Printf
(
"Types:"
)
fmt
.
Printf
(
"Types:
\n
"
)
for
_
,
t
:=
range
types
{
fmt
.
Printf
(
"%s:%s"
,
t
.
Name
,
t
.
Version
)
fmt
.
Printf
(
"%s:%s
\n
"
,
t
.
Name
,
t
.
Version
)
downloadURL
,
err
:=
git
.
GetURL
(
t
)
if
err
!=
nil
{
log
.
Printf
(
"Failed to get download URL for type %s:%s"
,
t
.
Name
,
t
.
Version
)
}
fmt
.
Printf
(
"
\t
download URL: %s"
,
downloadURL
)
fmt
.
Printf
(
"
\t
download URL: %s
\n
"
,
downloadURL
)
}
case
"describe"
:
fmt
.
Printf
(
"this feature is not yet implemented"
)
...
...
registry/github_registry.go
View file @
c7d35e3a
...
...
@@ -60,21 +60,32 @@ func (g *GithubRegistry) List() ([]Type, error) {
return
retTypes
,
nil
}
// GetURL fetches the download URL for a given Type.
// GetURL fetches the download URL for a given Type
and checks for existence of a schema file
.
func
(
g
*
GithubRegistry
)
GetURL
(
t
Type
)
(
string
,
error
)
{
_
,
dc
,
_
,
err
:=
g
.
client
.
Repositories
.
GetContents
(
g
.
owner
,
g
.
repository
,
TypesDir
+
"/"
+
t
.
Name
+
"/"
+
t
.
Version
,
nil
)
if
err
!=
nil
{
log
.
Printf
(
"Failed to list types : %v"
,
err
)
return
""
,
err
}
var
downloadURL
,
typeName
,
schemaName
string
for
_
,
f
:=
range
dc
{
if
*
f
.
Type
==
"file"
{
if
*
f
.
Name
==
t
.
Name
+
".jinja"
||
*
f
.
Name
==
t
.
Name
+
".py"
{
return
*
f
.
DownloadURL
,
nil
typeName
=
*
f
.
Name
downloadURL
=
*
f
.
DownloadURL
}
if
*
f
.
Name
==
t
.
Name
+
".jinja.schema"
||
*
f
.
Name
==
t
.
Name
+
".py.schema"
{
schemaName
=
*
f
.
Name
}
}
}
return
""
,
fmt
.
Errorf
(
"Can not find type %s:%s"
,
t
.
Name
,
t
.
Version
)
if
downloadURL
==
""
{
return
""
,
fmt
.
Errorf
(
"Can not find type %s:%s"
,
t
.
Name
,
t
.
Version
)
}
if
schemaName
==
typeName
+
".schema"
{
return
downloadURL
,
nil
}
return
""
,
fmt
.
Errorf
(
"Can not find schema for %s:%s, expected to find %s"
,
t
.
Name
,
t
.
Version
,
typeName
+
".schema"
)
}
func
(
g
*
GithubRegistry
)
getDirs
(
dir
string
)
([]
string
,
error
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment