Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
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
abdullh.alsoleman
Front-End
Commits
cec62889
Commit
cec62889
authored
Aug 07, 2015
by
Devon Carew
Browse files
Options
Browse Files
Download
Plain Diff
merge to master
parents
2efd1315
b2679dbc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
3 deletions
+29
-3
sky_server.dart
packages/flutter_tools/bin/sky_server.dart
+27
-2
pubspec.yaml
packages/flutter_tools/pubspec.yaml
+2
-1
No files found.
packages/flutter_tools/bin/sky_server.dart
View file @
cec62889
...
@@ -8,18 +8,33 @@ import 'package:args/args.dart';
...
@@ -8,18 +8,33 @@ import 'package:args/args.dart';
import
'package:shelf_static/shelf_static.dart'
;
import
'package:shelf_static/shelf_static.dart'
;
import
'package:shelf/shelf_io.dart'
as
io
;
import
'package:shelf/shelf_io.dart'
as
io
;
import
'package:shelf/shelf.dart'
;
import
'package:shelf/shelf.dart'
;
import
'package:shelf_route/shelf_route.dart'
as
shelf_route
;
void
printUsage
(
parser
)
{
void
printUsage
(
parser
)
{
print
(
'Usage: sky_server [-v] PORT'
);
print
(
'Usage: sky_server [-v] PORT'
);
print
(
parser
.
usage
);
print
(
parser
.
usage
);
}
}
void
addRoute
(
var
router
,
String
route
,
String
path
)
{
router
.
add
(
route
,
[
'GET'
],
createStaticHandler
(
path
,
serveFilesOutsidePath:
true
,
listDirectories:
true
),
exactMatch:
false
);
}
main
(
List
<
String
>
argv
)
async
{
main
(
List
<
String
>
argv
)
async
{
ArgParser
parser
=
new
ArgParser
();
ArgParser
parser
=
new
ArgParser
();
parser
.
addFlag
(
'help'
,
abbr:
'h'
,
negatable:
false
,
parser
.
addFlag
(
'help'
,
abbr:
'h'
,
negatable:
false
,
help:
'Display this help message.'
);
help:
'Display this help message.'
);
parser
.
addFlag
(
'verbose'
,
abbr:
'v'
,
negatable:
false
,
parser
.
addFlag
(
'verbose'
,
abbr:
'v'
,
negatable:
false
,
help:
'Log requests to stdout.'
);
help:
'Log requests to stdout.'
);
parser
.
addOption
(
'route'
,
allowMultiple:
true
,
splitCommas:
false
,
help:
'Adds a virtual directory to the root.'
);
ArgResults
args
=
parser
.
parse
(
argv
);
ArgResults
args
=
parser
.
parse
(
argv
);
...
@@ -36,8 +51,18 @@ main(List<String> argv) async {
...
@@ -36,8 +51,18 @@ main(List<String> argv) async {
return
;
return
;
}
}
Handler
handler
=
createStaticHandler
(
Directory
.
current
.
path
,
var
router
=
shelf_route
.
router
();
serveFilesOutsidePath:
true
,
listDirectories:
true
);
if
(
args
[
'route'
]
!=
null
)
{
for
(
String
arg
in
args
[
'route'
])
{
List
<
String
>
parsedArgs
=
arg
.
split
(
','
);
addRoute
(
router
,
parsedArgs
[
0
],
parsedArgs
[
1
]);
}
}
addRoute
(
router
,
'/'
,
Directory
.
current
.
path
);
var
handler
=
router
.
handler
;
if
(
args
[
'verbose'
])
if
(
args
[
'verbose'
])
handler
=
const
Pipeline
().
addMiddleware
(
logRequests
()).
addHandler
(
handler
);
handler
=
const
Pipeline
().
addMiddleware
(
logRequests
()).
addHandler
(
handler
);
...
...
packages/flutter_tools/pubspec.yaml
View file @
cec62889
name
:
sky_tools
name
:
sky_tools
version
:
0.0.
6
version
:
0.0.
8
description
:
Tools for building Sky applications
description
:
Tools for building Sky applications
homepage
:
https://github.com/domokit/sky_tools
homepage
:
https://github.com/domokit/sky_tools
author
:
Chromium Authors <sky-dev@googlegroups.com>
author
:
Chromium Authors <sky-dev@googlegroups.com>
...
@@ -11,6 +11,7 @@ dependencies:
...
@@ -11,6 +11,7 @@ dependencies:
args
:
^0.13.0
args
:
^0.13.0
path
:
^1.3.0
path
:
^1.3.0
shelf
:
^0.6.2
shelf
:
^0.6.2
shelf_route
:
^0.13.4
shelf_static
:
^0.2.3
shelf_static
:
^0.2.3
dev_dependencies
:
dev_dependencies
:
...
...
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