Skip to content

Commit

Permalink
Merge pull request #56 from dafyddcrosby/use_cookstyle
Browse files Browse the repository at this point in the history
Migrate from Chefstyle to Cookstyle
  • Loading branch information
tpowell-progress authored Dec 17, 2024
2 parents ce8b14d + f0f0cac commit 45a5509
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ group :docs do
end

group :test do
gem "chefstyle", "=0.4.0" # pin needed until we drop Ruby 2.0/2.1 support
gem "cookstyle", ">= 7.32.8"
gem "rspec", "~> 3.0"
gem "rspec-its"
gem "rake"
Expand Down
4 changes: 2 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ rescue LoadError
end

begin
require "chefstyle"
require "cookstyle/chefstyle"
require "rubocop/rake_task"
desc "Run Chefstyle tests"
RuboCop::RakeTask.new(:style) do |task|
task.options += ["--display-cop-names", "--no-color"]
end
rescue LoadError
puts "chefstyle gem is not installed. bundle install first to make sure all dependencies are installed."
puts "cookstyle gem is not installed. bundle install first to make sure all dependencies are installed."
end

begin
Expand Down
10 changes: 5 additions & 5 deletions lib/mixlib/versioning.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ def self.parse(version_string, format = nil)
# Attempt to parse from the most specific formats first.
parsed_version = nil
formats.each do |version|
begin
break parsed_version = version.new(version_string)
rescue Mixlib::Versioning::ParseError
next
end

break parsed_version = version.new(version_string)
rescue Mixlib::Versioning::ParseError
next

end
parsed_version
end
Expand Down
2 changes: 1 addition & 1 deletion lib/mixlib/versioning/format/git_describe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Format
# @author Seth Chisamore (<[email protected]>)
# @author Christopher Maier (<[email protected]>)
class GitDescribe < Format
GIT_DESCRIBE_REGEX = /^(\d+)\.(\d+)\.(\d+)(?:\-|\.)?(.+)?\-(\d+)\-g([a-f0-9]{7,40})(?:\-)?(\d+)?$/
GIT_DESCRIBE_REGEX = /^(\d+)\.(\d+)\.(\d+)(?:\-|\.)?(.+)?\-(\d+)\-g([a-f0-9]{7,40})(?:\-)?(\d+)?$/.freeze

attr_reader :commits_since, :commit_sha

Expand Down
4 changes: 2 additions & 2 deletions lib/mixlib/versioning/format/opscode_semver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Format
# @author Christopher Maier (<[email protected]>)
class OpscodeSemVer < SemVer
# The pattern is: `YYYYMMDDHHMMSS.git.COMMITS_SINCE.SHA1`
OPSCODE_BUILD_REGEX = /^\d{14}(\.git\.\d+\.[a-f0-9]{7})?$/
OPSCODE_BUILD_REGEX = /^\d{14}(\.git\.\d+\.[a-f0-9]{7})?$/.freeze

# Allows the following:
#
Expand All @@ -65,7 +65,7 @@ class OpscodeSemVer < SemVer
# rc, rc.0, rc.1, rc.2, etc.
# ```
#
OPSCODE_PRERELEASE_REGEX = /^(alpha|beta|rc)(\.\d+)?$/
OPSCODE_PRERELEASE_REGEX = /^(alpha|beta|rc)(\.\d+)?$/.freeze

# @see SemVer#parse
def parse(version_string)
Expand Down
2 changes: 1 addition & 1 deletion lib/mixlib/versioning/format/partial_semver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Format
# @author Ryan Hass (<[email protected]>)
class PartialSemVer < Format
# http://rubular.com/r/NmRSN8vCie
PARTIAL_REGEX = /^(\d+)\.?(?:(\d*))$/
PARTIAL_REGEX = /^(\d+)\.?(?:(\d*))$/.freeze
# @see Format#parse
def parse(version_string)
match = version_string.match(PARTIAL_REGEX) rescue nil
Expand Down
2 changes: 1 addition & 1 deletion lib/mixlib/versioning/format/rubygems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Format
# @author Seth Chisamore (<[email protected]>)
# @author Christopher Maier (<[email protected]>)
class Rubygems < Format
RUBYGEMS_REGEX = /^(\d+)\.(\d+)\.(\d+)(?:\.([[:alnum:]]+(?:\.[[:alnum:]]+)?))?(?:\-(\d+))?$/
RUBYGEMS_REGEX = /^(\d+)\.(\d+)\.(\d+)(?:\.([[:alnum:]]+(?:\.[[:alnum:]]+)?))?(?:\-(\d+))?$/.freeze

# @see Format#parse
def parse(version_string)
Expand Down
2 changes: 1 addition & 1 deletion lib/mixlib/versioning/format/semver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Format
# @author Seth Chisamore (<[email protected]>)
# @author Christopher Maier (<[email protected]>)
class SemVer < Format
SEMVER_REGEX = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*))*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/
SEMVER_REGEX = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*))*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/.freeze

# @see Format#parse
def parse(version_string)
Expand Down
2 changes: 1 addition & 1 deletion lib/mixlib/versioning/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@

module Mixlib
class Versioning
VERSION = "1.2.18"
VERSION = "1.2.18".freeze
end
end
2 changes: 1 addition & 1 deletion mixlib-versioning.gemspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
lib = File.expand_path("../lib", __FILE__)
lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "mixlib/versioning/version"

Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
require "rspec/its"

# load all shared examples and shared contexts
Dir[File.expand_path("../support/**/*.rb", __FILE__)].each do |file|
Dir[File.expand_path("support/**/*.rb", __dir__)].each do |file|
require(file)
end

Expand Down

0 comments on commit 45a5509

Please sign in to comment.