lib/puppetfile-resolver/puppetfile/parser/r10k_eval/module/forge.rb in puppetfile-resolver-0.3.0 vs lib/puppetfile-resolver/puppetfile/parser/r10k_eval/module/forge.rb in puppetfile-resolver-0.4.0
- old
+ new
@@ -12,16 +12,16 @@
!name.match(/\A(\w+)[-\/](\w+)\Z/).nil? && valid_version?(args)
end
def self.to_document_module(title, args)
mod = ::PuppetfileResolver::Puppetfile::ForgeModule.new(title)
- mod.version = args if valid_version?(args)
+ mod.version = munge_version_string(args) if valid_version?(args)
mod
end
def self.valid_version?(value)
- return false unless value.is_a?(String) || value.is_a?(Symbol)
+ return false unless value.is_a?(String) || value.is_a?(Symbol) || value.nil?
value == :latest || value.nil? || valid_version_string?(value)
end
private_class_method :valid_version?
# Version string matching regexes
@@ -40,9 +40,15 @@
prerelease = match[4]
prerelease.nil? || prerelease.split('.').all? { |x| x !~ /^0\d+$/ }
end
end
private_class_method :valid_version_string?
+
+ def self.munge_version_string(value)
+ return :latest if value.nil? || value == :latest
+ "=#{value}"
+ end
+ private_class_method :munge_version_string
end
end
end
end
end