metasploit-version 0.1.2-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/.coveralls.yml +1 -0
 - data/.gitignore +32 -0
 - data/.simplecov +60 -0
 - data/.travis.yml +26 -0
 - data/.yardopts +7 -0
 - data/CONTRIBUTING.md +156 -0
 - data/Gemfile +17 -0
 - data/LICENSE.txt +22 -0
 - data/README.md +133 -0
 - data/Rakefile +20 -0
 - data/features/shared/examples/metasploit/version/gem_version_constant.feature +215 -0
 - data/features/shared/examples/metasploit/version/version_constant.feature +183 -0
 - data/features/shared/examples/metasploit/version/version_module.feature +275 -0
 - data/features/shared/examples/metasploit/version/version_module/prerelease/git/branch.feature +234 -0
 - data/features/shared/examples/metasploit/version/version_module/prerelease/git/detached_head.feature +97 -0
 - data/features/shared/examples/metasploit/version/version_module/prerelease/git/master.feature +94 -0
 - data/features/shared/examples/metasploit/version/version_module/prerelease/git/step_definitions/environment_variable_steps.rb +13 -0
 - data/features/shared/examples/metasploit/version/version_module/prerelease/git/step_definitions/git_steps.rb +30 -0
 - data/features/shared/examples/metasploit/version/version_module/prerelease/travis_ci/branch.feature +173 -0
 - data/features/shared/examples/metasploit/version/version_module/prerelease/travis_ci/master.feature +90 -0
 - data/features/shared/examples/metasploit/version/version_module/prerelease/travis_ci/pull_request.feature +99 -0
 - data/features/shared/examples/metasploit/version/version_module/prerelease/travis_ci/tag.feature +277 -0
 - data/features/support/env.rb +41 -0
 - data/features/support/simplecov_setup.rb +12 -0
 - data/lib/metasploit/version.rb +19 -0
 - data/lib/metasploit/version/branch.rb +172 -0
 - data/lib/metasploit/version/version.rb +57 -0
 - data/metasploit-version.gemspec +41 -0
 - data/spec/lib/metasploit/version/branch_spec.rb +660 -0
 - data/spec/lib/metasploit/version/version_spec.rb +5 -0
 - data/spec/lib/metasploit/version_spec.rb +6 -0
 - data/spec/spec_helper.rb +13 -0
 - data/spec/support/shared/examples/metasploit/version/gem_version_constant.rb +17 -0
 - data/spec/support/shared/examples/metasploit/version/version_constant.rb +17 -0
 - data/spec/support/shared/examples/metasploit/version/version_module.rb +226 -0
 - metadata +173 -0
 
    
        data/spec/spec_helper.rb
    ADDED
    
    | 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            # require before 'metasploit/version' so coverage is shown for files required by 'metasploit/version'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'simplecov'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            require 'metasploit/version'
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            # Use find_all_by_name instead of find_by_name as find_all_by_name will return pre-release versions
         
     | 
| 
      
 9 
     | 
    
         
            +
            gem_specification = Gem::Specification.find_all_by_name('metasploit-version').first
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            Dir[File.join(gem_specification.gem_dir, 'spec', 'support', '**', '*.rb')].each do |f|
         
     | 
| 
      
 12 
     | 
    
         
            +
              require f
         
     | 
| 
      
 13 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,17 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            shared_examples_for 'Metasploit::Version GEM_VERSION constant' do
         
     | 
| 
      
 2 
     | 
    
         
            +
              context 'CONSTANTS' do
         
     | 
| 
      
 3 
     | 
    
         
            +
                context 'GEM_VERSION' do
         
     | 
| 
      
 4 
     | 
    
         
            +
                  subject(:version) {
         
     | 
| 
      
 5 
     | 
    
         
            +
                    described_class::GEM_VERSION
         
     | 
| 
      
 6 
     | 
    
         
            +
                  }
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                  it 'is defined' do
         
     | 
| 
      
 9 
     | 
    
         
            +
                    expect(defined? described_class::GEM_VERSION).not_to be_nil, "expected #{described_class}::GEM_VERSION to be defined"
         
     | 
| 
      
 10 
     | 
    
         
            +
                  end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                  it 'is Version.gem' do
         
     | 
| 
      
 13 
     | 
    
         
            +
                    expect(version).to eq(described_class::Version.gem), "expected #{described_class}::GEM_VERSION to equal #{described_class}::Version.gem"
         
     | 
| 
      
 14 
     | 
    
         
            +
                  end
         
     | 
