Skip to content
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

Resolves #17 #18

Closed
wants to merge 3 commits into from
Closed

Resolves #17 #18

wants to merge 3 commits into from

Conversation

Agraphie
Copy link

@Agraphie Agraphie commented Jun 5, 2019

Resolves issue #17 by not using pubspec package for writing new version, but by searching for the version string in the pubspec file, incrementing it and writing back the string to the pubspec file.

Future _writeNewPubSpec(
File pubSpec, Version oldVersion, Version newVersion) async {
String newPubSpec = pubSpec.readAsStringSync().replaceFirst(
'version: "${oldVersion}"', "version: " + '"${newVersion.toString()}"');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if a different quotation is used?

version: '1.2.3+4'

or

version: 1.2.3+4

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, thanks. The ouput shouldn't matter but for the input I guess it's better to use a simple regex. I'll add it.

@f3ath
Copy link
Owner

f3ath commented Jun 6, 2019

Thanks for the PR. I'd like to see the pubspec manipulation logic extracted to a separate class. This way we could use it also for reading the version and get rid of the entire pubspec dependency.

@Agraphie
Copy link
Author

Agraphie commented Jun 6, 2019

Good idea. I'll do that. I'll (possibly) also try to add this feature further down in the pubspec package or so. But after a quick glance I didn't find an easy way. In any case, if it gets added further down the pipe, we can just remove the code here again and revert to copy(...).save(). What do you think? Also I'm quite the beginner in Dart, so any feedback is appreciated :D

@f3ath
Copy link
Owner

f3ath commented Jun 6, 2019

Sure. Open another PR to this branch, I'll help with refactoring.

@Agraphie Agraphie closed this Jun 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants