-
Notifications
You must be signed in to change notification settings - Fork 237
feat: add template for creating a flutter plugin #169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
e542eb9
feat: add template for creating a flutter plugin
denangelov 41cb3bf
formating
denangelov 96218f4
remove unused import
denangelov f574e07
refactored flutter cli and updated flutter cli unit tests
denangelov bbdd562
remove redundant import
denangelov a6d189d
update tests to generate a valid pubspec.yaml
denangelov 4fa5e02
formatting
denangelov 2ba04b2
updated mason bundle for flutter plugin template
denangelov 24545c2
formatting
denangelov f6166a5
updated flutter_plugin template test to generate pubspec.yaml
denangelov 976b373
fix: apply feedback
felangel 1f3b30f
update flutter plugin mason bundle
denangelov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| export 'dart_package_bundle.dart'; | ||
| export 'flutter_package_bundle.dart'; | ||
| export 'flutter_plugin_bundle.dart'; | ||
| export 'template.dart'; | ||
| export 'very_good_core_bundle.dart'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,106 @@ | ||
| import 'package:path/path.dart' as p; | ||
| import 'package:test/test.dart'; | ||
| import 'package:universal_io/io.dart'; | ||
| import 'package:very_good_cli/src/flutter_cli.dart'; | ||
|
|
||
| const pubspec = ''' | ||
| name: example | ||
| environment: | ||
| sdk: ">=2.13.0 <3.0.0" | ||
| '''; | ||
|
|
||
| const invalidPubspec = ''' | ||
| name: example | ||
| '''; | ||
|
|
||
| void main() { | ||
| group('Flutter CLI', () { | ||
| group('packages get', () { | ||
| test('throws when there is no pubspec.yaml', () { | ||
| expectLater( | ||
| Flutter.packagesGet(Directory.systemTemp.path), | ||
| Flutter.packagesGet(cwd: Directory.systemTemp.path), | ||
| throwsException, | ||
| ); | ||
| }); | ||
|
|
||
| test('throws when process fails', () { | ||
| final directory = Directory.systemTemp.createTempSync(); | ||
| File(p.join(directory.path, 'pubspec.yaml')) | ||
| .writeAsStringSync(invalidPubspec); | ||
|
|
||
| expectLater( | ||
| Flutter.packagesGet(cwd: directory.path), | ||
| throwsException, | ||
| ); | ||
| }); | ||
|
|
||
| test('completes when there is a pubspec.yaml', () { | ||
| expectLater(Flutter.packagesGet(), completes); | ||
| }); | ||
|
|
||
| test('throws when there is no pubspec.yaml (recursive)', () { | ||
| final directory = Directory.systemTemp.createTempSync(); | ||
| expectLater( | ||
| Flutter.packagesGet(cwd: directory.path, recursive: true), | ||
| throwsException, | ||
| ); | ||
| }); | ||
|
|
||
| test('completes when there is a pubspec.yaml (recursive)', () { | ||
| final directory = Directory.systemTemp.createTempSync(); | ||
| final nestedDirectory = Directory(p.join(directory.path, 'test')) | ||
| ..createSync(); | ||
| File(p.join(nestedDirectory.path, 'pubspec.yaml')) | ||
| .writeAsStringSync(pubspec); | ||
| expectLater( | ||
| Flutter.packagesGet(cwd: directory.path, recursive: true), | ||
| completes, | ||
| ); | ||
| }); | ||
| }); | ||
|
|
||
| group('pub get', () { | ||
| test('throws when there is no pubspec.yaml', () { | ||
| expectLater( | ||
| Flutter.pubGet(Directory.systemTemp.path), | ||
| Flutter.pubGet(cwd: Directory.systemTemp.path), | ||
| throwsException, | ||
| ); | ||
| }); | ||
|
|
||
| test('throws when process fails', () { | ||
| final directory = Directory.systemTemp.createTempSync(); | ||
| File(p.join(directory.path, 'pubspec.yaml')) | ||
| .writeAsStringSync(invalidPubspec); | ||
|
|
||
| expectLater( | ||
| Flutter.pubGet(cwd: directory.path), | ||
| throwsException, | ||
| ); | ||
| }); | ||
|
|
||
| test('completes when there is a pubspec.yaml', () { | ||
| expectLater(Flutter.pubGet(), completes); | ||
| }); | ||
|
|
||
| test('throws when there is no pubspec.yaml (recursive)', () { | ||
| final directory = Directory.systemTemp.createTempSync(); | ||
| expectLater( | ||
| Flutter.pubGet(cwd: directory.path, recursive: true), | ||
| throwsException, | ||
| ); | ||
| }); | ||
|
|
||
| test('completes when there is a pubspec.yaml (recursive)', () { | ||
| final directory = Directory.systemTemp.createTempSync(); | ||
| final nestedDirectory = Directory(p.join(directory.path, 'test')) | ||
| ..createSync(); | ||
| File(p.join(nestedDirectory.path, 'pubspec.yaml')) | ||
| .writeAsStringSync(pubspec); | ||
| expectLater( | ||
| Flutter.pubGet(cwd: directory.path, recursive: true), | ||
| completes, | ||
| ); | ||
| }); | ||
| }); | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.