| 
      
 15 
     | 
    
         
            +
                end
         
     | 
| 
      
 16 
     | 
    
         
            +
              end
         
     | 
| 
      
 17 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,17 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            shared_examples_for 'Metasploit::Version VERSION constant' do
         
     | 
| 
      
 2 
     | 
    
         
            +
              context 'CONSTANTS' do
         
     | 
| 
      
 3 
     | 
    
         
            +
                context 'VERSION' do
         
     | 
| 
      
 4 
     | 
    
         
            +
                  subject(:version) {
         
     | 
| 
      
 5 
     | 
    
         
            +
                    described_class::VERSION
         
     | 
| 
      
 6 
     | 
    
         
            +
                  }
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                  it 'is defined' do
         
     | 
| 
      
 9 
     | 
    
         
            +
                    expect(defined? described_class::VERSION).not_to be_nil, "expected #{described_class}::VERSION to be defined"
         
     | 
| 
      
 10 
     | 
    
         
            +
                  end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                  it 'is Version.full' do
         
     | 
| 
      
 13 
     | 
    
         
            +
                    expect(version).to eq(described_class::Version.full), "expected #{described_class}::VERSION to equal #{described_class}::Version.full"
         
     | 
| 
      
 14 
     | 
    
         
            +
                  end
         
     | 
| 
      
 15 
     | 
    
         
            +
                end
         
     | 
| 
      
 16 
     | 
    
         
            +
              end
         
     | 
| 
      
 17 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,226 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            shared_examples_for 'Metasploit::Version Version Module' do
         
     | 
| 
      
 2 
     | 
    
         
            +
              context 'CONSTANTS' do
         
     | 
| 
      
 3 
     | 
    
         
            +
                context 'MAJOR' do
         
     | 
| 
      
 4 
     | 
    
         
            +
                  subject(:major) {
         
     | 
| 
      
 5 
     | 
    
         
            +
                    described_class::MAJOR
         
     | 
| 
      
 6 
     | 
    
         
            +
                  }
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                  it { should be_an Integer }
         
     | 
| 
      
 9 
     | 
    
         
            +
                end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                context 'MINOR' do
         
     | 
| 
      
 12 
     | 
    
         
            +
                  subject(:minor) {
         
     | 
| 
      
 13 
     | 
    
         
            +
                    described_class::MINOR
         
     | 
| 
      
 14 
     | 
    
         
            +
                  }
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                  it { should be_a Integer }
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                context 'PATCH' do
         
     | 
| 
      
 20 
     | 
    
         
            +
                  subject(:patch) {
         
     | 
| 
      
 21 
     | 
    
         
            +
                    described_class::PATCH
         
     | 
| 
      
 22 
     | 
    
         
            +
                  }
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                  it { should be_a Integer }
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                pull_request = ENV['TRAVIS_PULL_REQUEST']
         
     | 
| 
      
 28 
     | 
    
         
            +
                example_options = {}
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                if !pull_request.nil? && pull_request != 'false'
         
     | 
| 
      
 31 
     | 
    
         
            +
                  example_options = {
         
     | 
| 
      
 32 
     | 
    
         
            +
                      pending: "PRERELEASE can only be set appropriately for a merge by merging to the target branch and then " \
         
     | 
| 
      
 33 
     | 
    
         
            +
                               "updating PRERELEASE on the target branch before committing and/or pushing to github and travis-ci."
         
     | 
| 
      
 34 
     | 
    
         
            +
                  }
         
     | 
| 
      
 35 
     | 
    
         
            +
                end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                context 'PRERELEASE' do
         
     | 
| 
      
 38 
     | 
    
         
            +
                  subject(:prerelease) {
         
     | 
| 
      
 39 
     | 
    
         
            +
                    described_class::PRERELEASE
         
     | 
| 
      
 40 
     | 
    
         
            +
                  }
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                  branch = Metasploit::Version::Branch.current
         
     | 
| 
      
 43 
     | 
    
         
            +
                  parsed_branch = Metasploit::Version::Branch.parse(branch)
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                  #
         
     | 
| 
      
 46 
     | 
    
         
            +
                  # Methods
         
     | 
| 
      
 47 
     | 
    
         
            +
                  #
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                  # use define_method to capture `parsed_branch`
         
     | 
| 
      
 50 
     | 
    
         
            +
                  define_method(:expect_prerelease_to_be_defined) do
         
     | 
