Skip to content

Commit

Permalink
Merge pull request #89 from k1LoW/remove-deprecated-section
Browse files Browse the repository at this point in the history
Remove deprecated section `diagrams:`
  • Loading branch information
k1LoW authored Apr 21, 2021
2 parents 81a1290 + 128e707 commit b0027e9
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go_version: [1.14, 1.15]
go_version: [1.15, 1.16]
steps:
- name: Set up Go ${{ matrix.go_version }}
uses: actions/setup-go@v2
Expand Down
18 changes: 0 additions & 18 deletions cmd/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,7 @@ var docCmd = &cobra.Command{
if !cfg.HideViews {
// generate md
o := md.New(cfg)
oldPath := filepath.Join(cfg.DocPath, config.MakeMdFilename("diagram", v.Id()))
path := filepath.Join(cfg.DocPath, config.MakeMdFilename("view", v.Id()))
if _, err := os.Stat(oldPath); err == nil {
if _, err := os.Stat(path); err == nil {
return fmt.Errorf("old file exists: %s", oldPath)
}
if err := os.Rename(oldPath, path); err != nil {
return err
}
}
file, err := os.Create(path)
if err != nil {
return err
Expand All @@ -115,16 +106,7 @@ var docCmd = &cobra.Command{
}
// draw view
diag := gviz.New(cfg)
oldPath := filepath.Join(cfg.DocPath, config.MakeDiagramFilename("diagram", v.Id(), format))
path := filepath.Join(cfg.DocPath, config.MakeDiagramFilename("view", v.Id(), format))
if _, err := os.Stat(oldPath); err == nil {
if _, err := os.Stat(path); err == nil {
return fmt.Errorf("old diagram file exists: %s", oldPath)
}
if err := os.Rename(oldPath, path); err != nil {
return err
}
}
dFile, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) // #nosec
if err != nil {
return err
Expand Down
10 changes: 0 additions & 10 deletions config/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,16 +309,6 @@ func (cfg *Config) buildDescriptions() error {
if v.Desc != "" {
continue
}
path := filepath.Join(cfg.DescPath, MakeMdFilename("_view", v.Id()))
oldPath := filepath.Join(cfg.DescPath, MakeMdFilename("_diagram", v.Id()))
if _, err := os.Stat(oldPath); err == nil {
if _, err := os.Stat(path); err == nil {
return fmt.Errorf("old description file exists: %s", oldPath)
}
if err := os.Rename(oldPath, path); err != nil {
return err
}
}
desc, err := cfg.readDescFile(MakeMdFilename("_view", v.Id()))
if err != nil {
return err
Expand Down
9 changes: 2 additions & 7 deletions config/yaml.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package config

import (
"errors"
"fmt"
"regexp"
"sort"
Expand All @@ -24,9 +23,8 @@ func (d *Config) UnmarshalYAML(data []byte) error {
HideLayers bool `yaml:"hideLayers"`
HideRealNodes bool `yaml:"hideRealNodes"`
HideLabels bool `yaml:"hideLabels"`
Views Views `yaml:"views"`
Old Views `yaml:"diagrams"` // TODO: Remove
Nodes Nodes `yaml:"nodes"`
Views []*View `yaml:"views"`
Nodes []*Node `yaml:"nodes"`
Networks []interface{} `yaml:"networks"`
Relations []interface{} `yaml:"relations"`
Dict *dict.Dict `yaml:"dict,omitempty"`
Expand All @@ -38,9 +36,6 @@ func (d *Config) UnmarshalYAML(data []byte) error {
if err := yaml.Unmarshal(data, &raw); err != nil {
return err
}
if len(raw.Old) > 0 {
return errors.New("`diagrams:` is deprecated. Please use `views:` instead of `diagrams:`.")
}
d.Name = raw.Name
d.Desc = raw.Desc
d.DocPath = raw.DocPath
Expand Down

0 comments on commit b0027e9

Please sign in to comment.