Skip to content

Commit

Permalink
Update v2.0.5 (#442)
Browse files Browse the repository at this point in the history
* Update version
  • Loading branch information
johnfercher authored May 26, 2024
1 parent f76ae41 commit 97de544
Show file tree
Hide file tree
Showing 29 changed files with 73 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/goci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
run: go build $(go list -f '{{ .Dir }}' ./... | grep -E -v 'docs|cmd|mocks')

- name: Test
run: go test -v $(go list -f '{{ .Dir }}' ./... | grep -E -v 'docs|cmd|mocks')
run: go test -v $(go list -f '{{ .Dir }}' ./... | grep -E -v 'docs|cmd|mocks') && go test -v $(go list -f '{{ .Dir }}' ./docs/assets/examples/...)
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
GO_FILES = $(shell find . '(' -path '*/.*' -o -path './vendor' ')' -prune -o -name '*.go' -print | cut -b3-)
GO_PATHS = $(shell go list -f '{{ .Dir }}' ./... | grep -E -v 'docs|cmd|mocks')
GO_EXAMPLES = $(shell go list -f '{{ .Dir }}' ./docs/assets/examples/...)

.PHONY: dod
dod: build test fmt lint
Expand All @@ -11,6 +12,7 @@ build:
.PHONY: test
test:
go test $(GO_PATHS)
go test $(GO_EXAMPLES)

.PHONY: fmt
fmt:
Expand Down Expand Up @@ -43,6 +45,7 @@ godoc:
.PHONY: mocks
mocks:
mockery
make fmt

.PHONY: examples
examples:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ You can write your PDFs like you are creating a site using Bootstrap. A Row may
Besides that, pages will be added when content may extrapolate the useful area. You can define a header which will be added
always when a new page appear, in this case, a header may have many rows, lines or tablelist.

#### Maroto `v2.0.4` is here! Try out:
#### Maroto `v2.0.5` is here! Try out:

* Installation with`go get`:

```bash
go get github.com/johnfercher/maroto/v2@v2.0.4
go get github.com/johnfercher/maroto/v2@v2.0.5
```

* You can see the full `v2` documentation [here](https://maroto.io/).
Expand Down
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@

* We are about to create a document processor to generate PDFs by interpreting serialized data as: yml, json or html. Please contribute with your ideas in [this discussion](https://github.com/johnfercher/maroto/discussions/390).

#### 3. Maroto`v2.0.4`is here! Try out:
#### 3. Maroto`v2.0.5`is here! Try out:

* Installation with`go get`:

```bash
go get github.com/johnfercher/maroto/v2@v2.0.4
go get github.com/johnfercher/maroto/v2@v2.0.5
```

The public API was completely redesigned with the aim of enhancing the
Expand Down
2 changes: 1 addition & 1 deletion docs/_coverpage.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![logo](assets/images/logo.png)

# Maroto <small>v2.0.4</small>
# Maroto <small>v2.0.5</small>

> An open-source golang lib to create PDFs. Fast and Simple.
Expand Down
1 change: 1 addition & 0 deletions metricsdecorator.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func NewMetricsDecorator(inner core.Maroto) core.Maroto {
}
}

// FitlnCurrentPage decoratess the FitlnCurrentPage method of maroto instance.
func (m *MetricsDecorator) FitlnCurrentPage(heightNewLine float64) bool {
return m.inner.FitlnCurrentPage(heightNewLine)
}
Expand Down
23 changes: 22 additions & 1 deletion metricsdecorator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"fmt"
"testing"

"github.com/johnfercher/maroto/v2/pkg/core/entity"

"github.com/johnfercher/maroto/v2/pkg/components/text"

"github.com/johnfercher/go-tree/node"
Expand Down Expand Up @@ -149,16 +151,35 @@ func TestMetricsDecorator_GetStructure(t *testing.T) {
}

func TestMetricsDecorator_FitlnCurrentPage(t *testing.T) {
// Arrange
inner := mocks.NewMaroto(t)
inner.EXPECT().FitlnCurrentPage(10.0).Return(true)
inner.EXPECT().FitlnCurrentPage(20.0).Return(false)

sut := NewMetricsDecorator(inner)
// Assert

// Act & Assert
assert.True(t, sut.FitlnCurrentPage(10))
assert.False(t, sut.FitlnCurrentPage(20))
}

func TestMetricsDecorator_GetCurrentConfig(t *testing.T) {
// Arrange
cfgToReturn := &entity.Config{
MaxGridSize: 15,
}
inner := mocks.NewMaroto(t)
inner.EXPECT().GetCurrentConfig().Return(cfgToReturn)

sut := NewMetricsDecorator(inner)

// Act
cfg := sut.GetCurrentConfig()

// Assert
assert.Equal(t, cfgToReturn.MaxGridSize, cfg.MaxGridSize)
}

func TestMetricsDecorator_RegisterHeader(t *testing.T) {
// Arrange
row := text.NewRow(10, "text")
Expand Down
3 changes: 2 additions & 1 deletion mocks/Builder.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion mocks/Cache.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion mocks/CellWriter.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion mocks/Code.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion mocks/Col.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion mocks/Component.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion mocks/Document.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion mocks/Font.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion mocks/Fpdf.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion mocks/Image.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion mocks/Line.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion mocks/Listable.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion mocks/Maroto.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion mocks/Math.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion mocks/Node.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion mocks/Page.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion mocks/Provider.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion mocks/Repository.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion mocks/Row.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion mocks/Text.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@
- [ ] Updated docs/doc.go and docs/* <!-- If applied -->
- [ ] Updated ```example_test.go```. <!-- If applied -->
- [ ] Updated README.md <!-- If applied -->
- [ ] Executed `make examples` to update all examples inside docs/examples. <!-- If applied -->
- [ ] New public methods/structs/interfaces has comments upside them explaining they responsibilities <!-- If applied -->
- [ ] Executed `make dod` with none issues pointed out by `golangci-lint`
1 change: 1 addition & 0 deletions test/maroto/examples/metadatas.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"config_metadata_author": "Utf8Text(author, false)",
"config_metadata_creation_date": true,
"config_metadata_creator": "Utf8Text(creator, false)",
"config_metadata_keywords": "Utf8Text(keyword, false)",
"config_metadata_subject": "Utf8Text(subject, false)",
"config_metadata_title": "Utf8Text(title, false)",
"config_provider_type": "gofpdf",
Expand Down

0 comments on commit 97de544

Please sign in to comment.