| 
      
 51 
     | 
    
         
            +
                    expect(defined? described_class::PRERELEASE).not_to(
         
     | 
| 
      
 52 
     | 
    
         
            +
                        be_nil,
         
     | 
| 
      
 53 
     | 
    
         
            +
                        # lambda so error string is only calculated on failures
         
     | 
| 
      
 54 
     | 
    
         
            +
                        ->() {
         
     | 
| 
      
 55 
     | 
    
         
            +
                          "expected #{described_class}::PRERELEASE to be defined.\n" \
         
     | 
| 
      
 56 
     | 
    
         
            +
                          "Add the following to #{described_class}:\n" \
         
     | 
| 
      
 57 
     | 
    
         
            +
                          "\n" \
         
     | 
| 
      
 58 
     | 
    
         
            +
                          "    # The prerelease version, scoped to the {PATCH} version number.\n" \
         
     | 
| 
      
 59 
     | 
    
         
            +
                          "    PRERELEASE = #{parsed_branch[:prerelease]}"
         
     | 
| 
      
 60 
     | 
    
         
            +
                        }
         
     | 
| 
      
 61 
     | 
    
         
            +
                    )
         
     | 
| 
      
 62 
     | 
    
         
            +
                  end
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                  # unknown format
         
     | 
| 
      
 65 
     | 
    
         
            +
                  if parsed_branch.nil?
         
     | 
| 
      
 66 
     | 
    
         
            +
                    # unknown format is still wrong, even on a pull request, so don't use `example_options`
         
     | 
| 
      
 67 
     | 
    
         
            +
                    it 'has an abbreviated reference that can be parsed for prerelease' do
         
     | 
| 
      
 68 
     | 
    
         
            +
                      fail "Do not know how to parse #{branch.inspect} for PRERELEASE"
         
     | 
| 
      
 69 
     | 
    
         
            +
                    end
         
     | 
| 
      
 70 
     | 
    
         
            +
                  # detached HEAD in git
         
     | 
| 
      
 71 
     | 
    
         
            +
                  elsif parsed_branch == 'HEAD'
         
     | 
| 
      
 72 
     | 
    
         
            +
                    it 'has an abbreviated reference that can be parsed for prerelease',
         
     | 
| 
      
 73 
     | 
    
         
            +
                       pending: 'Cannot determine branch name in detached HEAD state.  Set TRAVIS_BRANCH to supply branch name' do
         
     | 
| 
      
 74 
     | 
    
         
            +
                      fail "Do not know how to parse #{branch.inspect} for PRERELEASE"
         
     | 
| 
      
 75 
     | 
    
         
            +
                    end
         
     | 
| 
      
 76 
     | 
    
         
            +
                  # master
         
     | 
| 
      
 77 
     | 
    
         
            +
                  elsif parsed_branch == 'master'
         
     | 
| 
      
 78 
     | 
    
         
            +
                    it 'is not defined', example_options do
         
     | 
| 
      
 79 
     | 
    
         
            +
                      expect(defined? described_class::PRERELEASE).to(
         
     | 
| 
      
 80 
     | 
    
         
            +
                          be_nil,
         
     | 
| 
      
 81 
     | 
    
         
            +
                          "expected #{described_class}::PRERELEASE not to be defined on master"
         
     | 
| 
      
 82 
     | 
    
         
            +
                      )
         
     | 
| 
      
 83 
     | 
    
         
            +
                    end
         
     | 
| 
      
 84 
     | 
    
         
            +
                  # non-master branches
         
     | 
| 
      
 85 
     | 
    
         
            +
                  elsif parsed_branch.has_key? :type
         
     | 
| 
      
 86 
     | 
    
         
            +
                    it "matches the #{parsed_branch[:type]} branch's name", example_options do
         
     | 
| 
      
 87 
     | 
    
         
            +
                      expect_prerelease_to_be_defined
         
     | 
| 
      
 88 
     | 
    
         
            +
                      expect(prerelease).to eq(parsed_branch[:prerelease])
         
     | 
| 
      
 89 
     | 
    
         
            +
                    end
         
     | 
| 
      
 90 
     | 
    
         
            +
                  # tags
         
     | 
| 
      
 91 
     | 
    
         
            +
                  else
         
     | 
| 
      
 92 
     | 
    
         
            +
                    # pre-release tag
         
     | 
| 
      
 93 
     | 
    
         
            +
                    if parsed_branch[:prerelease]
         
     | 
| 
      
 94 
     | 
    
         
            +
                      it 'matches the tag prerelease converted from a gem version to a VERSION', example_options do
         
     | 
| 
      
 95 
     | 
    
         
            +
                        expect_prerelease_to_be_defined
         
     | 
