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

chore: update package version to distribution in pub dev #7

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/PULL_REQUEST_TEMPLATES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Tipo do Merge Request

- [ ] 🛠️ Bugfix
- [ ] ✨ Feature
- [ ] ✅ Build or CI
- [ ] 🧹 Code Refactor or Style
- [ ] 📝 Documentation
- [ ] 🗑️ Others

## Describe current behavior

Briefly describe the behavior of the application

### What were the behavior changes?

List the changes presented in this MR, with images if possible

### Does this MR have any breaking changes?

- [ ] ✅ Yes
- [ ] ❌ No

### Other information

Talk a little more about what is being done in this MR
7 changes: 7 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
enable-beta-ecosystems: true
updates:
- package-ecosystem: "pub"
directory: "/"
schedule:
interval: "weekly"
62 changes: 62 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Rubik Utils CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
test:
name: Test
runs-on: ubuntu-latest

if: ${{ always() }}

steps:
- uses: actions/checkout@v4
- uses: subosito/[email protected]

- name: Set up timezone
run: sudo ln -snf /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime && echo America/Sao_Paulo | sudo tee /etc/timezone

- name: Setup coverage
run: sudo apt-get update -qq -y && sudo apt-get install -y lcov

- name: Run Test
run: flutter test --coverage test/rubik_utils_test.dart

- name: Coverage
run: |
lcov --list coverage/lcov.info
lcov -r coverage/lcov.info '*/__test*__/*' -o coverage/lcov_cleaned.info
genhtml coverage/lcov_cleaned.info --output=coverage

publish:
needs: test
name: Publish
runs-on: ubuntu-latest

if: github.ref == 'refs/heads/main'

steps:
- uses: actions/checkout@v4
- uses: subosito/[email protected]

- run: echo "flutter pub publish -h"

analyze:
name: Analyze
runs-on: ubuntu-latest

if: ${{ always() }}

steps:
- uses: actions/checkout@v4
- uses: subosito/[email protected]

- name: Run Analyze
run: flutter analyze
continue-on-error: true


47 changes: 47 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
image: ghcr.io/cirruslabs/flutter:latest

stages:
- test
- analyze
- deploy

Test:
stage: test
before_script:
- DEBIAN_FRONTEND=noninteractive apt-get update
- DEBIAN_FRONTEND=noninteractive apt-get install tzdata
- ln -fs /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime
script:
- flutter clean && flutter pub get
- TZ="America/Bahia" && flutter test --coverage test/rubik_utils_test.dart
- lcov -r coverage/lcov.info '*/__test*__/*' -o coverage/lcov_cleaned.info
- genhtml coverage/lcov_cleaned.info --output=coverage
coverage: '/lines\.*:\s*(\d+.\d+)%/'
artifacts:
paths:
- coverage

Analyze:
stage: analyze
script:
- flutter analyze
allow_failure: true

SonarQube:
stage: deploy
variables:
GIT_DEPTH: "0"
GIT_STRATEGY: clone
needs:
- Test
script:
- |
curl -O https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.8.0.2856-linux.zip
unzip sonar-scanner-cli-4.8.0.2856-linux.zip
sonar-scanner-4.8.0.2856-linux/bin/sonar-scanner \
-Dsonar.projectKey=$CI_PROJECT_PATH_SLUG \
-Dsonar.qualitygate.wait=true \
-Dsonar.host.url=https://sonarqube.cubos.io \
-Dsonar.sources=lib
allow_failure: true

