Skip to content

Commit eb07fc8

Browse files
committed
Refactor into event and speaker packages
Signed-off-by: Matt Stratton <[email protected]>
1 parent 82a7cf2 commit eb07fc8

File tree

10 files changed

+42
-43
lines changed

10 files changed

+42
-43
lines changed

cmd/event.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"time"
1212

1313
rice "github.com/GeertJohan/go.rice"
14-
"github.com/devopsdays/devopsdays-cli/create"
14+
"github.com/devopsdays/devopsdays-cli/event"
1515
"github.com/devopsdays/devopsdays-cli/helpers"
1616
"github.com/spf13/cobra"
1717
)
@@ -42,7 +42,7 @@ var createEventCmd = &cobra.Command{
4242
devopsdays-cli create event -c New York --year 2017`,
4343

4444
Run: func(cmd *cobra.Command, args []string) {
45-
create.Event(City, Year)
45+
event.CreateEvent(City, Year)
4646
},
4747
}
4848

cmd/speaker.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package cmd
33
import (
44
"fmt"
55

6-
"github.com/devopsdays/devopsdays-cli/create"
6+
"github.com/devopsdays/devopsdays-cli/speaker"
77
"github.com/spf13/cobra"
88
)
99

@@ -36,7 +36,7 @@ var createSpeakerCmd = &cobra.Command{
3636

3737
Args: cobra.MaximumNArgs(1),
3838
Run: func(cmd *cobra.Command, args []string) {
39-
create.Speaker("", City, Year)
39+
speaker.CreateSpeaker("", City, Year)
4040
},
4141
}
4242

create/event.go renamed to event/event.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
package create
1+
// Package event provides the functions for creating, editing, and showing events
2+
package event
23

34
import (
45
"errors"
@@ -118,8 +119,8 @@ var qsCreateEvent = []*survey.Question{
118119
},
119120
}
120121

121-
// Event takes input from the user to create a new event
122-
func Event(city, year string) (err error) {
122+
// CreateEvent takes input from the user to create a new event
123+
func CreateEvent(city, year string) (err error) {
123124

124125
answers := struct {
125126
Twitter string

create/templates.go renamed to event/templates.go

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package create
1+
package event
22

33
const eventTmpl = `name: "{{ .Name }}" # The name of the event. Four digit year with the city name in lower-case, with no spaces.
44
year: "{{ .Year }}" # The year of the event. Make sure it is in quotes.
@@ -90,17 +90,3 @@ sponsor_levels:
9090
- id: community
9191
label: Community
9292
`
93-
94-
const speakerTmpl = `+++
95-
Title = "{{ .Title }}"
96-
type = "speaker"
97-
{{ with .Website }}website = "{{ . }}"{{ end }}
98-
{{ with .Twitter }}twitter = "{{ . }}"{{ end }}
99-
{{ with .Facebook }}facebook = "{{ . }}"{{ end }}
100-
{{ with .Linkedin }}linkedin = "{{ . }}"{{ end }}
101-
{{ with .Github }}github = "{{ . }}"{{ end }}
102-
{{ with .Gitlab }}gitlab = "{{ . }}"{{ end }}
103-
{{ with .ImagePath }}image = "{{ . }}"{{ end }}
104-
+++
105-
{{ with .Bio }}{{.}}{{ end }}
106-
`

sampleData/content/events/2018-canterlot/speakers/apple-jack.md

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
+++
2+
Title = "Rainbow Dash"
3+
type = "speaker"
4+
5+
6+
7+
8+
9+
10+
11+
+++
12+

sampleData/data/events/2018-canterlot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: "2018-canterlot" # The name of the event. Four digit year with the city name in lower-case, with no spaces.
22
year: "2018" # The year of the event. Make sure it is in quotes.
33
city: "Canterlot" # The displayed city name of the event. Capitalize it.
4-
event_twitter: "canterlot" # Change this to the twitter handle for your event such as devopsdayschi or devopsdaysmsp
4+
event_twitter: "" # Change this to the twitter handle for your event such as devopsdayschi or devopsdaysmsp
55
description: "Devopsdays is coming to Canterlot!" # Edit this to suit your preferences
66
ga_tracking_id: "" # If you have your own Google Analytics tracking ID, enter it here. Example: "UA-74738648-1"
77

create/speaker.go renamed to speaker/speaker.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// Package create provides functions to create new content.
2-
package create
1+
// Package speaker provides functions to add, create, edit, delete, and show speakers
2+
package speaker
33

44
import (
55
"errors"
@@ -116,8 +116,8 @@ var qsCreateSpeaker = []*survey.Question{
116116
},
117117
}
118118

119-
// Speaker takes input from the user to create a new speaker
120-
func Speaker(speakerName, city, year string) (err error) {
119+
// CreateSpeaker takes input from the user to create a new speaker
120+
func CreateSpeaker(speakerName, city, year string) (err error) {
121121

122122
answers := struct {
123123
Name string

create/speaker_test.go renamed to speaker/speaker_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package create
1+
package speaker
22

33
import (
44
"testing"

speaker/templates.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package speaker
2+
3+
const speakerTmpl = `+++
4+
Title = "{{ .Title }}"
5+
type = "speaker"
6+
{{ with .Website }}website = "{{ . }}"{{ end }}
7+
{{ with .Twitter }}twitter = "{{ . }}"{{ end }}
8+
{{ with .Facebook }}facebook = "{{ . }}"{{ end }}
9+
{{ with .Linkedin }}linkedin = "{{ . }}"{{ end }}
10+
{{ with .Github }}github = "{{ . }}"{{ end }}
11+
{{ with .Gitlab }}gitlab = "{{ . }}"{{ end }}
12+
{{ with .ImagePath }}image = "{{ . }}"{{ end }}
13+
+++
14+
{{ with .Bio }}{{.}}{{ end }}
15+
`

0 commit comments

Comments
 (0)