| 
      
 96 
     | 
    
         
            +
                        expect(prerelease).to eq(parsed_branch[:prerelease])
         
     | 
| 
      
 97 
     | 
    
         
            +
                      end
         
     | 
| 
      
 98 
     | 
    
         
            +
                    # master tag
         
     | 
| 
      
 99 
     | 
    
         
            +
                    else
         
     | 
| 
      
 100 
     | 
    
         
            +
                      it 'is not defined', example_options do
         
     | 
| 
      
 101 
     | 
    
         
            +
                        expect(defined? described_class::PRERELEASE).to(
         
     | 
| 
      
 102 
     | 
    
         
            +
                            be_nil,
         
     | 
| 
      
 103 
     | 
    
         
            +
                            "expected #{described_class}::PRERELEASE not to be defined on master"
         
     | 
| 
      
 104 
     | 
    
         
            +
                        )
         
     | 
| 
      
 105 
     | 
    
         
            +
                      end
         
     | 
| 
      
 106 
     | 
    
         
            +
                    end
         
     | 
| 
      
 107 
     | 
    
         
            +
                  end
         
     | 
| 
      
 108 
     | 
    
         
            +
                end
         
     | 
| 
      
 109 
     | 
    
         
            +
              end
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
              context 'full' do
         
     | 
| 
      
 112 
     | 
    
         
            +
                subject(:full) {
         
     | 
| 
      
 113 
     | 
    
         
            +
                  described_class.full
         
     | 
| 
      
 114 
     | 
    
         
            +
                }
         
     | 
| 
      
 115 
     | 
    
         
            +
             
     | 
| 
      
 116 
     | 
    
         
            +
                #
         
     | 
| 
      
 117 
     | 
    
         
            +
                # Methods
         
     | 
| 
      
 118 
     | 
    
         
            +
                #
         
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
| 
      
 120 
     | 
    
         
            +
                def expect_method_defined
         
     | 
| 
      
 121 
     | 
    
         
            +
                  expect(defined? described_class.full).to(
         
     | 
| 
      
 122 
     | 
    
         
            +
                      eq('method'),
         
     | 
| 
      
 123 
     | 
    
         
            +
                      # lambda so expensive message calculation only happens on failure
         
     | 
| 
      
 124 
     | 
    
         
            +
                      ->() {
         
     | 
| 
      
 125 
     | 
    
         
            +
                        "expected #{described_class} to define self.full().\n" \
         
     | 
| 
      
 126 
     | 
    
         
            +
                        "Add the following to #{described_class}\n" \
         
     | 
| 
      
 127 
     | 
    
         
            +
                        "\n" \
         
     | 
| 
      
 128 
     | 
    
         
            +
                        "    # The full version string, including the {MAJOR}, {MINOR}, {PATCH}, and optionally, the {PRERELEASE} in the\n" \
         
     | 
| 
      
 129 
     | 
    
         
            +
                        "    # {http://semver.org/spec/v2.0.0.html semantic versioning v2.0.0} format.\n" \
         
     | 
| 
      
 130 
     | 
    
         
            +
                        "    #\n" \
         
     | 
| 
      
 131 
     | 
    
         
            +
                        "    # @return [String] '{MAJOR}.{MINOR}.{PATCH}' on master.  '{MAJOR}.{MINOR}.{PATCH}-{PRERELEASE}' on any branch\n" \
         
     | 
| 
      
 132 
     | 
    
         
            +
                        "    #   other than master.\n" \
         
     | 
| 
      
 133 
     | 
    
         
            +
                        "    def self.full\n" \
         
     | 
| 
      
 134 
     | 
    
         
            +
                        "      version = \"\#{MAJOR}.\#{MINOR}.\#{PATCH}\"\n" \
         
     | 
| 
      
 135 
     | 
    
         
            +
                        "\n" \
         
     | 
| 
      
 136 
     | 
    
         
            +
                        "      if defined? PRERELEASE\n" \
         
     | 
| 
      
 137 
     | 
    
         
            +
                        "        version = \"\#{version}-\#{PRERELEASE}\"\n" \
         
     | 
| 
      
 138 
     | 
    
         
            +
                        "      end\n" \
         
     | 
| 
      
 139 
     | 
    
         
            +
                        "\n" \
         
     | 
| 
      
 140 
     | 
    
         
            +
                        "      version\n" \
         
     | 
| 
      
 141 
     | 
    
         
            +
                        "   end"
         
     | 
| 
      
 142 
     | 
    
         
            +
                      }
         
     | 
| 
      
 143 
     | 
    
         
            +
                  )
         
     | 
