Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
2fcb8b84
Commit
2fcb8b84
authored
Mar 08, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style(cli): fixed typos
parent
d7a72e30
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
pkg/cmd/grafana-cli/commands/install_command.go
+9
-9
pkg/cmd/grafana-cli/commands/install_command_test.go
+2
-2
No files found.
pkg/cmd/grafana-cli/commands/install_command.go
View file @
2fcb8b84
...
...
@@ -26,8 +26,8 @@ func validateInput(c CommandLine, pluginFolder string) error {
return
errors
.
New
(
"missing path flag"
)
}
file
i
nfo
,
err
:=
os
.
Stat
(
pluginDir
)
if
err
!=
nil
&&
!
file
i
nfo
.
IsDir
()
{
file
I
nfo
,
err
:=
os
.
Stat
(
pluginDir
)
if
err
!=
nil
&&
!
file
I
nfo
.
IsDir
()
{
return
errors
.
New
(
"path is not a directory"
)
}
...
...
@@ -106,20 +106,20 @@ func SelectVersion(plugin m.Plugin, version string) (m.Version, error) {
return
m
.
Version
{},
errors
.
New
(
"Could not find the version your looking for"
)
}
func
RemoveGitBuildFrom
name
(
pluginn
ame
,
filename
string
)
string
{
func
RemoveGitBuildFrom
Name
(
pluginN
ame
,
filename
string
)
string
{
r
:=
regexp
.
MustCompile
(
"^[a-zA-Z0-9_.-]*/"
)
return
r
.
ReplaceAllString
(
filename
,
plugin
n
ame
+
"/"
)
return
r
.
ReplaceAllString
(
filename
,
plugin
N
ame
+
"/"
)
}
var
retryCount
=
0
func
downloadFile
(
pluginName
,
file
p
ath
,
url
string
)
(
err
error
)
{
func
downloadFile
(
pluginName
,
file
P
ath
,
url
string
)
(
err
error
)
{
defer
func
()
{
if
r
:=
recover
();
r
!=
nil
{
retryCount
++
if
retryCount
==
1
{
log
.
Debug
(
"
\n
Failed downloading. Will retry once.
\n
"
)
downloadFile
(
pluginName
,
file
p
ath
,
url
)
downloadFile
(
pluginName
,
file
P
ath
,
url
)
}
else
{
panic
(
r
)
}
...
...
@@ -142,12 +142,12 @@ func downloadFile(pluginName, filepath, url string) (err error) {
return
err
}
for
_
,
zf
:=
range
r
.
File
{
new
file
:=
path
.
Join
(
filepath
,
RemoveGitBuildFromn
ame
(
pluginName
,
zf
.
Name
))
new
File
:=
path
.
Join
(
filePath
,
RemoveGitBuildFromN
ame
(
pluginName
,
zf
.
Name
))
if
zf
.
FileInfo
()
.
IsDir
()
{
os
.
Mkdir
(
new
f
ile
,
0777
)
os
.
Mkdir
(
new
F
ile
,
0777
)
}
else
{
dst
,
err
:=
os
.
Create
(
new
f
ile
)
dst
,
err
:=
os
.
Create
(
new
F
ile
)
if
err
!=
nil
{
log
.
Errorf
(
"%v"
,
err
)
}
...
...
pkg/cmd/grafana-cli/commands/install_command_test.go
View file @
2fcb8b84
...
...
@@ -19,7 +19,7 @@ func TestFoldernameReplacement(t *testing.T) {
Convey
(
"should be replaced with plugin name"
,
func
()
{
for
k
,
v
:=
range
paths
{
So
(
RemoveGitBuildFrom
n
ame
(
pluginName
,
k
),
ShouldEqual
,
v
)
So
(
RemoveGitBuildFrom
N
ame
(
pluginName
,
k
),
ShouldEqual
,
v
)
}
})
})
...
...
@@ -32,7 +32,7 @@ func TestFoldernameReplacement(t *testing.T) {
Convey
(
"should be replaced with plugin name"
,
func
()
{
for
k
,
v
:=
range
paths
{
So
(
RemoveGitBuildFrom
n
ame
(
pluginName
,
k
),
ShouldEqual
,
v
)
So
(
RemoveGitBuildFrom
N
ame
(
pluginName
,
k
),
ShouldEqual
,
v
)
}
})
})
...
...
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