summaryrefslogtreecommitdiff
path: root/lib/chef/cookbook_version.rb
Commit message (Collapse)AuthorAgeFilesLines
* Resolve Performance/RegexpMatch warningsPerformance_RegexpMatchTim Smith2021-12-261-1/+1
| | | | | | Do regex checks without creating objects for the results. Signed-off-by: Tim Smith <tsmith@chef.io>
* reject cookbooks with ambiguous yaml filesMarc A. Paradise2021-05-271-2/+21
| | | | | | | | | | | | | | With this change we will now fail the run when a cookbook contains two same-named YAML files with different extensions. THis is because we don't know which one to use - either one is a valid YAML file extension. Instead of picking one arbitrarily we'll fail with an error explaining how to resolve it. For example if the cookbook contains both recipes/default.yaml and recipes/default.yml it will fail with the following output: Cookbook test1@0.1.0 contains ambiguous files: recipes/default.yaml and recipes/default.yml. Please update the cookbook to remove the incorrect file. Signed-off-by: Marc A. Paradise <marc.paradise@gmail.com>
* Support recipes that and in .yaml as well as .ymlMarc A. Paradise2021-05-261-3/+6
| | | | | | | | | | | | | | | | | | | This adds support for recipe files that end in the '.yaml' extension in addition to existing support for '.yml', because both are valid and common extensions for yaml files. Of note is that the message we log when a recipes/default.y[a]ml and a root_files/recipe.y[a]ml both exist will be slightly off, in that we don't capture the actual extension of each file. This seems to be more complexity than it was worth, for a message that is shown at the beginning of the run and largely ignored. I also tried to add a bit of localized unit testing for `recipe_yml_filenames_by_name` because we didn't before. Mostly focuses on this use case (yaml, yml both work) but we could probalby improve that by including tests for a mix of yaml/yml files. Signed-off-by: Marc A. Paradise <marc.paradise@gmail.com>
* Use ||= where we can (#10609)Tim Smith2020-11-081-4/+1
| | | | | * Use ||= where we can Signed-off-by: Tim Smith <tsmith@chef.io>
* Merge repetitive conditionalsTim Smith2020-10-271-1/+1
| | | | | | So much easier to read and probably faster this way too. Signed-off-by: Tim Smith <tsmith@chef.io>
* Use .match? not =~ when match values aren't necessaryTim Smith2020-06-111-2/+2
| | | | | | Autocorrected from RuboCop Performance which is now smart enough to detect when you use the match and when you don't. Using match? does not create any objects so it's slightly faster and uses less memory. Signed-off-by: Tim Smith <tsmith@chef.io>
* Get lib/ free of spelling violations.Pete Higgins2020-05-181-2/+2
| | | | Signed-off-by: Pete Higgins <pete@peterhiggins.org>
* Align all our comments with the codeTim Smith2020-05-061-4/+4
| | | | | | Autocorrected with chefstyle after enabling that cop. It was very hard to read some complex autocorrected blocks w/o this. Signed-off-by: Tim Smith <tsmith@chef.io>
* Remove copyright dateslcg/remove-copyright-datesLamont Granquist2020-04-131-1/+1
| | | | | | | | Legally incredibly dubious, particularly since we don't follow it strictly as policy, and we have git history instead, which does it right. This is just a waste of time and a cargo cult. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Fix typoVivek Singh2020-04-061-2/+2
| | | | Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
* parse yaml recipesLamont Granquist2020-02-141-2/+37
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Added client side validation to validate presence of metadata files and ↵Vasu11052019-12-201-0/+4
| | | | | | validate name field Signed-off-by: Vasu1105 <vasundhara.jagdale@msystechnologies.com>
* Genrates metadata.json if not present and uploads it to chef server and ↵Vasu11052019-12-161-0/+13
| | | | | | deletes the local copy of it from chef repo Signed-off-by: Vasu1105 <vasundhara.jagdale@msystechnologies.com>
* Style/RegexpLiteralLamont Granquist2019-07-051-3/+3
| | | | | | | given how many regexps we have with /'s in the match this seems like a very good one. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Style/EmptyLiteralLamont Granquist2019-07-051-5/+5
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Style/SymbolArrayLamont Granquist2019-07-021-1/+1
| | | | | | start enforcing using %i{} instead of arrays of symbols Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix Layout/EmptyLineAfterGuardClauseLamont Granquist2019-07-021-0/+1
| | | | | | | i like this one, gives visual priority to returns or raises that are buried in the middle of things. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Convert require to require_relativeLamont Granquist2019-05-081-7/+7
| | | | | | | This gives a speed boost since rubygems does not have to scan through every gem in the gemset in order to find the file. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* change HTTPServerException to HTTPClientException for ruby 2.6Lamont Granquist2019-01-031-1/+1
| | | | | | includes backcompat for 2.5 Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* replace some instances of to_hash with to_hlcg/to-h-cleanupLamont Granquist2018-09-261-1/+1
| | | | | | | | | | | to_hash on a lot of these objects should go away, but even eliminating all our calls to to_hash on these objects internally is difficult. (e.g. converting the knife ui code to call #to_h means we wind up calling nil#to_h which "helpfully" becomes '{}' which is hilarious and i don't know why someone thought that was a good idea). Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Add fix for filespecificity regexScott McGillivray2018-09-051-2/+2
| | | | Signed-off-by: Scott McGillivray <scott.mcgillivray@gmail.com>
* fix Style/MutableConstantLamont Granquist2018-07-021-1/+1
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix Style/PreferredHashMethodsLamont Granquist2018-07-021-1/+1
| | | | | | | absolutely hard requirement on the fixes that went into chef-config 2.2.11, so the floor of that gem is bumped up. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* add host-<fqdn> to the error message herelcg/cookbook-fqdn-errorLamont Granquist2018-05-251-0/+1
| | | | | | closes #1479 Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Fix manifest entries for root filestm/fix_manifest_root_filesThom May2018-05-161-2/+2
| | | | | | | | We weren't consistently naming root files; in some places in the spec the names contained the `root_files` segment and in other places they didn't. This now always uses `root_files`. Signed-off-by: Thom May <thom@chef.io>
* mechanical conversion of most debug log statements to traceThom May2018-03-261-2/+2
| | | | Signed-off-by: Thom May <thom@chef.io>
* prepping for rubocop 0.52.1lcg/rubocop-0.52.1Lamont Granquist2018-01-171-7/+1
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Feed the rubocop.Noah Kantrowitz2017-04-051-2/+2
| | | | Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
* Make root alias attributes work with the normal CookbookCompiler load behavior.Noah Kantrowitz2017-04-041-1/+4
| | | | Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
* First pass on implementing root aliases.Noah Kantrowitz2017-04-041-2/+12
| | | | Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
* RFC 67: Remove cookbook segmentsThom May2017-04-041-149/+53
| | | | | | | | | This implements RFC 67, which removes cookbook segments, and moves to a single list of all the files contained in a cookbook. This allows us to move forward with better audit modes and also proper shipping of ohai plugins. Signed-off-by: Thom May <thom@chef.io>
* Kill JSON auto inflate with firetm/remove_json_autoinflateThom May2017-03-141-5/+0
| | | | Signed-off-by: Thom May <thom@chef.io>
* fix specs: RedundantReturn, RedundantSelf, RedundantBeginLamont Granquist2017-02-131-3/+3
| | | | | | department of redundancy department Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Structure deprecations with additional metadatatm/deprecation_with_urlThom May2016-11-161-4/+4
| | | | | | | | This adds URLs to each class of deprecation, and correctly prints and formats them for maximum user efficiency. We also provide the URL to the data collector for Visibility to ingest. Signed-off-by: Thom May <thom@chef.io>
* fix Style/BlockDelimiters, Style/MultilineBlockLayout and 0.42.0 engine upgradeLamont Granquist2016-08-171-2/+2
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fixes Style/OpMethod copLamont Granquist2016-08-161-3/+3
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* autofixing Style/SpaceBeforeSemicolon copLamont Granquist2016-08-161-1/+1
|
* preferred_manifest_record: fix pretty print.David Duponchel2016-03-071-3/+9
| | | | | | | | | | | | | | | | | | | | The `preferred_manifest_record` function pretty prints the list of existing files when the asked file can't be found. To do that, the root path of the cookbook is removed from each existing file but the update is done on the `existing_files` variable, not on a copy. When called several times, this variable will eventually be equals to `[nil]`, leading to a NoMethodError. Without the fix, the new unit test fails with > expected Chef::Exceptions::FileNotFound, got #<NoMethodError: undefined method `[]' for nil:NilClass> with backtrace: > # ./lib/chef/cookbook_version.rb:321:in `block in preferred_manifest_record' > # ./lib/chef/cookbook_version.rb:319:in `map!' > # ./lib/chef/cookbook_version.rb:319:in `preferred_manifest_record' > # ./spec/unit/cookbook_version_file_specificity_spec.rb:318:in `block (3 levels) in <top (required)>' > # ./spec/unit/cookbook_version_file_specificity_spec.rb:317:in `block (2 levels) in <top (required)>' Fixes #2561.
* Merge pull request #4617 from chef/lcg/chefstyle-perfLamont Granquist2016-03-041-2/+2
|\ | | | | Autofixing new Perf cops in 0.37.2
| * remove unused block argumentslcg/chefstyle-perfLamont Granquist2016-02-231-1/+1
| |
| * Autofixing new Perf cops in 0.37.2Lamont Granquist2016-02-231-1/+1
| | | | | | | | | | | | | | | | | | | | 6 Performance/Casecmp 18 Performance/Detect 1 Performance/RangeInclude 27 Performance/RedundantBlockCall 6 Performance/RedundantMatch 5 Performance/RedundantMerge 18 Performance/StringReplacement
* | Rename all_unignored_files -> all_filesdanielsdeleo2016-02-261-2/+2
| |
* | Add all_unignored_files attribute to CBVersiondanielsdeleo2016-02-261-0/+4
|/
* autofixing whitespace copsLamont Granquist2016-02-051-12/+9
| | | | | | | | | | | | | | | | | | | | | | 4174 Style/SpaceInsideHashLiteralBraces 1860 Style/SpaceAroundOperators 1336 Style/SpaceInsideBlockBraces 1292 Style/AlignHash 997 Style/SpaceAfterComma 860 Style/SpaceAroundEqualsInParameterDefault 310 Style/EmptyLines 294 Style/IndentationConsistency 267 Style/TrailingWhitespace 238 Style/ExtraSpacing 212 Style/SpaceBeforeBlockBraces 166 Style/MultilineOperationIndentation 144 Style/TrailingBlankLines 120 Style/EmptyLineBetweenDefs 101 Style/IndentationWidth 82 Style/SpaceAroundBlockParameters 40 Style/EmptyLinesAroundMethodBody 29 Style/EmptyLinesAroundAccessModifier 1 Style/RescueEnsureAlignment
* Update all auth email address from opscode.com and getchef.com to chef.io.Noah Kantrowitz2016-02-021-6/+6
| | | Generated via git ls-files | xargs perl -pi -e "s/(Author.*?<[^@]+@)(?:opscode\\.com|getchef\\.com)(>)/\\1chef.io\\2/gi"
* Copyright year update for 2016 and massive cleanup.Noah Kantrowitz2016-02-021-1/+1
| | | Generated via git ls-files | xargs perl -pi -e "s/[Cc]opyright (?:\([Cc]\) )?((?\!$(date +%Y))\\d{4})(-\\d{4})?([, ][ \d]+)*(,|(?= ))/Copyright \\1-$(date +%Y),/g"
* add deprecation warningsThom May2016-01-181-0/+1
|
* Use double quotes by defaultThom May2016-01-141-14/+14
| | | | | | | This is an entirely mechanically generated (chefstyle -a) change, to go along with chef/chefstyle#5 . We should pick something and use it consistently, and my opinion is that double quotes are the appropriate thing.
* really fix copslcg/really-fix-copsLamont Granquist2016-01-121-51/+51
|
* Convert all uses of Chef::REST to Chef::ServerAPItm/no_more_restThom May2016-01-111-14/+16
| | | | | | | In the process, stop auto-expanding JSON in the HTTP client, and let individual classes control that themselves. Fixes #2737, Fixes #3518