| 
      
 144 
     | 
    
         
            +
                end
         
     | 
| 
      
 145 
     | 
    
         
            +
             
     | 
| 
      
 146 
     | 
    
         
            +
                #
         
     | 
| 
      
 147 
     | 
    
         
            +
                # Callbacks
         
     | 
| 
      
 148 
     | 
    
         
            +
                #
         
     | 
| 
      
 149 
     | 
    
         
            +
             
     | 
| 
      
 150 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
      
 151 
     | 
    
         
            +
                  expect_method_defined
         
     | 
| 
      
 152 
     | 
    
         
            +
                end
         
     | 
| 
      
 153 
     | 
    
         
            +
             
     | 
| 
      
 154 
     | 
    
         
            +
                context 'with PRERELEASE defined' do
         
     | 
| 
      
 155 
     | 
    
         
            +
                  #
         
     | 
| 
      
 156 
     | 
    
         
            +
                  # lets
         
     | 
| 
      
 157 
     | 
    
         
            +
                  #
         
     | 
| 
      
 158 
     | 
    
         
            +
             
     | 
| 
      
 159 
     | 
    
         
            +
                  let(:prerelease) {
         
     | 
| 
      
 160 
     | 
    
         
            +
                    'prerelease'
         
     | 
| 
      
 161 
     | 
    
         
            +
                  }
         
     | 
| 
      
 162 
     | 
    
         
            +
             
     | 
| 
      
 163 
     | 
    
         
            +
                  #
         
     | 
| 
      
 164 
     | 
    
         
            +
                  # Callbacks
         
     | 
| 
      
 165 
     | 
    
         
            +
                  #
         
     | 
| 
      
 166 
     | 
    
         
            +
             
     | 
| 
      
 167 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
      
 168 
     | 
    
         
            +
                    stub_const("#{described_class}::PRERELEASE", prerelease)
         
     | 
| 
      
 169 
     | 
    
         
            +
                  end
         
     | 
| 
      
 170 
     | 
    
         
            +
             
     | 
| 
      
 171 
     | 
    
         
            +
                  it 'is <MAJOR>.<MINOR>.<PATCH>-<PRERELEASE>' do
         
     | 
| 
      
 172 
     | 
    
         
            +
                    expect(full).to eq("#{described_class::MAJOR}.#{described_class::MINOR}.#{described_class::PATCH}-#{prerelease}")
         
     | 
| 
      
 173 
     | 
    
         
            +
                  end
         
     | 
| 
      
 174 
     | 
    
         
            +
                end
         
     | 
| 
      
 175 
     | 
    
         
            +
             
     | 
| 
      
 176 
     | 
    
         
            +
                context 'without PRERELEASE defined' do
         
     | 
| 
      
 177 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
      
 178 
     | 
    
         
            +
                    hide_const("#{described_class}::PRERELEASE")
         
     | 
| 
      
 179 
     | 
    
         
            +
                  end
         
     | 
| 
      
 180 
     | 
    
         
            +
             
     | 
| 
      
 181 
     | 
    
         
            +
                  it 'is <MAJOR>.<MINOR>.<PATCH>' do
         
     | 
| 
      
 182 
     | 
    
         
            +
                    expect(full).to eq("#{described_class::MAJOR}.#{described_class::MINOR}.#{described_class::PATCH}")
         
     | 
| 
      
 183 
     | 
    
         
            +
                  end
         
     | 
| 
      
 184 
     | 
    
         
            +
                end
         
     | 
| 
      
 185 
     | 
    
         
            +
              end
         
     | 
| 
      
 186 
     | 
    
         
            +
             
     | 
| 
      
 187 
     | 
    
         
            +
              context 'gem' do
         
     | 
| 
      
 188 
     | 
    
         
            +
                subject(:gem) {
         
     | 
| 
      
 189 
     | 
    
         
            +
                  described_class.gem
         
     | 
| 
      
 190 
     | 
    
         
            +
                }
         
     | 
| 
      
 191 
     | 
    
         
            +
             
     | 
| 
      
 192 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
      
 193 
     | 
    
         
            +
                  expect(described_class).to receive(:full).and_return('1.2.3-multiword-prerelease')
         
     | 
| 
      
 194 
     | 
    
         
            +
                end
         
     | 
| 
      
 195 
     | 
    
         
            +
             
     | 
