OLD | NEW |
1 import "dart:io"; | 1 import "dart:io"; |
2 import "dart:async"; | 2 import "dart:async"; |
3 | 3 |
4 import '../discovery_api_dart_client_generator/lib/generator.dart'; | 4 import '../discovery_api_dart_client_generator/lib/generator.dart'; |
5 import 'package:google_discovery_v1_api/discovery_v1_api_client.dart'; | 5 import 'package:google_discovery_v1_api/discovery_v1_api_client.dart'; |
6 import 'package:yaml/yaml.dart'; | 6 import 'package:yaml/yaml.dart'; |
7 | 7 |
8 class Package { | 8 class Package { |
9 final String name; | 9 final String name; |
10 final List<String> apis; | 10 final List<String> apis; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 } | 73 } |
74 var licenseFile; | 74 var licenseFile; |
75 if (values['license'] != null) { | 75 if (values['license'] != null) { |
76 licenseFile = Platform.script.resolve(values['license']).path; | 76 licenseFile = Platform.script.resolve(values['license']).path; |
77 } | 77 } |
78 | 78 |
79 | 79 |
80 // Generate package description. | 80 // Generate package description. |
81 var apiDescriptions = []; | 81 var apiDescriptions = []; |
82 var sb = new StringBuffer() | 82 var sb = new StringBuffer() |
83 ..write('Auto-generated client libraries for accessing ' | 83 ..write('"Auto-generated client libraries for accessing ' |
84 'the following APIs:'); | 84 'the following APIs:\\n'); |
85 items.forEach((DirectoryListItems apiDescription) { | 85 items.forEach((DirectoryListItems apiDescription) { |
86 if (apis.contains(apiDescription.id)) { | 86 if (apis.contains(apiDescription.id)) { |
87 sb..writeln(' ') | 87 sb..writeln('') |
| 88 ..write(' ') |
88 ..write(apiDescription.id) | 89 ..write(apiDescription.id) |
89 ..write(' - ') | 90 ..write(' - ') |
90 ..write(apiDescription.description); | 91 ..write(apiDescription.description) |
| 92 ..write('\\n'); |
91 apiDescriptions.add(apiDescription); | 93 apiDescriptions.add(apiDescription); |
92 } | 94 } |
93 }); | 95 }); |
| 96 sb.write('"'); |
94 | 97 |
95 // Generate the README.md file content. | 98 // Generate the README.md file content. |
96 var readme = generateReadme(readmeFile, apiDescriptions); | 99 var readme = generateReadme(readmeFile, apiDescriptions); |
97 | 100 |
98 // Read the LICENSE | 101 // Read the LICENSE |
99 var license = new File(licenseFile).readAsStringSync(); | 102 var license = new File(licenseFile).readAsStringSync(); |
100 | 103 |
101 // Create package description with pubspec.yaml information. | 104 // Create package description with pubspec.yaml information. |
102 var pubspec = new Pubspec( | 105 var pubspec = new Pubspec( |
103 name, version, sb.toString(), author: author, homepage: homepage); | 106 name, version, sb.toString(), author: author, homepage: homepage); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 .writeAsStringSync(package.readme); | 153 .writeAsStringSync(package.readme); |
151 if (package.license != null) { | 154 if (package.license != null) { |
152 new File('$generatedApisDir/$name/LICENSE') | 155 new File('$generatedApisDir/$name/LICENSE') |
153 .writeAsStringSync(package.license); | 156 .writeAsStringSync(package.license); |
154 } | 157 } |
155 }); | 158 }); |
156 print('DONE'); | 159 print('DONE'); |
157 }); | 160 }); |
158 }); | 161 }); |
159 } | 162 } |
OLD | NEW |