31 changes: 31 additions & 0 deletions .gitlab/merge_request_templates/Merge Request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[//]: # (NÃO ALTERE o formato do bloco abaixo. Utilizamos um parser para coletar o tipo do merge request, link do clickup e o numero de story points)

### Tipo do Merge Request

- [ ] Bugfix
- [ ] Feature
- [ ] Code style (Formatação, mudança de nome de variáveis)
- [ ] Refactoring (Sem mudanças funcionais na aplicação)
- [ ] Mudanças de Build ou CI
- [ ] Mudanças na documentação
- [ ] Outro (por favor descreva):

* Link do ClickUp: N/A
* Story points: N/A

### Descreva o comportamento atual

Faça uma breve descrição do comportamento da aplicação

### Quais foram as mudanças de comportamento?

Liste as alterações presentes neste MR, com imagens se possível

### Esse MR tem alguma breaking change?

- [ ] Sim
- [ ] Não

### Outras informações

Fale um pouco mais sobre o que está sendo feito neste MR
10 changes: 0 additions & 10 deletions .metadata

This file was deleted.

48 changes: 24 additions & 24 deletions INSTALLING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,39 @@

1. Depend on it

Add this to your package's pubspec.yaml file:
Add this to your package's pubspec.yaml file:

```flutter
dependencies:
rubik_utils: ^0.0.2
```
```flutter
dependencies:
rubik_utils: ^1.0.2
```

2. Install it

You can install packages from the command line:
with Flutter:
You can install packages from the command line:
with Flutter:

```bash
flutter pub get
```
```bash
flutter pub get
```

Alternatively, your editor might support flutter pub get. Check the docs for your editor to
learn more.
Alternatively, your editor might support flutter pub get. Check the docs for your editor to
learn more.

3. Import it
Now in your Dart code, you can use:
Now in your Dart code, you can use:

```flutter
import 'package:rubik_utils/rubik_utils.dart';
```flutter
import 'package:rubik_utils/rubik_utils.dart';

void main(){
print('hello'.isNull); // Hello world!
print('rubik'.isInstanceOf<int>()); // false
print('hello word!'.capitalize()); // Hello world!
void main(){
print('hello'.isNull); // Hello world!
print('rubik'.isInstanceOf<int>()); // false
print('hello word!'.capitalize()); // Hello world!

final schema = RubikValidationsBuilder.strings().minLength(3).maxLength(10);
print(schema.validate('rubik')); // null
final schema = RubikValidationsBuilder.strings().minLength(3).maxLength(10);
print(schema.validate('rubik')); // null

print(RString().minLength(3).maxLength(10).validate('rubik')) // null
}
```
print(RString().minLength(3).maxLength(10).validate('rubik')) // null
}
```
29 changes: 1 addition & 28 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,28 +1 @@
BSD 3-Clause License

Copyright (c) 2023, Cubos Tecnologia

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
TODO: Add your license here.
57 changes: 29 additions & 28 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
include: package:flutter_lints/flutter.yaml
include: package:lints/recommended.yaml

analyzer:
plugins:
- dart_code_metrics
exclude:
- test/**

dart_code_metrics:
metrics:
cyclomatic-complexity: 20
number-of-parameters: 4
maximum-nesting-level: 5
metrics-exclude:
- test/**
linter:
rules:
- avoid-dynamic
- avoid-redundant-async
- avoid-passing-async-when-sync-expected
- avoid-redundant-async
- avoid-unnecessary-type-assertions
- avoid-unnecessary-type-casts
- avoid-unrelated-type-assertions
- avoid-unused-parameters
- avoid-nested-conditional-expressions
- newline-before-return
- no-boolean-literal-compare
- no-empty-block
- prefer-trailing-comma
- prefer-conditional-expressions
- no-equal-then-else
- prefer-moving-to-variable
- prefer-declaring-const-constructor:
allow-one: true
- close_sinks
- avoid_print
- avoid_unnecessary_containers
- avoid_web_libraries_in_flutter
- comment_references
- no_logic_in_create_state
- prefer_const_constructors
- prefer_const_constructors_in_immutables
- prefer_const_declarations
- prefer_const_literals_to_create_immutables
- sized_box_for_whitespace
- sort_child_properties_last
- use_build_context_synchronously
- use_full_hex_values_for_flutter_colors
- use_key_in_widget_constructors
- use_super_parameters
- prefer_single_quotes
- always_declare_return_types
- cancel_subscriptions
- combinators_ordering
- comment_references
- dangling_library_doc_comments
- collection_methods_unrelated_type
- invalid_case_patterns
- implicit_call_tearoffs: true
Loading