| 
      
 196 
     | 
    
         
            +
                it "replaces '-' with '.pre.' to be compatible with rubygems 1.8.6" do
         
     | 
| 
      
 197 
     | 
    
         
            +
                  gem_method = described_class.method(:gem)
         
     | 
| 
      
 198 
     | 
    
         
            +
                  method_arity = gem_method.arity
         
     | 
| 
      
 199 
     | 
    
         
            +
             
     | 
| 
      
 200 
     | 
    
         
            +
                  expect(method_arity).to(
         
     | 
| 
      
 201 
     | 
    
         
            +
                      eq(0),
         
     | 
| 
      
 202 
     | 
    
         
            +
                      # lambda so expensive message calculation only happens on failure
         
     | 
| 
      
 203 
     | 
    
         
            +
                      ->() {
         
     | 
| 
      
 204 
     | 
    
         
            +
                        method_location = gem_method.source_location
         
     | 
| 
      
 205 
     | 
    
         
            +
                        method_file = method_location[0]
         
     | 
| 
      
 206 
     | 
    
         
            +
                        method_line = method_location[1]
         
     | 
| 
      
 207 
     | 
    
         
            +
             
     | 
| 
      
 208 
     | 
    
         
            +
                        "expected #{described_class} to define self.gem(), but method defined by #{gem_method.owner} in " \
         
     | 
| 
      
 209 
     | 
    
         
            +
                        "#{method_file} on line #{method_line} with arity #{method_arity}.\n" \
         
     | 
| 
      
 210 
     | 
    
         
            +
                        "Add the following to #{described_class}:\n" \
         
     | 
| 
      
 211 
     | 
    
         
            +
                        "\n" \
         
     | 
| 
      
 212 
     | 
    
         
            +
                        "   # The full gem version string, including the {MAJOR}, {MINOR}, {PATCH}, and optionally, the {PRERELEASE} in the\n" \
         
     | 
| 
      
 213 
     | 
    
         
            +
                        "   # {http://guides.rubygems.org/specification-reference/#version RubyGems versioning} format.\n" \
         
     | 
| 
      
 214 
     | 
    
         
            +
                        "   #\n" \
         
     | 
| 
      
 215 
     | 
    
         
            +
                        "   # @return [String] '{MAJOR}.{MINOR}.{PATCH}' on master.  '{MAJOR}.{MINOR}.{PATCH}.{PRERELEASE}' on any branch\n" \
         
     | 
| 
      
 216 
     | 
    
         
            +
                        "   #   other than master.\n" \
         
     | 
| 
      
 217 
     | 
    
         
            +
                        "   def self.gem\n" \
         
     | 
| 
      
 218 
     | 
    
         
            +
                        "     full.gsub('-', '.pre.')\n" \
         
     | 
| 
      
 219 
     | 
    
         
            +
                        "   end"
         
     | 
| 
      
 220 
     | 
    
         
            +
                      }
         
     | 
| 
      
 221 
     | 
    
         
            +
                  )
         
     | 
| 
      
 222 
     | 
    
         
            +
             
     | 
| 
      
 223 
     | 
    
         
            +
                  expect(gem).to eq('1.2.3.pre.multiword.pre.prerelease')
         
     | 
| 
      
 224 
     | 
    
         
            +
                end
         
     | 
| 
      
 225 
     | 
    
         
            +
              end
         
     | 
| 
      
 226 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,173 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: metasploit-version
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.2
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: java
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Luke Imhoff
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire:
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2014-09-18 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: bundler
         
     | 
| 
      
 15 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '1.5'
         
     | 
| 
      
 20 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 21 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 22 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 23 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 24 
     | 
    
         
            +
                    version: '1.5'
         
     | 
| 
      
 25 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 26 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: metasploit-yard
         
     | 
| 
      
 29 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 30 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '1.0'
         
     | 
| 
      
 34 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 35 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 36 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 37 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 38 
     | 
    
         
            +
                    version: '1.0'
         
     | 
| 
      
 39 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 40 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 41 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 42 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 43 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 44 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 45 
     | 
    
         
            +
                - - '>='
         
     | 
| 
      
 46 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 47 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 48 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 49 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 50 
     | 
    
         
            +
                - - '>='
         
     | 
| 
      
 51 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 52 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 53 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 54 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 55 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 56 
     | 
    
         
            +
              name: kramdown
         
     | 
| 
      
 57 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 58 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 59 
     | 
    
         
            +
                - - '>='
         
     | 
| 
      
 60 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 62 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 63 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 64 
     | 
    
         
            +
                - - '>='
         
     | 
