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
8ff2a887
Commit
8ff2a887
authored
Jan 14, 2014
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix counting error in SourceOptions
parent
a5f16d46
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
5 deletions
+21
-5
InitCommand.java
...ava/org/springframework/boot/cli/command/InitCommand.java
+12
-1
SourceOptions.java
...a/org/springframework/boot/cli/command/SourceOptions.java
+9
-4
No files found.
spring-boot-cli/src/main/java/org/springframework/boot/cli/command/InitCommand.java
View file @
8ff2a887
...
...
@@ -16,10 +16,13 @@
package
org
.
springframework
.
boot
.
cli
.
command
;
import
groovy.lang.Binding
;
import
groovy.lang.GroovyClassLoader
;
import
groovy.lang.Script
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.ServiceLoader
;
import
joptsimple.OptionSet
;
...
...
@@ -34,6 +37,7 @@ import org.springframework.boot.cli.compiler.GroovyCompilerConfigurationAdapter;
import
org.springframework.boot.cli.compiler.GroovyCompilerScope
;
import
org.springframework.boot.cli.compiler.RepositoryConfigurationFactory
;
import
org.springframework.boot.cli.compiler.grape.RepositoryConfiguration
;
import
org.springframework.core.env.JOptCommandLinePropertySource
;
import
org.springframework.util.StringUtils
;
/**
...
...
@@ -116,10 +120,17 @@ public class InitCommand extends OptionParsingCommand {
for
(
Class
<?>
type
:
classes
)
{
if
(
Script
.
class
.
isAssignableFrom
(
type
))
{
Script
script
=
(
Script
)
type
.
newInstance
();
JOptCommandLinePropertySource
properties
=
new
JOptCommandLinePropertySource
(
options
);
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
for
(
String
key
:
properties
.
getPropertyNames
())
{
map
.
put
(
key
,
properties
.
getProperty
(
key
));
}
script
.
setBinding
(
new
Binding
(
map
));
script
.
run
();
}
enhanced
=
true
;
}
enhanced
=
true
;
}
if
(
enhanced
)
{
...
...
spring-boot-cli/src/main/java/org/springframework/boot/cli/command/SourceOptions.java
View file @
8ff2a887
...
...
@@ -61,6 +61,7 @@ public class SourceOptions {
String
...
defaultPaths
)
{
List
<?>
nonOptionArguments
=
optionSet
.
nonOptionArguments
();
List
<
String
>
sources
=
new
ArrayList
<
String
>();
int
sourceArgCount
=
0
;
for
(
Object
option
:
nonOptionArguments
)
{
if
(
option
instanceof
String
)
{
String
filename
=
(
String
)
option
;
...
...
@@ -73,14 +74,18 @@ public class SourceOptions {
sources
.
add
(
url
);
}
}
if
((
filename
.
endsWith
(
".groovy"
)
||
filename
.
endsWith
(
".java"
))
&&
urls
.
isEmpty
())
{
throw
new
IllegalArgumentException
(
"Can't find "
+
filename
);
if
((
filename
.
endsWith
(
".groovy"
)
||
filename
.
endsWith
(
".java"
)))
{
if
(
urls
.
isEmpty
())
{
throw
new
IllegalArgumentException
(
"Can't find "
+
filename
);
}
else
{
sourceArgCount
++;
}
}
}
}
this
.
args
=
Collections
.
unmodifiableList
(
nonOptionArguments
.
subList
(
source
s
.
size
()
,
nonOptionArguments
.
size
()));
source
ArgCount
,
nonOptionArguments
.
size
()));
if
(
sources
.
size
()
==
0
)
{
if
(
defaultPaths
.
length
==
0
)
{
throw
new
IllegalArgumentException
(
...
...
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