From 5ff479e3e5017e28ab08823c5429de86dab0a38e Mon Sep 17 00:00:00 2001 From: Postmodern Date: Wed, 11 Dec 2024 16:53:35 -0800 Subject: [PATCH] Moved `VERSION_NUMBER` to `ronin/support/text/patterns/software` (closes #554). --- lib/ronin/support/text/patterns.rb | 1 + lib/ronin/support/text/patterns/numeric.rb | 5 - lib/ronin/support/text/patterns/software.rb | 37 + spec/text/patterns/numeric_spec.rb | 862 ------------------- spec/text/patterns/software_spec.rb | 867 ++++++++++++++++++++ 5 files changed, 905 insertions(+), 867 deletions(-) create mode 100644 lib/ronin/support/text/patterns/software.rb create mode 100644 spec/text/patterns/software_spec.rb diff --git a/lib/ronin/support/text/patterns.rb b/lib/ronin/support/text/patterns.rb index bd2f36da..402fb94a 100644 --- a/lib/ronin/support/text/patterns.rb +++ b/lib/ronin/support/text/patterns.rb @@ -23,4 +23,5 @@ require 'ronin/support/text/patterns/file_system' require 'ronin/support/text/patterns/network' require 'ronin/support/text/patterns/pii' +require 'ronin/support/text/patterns/software' require 'ronin/support/text/patterns/source_code' diff --git a/lib/ronin/support/text/patterns/numeric.rb b/lib/ronin/support/text/patterns/numeric.rb index 8d939c19..5f1638aa 100644 --- a/lib/ronin/support/text/patterns/numeric.rb +++ b/lib/ronin/support/text/patterns/numeric.rb @@ -79,11 +79,6 @@ module Patterns # # @since 1.0.0 HEX_NUMBER = /(?:0x)?[0-9a-fA-F]+/ - - # Regular expression for finding version numbers in text. - # - # @since 1.0.0 - VERSION_NUMBER = /\d+(?:\.\d+){1,3}(?:[-.]?[A-Za-z]+(?:[-.]?\d+)?)?/ end end end diff --git a/lib/ronin/support/text/patterns/software.rb b/lib/ronin/support/text/patterns/software.rb new file mode 100644 index 00000000..84ac3c66 --- /dev/null +++ b/lib/ronin/support/text/patterns/software.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true +# +# Copyright (c) 2006-2024 Hal Brodigan (postmodern.mod3 at gmail.com) +# +# ronin-support is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# ronin-support is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with ronin-support. If not, see . +# + +module Ronin + module Support + module Text + # + # @since 0.3.0 + # + module Patterns + # + # @group Software Version Patterns + # + + # Regular expression for finding version numbers in text. + # + # @since 1.0.0 + VERSION_NUMBER = /\d+(?:\.\d+){1,3}(?:[-.]?[A-Za-z]+(?:[-.]?\d+)?)?/ + end + end + end +end diff --git a/spec/text/patterns/numeric_spec.rb b/spec/text/patterns/numeric_spec.rb index 924c65f0..4690e77c 100644 --- a/spec/text/patterns/numeric_spec.rb +++ b/spec/text/patterns/numeric_spec.rb @@ -266,866 +266,4 @@ end end end - - describe "VERSION_NUMBER" do - subject { described_class::VERSION_NUMBER } - - it "must match 'X.Y' versions" do - version = '1.0' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y' versions" do - version = '1.2.3' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y.Z' versions" do - version = '1.2.3.4' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Ypre' versions" do - version = '1.2.3pre' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Yrc' versions" do - version = '1.2.3rc' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Yalpha' versions" do - version = '1.2.3alpha' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Ybeta' versions" do - version = '1.2.3beta' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Yword' versions" do - version = '1.2.3hotfix' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y-pre' versions" do - version = '1.2.3-pre' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y-rc' versions" do - version = '1.2.3-rc' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y-alpha' versions" do - version = '1.2.3-alpha' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y-beta' versions" do - version = '1.2.3-beta' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y-word' versions" do - version = '1.2.3-hotfix' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y.pre' versions" do - version = '1.2.3.pre' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y.rc' versions" do - version = '1.2.3.rc' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y.alpha' versions" do - version = '1.2.3.alpha' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y.beta' versions" do - version = '1.2.3.beta' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y.word' versions" do - version = '1.2.3.word' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.YpreNNN' versions" do - version = '1.2.3pre123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.YrcNNN' versions" do - version = '1.2.3rc123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.YalphaNNN' versions" do - version = '1.2.3alpha123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.YbetaNNN' versions" do - version = '1.2.3beta123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.YwordNNN' versions" do - version = '1.2.3hotfix123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Ypre-NNN' versions" do - version = '1.2.3pre-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Yrc-NNN' versions" do - version = '1.2.3rc-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Yalpha-NNN' versions" do - version = '1.2.3alpha-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Ybeta-NNN' versions" do - version = '1.2.3beta-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Yword-NNN' versions" do - version = '1.2.3hotfix-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Ypre.NNN' versions" do - version = '1.2.3pre.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Yrc.NNN' versions" do - version = '1.2.3rc.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Yalpha.NNN' versions" do - version = '1.2.3alpha.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Ybeta.NNN' versions" do - version = '1.2.3beta.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Yword.NNN' versions" do - version = '1.2.3hotfix-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y-preNNN' versions" do - version = '1.2.3-pre123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y-rcNNN' versions" do - version = '1.2.3-rc123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y-alphaNNN' versions" do - version = '1.2.3-alpha123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y-betaNNN' versions" do - version = '1.2.3-beta123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y-xyzNNN' versions" do - version = '1.2.3-hotfix123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y.preNNN' versions" do - version = '1.2.3.pre123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y.rcNNN' versions" do - version = '1.2.3.rc123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y.alphaNNN' versions" do - version = '1.2.3.alpha123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y.betaNNN' versions" do - version = '1.2.3.beta123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y.xyzNNN' versions" do - version = '1.2.3.hotfix123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Ypre-NNN' versions" do - version = '1.2.3pre-1234' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Yrc-NNN' versions" do - version = '1.2.3rc-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Yalpha-NNN' versions" do - version = '1.2.3alpha-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Ybeta-NNN' versions" do - version = '1.2.3beta-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Yxyz-NNN' versions" do - version = '1.2.3hotfix-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y-pre-NNN' versions" do - version = '1.2.3-pre-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y-rc-NNN' versions" do - version = '1.2.3-rc-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y-alpha-NNN' versions" do - version = '1.2.3-alpha-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y-beta-NNN' versions" do - version = '1.2.3-beta-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y-xyz-NNN' versions" do - version = '1.2.3-hotfix-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y.pre-NNN' versions" do - version = '1.2.3.pre-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y.rc-NNN' versions" do - version = '1.2.3.rc-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y.alpha-NNN' versions" do - version = '1.2.3.alpha-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y.beta-NNN' versions" do - version = '1.2.3.beta-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y.xyz-NNN' versions" do - version = '1.2.3.hotfix-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Ypre.NNN' versions" do - version = '1.2.3pre.1234' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Yrc.NNN' versions" do - version = '1.2.3rc.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Yalpha.NNN' versions" do - version = '1.2.3alpha.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Ybeta.NNN' versions" do - version = '1.2.3beta.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Yxyz.NNN' versions" do - version = '1.2.3hotfix.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y-pre.NNN' versions" do - version = '1.2.3-pre.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y-rc.NNN' versions" do - version = '1.2.3-rc.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y-alpha.NNN' versions" do - version = '1.2.3-alpha.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y-beta.NNN' versions" do - version = '1.2.3-beta.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y-xyz.NNN' versions" do - version = '1.2.3-hotfix.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y.pre.NNN' versions" do - version = '1.2.3.pre.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y.rc.NNN' versions" do - version = '1.2.3.rc.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y.alpha.NNN' versions" do - version = '1.2.3.alpha.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y.beta.NNN' versions" do - version = '1.2.3.beta.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Y.xyz.NNN' versions" do - version = '1.2.3.hotfix.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Zpre' versions" do - version = '1.2.3.4pre' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Zrc' versions" do - version = '1.2.3.4rc' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Zalpha' versions" do - version = '1.2.3.4alpha' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Zbeta' versions" do - version = '1.2.3.4beta' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Zword' versions" do - version = '1.2.3.4hotfix' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z-pre' versions" do - version = '1.2.3.4-pre' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z-rc' versions" do - version = '1.2.3.4-rc' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z-alpha' versions" do - version = '1.2.3.4-alpha' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z-beta' versions" do - version = '1.2.3.4-beta' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z-xyz' versions" do - version = '1.2.3.4-hotfix' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z.pre' versions" do - version = '1.2.3.4.pre' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z.rc' versions" do - version = '1.2.3.4.rc' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z.alpha' versions" do - version = '1.2.3.4.alpha' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z.beta' versions" do - version = '1.2.3.4.beta' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z.word' versions" do - version = '1.2.3.4.hotfix' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.ZpreNNN' versions" do - version = '1.2.3.4pre123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.ZrcNNN' versions" do - version = '1.2.3.4rc123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.ZalphaNNN' versions" do - version = '1.2.3.4alpha123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.ZbetaNNN' versions" do - version = '1.2.3.4beta123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.ZwordNNN' versions" do - version = '1.2.3.4hotfix123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Zpre-NNN' versions" do - version = '1.2.3.4pre-1234' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Zrc-NNN' versions" do - version = '1.2.3.4rc-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Zalpha-NNN' versions" do - version = '1.2.3.4alpha-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Zbeta-NNN' versions" do - version = '1.2.3.4beta-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Zword-NNN' versions" do - version = '1.2.3.4hotfix-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Zpre.NNN' versions" do - version = '1.2.3.4pre.1234' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Zrc.NNN' versions" do - version = '1.2.3.4rc.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Zalpha.NNN' versions" do - version = '1.2.3.4alpha.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Zbeta.NNN' versions" do - version = '1.2.3.4beta.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Zword-NNN' versions" do - version = '1.2.3.4hotfix-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z-preNNN' versions" do - version = '1.2.3.4-pre123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z-rcNNN' versions" do - version = '1.2.3.4-rc123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z-alphaNNN' versions" do - version = '1.2.3.4-alpha123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z-betaNNN' versions" do - version = '1.2.3.4-beta123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z-wordNNN' versions" do - version = '1.2.3.4-hotfix123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z.preNNN' versions" do - version = '1.2.3.4.pre123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z.rcNNN' versions" do - version = '1.2.3.4.rc123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z.alphaNNN' versions" do - version = '1.2.3.4.alpha123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z.betaNNN' versions" do - version = '1.2.3.4.beta123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z.wordNNN' versions" do - version = '1.2.3.4.hotfix123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Zpre-NNN' versions" do - version = '1.2.3.4pre-1234' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Zrc-NNN' versions" do - version = '1.2.3.4rc-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Zalpha-NNN' versions" do - version = '1.2.3.4alpha-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Zbeta-NNN' versions" do - version = '1.2.3.4beta-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Zword-NNN' versions" do - version = '1.2.3.4hotfix-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z-pre-NNN' versions" do - version = '1.2.3.4-pre-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z-rc-NNN' versions" do - version = '1.2.3.4-rc-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z-alpha-NNN' versions" do - version = '1.2.3.4-alpha-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z-beta-NNN' versions" do - version = '1.2.3.4-beta-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z-word-NNN' versions" do - version = '1.2.3.4-hotfix-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z.pre-NNN' versions" do - version = '1.2.3.4.pre-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z.rc-NNN' versions" do - version = '1.2.3.4.rc-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z.alpha-NNN' versions" do - version = '1.2.3.4.alpha-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z.beta-NNN' versions" do - version = '1.2.3.4.beta-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z.word-NNN' versions" do - version = '1.2.3.4.hotfix-123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Zpre.NNN' versions" do - version = '1.2.3.4pre.1234' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Zrc.NNN' versions" do - version = '1.2.3.4rc.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Zalpha.NNN' versions" do - version = '1.2.3.4alpha.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Zbeta.NNN' versions" do - version = '1.2.3.4beta.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Zword.NNN' versions" do - version = '1.2.3.4hotfix.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z-pre.NNN' versions" do - version = '1.2.3.4-pre.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z-rc.NNN' versions" do - version = '1.2.3.4-rc.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z-alpha.NNN' versions" do - version = '1.2.3.4-alpha.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z-beta.NNN' versions" do - version = '1.2.3.4-beta.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z-word.NNN' versions" do - version = '1.2.3.4-hotfix.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z.pre.NNN' versions" do - version = '1.2.3.4.pre.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z.rc.NNN' versions" do - version = '1.2.3.4.rc.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z.alpha.NNN' versions" do - version = '1.2.3.4.alpha.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z.beta.NNN' versions" do - version = '1.2.3.4.beta.123' - - expect(version).to fully_match(subject) - end - - it "must match 'X.Y.Z.Y.Z.word.NNN' versions" do - version = '1.2.3.4.hotfix.123' - - expect(version).to fully_match(subject) - end - end end diff --git a/spec/text/patterns/software_spec.rb b/spec/text/patterns/software_spec.rb new file mode 100644 index 00000000..4d7c58c7 --- /dev/null +++ b/spec/text/patterns/software_spec.rb @@ -0,0 +1,867 @@ +require 'spec_helper' +require 'matchers/fully_match' +require 'ronin/support/text/patterns/software' + +describe Ronin::Support::Text::Patterns do + describe "VERSION_NUMBER" do + subject { described_class::VERSION_NUMBER } + + it "must match 'X.Y' versions" do + version = '1.0' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y' versions" do + version = '1.2.3' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y.Z' versions" do + version = '1.2.3.4' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Ypre' versions" do + version = '1.2.3pre' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Yrc' versions" do + version = '1.2.3rc' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Yalpha' versions" do + version = '1.2.3alpha' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Ybeta' versions" do + version = '1.2.3beta' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Yword' versions" do + version = '1.2.3hotfix' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y-pre' versions" do + version = '1.2.3-pre' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y-rc' versions" do + version = '1.2.3-rc' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y-alpha' versions" do + version = '1.2.3-alpha' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y-beta' versions" do + version = '1.2.3-beta' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y-word' versions" do + version = '1.2.3-hotfix' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y.pre' versions" do + version = '1.2.3.pre' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y.rc' versions" do + version = '1.2.3.rc' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y.alpha' versions" do + version = '1.2.3.alpha' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y.beta' versions" do + version = '1.2.3.beta' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y.word' versions" do + version = '1.2.3.word' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.YpreNNN' versions" do + version = '1.2.3pre123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.YrcNNN' versions" do + version = '1.2.3rc123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.YalphaNNN' versions" do + version = '1.2.3alpha123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.YbetaNNN' versions" do + version = '1.2.3beta123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.YwordNNN' versions" do + version = '1.2.3hotfix123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Ypre-NNN' versions" do + version = '1.2.3pre-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Yrc-NNN' versions" do + version = '1.2.3rc-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Yalpha-NNN' versions" do + version = '1.2.3alpha-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Ybeta-NNN' versions" do + version = '1.2.3beta-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Yword-NNN' versions" do + version = '1.2.3hotfix-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Ypre.NNN' versions" do + version = '1.2.3pre.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Yrc.NNN' versions" do + version = '1.2.3rc.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Yalpha.NNN' versions" do + version = '1.2.3alpha.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Ybeta.NNN' versions" do + version = '1.2.3beta.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Yword.NNN' versions" do + version = '1.2.3hotfix-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y-preNNN' versions" do + version = '1.2.3-pre123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y-rcNNN' versions" do + version = '1.2.3-rc123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y-alphaNNN' versions" do + version = '1.2.3-alpha123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y-betaNNN' versions" do + version = '1.2.3-beta123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y-xyzNNN' versions" do + version = '1.2.3-hotfix123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y.preNNN' versions" do + version = '1.2.3.pre123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y.rcNNN' versions" do + version = '1.2.3.rc123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y.alphaNNN' versions" do + version = '1.2.3.alpha123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y.betaNNN' versions" do + version = '1.2.3.beta123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y.xyzNNN' versions" do + version = '1.2.3.hotfix123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Ypre-NNN' versions" do + version = '1.2.3pre-1234' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Yrc-NNN' versions" do + version = '1.2.3rc-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Yalpha-NNN' versions" do + version = '1.2.3alpha-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Ybeta-NNN' versions" do + version = '1.2.3beta-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Yxyz-NNN' versions" do + version = '1.2.3hotfix-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y-pre-NNN' versions" do + version = '1.2.3-pre-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y-rc-NNN' versions" do + version = '1.2.3-rc-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y-alpha-NNN' versions" do + version = '1.2.3-alpha-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y-beta-NNN' versions" do + version = '1.2.3-beta-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y-xyz-NNN' versions" do + version = '1.2.3-hotfix-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y.pre-NNN' versions" do + version = '1.2.3.pre-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y.rc-NNN' versions" do + version = '1.2.3.rc-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y.alpha-NNN' versions" do + version = '1.2.3.alpha-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y.beta-NNN' versions" do + version = '1.2.3.beta-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y.xyz-NNN' versions" do + version = '1.2.3.hotfix-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Ypre.NNN' versions" do + version = '1.2.3pre.1234' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Yrc.NNN' versions" do + version = '1.2.3rc.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Yalpha.NNN' versions" do + version = '1.2.3alpha.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Ybeta.NNN' versions" do + version = '1.2.3beta.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Yxyz.NNN' versions" do + version = '1.2.3hotfix.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y-pre.NNN' versions" do + version = '1.2.3-pre.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y-rc.NNN' versions" do + version = '1.2.3-rc.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y-alpha.NNN' versions" do + version = '1.2.3-alpha.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y-beta.NNN' versions" do + version = '1.2.3-beta.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y-xyz.NNN' versions" do + version = '1.2.3-hotfix.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y.pre.NNN' versions" do + version = '1.2.3.pre.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y.rc.NNN' versions" do + version = '1.2.3.rc.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y.alpha.NNN' versions" do + version = '1.2.3.alpha.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y.beta.NNN' versions" do + version = '1.2.3.beta.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Y.xyz.NNN' versions" do + version = '1.2.3.hotfix.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Zpre' versions" do + version = '1.2.3.4pre' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Zrc' versions" do + version = '1.2.3.4rc' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Zalpha' versions" do + version = '1.2.3.4alpha' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Zbeta' versions" do + version = '1.2.3.4beta' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Zword' versions" do + version = '1.2.3.4hotfix' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z-pre' versions" do + version = '1.2.3.4-pre' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z-rc' versions" do + version = '1.2.3.4-rc' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z-alpha' versions" do + version = '1.2.3.4-alpha' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z-beta' versions" do + version = '1.2.3.4-beta' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z-xyz' versions" do + version = '1.2.3.4-hotfix' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z.pre' versions" do + version = '1.2.3.4.pre' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z.rc' versions" do + version = '1.2.3.4.rc' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z.alpha' versions" do + version = '1.2.3.4.alpha' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z.beta' versions" do + version = '1.2.3.4.beta' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z.word' versions" do + version = '1.2.3.4.hotfix' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.ZpreNNN' versions" do + version = '1.2.3.4pre123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.ZrcNNN' versions" do + version = '1.2.3.4rc123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.ZalphaNNN' versions" do + version = '1.2.3.4alpha123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.ZbetaNNN' versions" do + version = '1.2.3.4beta123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.ZwordNNN' versions" do + version = '1.2.3.4hotfix123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Zpre-NNN' versions" do + version = '1.2.3.4pre-1234' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Zrc-NNN' versions" do + version = '1.2.3.4rc-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Zalpha-NNN' versions" do + version = '1.2.3.4alpha-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Zbeta-NNN' versions" do + version = '1.2.3.4beta-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Zword-NNN' versions" do + version = '1.2.3.4hotfix-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Zpre.NNN' versions" do + version = '1.2.3.4pre.1234' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Zrc.NNN' versions" do + version = '1.2.3.4rc.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Zalpha.NNN' versions" do + version = '1.2.3.4alpha.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Zbeta.NNN' versions" do + version = '1.2.3.4beta.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Zword-NNN' versions" do + version = '1.2.3.4hotfix-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z-preNNN' versions" do + version = '1.2.3.4-pre123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z-rcNNN' versions" do + version = '1.2.3.4-rc123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z-alphaNNN' versions" do + version = '1.2.3.4-alpha123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z-betaNNN' versions" do + version = '1.2.3.4-beta123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z-wordNNN' versions" do + version = '1.2.3.4-hotfix123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z.preNNN' versions" do + version = '1.2.3.4.pre123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z.rcNNN' versions" do + version = '1.2.3.4.rc123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z.alphaNNN' versions" do + version = '1.2.3.4.alpha123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z.betaNNN' versions" do + version = '1.2.3.4.beta123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z.wordNNN' versions" do + version = '1.2.3.4.hotfix123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Zpre-NNN' versions" do + version = '1.2.3.4pre-1234' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Zrc-NNN' versions" do + version = '1.2.3.4rc-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Zalpha-NNN' versions" do + version = '1.2.3.4alpha-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Zbeta-NNN' versions" do + version = '1.2.3.4beta-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Zword-NNN' versions" do + version = '1.2.3.4hotfix-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z-pre-NNN' versions" do + version = '1.2.3.4-pre-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z-rc-NNN' versions" do + version = '1.2.3.4-rc-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z-alpha-NNN' versions" do + version = '1.2.3.4-alpha-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z-beta-NNN' versions" do + version = '1.2.3.4-beta-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z-word-NNN' versions" do + version = '1.2.3.4-hotfix-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z.pre-NNN' versions" do + version = '1.2.3.4.pre-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z.rc-NNN' versions" do + version = '1.2.3.4.rc-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z.alpha-NNN' versions" do + version = '1.2.3.4.alpha-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z.beta-NNN' versions" do + version = '1.2.3.4.beta-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z.word-NNN' versions" do + version = '1.2.3.4.hotfix-123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Zpre.NNN' versions" do + version = '1.2.3.4pre.1234' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Zrc.NNN' versions" do + version = '1.2.3.4rc.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Zalpha.NNN' versions" do + version = '1.2.3.4alpha.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Zbeta.NNN' versions" do + version = '1.2.3.4beta.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Zword.NNN' versions" do + version = '1.2.3.4hotfix.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z-pre.NNN' versions" do + version = '1.2.3.4-pre.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z-rc.NNN' versions" do + version = '1.2.3.4-rc.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z-alpha.NNN' versions" do + version = '1.2.3.4-alpha.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z-beta.NNN' versions" do + version = '1.2.3.4-beta.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z-word.NNN' versions" do + version = '1.2.3.4-hotfix.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z.pre.NNN' versions" do + version = '1.2.3.4.pre.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z.rc.NNN' versions" do + version = '1.2.3.4.rc.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z.alpha.NNN' versions" do + version = '1.2.3.4.alpha.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z.beta.NNN' versions" do + version = '1.2.3.4.beta.123' + + expect(version).to fully_match(subject) + end + + it "must match 'X.Y.Z.Y.Z.word.NNN' versions" do + version = '1.2.3.4.hotfix.123' + + expect(version).to fully_match(subject) + end + end +end