Skip to content

Commit

Permalink
Merge pull request #14 from edufolly/dev
Browse files Browse the repository at this point in the history
Version 0.2.0.
  • Loading branch information
edufolly authored May 26, 2024
2 parents 927b851 + 7221c0a commit 49ad5d1
Show file tree
Hide file tree
Showing 9 changed files with 285 additions and 163 deletions.
27 changes: 18 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,23 @@ jobs:
version: ${{ steps.version-step.outputs.version }}
steps:
- name: Code Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Get Pubspec Version
id: version-step
run: |
export VERSION=$(grep 'version:' pubspec.yaml | cut -c 10- | cut -f 1 -d '+')
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Check if version is used
run: |
URL=$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/latest
LATEST=$(curl --silent "$URL" | jq -r .name)
if [ "$LATEST" == "v$VERSION" ]; then
echo "Version already used: $VERSION"
exit 1
fi
###################
# Tests & Release #
Expand All @@ -36,7 +45,7 @@ jobs:
contents: write
steps:
- name: Code Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Flutter Environment
uses: subosito/flutter-action@v2
Expand Down Expand Up @@ -64,10 +73,10 @@ jobs:
- name: Creating lcov.info
run: |
dart run coverage:format_coverage \
--packages=coverage/package.json \
--lcov \
-i coverage \
-o coverage/lcov.info
--packages=coverage/package.json \
--lcov \
-i coverage \
-o coverage/lcov.info
- name: Creating Test Coverage HTML
run: |
Expand All @@ -80,21 +89,21 @@ jobs:
run: dart run helpers/create_index.dart README.md coverage/html/index.html

- name: Publish Dart Package
uses: k-paxian/dart-package-publisher@master
uses: k-paxian/dart-package-publisher@1.6
with:
accessToken: ${{ secrets.OAUTH_ACCESS_TOKEN }}
refreshToken: ${{ secrets.OAUTH_REFRESH_TOKEN }}
skipTests: true
format: true

- name: Publishing to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4
with:
publish_dir: ./coverage/html
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Creating a GitHub Tag
uses: mathieudutour/github-tag-action@v6.1
uses: mathieudutour/github-tag-action@v6.2
with:
custom_tag: ${{ needs.boot.outputs.version }}
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
timeout-minutes: 20
steps:
- name: Code Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Flutter Environment
uses: subosito/flutter-action@v2
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
## 0.2.0 (2024-05-26)

- Updating dependencies.

## 0.1.2 (2023-06-29)

- Removing http package dependency.
- Adding testainer package.
- Adding testainers package.

## 0.1.1 (2023-06-24)

Expand Down
75 changes: 64 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,74 @@
# curt

