-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(nextcloud_test): move test presets to a separate package
Signed-off-by: Nikolas Rimikis <[email protected]>
- Loading branch information
Showing
63 changed files
with
116 additions
and
68 deletions.
There are no files selected for viewing
This file contains 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 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
53 changes: 0 additions & 53 deletions
53
packages/nextcloud/packages/nextcloud_test/lib/src/app.dart
This file was deleted.
Oops, something went wrong.
This file contains 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 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../assets/AGPL-3.0.txt |
1 change: 1 addition & 0 deletions
1
packages/nextcloud/packages/nextcloud_test_presets/analysis_options.yaml
This file contains 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
include: package:neon_lints/dart.yaml |
5 changes: 5 additions & 0 deletions
5
packages/nextcloud/packages/nextcloud_test_presets/bin/generate_presets.dart
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import 'package:nextcloud_test_presets/presets_builder.dart'; | ||
|
||
Future<void> main() async { | ||
await generatePresets(); | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
packages/nextcloud/packages/nextcloud_test_presets/lib/presets_builder.dart
This file contains 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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/// Tools to generate the Nextcloud test presets. | ||
library; | ||
|
||
export 'src/generate_presets.dart'; |
This file contains 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
32 changes: 32 additions & 0 deletions
32
packages/nextcloud/packages/nextcloud_test_presets/lib/src/models/app.dart
This file contains 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import 'package:meta/meta.dart'; | ||
import 'package:nextcloud_test_presets/src/models/models.dart'; | ||
|
||
/// Describes an app from https://apps.nextcloud.com | ||
@internal | ||
class App { | ||
App({ | ||
required this.id, | ||
required this.releases, | ||
}); | ||
|
||
final String id; | ||
final List<AppRelease> releases; | ||
|
||
AppRelease? findLatestCompatibleRelease(Version serverVersion, {bool allowUnstable = false}) { | ||
final compatibleReleases = releases | ||
.where( | ||
(release) => | ||
serverVersion >= release.minimumServerVersion && | ||
serverVersion < release.maximumServerVersion.incrementMajor() && | ||
(allowUnstable || !release.version.isPreRelease), | ||
) | ||
.toList() | ||
..sort((a, b) => b.version.compareTo(a.version)); | ||
return compatibleReleases.firstOrNull; | ||
} | ||
|
||
AppRelease findLatestRelease() { | ||
final sortedReleases = releases..sort((a, b) => b.version.compareTo(a.version)); | ||
return sortedReleases.first; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
packages/nextcloud/packages/nextcloud_test_presets/lib/src/models/app_release.dart
This file contains 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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import 'package:meta/meta.dart'; | ||
import 'package:nextcloud_test_presets/src/models/models.dart'; | ||
|
||
/// Describes a release of an [App] from https://apps.nextcloud.com | ||
@internal | ||
class AppRelease { | ||
const AppRelease({ | ||
required this.version, | ||
required this.url, | ||
required this.minimumServerVersion, | ||
required this.maximumServerVersion, | ||
}); | ||
|
||
final Version version; | ||
final String url; | ||
final Version minimumServerVersion; | ||
final Version maximumServerVersion; | ||
|
||
Version? findLatestServerVersion(List<Version> serverVersions) { | ||
final compatibleReleases = serverVersions | ||
.where( | ||
(serverVersion) => | ||
serverVersion >= minimumServerVersion && serverVersion < maximumServerVersion.incrementMajor(), | ||
) | ||
.toList() | ||
..sort((a, b) => b.compareTo(a)); | ||
return compatibleReleases.firstOrNull; | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/nextcloud/packages/nextcloud_test_presets/lib/src/models/models.dart
This file contains 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export 'package:version/version.dart'; | ||
export 'app.dart'; | ||
export 'app_release.dart'; |
18 changes: 18 additions & 0 deletions
18
packages/nextcloud/packages/nextcloud_test_presets/pubspec.yaml
This file contains 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: nextcloud_test_presets | ||
version: 1.0.0 | ||
publish_to: none | ||
|
||
environment: | ||
sdk: ^3.0.0 | ||
|
||
dependencies: | ||
http: ^1.2.0 | ||
meta: ^1.0.0 | ||
nextcloud: ^7.0.0 | ||
version: ^3.0.0 | ||
|
||
dev_dependencies: | ||
neon_lints: | ||
git: | ||
url: https://github.com/nextcloud/neon | ||
path: packages/neon_lints |
8 changes: 8 additions & 0 deletions
8
packages/nextcloud/packages/nextcloud_test_presets/pubspec_overrides.yaml
This file contains 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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# melos_managed_dependency_overrides: dynamite_runtime,neon_lints,nextcloud | ||
dependency_overrides: | ||
dynamite_runtime: | ||
path: ../../../dynamite/packages/dynamite_runtime | ||
neon_lints: | ||
path: ../../../neon_lints | ||
nextcloud: | ||
path: ../.. |
This file contains 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 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 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 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