Skip to content

Commit

Permalink
Merge pull request #98 from svanharmelen/dev
Browse files Browse the repository at this point in the history
Fix small regression
  • Loading branch information
Sander van Harmelen committed Aug 7, 2015
2 parents dd768c1 + 3ad80a6 commit 02ee97c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Chef-Guard CHANGELOG
====================

0.6.1
-----
- Fixed a small regression where the `metadata.rb` and/or `metadata.json` are not handled correctly

0.6.0
-----
- Added support for using GitLab as git backend (fixes GH-61)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.6.0-UNRELEASED
0.6.1
2 changes: 1 addition & 1 deletion cookbook.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func (cg *ChefGuard) processCookbookFiles() error {
}

for _, f := range cg.getAllCookbookFiles() {
ignore, err := cg.ignoreThisFile(f.Name)
ignore, err := cg.ignoreThisFile(f.Name, false)
if err != nil {
return fmt.Errorf("Ignore check failed for file %s: %s", f.Name, err)
}
Expand Down
14 changes: 8 additions & 6 deletions validations.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func (cg *ChefGuard) compareCookbooks() (int, error) {
changed = append(changed, file)
}
} else {
ignore, err := cg.ignoreThisFile(file)
ignore, err := cg.ignoreThisFile(file, true)
if err != nil {
return http.StatusBadGateway, err
}
Expand All @@ -252,7 +252,7 @@ func (cg *ChefGuard) compareCookbooks() (int, error) {
}
if len(sh) > 0 {
for file, _ := range sh {
ignore, err := cg.ignoreThisFile(file)
ignore, err := cg.ignoreThisFile(file, true)
if err != nil {
return http.StatusBadGateway, err
}
Expand Down Expand Up @@ -287,10 +287,12 @@ func (cg *ChefGuard) searchSourceCookbook() (errCode int, err error) {
"Failed to locate the source of the %s cookbook!", cg.Cookbook.Name)
}

func (cg *ChefGuard) ignoreThisFile(file string) (ignore bool, err error) {
// if file == "metadata.rb" || file == "metadata.json" || strings.HasPrefix(file, "spec/") {
// return true, nil
// }
func (cg *ChefGuard) ignoreThisFile(file string, ignoreDefaultFiles bool) (ignore bool, err error) {
if ignoreDefaultFiles {
if file == "metadata.rb" || file == "metadata.json" || strings.HasPrefix(file, "spec/") {
return true, nil
}
}
ignore, err = pathspec.GitIgnore(bytes.NewReader(cg.GitIgnoreFile), file)
if ignore || err != nil {
return ignore, err
Expand Down

0 comments on commit 02ee97c

Please sign in to comment.