Method: Puppet::ModuleTool::Applications::Application#parse_filename
- Defined in:
- lib/puppet/module_tool/applications/application.rb
#parse_filename(filename) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/puppet/module_tool/applications/application.rb', line 75 def parse_filename(filename) match = /^((.*?)-(.*?))-(\d+\.\d+\.\d+.*?)$/.match(File.basename(filename, '.tar.gz')) if match module_name, , shortname, version = match.captures else raise ArgumentError, _("Could not parse filename to obtain the username, module name and version. (%{release_name})") % { release_name: @release_name } end unless SemanticPuppet::Version.valid?(version) raise ArgumentError, _("Invalid version format: %{version} (Semantic Versions are acceptable: http://semver.org)") % { version: version } end { :module_name => module_name, :author => , :dir_name => shortname, :version => version } end |