Sha256: e27f3ede64e75565e0740b3aa1bd3a6c23745b8aa633b01eb9bd523802e211a6
Contents?: true
Size: 614 Bytes
Versions: 2
Compression:
Stored size: 614 Bytes
Contents
module Jim class VersionParser NOT_EXTENSIONS = %w{.min .pre .beta} def self.parse_filename(filename) f = filename.dup extension = f.scan(/\.[^\.\d\s\-\_][^\.]*$/)[0] if NOT_EXTENSIONS.include?(extension) extension = nil else f.gsub!(/#{extension}$/, '') end name, after_name, delimiter, version = f.scan(/^([a-z\.\-]+)(([\.\-\_\s])(([\w\d]{6,7})|([\d\w\.]+)))?$/i)[0] [name, version || "0"] end def self.parse_package_json(package) json = Yajl::Parser.parse(package) [json["name"], json["version"]] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jim-0.1.1 | lib/jim/version_parser.rb |
jim-0.1.0 | lib/jim/version_parser.rb |