| 
      
 65 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 66 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 67 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 68 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 69 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 70 
     | 
    
         
            +
              name: rspec
         
     | 
| 
      
 71 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 72 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 73 
     | 
    
         
            +
                - - '>='
         
     | 
| 
      
 74 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 75 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 76 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 77 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 78 
     | 
    
         
            +
                - - '>='
         
     | 
| 
      
 79 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 80 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 81 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 82 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 83 
     | 
    
         
            +
            description: 'Metasploit::Version::Full for deriving String VERSION from constants
         
     | 
| 
      
 84 
     | 
    
         
            +
              in Version module and shared examples: ''Metasploit::Version VERSION constant''
         
     | 
| 
      
 85 
     | 
    
         
            +
              to check VERSION and ''Metasploit::Version Version Module'' to check Version.'
         
     | 
| 
      
 86 
     | 
    
         
            +
            email:
         
     | 
| 
      
 87 
     | 
    
         
            +
            - luke_imhoff@rapid7.com
         
     | 
| 
      
 88 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 89 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 90 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 91 
     | 
    
         
            +
            files:
         
     | 
| 
      
 92 
     | 
    
         
            +
            - .coveralls.yml
         
     | 
| 
      
 93 
     | 
    
         
            +
            - .gitignore
         
     | 
| 
      
 94 
     | 
    
         
            +
            - .simplecov
         
     | 
| 
      
 95 
     | 
    
         
            +
            - .travis.yml
         
     | 
| 
      
 96 
     | 
    
         
            +
            - .yardopts
         
     | 
| 
      
 97 
     | 
    
         
            +
            - CONTRIBUTING.md
         
     | 
| 
      
 98 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 99 
     | 
    
         
            +
            - LICENSE.txt
         
     | 
| 
      
 100 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 101 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 102 
     | 
    
         
            +
            - features/shared/examples/metasploit/version/gem_version_constant.feature
         
     | 
| 
      
 103 
     | 
    
         
            +
            - features/shared/examples/metasploit/version/version_constant.feature
         
     | 
| 
      
 104 
     | 
    
         
            +
            - features/shared/examples/metasploit/version/version_module.feature
         
     | 
| 
      
 105 
     | 
    
         
            +
            - features/shared/examples/metasploit/version/version_module/prerelease/git/branch.feature
         
     | 
| 
      
 106 
     | 
    
         
            +
            - features/shared/examples/metasploit/version/version_module/prerelease/git/detached_head.feature
         
     | 
| 
      
 107 
     | 
    
         
            +
            - features/shared/examples/metasploit/version/version_module/prerelease/git/master.feature
         
     | 
| 
      
 108 
     | 
    
         
            +
            - features/shared/examples/metasploit/version/version_module/prerelease/git/step_definitions/environment_variable_steps.rb
         
     | 
| 
      
 109 
     | 
    
         
            +
            - features/shared/examples/metasploit/version/version_module/prerelease/git/step_definitions/git_steps.rb
         
     | 
| 
      
 110 
     | 
    
         
            +
            - features/shared/examples/metasploit/version/version_module/prerelease/travis_ci/branch.feature
         
     | 
| 
      
 111 
     | 
    
         
            +
            - features/shared/examples/metasploit/version/version_module/prerelease/travis_ci/master.feature
         
     | 
| 
      
 112 
     | 
    
         
            +
            - features/shared/examples/metasploit/version/version_module/prerelease/travis_ci/pull_request.feature
         
     | 
| 
      
 113 
     | 
    
         
            +
            - features/shared/examples/metasploit/version/version_module/prerelease/travis_ci/tag.feature
         
     | 
| 
      
 114 
     | 
    
         
            +
            - features/support/env.rb
         
     | 
| 
      
 115 
     | 
    
         
            +
            - features/support/simplecov_setup.rb
         
     | 
| 
      
 116 
     | 
    
         
            +
            - lib/metasploit/version.rb
         
     | 
| 
      
 117 
     | 
    
         
            +
            - lib/metasploit/version/branch.rb
         
     | 
| 
      
 118 
     | 
    
         
            +
            - lib/metasploit/version/version.rb
         
     | 
| 
      
 119 
     | 
    
         
            +
            - metasploit-version.gemspec
         
     | 
| 
      
 120 
     | 
    
         
            +
            - spec/lib/metasploit/version/branch_spec.rb
         
     | 
| 
      
 121 
     | 
    
         
            +
            - spec/lib/metasploit/version/version_spec.rb
         
     | 
