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
987ce972
Commit
987ce972
authored
Aug 07, 2015
by
Devon Carew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use mustache4dart
parent
b114623b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
15 deletions
+13
-15
init.dart
packages/flutter_tools/lib/src/init.dart
+12
-15
pubspec.yaml
packages/flutter_tools/pubspec.yaml
+1
-0
No files found.
packages/flutter_tools/lib/src/init.dart
View file @
987ce972
...
@@ -8,6 +8,7 @@ import 'dart:async';
...
@@ -8,6 +8,7 @@ import 'dart:async';
import
'dart:io'
;
import
'dart:io'
;
import
'package:args/args.dart'
;
import
'package:args/args.dart'
;
import
'package:mustache4dart/mustache4dart.dart'
as
mustache
;
import
'package:path/path.dart'
as
p
;
import
'package:path/path.dart'
as
p
;
import
'common.dart'
;
import
'common.dart'
;
...
@@ -16,12 +17,10 @@ class InitCommandHandler extends CommandHandler {
...
@@ -16,12 +17,10 @@ class InitCommandHandler extends CommandHandler {
InitCommandHandler
()
:
super
(
'init'
,
'Create a new sky project.'
);
InitCommandHandler
()
:
super
(
'init'
,
'Create a new sky project.'
);
ArgParser
get
parser
{
ArgParser
get
parser
{
// TODO: Add a --template option for template selection when we have more than one.
ArgParser
parser
=
new
ArgParser
();
ArgParser
parser
=
new
ArgParser
();
parser
.
addFlag
(
'help'
,
parser
.
addFlag
(
'help'
,
abbr:
'h'
,
negatable:
false
,
help:
'Display this help message.'
);
abbr:
'h'
,
negatable:
false
,
help:
'Display this help message.'
);
// parser.addOption('template',
// abbr: 't',
// help: "The template to generate; either sky-simple or sky-full.");
parser
.
addOption
(
'out'
,
abbr:
'o'
,
help:
'The output directory.'
);
parser
.
addOption
(
'out'
,
abbr:
'o'
,
help:
'The output directory.'
);
parser
.
addFlag
(
'pub'
,
defaultsTo:
true
,
parser
.
addFlag
(
'pub'
,
defaultsTo:
true
,
help:
'Whether to run pub after the project has been created.'
);
help:
'Whether to run pub after the project has been created.'
);
...
@@ -39,11 +38,9 @@ class InitCommandHandler extends CommandHandler {
...
@@ -39,11 +38,9 @@ class InitCommandHandler extends CommandHandler {
return
new
Future
.
value
();
return
new
Future
.
value
();
}
}
// TODO: Confirm overwrite of an existing directory with the user.
Directory
out
=
new
Directory
(
results
[
'out'
]);
Directory
out
=
new
Directory
(
results
[
'out'
]);
// TODO: confirm overwrite with user
//if (out.existsSync())
new
SkySimpleTemplate
().
generateInto
(
out
);
new
SkySimpleTemplate
().
generateInto
(
out
);
print
(
''
);
print
(
''
);
...
@@ -81,9 +78,11 @@ abstract class Template {
...
@@ -81,9 +78,11 @@ abstract class Template {
dir
.
createSync
(
recursive:
true
);
dir
.
createSync
(
recursive:
true
);
files
.
forEach
((
String
path
,
String
contents
)
{
files
.
forEach
((
String
path
,
String
contents
)
{
contents
=
contents
Map
m
=
{
.
replaceAll
(
'{{projectName}}'
,
projectName
)
'projectName'
:
projectName
,
.
replaceAll
(
'{{description}}'
,
description
);
'description'
:
description
};
contents
=
mustache
.
render
(
contents
,
m
);
File
file
=
new
File
(
p
.
join
(
dir
.
path
,
path
));
File
file
=
new
File
(
p
.
join
(
dir
.
path
,
path
));
file
.
parent
.
createSync
();
file
.
parent
.
createSync
();
file
.
writeAsStringSync
(
contents
);
file
.
writeAsStringSync
(
contents
);
...
@@ -147,12 +146,10 @@ import 'package:sky/widgets.dart';
...
@@ -147,12 +146,10 @@ import 'package:sky/widgets.dart';
class HelloWorldApp extends App {
class HelloWorldApp extends App {
Widget build() {
Widget build() {
return new Scaffold(
return new Scaffold(
toolbar: new ToolBar(center: new Text("Demo")),
toolbar: new ToolBar(center: new Text("Demo")),
body: new Material(child: new Center(child: new Text("Hello world!"))),
body: new Material(child: new Center(child: new Text("Hello world!"))),
floatingActionButton: new FloatingActionButton(
floatingActionButton: new FloatingActionButton(
child: new Icon(type: '
content
/
add
', size: 24)
child: new Icon(type: '
content
/
add
', size: 24)));
)
);
}
}
}
}
...
...
packages/flutter_tools/pubspec.yaml
View file @
987ce972
...
@@ -9,6 +9,7 @@ environment:
...
@@ -9,6 +9,7 @@ environment:
dependencies
:
dependencies
:
args
:
^0.13.0
args
:
^0.13.0
mustache4dart
:
^1.0.0
path
:
^1.3.0
path
:
^1.3.0
shelf
:
^0.6.2
shelf
:
^0.6.2
shelf_route
:
^0.13.4
shelf_route
:
^0.13.4
...
...
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