From 7631713f9a157fa8713f717acb2a4600da488d82 Mon Sep 17 00:00:00 2001 From: Eduardo Folly Date: Sun, 11 Jan 2026 14:05:31 -0300 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=8E=A8=20Update=20project.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 7 +- .github/workflows/test.yml | 2 +- .gitignore | 1 + CHANGELOG.md | 4 + analysis_options.yaml | 222 ------------------- bin/check.dart | 17 +- bin/returned_data.dart | 150 +++---------- helpers/create_index.dart | 5 - helpers/package.dart | 3 - pubspec.lock | 426 ------------------------------------- pubspec.yaml | 14 +- 11 files changed, 53 insertions(+), 798 deletions(-) delete mode 100644 pubspec.lock diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a257baa..34b091b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,17 +12,18 @@ jobs: contents: write steps: - name: Code Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Get Pubspec Version run: | VERSION=$(grep 'version:' pubspec.yaml | cut -c 10- | cut -f 1 -d '+') + sed -i "s/dev/$VERSION/g" bin/check.dart echo "VERSION=$VERSION" >> $GITHUB_ENV - name: Check if version is used run: | - URL=$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/tags/v${{ env.VERSION }} - CODE=$(curl -s -o /dev/null -w "%{http_code}" "$URL") + URL=$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/tags/${{ env.VERSION }} + CODE=$(curl -s -H "Authorization: Bearer ${{ github.token }}" -o /dev/null -w "%{http_code}" "$URL") if [ "$CODE" != 404 ]; then echo "Release '$VERSION' already exists. ($CODE)" exit 1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ed28100..b2ff89d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ jobs: timeout-minutes: 20 steps: - name: Code Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Get Pubspec Version run: | diff --git a/.gitignore b/.gitignore index e8997db..bc608cf 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ .dart_tool/ .idea/ .env +pubspec.lock check diff --git a/CHANGELOG.md b/CHANGELOG.md index 015f20b..8efa042 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.0.4 [2026-01-11] + +- Updating project plugins, CI and dependencies. + ## 0.0.3 [2024-06-01] - Updating project plugins, CI and dependencies. diff --git a/analysis_options.yaml b/analysis_options.yaml index ce7c19f..572dd23 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,223 +1 @@ include: package:lints/recommended.yaml - -# https://dart.dev/guides/language/analysis-options - -# https://dart-lang.github.io/linter/lints/options/options.html -linter: - rules: - always_declare_return_types: true - always_put_control_body_on_new_line: true - always_put_required_named_parameters_first: true - always_specify_types: true - always_use_package_imports: true - annotate_overrides: true - avoid_annotating_with_dynamic: false - avoid_bool_literals_in_conditional_expressions: true - avoid_catches_without_on_clauses: true - avoid_catching_errors: false - avoid_classes_with_only_static_members: false - avoid_double_and_int_checks: true - avoid_dynamic_calls: true - avoid_empty_else: true - avoid_equals_and_hash_code_on_mutable_classes: false - avoid_escaping_inner_quotes: true - avoid_field_initializers_in_const_classes: true - avoid_final_parameters: true - avoid_function_literals_in_foreach_calls: true - avoid_implementing_value_types: true - avoid_init_to_null: true - avoid_js_rounded_ints: true - avoid_multiple_declarations_per_line: true - avoid_null_checks_in_equality_operators: true - avoid_positional_boolean_parameters: true - avoid_print: false - avoid_private_typedef_functions: true - avoid_redundant_argument_values: true - avoid_relative_lib_imports: true - avoid_renaming_method_parameters: true - avoid_return_types_on_setters: true - avoid_returning_null_for_void: true - avoid_returning_this: true - avoid_setters_without_getters: true - avoid_shadowing_type_parameters: true - avoid_single_cascade_in_expression_statements: true - avoid_slow_async_io: true - avoid_type_to_string: true - avoid_types_as_parameter_names: true - avoid_types_on_closure_parameters: false - avoid_unnecessary_containers: true - avoid_unused_constructor_parameters: true - avoid_void_async: true - avoid_web_libraries_in_flutter: true - await_only_futures: true - camel_case_extensions: true - camel_case_types: true - cancel_subscriptions: true - cascade_invocations: true - cast_nullable_to_non_nullable: true - close_sinks: true - collection_methods_unrelated_type: true - combinators_ordering: true - comment_references: true - conditional_uri_does_not_exist: true - constant_identifier_names: true - control_flow_in_finally: true - curly_braces_in_flow_control_structures: true - dangling_library_doc_comments: true - depend_on_referenced_packages: true - deprecated_consistency: true - deprecated_member_use_from_same_package: true - diagnostic_describe_all_properties: false - directives_ordering: true - discarded_futures: false - do_not_use_environment: true - empty_catches: true - empty_constructor_bodies: true - empty_statements: true - eol_at_end_of_file: true - exhaustive_cases: true - file_names: true - flutter_style_todos: true - hash_and_equals: true - implementation_imports: true - implicit_call_tearoffs: true - implicit_reopen: true - invalid_case_patterns: true - join_return_with_assignment: true - leading_newlines_in_multiline_strings: true - library_annotations: true - library_names: true - library_prefixes: true - library_private_types_in_public_api: true - lines_longer_than_80_chars: true - literal_only_boolean_expressions: true - matching_super_parameters: true - missing_whitespace_between_adjacent_strings: true - no_adjacent_strings_in_list: true - no_default_cases: true - no_duplicate_case_values: true - no_leading_underscores_for_library_prefixes: true - no_leading_underscores_for_local_identifiers: true - no_literal_bool_comparisons: true - no_logic_in_create_state: true - no_runtimeType_toString: true - no_self_assignments: true - no_wildcard_variable_uses: true - non_constant_identifier_names: true - noop_primitive_operations: true - null_check_on_nullable_type_parameter: true - null_closures: true - omit_local_variable_types: false - one_member_abstracts: true - only_throw_errors: true - overridden_fields: true - package_api_docs: true - package_names: true - package_prefixed_library_names: true - parameter_assignments: true - prefer_adjacent_string_concatenation: true - prefer_asserts_in_initializer_lists: true - prefer_asserts_with_message: true - prefer_collection_literals: true - prefer_conditional_assignment: true - prefer_const_constructors: true - prefer_const_constructors_in_immutables: true - prefer_const_declarations: true - prefer_const_literals_to_create_immutables: true - prefer_constructors_over_static_methods: true - prefer_contains: true - prefer_double_quotes: false - prefer_expression_function_bodies: false - prefer_final_fields: true - prefer_final_in_for_each: true - prefer_final_locals: true - prefer_final_parameters: false - prefer_for_elements_to_map_fromIterable: true - prefer_foreach: true - prefer_function_declarations_over_variables: true - prefer_generic_function_type_aliases: true - prefer_if_elements_to_conditional_expressions: true - prefer_if_null_operators: true - prefer_initializing_formals: true - prefer_inlined_adds: true - prefer_int_literals: true - prefer_interpolation_to_compose_strings: true - prefer_is_empty: true - prefer_is_not_empty: true - prefer_is_not_operator: true - prefer_iterable_whereType: true - prefer_mixin: true - prefer_null_aware_method_calls: true - prefer_null_aware_operators: true - prefer_relative_imports: false - prefer_single_quotes: true - prefer_spread_collections: true - prefer_typing_uninitialized_variables: true - prefer_void_to_null: true - provide_deprecation_message: true - public_member_api_docs: false - recursive_getters: true - require_trailing_commas: true - secure_pubspec_urls: true - sized_box_for_whitespace: true - sized_box_shrink_expand: true - slash_for_doc_comments: true - sort_child_properties_last: true - sort_constructors_first: false - sort_pub_dependencies: true - sort_unnamed_constructors_first: true - test_types_in_equals: true - throw_in_finally: true - tighten_type_of_initializing_formals: true - type_annotate_public_apis: true - type_init_formals: true - type_literal_in_constant_pattern: true - unawaited_futures: true - unnecessary_await_in_return: true - unnecessary_brace_in_string_interps: true - unnecessary_breaks: true - unnecessary_const: true - unnecessary_constructor_name: true - unnecessary_final: false - unnecessary_getters_setters: true - unnecessary_lambdas: true - unnecessary_late: true - unnecessary_library_directive: true - unnecessary_new: true - unnecessary_null_aware_assignments: true - unnecessary_null_aware_operator_on_extension_on_nullable: true - unnecessary_null_checks: true - unnecessary_null_in_if_null_operators: true - unnecessary_nullable_for_final_variable_declarations: true - unnecessary_overrides: true - unnecessary_parenthesis: true - unnecessary_raw_strings: true - unnecessary_statements: true - unnecessary_string_escapes: true - unnecessary_string_interpolations: true - unnecessary_this: true - unnecessary_to_list_in_spreads: true - unreachable_from_main: true - unrelated_type_equality_checks: true - unsafe_html: true - use_build_context_synchronously: true - use_colored_box: true - use_decorated_box: true - use_enums: true - use_full_hex_values_for_flutter_colors: true - use_function_type_syntax_for_parameters: true - use_if_null_to_convert_nulls_to_bools: true - use_is_even_rather_than_modulo: true - use_key_in_widget_constructors: true - use_late_for_private_fields_and_variables: true - use_named_constants: true - use_raw_strings: true - use_rethrow_when_possible: true - use_setters_to_change_properties: true - use_string_buffers: true - use_string_in_part_of_directives: true - use_super_parameters: true - use_test_throws_matchers: true - use_to_and_as_if_applicable: true - valid_regexps: true - void_checks: true diff --git a/bin/check.dart b/bin/check.dart index 5aad115..ce53a92 100644 --- a/bin/check.dart +++ b/bin/check.dart @@ -5,16 +5,10 @@ import 'package:http/http.dart'; import 'returned_data.dart'; -const String version = '0.0.3'; +const String version = 'dev'; -/// -/// -/// enum Method { head, get, post, put, patch, delete } -/// -/// -/// void main(List arguments) async { final ReturnedData data = await check(arguments); @@ -29,9 +23,6 @@ void main(List arguments) async { exit(0); } -/// -/// -/// ArgParser buildParser() { return ArgParser() ..addFlag( @@ -77,17 +68,11 @@ ArgParser buildParser() { ); } -/// -/// -/// void printUsage(ArgParser argParser) { print('Usage: check [METHOD] URL'); print(argParser.usage); } -/// -/// -/// Future check(List arguments) async { final ArgParser argParser = buildParser(); try { diff --git a/bin/returned_data.dart b/bin/returned_data.dart index 8baa753..be6a49f 100644 --- a/bin/returned_data.dart +++ b/bin/returned_data.dart @@ -1,122 +1,47 @@ -/// -/// -/// class ReturnedData { final int exitCode; final int statusCode; final bool canFail; - /// - /// - /// ReturnedData({ required this.exitCode, required this.statusCode, required this.canFail, }); - /// - /// - /// - factory ReturnedData.empty() => ReturnedData( - exitCode: 0, - statusCode: 0, - canFail: true, - ); - - /// - /// - /// - factory ReturnedData.ok({bool canFail = true}) => ReturnedData( - exitCode: 0, - statusCode: 200, - canFail: canFail, - ); - - /// - /// - /// - factory ReturnedData.created({bool canFail = true}) => ReturnedData( - exitCode: 0, - statusCode: 201, - canFail: canFail, - ); - - /// - /// - /// - factory ReturnedData.accepted({bool canFail = true}) => ReturnedData( - exitCode: 0, - statusCode: 202, - canFail: canFail, - ); - - /// - /// - /// - factory ReturnedData.noContent({bool canFail = true}) => ReturnedData( - exitCode: 0, - statusCode: 204, - canFail: canFail, - ); - - /// - /// - /// - factory ReturnedData.multipleChoices({bool canFail = true}) => ReturnedData( - exitCode: 10, - statusCode: 300, - canFail: canFail, - ); - - /// - /// - /// - factory ReturnedData.badRequest({bool canFail = true}) => ReturnedData( - exitCode: 110, - statusCode: 400, - canFail: canFail, - ); - - /// - /// - /// - factory ReturnedData.unauthorized({bool canFail = true}) => ReturnedData( - exitCode: 111, - statusCode: 401, - canFail: canFail, - ); - - /// - /// - /// - factory ReturnedData.forbidden({bool canFail = true}) => ReturnedData( - exitCode: 113, - statusCode: 403, - canFail: canFail, - ); - - /// - /// - /// - factory ReturnedData.notFound({bool canFail = true}) => ReturnedData( - exitCode: 114, - statusCode: 404, - canFail: canFail, - ); - - /// - /// - /// - factory ReturnedData.serverError({bool canFail = true}) => ReturnedData( - exitCode: 210, - statusCode: 500, - canFail: canFail, - ); - - /// - /// - /// + factory ReturnedData.empty() => + ReturnedData(exitCode: 0, statusCode: 0, canFail: true); + + factory ReturnedData.ok({bool canFail = true}) => + ReturnedData(exitCode: 0, statusCode: 200, canFail: canFail); + + factory ReturnedData.created({bool canFail = true}) => + ReturnedData(exitCode: 0, statusCode: 201, canFail: canFail); + + factory ReturnedData.accepted({bool canFail = true}) => + ReturnedData(exitCode: 0, statusCode: 202, canFail: canFail); + + factory ReturnedData.noContent({bool canFail = true}) => + ReturnedData(exitCode: 0, statusCode: 204, canFail: canFail); + + factory ReturnedData.multipleChoices({bool canFail = true}) => + ReturnedData(exitCode: 10, statusCode: 300, canFail: canFail); + + factory ReturnedData.badRequest({bool canFail = true}) => + ReturnedData(exitCode: 110, statusCode: 400, canFail: canFail); + + factory ReturnedData.unauthorized({bool canFail = true}) => + ReturnedData(exitCode: 111, statusCode: 401, canFail: canFail); + + factory ReturnedData.forbidden({bool canFail = true}) => + ReturnedData(exitCode: 113, statusCode: 403, canFail: canFail); + + factory ReturnedData.notFound({bool canFail = true}) => + ReturnedData(exitCode: 114, statusCode: 404, canFail: canFail); + + factory ReturnedData.serverError({bool canFail = true}) => + ReturnedData(exitCode: 210, statusCode: 500, canFail: canFail); + @override int get hashCode { int result = 7; @@ -126,9 +51,6 @@ class ReturnedData { return result; } - /// - /// - /// @override bool operator ==(Object other) { if (other is! ReturnedData) { @@ -140,11 +62,9 @@ class ReturnedData { (canFail == other.canFail); } - /// - /// - /// @override - String toString() => 'ReturnedData(' + String toString() => + 'ReturnedData(' 'exitCode: $exitCode, ' 'statusCode: $statusCode, ' 'fail: $canFail)'; diff --git a/helpers/create_index.dart b/helpers/create_index.dart index 5459da5..361343a 100644 --- a/helpers/create_index.dart +++ b/helpers/create_index.dart @@ -1,12 +1,7 @@ -// ignore_for_file: avoid_print - import 'dart:io'; import 'package:markdown/markdown.dart'; -/// -/// -/// void main(List args) { if (args.length != 2) { print('Invalid parameters.'); diff --git a/helpers/package.dart b/helpers/package.dart index 3585e9f..3bc6705 100644 --- a/helpers/package.dart +++ b/helpers/package.dart @@ -1,9 +1,6 @@ import 'dart:convert'; import 'dart:io'; -/// -/// -/// void main() { final Map check = { 'name': 'check', diff --git a/pubspec.lock b/pubspec.lock deleted file mode 100644 index 1ac2b29..0000000 --- a/pubspec.lock +++ /dev/null @@ -1,426 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - _fe_analyzer_shared: - dependency: transitive - description: - name: _fe_analyzer_shared - sha256: "5aaf60d96c4cd00fe7f21594b5ad6a1b699c80a27420f8a837f4d68473ef09e3" - url: "https://pub.dev" - source: hosted - version: "68.0.0" - _macros: - dependency: transitive - description: dart - source: sdk - version: "0.1.0" - analyzer: - dependency: transitive - description: - name: analyzer - sha256: "21f1d3720fd1c70316399d5e2bccaebb415c434592d778cce8acb967b8578808" - url: "https://pub.dev" - source: hosted - version: "6.5.0" - args: - dependency: "direct main" - description: - name: args - sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" - url: "https://pub.dev" - source: hosted - version: "2.5.0" - async: - dependency: transitive - description: - name: async - sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" - url: "https://pub.dev" - source: hosted - version: "2.11.0" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - collection: - dependency: transitive - description: - name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a - url: "https://pub.dev" - source: hosted - version: "1.18.0" - convert: - dependency: transitive - description: - name: convert - sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" - url: "https://pub.dev" - source: hosted - version: "3.1.1" - coverage: - dependency: transitive - description: - name: coverage - sha256: "3945034e86ea203af7a056d98e98e42a5518fff200d6e8e6647e1886b07e936e" - url: "https://pub.dev" - source: hosted - version: "1.8.0" - crypto: - dependency: transitive - description: - name: crypto - sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab - url: "https://pub.dev" - source: hosted - version: "3.0.3" - file: - dependency: transitive - description: - name: file - sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" - url: "https://pub.dev" - source: hosted - version: "7.0.0" - frontend_server_client: - dependency: transitive - description: - name: frontend_server_client - sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 - url: "https://pub.dev" - source: hosted - version: "4.0.0" - glob: - dependency: transitive - description: - name: glob - sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" - url: "https://pub.dev" - source: hosted - version: "2.1.2" - http: - dependency: "direct main" - description: - name: http - sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938" - url: "https://pub.dev" - source: hosted - version: "1.2.1" - http_multi_server: - dependency: transitive - description: - name: http_multi_server - sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" - url: "https://pub.dev" - source: hosted - version: "3.2.1" - http_parser: - dependency: transitive - description: - name: http_parser - sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" - url: "https://pub.dev" - source: hosted - version: "4.0.2" - io: - dependency: transitive - description: - name: io - sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" - url: "https://pub.dev" - source: hosted - version: "1.0.4" - js: - dependency: transitive - description: - name: js - sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf - url: "https://pub.dev" - source: hosted - version: "0.7.1" - lints: - dependency: "direct dev" - description: - name: lints - sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235" - url: "https://pub.dev" - source: hosted - version: "4.0.0" - logging: - dependency: transitive - description: - name: logging - sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" - url: "https://pub.dev" - source: hosted - version: "1.2.0" - macros: - dependency: transitive - description: - name: macros - sha256: "12e8a9842b5a7390de7a781ec63d793527582398d16ea26c60fed58833c9ae79" - url: "https://pub.dev" - source: hosted - version: "0.1.0-main.0" - markdown: - dependency: "direct dev" - description: - name: markdown - sha256: ef2a1298144e3f985cc736b22e0ccdaf188b5b3970648f2d9dc13efd1d9df051 - url: "https://pub.dev" - source: hosted - version: "7.2.2" - matcher: - dependency: transitive - description: - name: matcher - sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb - url: "https://pub.dev" - source: hosted - version: "0.12.16+1" - meta: - dependency: transitive - description: - name: meta - sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 - url: "https://pub.dev" - source: hosted - version: "1.15.0" - mime: - dependency: transitive - description: - name: mime - sha256: "2e123074287cc9fd6c09de8336dae606d1ddb88d9ac47358826db698c176a1f2" - url: "https://pub.dev" - source: hosted - version: "1.0.5" - node_preamble: - dependency: transitive - description: - name: node_preamble - sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" - url: "https://pub.dev" - source: hosted - version: "2.0.2" - package_config: - dependency: transitive - description: - name: package_config - sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" - url: "https://pub.dev" - source: hosted - version: "2.1.0" - path: - dependency: transitive - description: - name: path - sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" - url: "https://pub.dev" - source: hosted - version: "1.9.0" - pool: - dependency: transitive - description: - name: pool - sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" - url: "https://pub.dev" - source: hosted - version: "1.5.1" - pub_semver: - dependency: transitive - description: - name: pub_semver - sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" - url: "https://pub.dev" - source: hosted - version: "2.1.4" - shelf: - dependency: transitive - description: - name: shelf - sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 - url: "https://pub.dev" - source: hosted - version: "1.4.1" - shelf_packages_handler: - dependency: transitive - description: - name: shelf_packages_handler - sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" - url: "https://pub.dev" - source: hosted - version: "3.0.2" - shelf_static: - dependency: transitive - description: - name: shelf_static - sha256: a41d3f53c4adf0f57480578c1d61d90342cd617de7fc8077b1304643c2d85c1e - url: "https://pub.dev" - source: hosted - version: "1.1.2" - shelf_web_socket: - dependency: transitive - description: - name: shelf_web_socket - sha256: "073c147238594ecd0d193f3456a5fe91c4b0abbcc68bf5cd95b36c4e194ac611" - url: "https://pub.dev" - source: hosted - version: "2.0.0" - source_map_stack_trace: - dependency: transitive - description: - name: source_map_stack_trace - sha256: "84cf769ad83aa6bb61e0aa5a18e53aea683395f196a6f39c4c881fb90ed4f7ae" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - source_maps: - dependency: transitive - description: - name: source_maps - sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703" - url: "https://pub.dev" - source: hosted - version: "0.10.12" - source_span: - dependency: transitive - description: - name: source_span - sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" - url: "https://pub.dev" - source: hosted - version: "1.10.0" - stack_trace: - dependency: transitive - description: - name: stack_trace - sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" - url: "https://pub.dev" - source: hosted - version: "1.11.1" - stream_channel: - dependency: transitive - description: - name: stream_channel - sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 - url: "https://pub.dev" - source: hosted - version: "2.1.2" - string_scanner: - dependency: transitive - description: - name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" - url: "https://pub.dev" - source: hosted - version: "1.2.0" - term_glyph: - dependency: transitive - description: - name: term_glyph - sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 - url: "https://pub.dev" - source: hosted - version: "1.2.1" - test: - dependency: "direct dev" - description: - name: test - sha256: d11b55850c68c1f6c0cf00eabded4e66c4043feaf6c0d7ce4a36785137df6331 - url: "https://pub.dev" - source: hosted - version: "1.25.5" - test_api: - dependency: transitive - description: - name: test_api - sha256: "2419f20b0c8677b2d67c8ac4d1ac7372d862dc6c460cdbb052b40155408cd794" - url: "https://pub.dev" - source: hosted - version: "0.7.1" - test_core: - dependency: transitive - description: - name: test_core - sha256: "4d070a6bc36c1c4e89f20d353bfd71dc30cdf2bd0e14349090af360a029ab292" - url: "https://pub.dev" - source: hosted - version: "0.6.2" - testainers: - dependency: "direct dev" - description: - name: testainers - sha256: fdb531b50467d26de08788bc149abf38a2da6d0b36a639827a5649c66a8070b5 - url: "https://pub.dev" - source: hosted - version: "0.1.1" - typed_data: - dependency: transitive - description: - name: typed_data - sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c - url: "https://pub.dev" - source: hosted - version: "1.3.2" - vm_service: - dependency: transitive - description: - name: vm_service - sha256: "360c4271613beb44db559547d02f8b0dc044741d0eeb9aa6ccdb47e8ec54c63a" - url: "https://pub.dev" - source: hosted - version: "14.2.3" - watcher: - dependency: transitive - description: - name: watcher - sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" - url: "https://pub.dev" - source: hosted - version: "1.1.0" - web: - dependency: transitive - description: - name: web - sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" - url: "https://pub.dev" - source: hosted - version: "0.5.1" - web_socket: - dependency: transitive - description: - name: web_socket - sha256: "24301d8c293ce6fe327ffe6f59d8fd8834735f0ec36e4fd383ec7ff8a64aa078" - url: "https://pub.dev" - source: hosted - version: "0.1.5" - web_socket_channel: - dependency: transitive - description: - name: web_socket_channel - sha256: a2d56211ee4d35d9b344d9d4ce60f362e4f5d1aafb988302906bd732bc731276 - url: "https://pub.dev" - source: hosted - version: "3.0.0" - webkit_inspection_protocol: - dependency: transitive - description: - name: webkit_inspection_protocol - sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" - url: "https://pub.dev" - source: hosted - version: "1.2.1" - yaml: - dependency: transitive - description: - name: yaml - sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" - url: "https://pub.dev" - source: hosted - version: "3.1.2" -sdks: - dart: ">=3.4.0 <4.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 26aee16..0d93dd6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,24 +5,24 @@ repository: https://github.com/testainers/check homepage: https://check.testainers.com environment: - sdk: ^3.4.0 + sdk: ^3.9.0 dependencies: # https://pub.dev/packages/args - args: ^2.5.0 + args: ^2.7.0 # https://pub.dev/packages/http - http: ^1.2.1 + http: ^1.6.0 dev_dependencies: # https://pub.dev/packages/lints - lints: ^4.0.0 + lints: ^6.0.0 # https://pub.dev/packages/markdown - markdown: ^7.2.2 + markdown: ^7.3.0 # https://pub.dev/packages/test - test: ^1.25.5 + test: ^1.29.0 # https://pub.dev/packages/testainers - testainers: ^0.1.1 + testainers: ^0.3.0 From 9773bf66c457cd50433856fc2bb3efb7f2826439 Mon Sep 17 00:00:00 2001 From: Eduardo Folly Date: Sun, 11 Jan 2026 15:03:52 -0300 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=94=96=20Version=20bump=200.0.4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 24 +++++++++++++++++++ bin/check.dart | 62 ++++++++++++-------------------------------------- pubspec.yaml | 2 +- 3 files changed, 39 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index 22fd1ab..e5a0959 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,14 @@ Obrigado pelo seu apoio contínuo! [![PIX](helpers/pix.png)](https://nubank.com.br/pagar/2bt2q/RBr4Szfuwr) +## Download + +```shell +curl -sSLO https://github.com/testainers/check/releases/latest/download/check +chmod a+x check +sudo mv check /usr/local/bin +``` + ## Examples Check http://localhost:8080 with GET method. @@ -55,6 +63,22 @@ Check http://localhost:8080 with GET method and timeout to 5 seconds. check -t 5 GET :8080 ``` +Add `check` directly from dockerfile. + +```dockerfile +ADD https://github.com/testainers/check/releases/latest/download/check \ + /usr/bin/check + +RUN chmod +x /usr/bin/check +``` + +Docker HEALTHCHECK example: + +```dockerfile +HEALTHCHECK --start-period=5s --interval=15s --timeout=10s --retries=3 \ + CMD check :8081/api/health || exit 1 +``` + ### Exit Codes The exit codes in the range from 1 to 8 are reserved for specific application diff --git a/bin/check.dart b/bin/check.dart index ce53a92..4fa6e31 100644 --- a/bin/check.dart +++ b/bin/check.dart @@ -50,22 +50,14 @@ ArgParser buildParser() { defaultsTo: 'check/$version', valueHelp: 'agent', ) - ..addFlag( - 'fail', - help: 'Fail on non-200 status code.', - defaultsTo: true, - ) + ..addFlag('fail', help: 'Fail on non-200 status code.', defaultsTo: true) ..addFlag( 'verbose', abbr: 'v', negatable: false, help: 'Show additional command output.', ) - ..addFlag( - 'version', - negatable: false, - help: 'Print the tool version.', - ); + ..addFlag('version', negatable: false, help: 'Print the tool version.'); } void printUsage(ArgParser argParser) { @@ -77,7 +69,7 @@ Future check(List arguments) async { final ArgParser argParser = buildParser(); try { final ArgResults results = argParser.parse(arguments); - bool verbose = false; + final verbose = results.wasParsed('verbose'); Method method = Method.get; int urlPos = 0; Duration timeout = const Duration(seconds: 10); @@ -92,10 +84,6 @@ Future check(List arguments) async { return ReturnedData.empty(); } - if (results.wasParsed('verbose')) { - verbose = true; - } - if (results.wasParsed('timeout')) { try { final int value = int.parse(results['timeout']); @@ -121,14 +109,10 @@ Future check(List arguments) async { method = Method.values.byName(results.rest.first.toLowerCase()); urlPos = 1; } on Error { - if (verbose) { - print('[VERBOSE] Using default method: GET'); - } + if (verbose) print('[VERBOSE] Using default method: GET'); } - if (verbose) { - print('[VERBOSE] Method: $method'); - } + if (verbose) print('[VERBOSE] Method: $method'); if (results.rest.length <= urlPos) { throw const FormatException('No URL provided.'); @@ -140,9 +124,7 @@ Future check(List arguments) async { url = 'http://localhost$url'; } - if (verbose) { - print('[VERBOSE] URL: $url'); - } + if (verbose) print('[VERBOSE] URL: $url'); Uri uri = Uri.parse(url); @@ -150,9 +132,7 @@ Future check(List arguments) async { uri = Uri.parse('http://$uri'); } - if (verbose) { - print('[VERBOSE] URI: $uri'); - } + if (verbose) print('[VERBOSE] URI: $uri'); final Map headers = { 'User-Agent': results['user-agent'], @@ -163,42 +143,28 @@ Future check(List arguments) async { switch (method) { case Method.head: - if (verbose) { - print('[VERBOSE] HEAD: $uri'); - } + if (verbose) print('[VERBOSE] HEAD: $uri'); response = await head(uri, headers: headers).timeout(timeout); case Method.get: - if (verbose) { - print('[VERBOSE] GET: $uri'); - } + if (verbose) print('[VERBOSE] GET: $uri'); response = await get(uri, headers: headers).timeout(timeout); case Method.post: - if (verbose) { - print('[VERBOSE] POST: $uri'); - } + if (verbose) print('[VERBOSE] POST: $uri'); response = await post(uri, headers: headers).timeout(timeout); case Method.put: - if (verbose) { - print('[VERBOSE] PUT: $uri'); - } + if (verbose) print('[VERBOSE] PUT: $uri'); response = await put(uri, headers: headers).timeout(timeout); case Method.patch: - if (verbose) { - print('[VERBOSE] PATCH: $uri'); - } + if (verbose) print('[VERBOSE] PATCH: $uri'); response = await patch(uri, headers: headers).timeout(timeout); case Method.delete: - if (verbose) { - print('[VERBOSE] DELETE: $uri'); - } + if (verbose) print('[VERBOSE] DELETE: $uri'); response = await delete(uri, headers: headers).timeout(timeout); } final int code = response.statusCode; - if (verbose) { - print('[VERBOSE] Status code: $code'); - } + if (verbose) print('[VERBOSE] Status code: $code'); int exitCode; diff --git a/pubspec.yaml b/pubspec.yaml index 0d93dd6..c044ee1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: check description: Minimum HTTP CLI. -version: 0.0.3 +version: 0.0.4 repository: https://github.com/testainers/check homepage: https://check.testainers.com