Skip to content

Commit 3ce1544

Browse files
committed
Merge branch 'refs/heads/develop'
2 parents 9abf0db + 0b4e283 commit 3ce1544

22 files changed

+48
-47
lines changed

internal/converter/copyright.go renamed to internal/converter/creator.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import (
66
"strings"
77
)
88

9-
type Copyright interface {
9+
type Creator interface {
1010
Get() (string, error)
1111
}
1212

13-
type CopyrightImpl struct {
13+
type CreatorImpl struct {
1414
}
1515

16-
func (c CopyrightImpl) Get() (string, error) {
16+
func (c CreatorImpl) Get() (string, error) {
1717

1818
gitUsername, err := c.getGitUsername()
1919

@@ -30,7 +30,7 @@ func (c CopyrightImpl) Get() (string, error) {
3030
return "", err
3131
}
3232

33-
func (c CopyrightImpl) getGitUsername() (string, error) {
33+
func (c CreatorImpl) getGitUsername() (string, error) {
3434

3535
gitCmd := exec.Command("git", "config", "--global", "user.name")
3636
nameBytes, err := gitCmd.Output()

internal/converter/copyright_test.go renamed to internal/converter/creator_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,23 @@ import (
88

99
// MARK: - Test Double
1010

11-
type CopyrightStub struct {
11+
type CreatorStub struct {
1212
GetSuccessStub string
1313
GetErrorStub error
1414
}
1515

16-
func (c CopyrightStub) Get() (string, error) {
16+
func (c CreatorStub) Get() (string, error) {
1717

1818
return c.GetSuccessStub, c.GetErrorStub
1919
}
2020

2121
// MARK: - Test Case
2222

23-
func TestCopyright(t *testing.T) {
23+
func TestCreator(t *testing.T) {
2424

25-
t.Run("get copyright", func(t *testing.T) {
25+
t.Run("get Creator", func(t *testing.T) {
2626
// given
27-
sut := converter.CopyrightImpl{}
27+
sut := converter.CreatorImpl{}
2828

2929
// when
3030
out, err := sut.Get()

internal/converter/header.go

+7-6
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ import (
1010
)
1111

1212
type HeaderConverter struct {
13-
copyright Copyright
13+
creator Creator
1414
targetProjectName string
1515
copyrightDefaultValue string
1616
date time.Time
1717
}
1818

1919
func NewHeaderConverter(
20-
copyright Copyright,
20+
creator Creator,
2121
config *model.Config,
2222
date time.Time) *HeaderConverter {
2323

2424
return &HeaderConverter{
25-
copyright: copyright,
25+
creator: creator,
2626
targetProjectName: config.TargetProjectName,
2727
copyrightDefaultValue: config.Copyright,
2828
date: date,
@@ -37,18 +37,19 @@ func (header *HeaderConverter) Render(source string, sceneName string) string {
3737

3838
dateStr := fmt.Sprintf("%d/%d/%d", day, month, year)
3939

40-
copyright, err := header.copyright.Get()
40+
creator, err := header.creator.Get()
4141

4242
if err != nil {
43-
copyright = header.copyrightDefaultValue
43+
creator = "clean-swift-scaffold"
4444
}
4545

4646
var replacedSource string = source
4747
replacedSource = strings.ReplaceAll(replacedSource, "__SCENE_NAME__", sceneName)
4848
replacedSource = strings.ReplaceAll(replacedSource, "__TARGET_PROJECT_NAME__", header.targetProjectName)
4949
replacedSource = strings.ReplaceAll(replacedSource, "__DATE__", dateStr)
5050
replacedSource = strings.ReplaceAll(replacedSource, "__YEAR__", strconv.Itoa(year))
51-
replacedSource = strings.ReplaceAll(replacedSource, "__COPYRIGHT__", copyright)
51+
replacedSource = strings.ReplaceAll(replacedSource, "__COPYRIGHT__", header.copyrightDefaultValue)
52+
replacedSource = strings.ReplaceAll(replacedSource, "__CREATOR__", creator)
5253

5354
return replacedSource
5455
}

internal/converter/header_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const dummySourceCode string = `//
1212
// __SCENE_NAME__Model.swift
1313
// __TARGET_PROJECT_NAME__
1414
//
15-
// Created by clean-swift-scaffold on __DATE__.
15+
// Created by __CREATOR__ on __DATE__.
1616
// Copyright © __YEAR__ __COPYRIGHT__. All rights reserved.
1717
//
1818
@@ -25,8 +25,8 @@ const expectedSourceCode string = `//
2525
// ArticleDetailModel.swift
2626
// Miro
2727
//
28-
// Created by clean-swift-scaffold on 12/10/2020.
29-
// Copyright © 2020 Geektree0101. All rights reserved.
28+
// Created by Geektree0101 on 12/10/2020.
29+
// Copyright © 2020 miro. All rights reserved.
3030
//
3131
3232
enum ArticleDetailModel {
@@ -40,13 +40,13 @@ func TestHeader(t *testing.T) {
4040
// given
4141
config := model.Config{
4242
TargetProjectName: "Miro",
43-
Copyright: "David Ha",
43+
Copyright: "miro",
4444
TemplatePath: "",
4545
}
4646

4747
date := time.Date(2020, 10, 12, 0, 0, 0, 0, time.UTC)
4848
sut := converter.NewHeaderConverter(
49-
CopyrightStub{
49+
CreatorStub{
5050
GetSuccessStub: "Geektree0101",
5151
GetErrorStub: nil,
5252
},

internal/converter/source_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ func createSource() *converter.SourceConverter {
1515

1616
config := &model.Config{
1717
TargetProjectName: "Miro",
18-
Copyright: "David Ha",
18+
Copyright: "miro",
1919
TemplatePath: "../../templates",
2020
SourceDir: "./Playground/Sources",
2121
TestDir: "./Playground/Tests",
2222
Indentation: 2,
2323
}
2424

2525
header := converter.NewHeaderConverter(
26-
CopyrightStub{
26+
CreatorStub{
2727
GetSuccessStub: "Geektree0101",
2828
GetErrorStub: nil,
2929
},

internal/gen/generator.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func (gen *Generator) Run() error {
4848
gen.flag.Name,
4949
strings.Split(gen.flag.UsecasesString, ","),
5050
converter.NewHeaderConverter(
51-
converter.CopyrightImpl{},
51+
converter.CreatorImpl{},
5252
config,
5353
today,
5454
),

templates/src/Interactor.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// __SCENE_NAME__Interactor.swift
33
// __TARGET_PROJECT_NAME__
44
//
5-
// Created by clean-swift-scaffold on __DATE__.
5+
// Created by __CREATOR__ on __DATE__.
66
// Copyright © __YEAR__ __COPYRIGHT__. All rights reserved.
77
//
88

templates/src/Model.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// __SCENE_NAME__Model.swift
33
// __TARGET_PROJECT_NAME__
44
//
5-
// Created by clean-swift-scaffold on __DATE__.
5+
// Created by __CREATOR__ on __DATE__.
66
// Copyright © __YEAR__ __COPYRIGHT__. All rights reserved.
77
//
88

templates/src/Presenter.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// __SCENE_NAME__Presenter.swift
33
// __TARGET_PROJECT_NAME__
44
//
5-
// Created by clean-swift-scaffold on __DATE__.
5+
// Created by __CREATOR__ on __DATE__.
66
// Copyright © __YEAR__ __COPYRIGHT__. All rights reserved.
77
//
88

templates/src/Router.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// __SCENE_NAME__Router.swift
33
// __TARGET_PROJECT_NAME__
44
//
5-
// Created by clean-swift-scaffold on __DATE__.
5+
// Created by __CREATOR__ on __DATE__.
66
// Copyright © __YEAR__ __COPYRIGHT__. All rights reserved.
77
//
88

templates/src/ViewController.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// __SCENE_NAME__ViewController.swift
33
// __TARGET_PROJECT_NAME__
44
//
5-
// Created by clean-swift-scaffold on __DATE__.
5+
// Created by __CREATOR__ on __DATE__.
66
// Copyright © __YEAR__ __COPYRIGHT__. All rights reserved.
77
//
88

templates/test/Interactor.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// __SCENE_NAME__InteractorTests.swift
33
// __TARGET_PROJECT_NAME__Tests
44
//
5-
// Created by clean-swift-scaffold on __DATE__.
5+
// Created by __CREATOR__ on __DATE__.
66
// Copyright © __YEAR__ __COPYRIGHT__. All rights reserved.
77
//
88

templates/test/Presenter.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// __SCENE_NAME__PresenterTests.swift
33
// __TARGET_PROJECT_NAME__Tests
44
//
5-
// Created by clean-swift-scaffold on __DATE__.
5+
// Created by __CREATOR__ on __DATE__.
66
// Copyright © __YEAR__ __COPYRIGHT__. All rights reserved.
77
//
88

templates/test/ViewController.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// __SCENE_NAME__ViewControllerTests.swift
33
// __TARGET_PROJECT_NAME__Tests
44
//
5-
// Created by clean-swift-scaffold on __DATE__.
5+
// Created by __CREATOR__ on __DATE__.
66
// Copyright © __YEAR__ __COPYRIGHT__. All rights reserved.
77
//
88

test/ArticleDetailInteractor.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// ArticleDetailInteractor.swift
33
// Miro
44
//
5-
// Created by clean-swift-scaffold on 12/10/2020.
6-
// Copyright © 2020 Geektree0101. All rights reserved.
5+
// Created by Geektree0101 on 12/10/2020.
6+
// Copyright © 2020 miro. All rights reserved.
77
//
88

99
import Foundation

test/ArticleDetailInteractorTests.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// ArticleDetailInteractorTests.swift
33
// MiroTests
44
//
5-
// Created by clean-swift-scaffold on 12/10/2020.
6-
// Copyright © 2020 Geektree0101. All rights reserved.
5+
// Created by Geektree0101 on 12/10/2020.
6+
// Copyright © 2020 miro. All rights reserved.
77
//
88

99
import XCTest

test/ArticleDetailModel.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// ArticleDetailModel.swift
33
// Miro
44
//
5-
// Created by clean-swift-scaffold on 12/10/2020.
6-
// Copyright © 2020 Geektree0101. All rights reserved.
5+
// Created by Geektree0101 on 12/10/2020.
6+
// Copyright © 2020 miro. All rights reserved.
77
//
88

99
enum ArticleDetailModel {

test/ArticleDetailPresenter.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// ArticleDetailPresenter.swift
33
// Miro
44
//
5-
// Created by clean-swift-scaffold on 12/10/2020.
6-
// Copyright © 2020 Geektree0101. All rights reserved.
5+
// Created by Geektree0101 on 12/10/2020.
6+
// Copyright © 2020 miro. All rights reserved.
77
//
88

99
import UIKit

test/ArticleDetailPresenterTests.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// ArticleDetailPresenterTests.swift
33
// MiroTests
44
//
5-
// Created by clean-swift-scaffold on 12/10/2020.
6-
// Copyright © 2020 Geektree0101. All rights reserved.
5+
// Created by Geektree0101 on 12/10/2020.
6+
// Copyright © 2020 miro. All rights reserved.
77
//
88

99
import XCTest

test/ArticleDetailRouter.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// ArticleDetailRouter.swift
33
// Miro
44
//
5-
// Created by clean-swift-scaffold on 12/10/2020.
6-
// Copyright © 2020 Geektree0101. All rights reserved.
5+
// Created by Geektree0101 on 12/10/2020.
6+
// Copyright © 2020 miro. All rights reserved.
77
//
88

99
import UIKit

test/ArticleDetailViewController.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// ArticleDetailViewController.swift
33
// Miro
44
//
5-
// Created by clean-swift-scaffold on 12/10/2020.
6-
// Copyright © 2020 Geektree0101. All rights reserved.
5+
// Created by Geektree0101 on 12/10/2020.
6+
// Copyright © 2020 miro. All rights reserved.
77
//
88

99
import UIKit

test/ArticleDetailViewControllerTests.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// ArticleDetailViewControllerTests.swift
33
// MiroTests
44
//
5-
// Created by clean-swift-scaffold on 12/10/2020.
6-
// Copyright © 2020 Geektree0101. All rights reserved.
5+
// Created by Geektree0101 on 12/10/2020.
6+
// Copyright © 2020 miro. All rights reserved.
77
//
88

99
import XCTest

0 commit comments

Comments
 (0)