Simple wrapper for curl in dart.
[![Build With Love](https://img.shields.io/badge/%20built%20with-%20%E2%9D%A4-ff69b4.svg)](https://github.com/edufolly/curt/stargazers)
[![Pub Package](https://img.shields.io/pub/v/curt?color=orange)](https://pub.dev/packages/curt)
[![Licence](https://img.shields.io/github/license/edufolly/curt?color=blue)](https://github.com/edufolly/curt/blob/main/LICENSE)
[![Build](https://img.shields.io/github/actions/workflow/status/edufolly/curt/main.yml?branch=main)](https://github.com/edufolly/curt/releases/latest)
[![Coverage Report](https://img.shields.io/badge/coverage-report-C08EA1)](https://edufolly.github.io/curt/coverage/)

[![BuildWithLove](https://img.shields.io/badge/%20built%20with-%20%E2%9D%A4-ff69b4.svg "build with love")](https://github.com/edufolly/curt/stargazers)
[![pub package](https://img.shields.io/pub/v/curt?include_prereleases.svg "curt")](https://pub.dev/packages/curt)
[![curt](https://img.shields.io/github/license/edufolly/curt "licence")](https://github.com/edufolly/curt)
[![curt](https://img.shields.io/github/actions/workflow/status/edufolly/curt/main.yml?branch=main "build")](https://github.com/edufolly/curt)
[![CoverageReport](https://img.shields.io/badge/coverage-report-blue "coverage report")](https://edufolly.github.io/curt/coverage/)
A convenient package that allows developers to interact with the curl command
within elegance of the Dart programming language.

## Motivation

Allow https connections with TLS less than 1.2 through curl.
This wrapper simplifies the process of sending HTTP requests, handling
responses, and managing data transfers, providing a more intuitive and efficient
way to work with curl functionality in the Dart ecosystem. By encapsulating the
complexity of curl within a straightforward wrapper, developers can leverage its
power and flexibility while benefiting from the simplicity and elegance of the
Dart programming language.

## Funding

Your contribution will help drive the development of quality tools for the
Flutter and Dart developer community. Any amount will be appreciated. Thank you
for your continued support!

[![BuyMeACoffee](https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg)](https://www.buymeacoffee.com/edufolly)

### Code Example
## PIX

Sua contribuição ajudará a impulsionar o desenvolvimento de ferramentas de
qualidade para a comunidade de desenvolvedores Flutter e Dart. Qualquer quantia
será apreciada. Obrigado pelo seu apoio contínuo!

[![PIX](helpers/pix.png)](https://nubank.com.br/pagar/2bt2q/RBr4Szfuwr)

## Motivation

Allow https connections with TLS less than 1.2 through [curl](https://curl.se/).

Legacy systems or older applications that rely on older TLS versions for
compatibility reasons. These systems might not have been upgraded to support TLS
1.2 or higher due to various constraints, such as limited resources, technical
limitations, or compatibility issues with certain dependencies. In such cases,
allowing HTTPS connections with TLS versions less than 1.2 through curl would
enable these systems to continue functioning without major modifications.

Certain devices or environments might enforce outdated TLS configurations due to
specific security policies or restrictions. These networks may still rely on
older TLS versions for various reasons, such as interoperability with legacy
systems or compliance with specific regulations. Allowing curl to establish
HTTPS connections with TLS versions less than 1.2 would ensure compatibility and
connectivity in these constrained environments.

However, it's important to note that TLS versions prior to 1.2 (such as TLS 1.0
and TLS 1.1) are considered less secure and potentially vulnerable to various
security threats. TLS 1.2 introduced significant improvements in terms of
security, encryption algorithms, and cryptographic protocols. Therefore, it's
generally recommended to use TLS 1.2 or higher for secure communications.

## Example

```dart
import 'package:curt/curt.dart';
https://github.com/edufolly/curt/blob/main/example/curt_example.dart
///
///
///
void main() async {
final Curt curt = Curt();
final CurtResponse response = await curt.get(Uri.parse('https://google.com'));
print('Status Code: ${response.statusCode}');
print('Headers: ${response.headers}');
print('Body:\n${response.body}');
}
```
64 changes: 62 additions & 2 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
include: package:lints/recommended.yaml

# https://dart.dev/guides/language/analysis-options
# https://dart.dev/tools/analysis

# https://dart-lang.github.io/linter/lints/options/options.html
analyze:
language:
strict-casts: true
strict-inference: true
strict-raw-types: true
strong-mode:
implicit-casts: false

# https://dart.dev/tools/linter-rules/all
linter:
rules:
always_declare_return_types: true
always_put_control_body_on_new_line: true
always_put_required_named_parameters_first: true

# Incompatible with:
# avoid_types_on_closure_parameters
# omit_local_variable_types
always_specify_types: true


# Incompatible with:
# prefer_relative_imports
always_use_package_imports: true

annotate_overrides: true
annotate_redeclares: true
avoid_annotating_with_dynamic: false
avoid_bool_literals_in_conditional_expressions: true
avoid_catches_without_on_clauses: true
Expand All @@ -22,7 +40,11 @@ linter:
avoid_equals_and_hash_code_on_mutable_classes: true
avoid_escaping_inner_quotes: true
avoid_field_initializers_in_const_classes: true

# Incompatible with:
# prefer_final_parameters
avoid_final_parameters: true

avoid_function_literals_in_foreach_calls: true
avoid_implementing_value_types: true
avoid_init_to_null: true
Expand All @@ -44,7 +66,11 @@ linter:
avoid_slow_async_io: true
avoid_type_to_string: true
avoid_types_as_parameter_names: true

# Incompatible with:
# always_specify_types
avoid_types_on_closure_parameters: false

avoid_unnecessary_containers: true
avoid_unused_constructor_parameters: true
avoid_void_async: true
Expand Down Expand Up @@ -92,6 +118,7 @@ linter:
lines_longer_than_80_chars: true
literal_only_boolean_expressions: true
matching_super_parameters: true
missing_code_block_language_in_doc_comment: true
missing_whitespace_between_adjacent_strings: true
no_adjacent_strings_in_list: true
no_default_cases: true
Expand All @@ -101,11 +128,17 @@ linter:
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

# Incompatible with:
# always_specify_types
omit_local_variable_types: false

one_member_abstracts: true
only_throw_errors: true
overridden_fields: true
Expand All @@ -124,12 +157,25 @@ linter:
prefer_const_literals_to_create_immutables: true
prefer_constructors_over_static_methods: true
prefer_contains: true

# Incompatible with:
# prefer_single_quotes
prefer_double_quotes: false

prefer_expression_function_bodies: false
prefer_final_fields: true
prefer_final_in_for_each: true

# Incompatible with:
# unnecessary_final
prefer_final_locals: true


# Incompatible with:
# unnecessary_final
# avoid_final_parameters
prefer_final_parameters: false

prefer_for_elements_to_map_fromIterable: true
prefer_foreach: true
prefer_function_declarations_over_variables: true
Expand All @@ -147,8 +193,16 @@ linter:
prefer_mixin: true
prefer_null_aware_method_calls: true
prefer_null_aware_operators: true

# Incompatible with:
# always_use_package_imports
prefer_relative_imports: false


# Incompatible with:
# prefer_double_quotes
prefer_single_quotes: true

prefer_spread_collections: true
prefer_typing_uninitialized_variables: true
prefer_void_to_null: true
Expand Down Expand Up @@ -176,11 +230,17 @@ linter:
unnecessary_breaks: true
unnecessary_const: true
unnecessary_constructor_name: true

# Incompatible with:
# prefer_final_locals
# prefer_final_parameters
unnecessary_final: false

unnecessary_getters_setters: true
unnecessary_lambdas: true
unnecessary_late: true
unnecessary_library_directive: true
unnecessary_library_name: false
unnecessary_new: true
unnecessary_null_aware_assignments: true
unnecessary_null_aware_operator_on_extension_on_nullable: true
Expand Down
1 change: 1 addition & 0 deletions helpers/create_index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ void main(List<String> args) {

if (!mdFile.existsSync()) {
print('Markdown file not exists.');
exit(20);
}

const String template = '''
Expand Down
Binary file added helpers/pix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 7 additions & 7 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: curt
description: Simple wrapper for curl in dart.
version: 0.1.2
description: A convenient package that allows developers to interact with the curl command within elegance of the Dart programming language.
version: 0.2.0
repository: https://github.com/edufolly/curt

environment:
Expand All @@ -11,16 +11,16 @@ dependencies:

dev_dependencies:
# https://pub.dev/packages/coverage
coverage: ^1.6.3
coverage: ^1.8.0

# https://pub.dev/packages/lints
lints: ^2.1.0
lints: ^4.0.0

# https://pub.dev/packages/markdown
markdown: ^7.1.0
markdown: ^7.2.2

# https://pub.dev/packages/test
test: ^1.24.0
test: ^1.25.5

# https://pub.dev/packages/testainers
testainers: ^0.0.1
testainers: ^0.1.1
Loading

0 comments on commit 49ad5d1

Please sign in to comment.