Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
2f260888
Commit
2f260888
authored
May 03, 2017
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unpack CLI for its integration tests as dir is no longer assembled
Closes gh-9080
parent
dc8a34f3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
11 deletions
+33
-11
CommandLineInvoker.java
...framework/boot/cli/infrastructure/CommandLineInvoker.java
+33
-11
No files found.
spring-boot-cli/src/it/java/org/springframework/boot/cli/infrastructure/CommandLineInvoker.java
View file @
2f260888
...
@@ -19,6 +19,8 @@ package org.springframework.boot.cli.infrastructure;
...
@@ -19,6 +19,8 @@ package org.springframework.boot.cli.infrastructure;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileFilter
;
import
java.io.FileFilter
;
import
java.io.FileInputStream
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.PrintWriter
;
import
java.io.PrintWriter
;
...
@@ -27,8 +29,11 @@ import java.io.StringWriter;
...
@@ -27,8 +29,11 @@ import java.io.StringWriter;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.List
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipInputStream
;
import
org.springframework.util.Assert
;
import
org.springframework.util.Assert
;
import
org.springframework.util.StreamUtils
;
/**
/**
* Utility to invoke the command line in the same way as a user would, i.e. via the shell
* Utility to invoke the command line in the same way as a user would, i.e. via the shell
...
@@ -63,18 +68,35 @@ public final class CommandLineInvoker {
...
@@ -63,18 +68,35 @@ public final class CommandLineInvoker {
return
processBuilder
.
start
();
return
processBuilder
.
start
();
}
}
private
File
findLaunchScript
()
{
private
File
findLaunchScript
()
throws
IOException
{
File
dir
=
new
File
(
"target"
);
File
unpacked
=
new
File
(
"target/unpacked-cli"
);
dir
=
dir
.
listFiles
(
new
FileFilter
()
{
if
(!
unpacked
.
isDirectory
())
{
@Override
File
zip
=
new
File
(
"target"
).
listFiles
(
new
FileFilter
()
{
public
boolean
accept
(
File
pathname
)
{
return
pathname
.
isDirectory
()
&&
pathname
.
getName
().
contains
(
"-bin"
);
@Override
public
boolean
accept
(
File
pathname
)
{
return
pathname
.
getName
().
endsWith
(
"-bin.zip"
);
}
})[
0
];
ZipInputStream
input
=
new
ZipInputStream
(
new
FileInputStream
(
zip
));
ZipEntry
entry
;
while
((
entry
=
input
.
getNextEntry
())
!=
null
)
{
File
file
=
new
File
(
unpacked
,
entry
.
getName
());
if
(
entry
.
isDirectory
())
{
file
.
mkdirs
();
}
else
{
file
.
getParentFile
().
mkdirs
();
StreamUtils
.
copy
(
input
,
new
FileOutputStream
(
file
));
if
(
entry
.
getName
().
endsWith
(
"/bin/spring"
))
{
file
.
setExecutable
(
true
);
}
}
}
}
})[
0
];
}
dir
=
new
File
(
dir
,
File
bin
=
new
File
(
unpacked
.
listFiles
()[
0
],
"bin"
);
dir
.
getName
().
replace
(
"-bin"
,
""
).
replace
(
"spring-boot-cli"
,
"spring"
));
File
launchScript
=
new
File
(
bin
,
isWindows
()
?
"spring.bat"
:
"spring"
);
dir
=
new
File
(
dir
,
"bin"
);
File
launchScript
=
new
File
(
dir
,
isWindows
()
?
"spring.bat"
:
"spring"
);
Assert
.
state
(
launchScript
.
exists
()
&&
launchScript
.
isFile
(),
Assert
.
state
(
launchScript
.
exists
()
&&
launchScript
.
isFile
(),
"Could not find CLI launch script "
+
launchScript
.
getAbsolutePath
());
"Could not find CLI launch script "
+
launchScript
.
getAbsolutePath
());
return
launchScript
;
return
launchScript
;
...
...
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