Skip to content
This repository has been archived by the owner on Oct 31, 2021. It is now read-only.

Upgrade dependency and fix travis #9

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: dart
dart:
- dev
- stable
script:
- dartanalyzer --fatal-warnings --fatal-lints .
- pub run test
- dart analyze --fatal-warnings --fatal-infos .
- dart pub run test
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.2.1

- Upgrade dependencies

## 0.1.2

- Added support for `generate directive`
Expand Down
11 changes: 6 additions & 5 deletions lib/src/template_file.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@

import 'dart:async';
import "dart:convert" show utf8;
import 'dart:io';
import 'dart:isolate';

import 'package:mustache/mustache.dart';
import 'package:resource/resource.dart' show Resource;

import 'path_util.dart';

/// Template file class wrapping operations on mustache template.
class TemplateFile {
Expand All @@ -24,8 +23,10 @@ class TemplateFile {

/// Renders template file on [_path] with values from [_data].
Future<String> renderString() async {
var uri = fixUri('package:angular_cli/templates/$_path');
var resource = new Resource(uri);
var uri = await Isolate.resolvePackageUri(
Uri.parse('package:angular_cli/templates/$_path'),
);
var resource = File.fromUri(uri);
var content = await resource.readAsString(encoding: utf8);

var template = new Template(content);
Expand Down
3 changes: 2 additions & 1 deletion lib/src/visitors/angular_component_visitor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd

import 'package:analyzer/analyzer.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/visitor.dart';

import '../app_logger.dart';
import '../exceptions.dart';
Expand Down
14 changes: 9 additions & 5 deletions lib/src/visitors/ast_cache.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

import 'dart:collection';

import 'package:analyzer/analyzer.dart';
import 'package:analyzer/dart/analysis/utilities.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:path/path.dart' as path;

import '../app_logger.dart';
Expand Down Expand Up @@ -70,14 +71,17 @@ class AstCache {
var filePath = _uriResolver.resolve(uri);
AppLogger.log.fine('Parsing file $filePath...');

compilationUnit = parseCompilationUnit(
FileReader.reader.readAsString(filePath),
name: filePath);
final parsed = parseString(
content: FileReader.reader.readAsString(filePath),
path: filePath,
);
compilationUnit = parsed.unit;
} on UsageException {
rethrow;
} catch (e) {
AppLogger.log.warning('Could not parse $uri: $e');
compilationUnit = parseCompilationUnit('');
final parsed = parseString(content: '');
compilationUnit = parsed.unit;
}

_uriToAst[uri] = compilationUnit;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/visitors/binding_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd

import 'package:analyzer/analyzer.dart';
import 'package:analyzer/dart/ast/ast.dart';

import '../app_logger.dart';
import '../exceptions.dart';
Expand Down
3 changes: 2 additions & 1 deletion lib/src/visitors/binding_visitor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd

import 'package:analyzer/analyzer.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/visitor.dart';

import 'binding_helper.dart';
import 'binding_info.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/visitors/dart_class_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd

import 'package:analyzer/analyzer.dart';
import 'package:analyzer/dart/ast/ast.dart';

/// Models a Dart class found during analysis.
class DartClassInfo {
Expand Down
3 changes: 2 additions & 1 deletion lib/src/visitors/dart_class_visitor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd

import 'package:analyzer/analyzer.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/visitor.dart';

import '../app_logger.dart';
import '../exceptions.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/visitors/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd

import 'package:analyzer/analyzer.dart';
import 'package:analyzer/dart/ast/ast.dart';

import '../app_logger.dart';

Expand Down
3 changes: 2 additions & 1 deletion lib/src/visitors/visit_resources.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd

import 'package:analyzer/analyzer.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:path/path.dart' as path;

import '../app_logger.dart';
Expand Down
11 changes: 5 additions & 6 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
name: angular_cli
version: 0.2.0
version: 0.2.1
authors:
- Tianfei Zhu <[email protected]>
- Jing Bian <[email protected]>
- Jonah Williams <[email protected]>
homepage: https://github.com/google/angular_cli
description: Scaffolding tool for AngularDart
environment:
sdk: '>=2.0.0-dev.69.0 <3.0.0'
sdk: '>=2.0.0 <3.0.0'
executables:
ngdart:
dependencies:
analyzer: ^0.32.4
analyzer: ^0.40.0
ansicolor: ^1.0.2
args: ^1.4.4
html: ^0.13.3+2
html: ^0.14.0
mustache: ^1.0.1
logging: ^0.11.3+2
path: ^1.6.2
resource: ^2.1.5
dev_dependencies:
test: ^1.3.0
test: ^1.5.0
5 changes: 3 additions & 2 deletions test/angular_component_visitor_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd

import 'package:analyzer/analyzer.dart';
import 'package:analyzer/dart/analysis/utilities.dart';
import 'package:angular_cli/src/visitors/angular_component_visitor.dart';
import 'package:angular_cli/src/visitors/component_info.dart';
import 'package:angular_cli/src/visitors/dart_class_info.dart';
Expand All @@ -14,7 +14,8 @@ void main() {
group('AngularComponentVisitor', () {
Map<String, ComponentInfo> visit(
Map<String, DartClassInfo> classes, String content) {
var compilationUnit = parseCompilationUnit(content);
var parsed = parseString(content: content);
var compilationUnit = parsed.unit;
var out = <String, ComponentInfo>{};
var visitor = new AngularComponentVisitor(classes, out);
compilationUnit.accept(visitor);
Expand Down
8 changes: 5 additions & 3 deletions test/binding_helper_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd

import 'package:analyzer/analyzer.dart';
import 'package:analyzer/dart/analysis/utilities.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:angular_cli/src/visitors/binding_helper.dart';
import 'package:angular_cli/src/visitors/binding_info.dart';
import 'package:test/test.dart';
Expand All @@ -18,7 +20,7 @@ void main() {
});

parse(String contents) {
parseCompilationUnit(contents).accept(visitor);
parseString(content: contents).unit.accept(visitor);
}

test('should parse simple binding', () {
Expand Down Expand Up @@ -154,7 +156,7 @@ void main() {
});

parse(String contents) {
parseCompilationUnit(contents).accept(visitor);
parseString(content: contents).unit.accept(visitor);
}

void checkExpandedModule(
Expand Down
5 changes: 3 additions & 2 deletions test/binding_visitor_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd

import 'package:analyzer/analyzer.dart';
import 'package:analyzer/dart/analysis/utilities.dart';
import 'package:angular_cli/src/visitors/binding_info.dart';
import 'package:angular_cli/src/visitors/binding_visitor.dart';
import 'package:test/test.dart';

void main() {
group('BindingVisitor', () {
Map<String, ModuleInfo> visit(String content) {
var compilationUnit = parseCompilationUnit(content);
var parsed = parseString(content: content);
var compilationUnit = parsed.unit;
var out = <String, ModuleInfo>{};
var visitor = new BindingVisitor('', out, {}, new Set<String>());
compilationUnit.accept(visitor);
Expand Down
5 changes: 3 additions & 2 deletions test/dart_class_visitor_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
// license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd

import 'package:analyzer/analyzer.dart';
import 'package:analyzer/dart/analysis/utilities.dart';
import 'package:angular_cli/src/visitors/dart_class_info.dart';
import 'package:angular_cli/src/visitors/dart_class_visitor.dart';
import 'package:test/test.dart';

void main() {
group('DartClassVisitor', () {
Map<String, DartClassInfo> visit(String content) {
var compilationUnit = parseCompilationUnit(content);
var parsed = parseString(content: content);
var compilationUnit = parsed.unit;
var out = <String, DartClassInfo>{};
var visitor = new DartClassVisitor('', out, {});
compilationUnit.accept(visitor);
Expand Down