| 
      
 122 
     | 
    
         
            +
            - spec/lib/metasploit/version_spec.rb
         
     | 
| 
      
 123 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     | 
| 
      
 124 
     | 
    
         
            +
            - spec/support/shared/examples/metasploit/version/gem_version_constant.rb
         
     | 
| 
      
 125 
     | 
    
         
            +
            - spec/support/shared/examples/metasploit/version/version_constant.rb
         
     | 
| 
      
 126 
     | 
    
         
            +
            - spec/support/shared/examples/metasploit/version/version_module.rb
         
     | 
| 
      
 127 
     | 
    
         
            +
            homepage: https://github.com/rapid7/metasploit-version
         
     | 
| 
      
 128 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 129 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 130 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 131 
     | 
    
         
            +
            post_install_message:
         
     | 
| 
      
 132 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 133 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 134 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 135 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 136 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 137 
     | 
    
         
            +
              - - '>='
         
     | 
| 
      
 138 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 139 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 140 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 141 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 142 
     | 
    
         
            +
              - - '>='
         
     | 
| 
      
 143 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 144 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 145 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 146 
     | 
    
         
            +
            rubyforge_project:
         
     | 
| 
      
 147 
     | 
    
         
            +
            rubygems_version: 2.1.9
         
     | 
| 
      
 148 
     | 
    
         
            +
            signing_key:
         
     | 
| 
      
 149 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 150 
     | 
    
         
            +
            summary: Semantic versioning helpers and shared examples
         
     | 
| 
      
 151 
     | 
    
         
            +
            test_files:
         
     | 
| 
      
 152 
     | 
    
         
            +
            - features/shared/examples/metasploit/version/gem_version_constant.feature
         
     | 
| 
      
 153 
     | 
    
         
            +
            - features/shared/examples/metasploit/version/version_constant.feature
         
     | 
| 
      
 154 
     | 
    
         
            +
            - features/shared/examples/metasploit/version/version_module.feature
         
     | 
| 
      
 155 
     | 
    
         
            +
            - features/shared/examples/metasploit/version/version_module/prerelease/git/branch.feature
         
     | 
| 
      
 156 
     | 
    
         
            +
            - features/shared/examples/metasploit/version/version_module/prerelease/git/detached_head.feature
         
     | 
| 
      
 157 
     | 
    
         
            +
            - features/shared/examples/metasploit/version/version_module/prerelease/git/master.feature
         
     | 
| 
      
 158 
     | 
    
         
            +
            - features/shared/examples/metasploit/version/version_module/prerelease/git/step_definitions/environment_variable_steps.rb
         
     | 
| 
      
 159 
     | 
    
         
            +
            - features/shared/examples/metasploit/version/version_module/prerelease/git/step_definitions/git_steps.rb
         
     | 
| 
      
 160 
     | 
    
         
            +
            - features/shared/examples/metasploit/version/version_module/prerelease/travis_ci/branch.feature
         
     | 
| 
      
 161 
     | 
    
         
            +
            - features/shared/examples/metasploit/version/version_module/prerelease/travis_ci/master.feature
         
     | 
| 
      
 162 
     | 
    
         
            +
            - features/shared/examples/metasploit/version/version_module/prerelease/travis_ci/pull_request.feature
         
     | 
| 
      
 163 
     | 
    
         
            +
            - features/shared/examples/metasploit/version/version_module/prerelease/travis_ci/tag.feature
         
     | 
| 
      
 164 
     | 
    
         
            +
            - features/support/env.rb
         
     | 
| 
      
 165 
     | 
    
         
            +
            - features/support/simplecov_setup.rb
         
     | 
| 
      
 166 
     | 
    
         
            +
            - spec/lib/metasploit/version/branch_spec.rb
         
     | 
| 
      
 167 
     | 
    
         
            +
            - spec/lib/metasploit/version/version_spec.rb
         
     | 
| 
      
 168 
     | 
    
         
            +
            - spec/lib/metasploit/version_spec.rb
         
     | 
| 
      
 169 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     | 
| 
      
 170 
     | 
    
         
            +
            - spec/support/shared/examples/metasploit/version/gem_version_constant.rb
         
     | 
| 
      
 171 
     | 
    
         
            +
            - spec/support/shared/examples/metasploit/version/version_constant.rb
         
     | 
| 
      
 172 
     | 
    
         
            +
            - spec/support/shared/examples/metasploit/version/version_module.rb
         
     | 
| 
      
 173 
     | 
    
         
            +
            has_rdoc:
         
     |