metasploit-yard 1.0.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 +24 -0
- data/.rspec +2 -0
- data/.simplecov +42 -0
- data/.travis.yml +21 -0
- data/.yardopts +7 -0
- data/CONTRIBUTING.md +178 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +29 -0
- data/README.md +114 -0
- data/Rakefile +19 -0
- data/config/cucumber.yml +6 -0
- data/features/rake_task.feature +90 -0
- data/features/step_definitions/project.rb +25 -0
- data/features/step_definitions/rvm.rb +46 -0
- data/features/support/env.rb +8 -0
- data/lib/metasploit/yard.rb +20 -0
- data/lib/metasploit/yard/aruba.rb +12 -0
- data/lib/metasploit/yard/aruba/rvm_env.rb +105 -0
- data/lib/metasploit/yard/aruba/rvm_env/export.rb +75 -0
- data/lib/metasploit/yard/aruba/rvm_env/prepend.rb +35 -0
- data/lib/metasploit/yard/aruba/rvm_env/unset.rb +44 -0
- data/lib/metasploit/yard/aruba/rvm_env/variable.rb +32 -0
- data/lib/metasploit/yard/railtie.rb +10 -0
- data/lib/metasploit/yard/version.rb +43 -0
- data/lib/tasks/yard.rake +58 -0
- data/metasploit-yard.gemspec +50 -0
- data/spec/metasploit/yard/aruba/rvm_env/export_spec.rb +95 -0
- data/spec/metasploit/yard/aruba/rvm_env/prepend_spec.rb +95 -0
- data/spec/metasploit/yard/version_spec.rb +143 -0
- data/spec/metasploit/yard_spec.rb +15 -0
- data/spec/spec_helper.rb +77 -0
- metadata +240 -0
@@ -0,0 +1,44 @@
|
|
1
|
+
# Recognizes `unset`s of environment variables.
|
2
|
+
class Metasploit::Yard::Aruba::RvmEnv::Unset < Metasploit::Yard::Aruba::RvmEnv::Variable
|
3
|
+
#
|
4
|
+
# CONSTANTS
|
5
|
+
#
|
6
|
+
|
7
|
+
# Matches line with format `unset <name>`
|
8
|
+
REGEXP = /\Aunset (?<name>.*?)\Z/
|
9
|
+
|
10
|
+
#
|
11
|
+
# Class Methods
|
12
|
+
#
|
13
|
+
|
14
|
+
# Parses lines of `rvm env` output into a {Prepend} if it matches {REGEXP}
|
15
|
+
#
|
16
|
+
# @param line [String] a line of `rvm env` output.
|
17
|
+
# @return [Unset] if line contains `unset`.
|
18
|
+
# @return [nil] otherwise
|
19
|
+
def self.parse(line)
|
20
|
+
match = REGEXP.match(line)
|
21
|
+
|
22
|
+
if match
|
23
|
+
new(
|
24
|
+
name: match[:name]
|
25
|
+
)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
#
|
30
|
+
# Instance Methods
|
31
|
+
#
|
32
|
+
|
33
|
+
# Unsets {Metasploit::Yard::Aruba::RvmEnv::Variable#name}.
|
34
|
+
#
|
35
|
+
# @param options [Hash{Symbol => Object}]
|
36
|
+
# @option options [Metasploit::Yard::Aruba::RvmEnv::Unset] :from the old state of this variable
|
37
|
+
# @option options [Object] :world the cucumber world instance for the current scenario
|
38
|
+
def change(options={})
|
39
|
+
options.assert_valid_keys(:from , :world)
|
40
|
+
|
41
|
+
world = options.fetch(:world)
|
42
|
+
world.unset_env(name)
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# An environment variable in `rvm env`.
|
2
|
+
class Metasploit::Yard::Aruba::RvmEnv::Variable
|
3
|
+
#
|
4
|
+
# Attributes
|
5
|
+
#
|
6
|
+
|
7
|
+
# @!attribute name
|
8
|
+
# The name of variable being manipulated in `rvm env`
|
9
|
+
#
|
10
|
+
# @return [String]
|
11
|
+
attr_accessor :name
|
12
|
+
|
13
|
+
#
|
14
|
+
# Instance Methods
|
15
|
+
#
|
16
|
+
|
17
|
+
# @param attributes [Hash{Symbol=>String}]
|
18
|
+
# @option attributes [String] :name (see #name)
|
19
|
+
def initialize(attributes={})
|
20
|
+
attributes.assert_valid_keys(:name)
|
21
|
+
|
22
|
+
@name = attributes[:name]
|
23
|
+
end
|
24
|
+
|
25
|
+
# This variable is the same class and has the same {#name} as `other`.
|
26
|
+
#
|
27
|
+
# @return [true] if `other.class` is `Metasploit::Yard::Aruba::RvmEnv::Variable` and `other.name` is {#name}.
|
28
|
+
# @return [false] otherwise
|
29
|
+
def ==(other)
|
30
|
+
other.class == self.class && other.name == self.name
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Metasploit
|
2
|
+
module Yard
|
3
|
+
# Holds components of {VERSION} as defined by {http://semver.org/spec/v2.0.0.html semantic versioning v2.0.0}.
|
4
|
+
module Version
|
5
|
+
# The major version number.
|
6
|
+
MAJOR = 1
|
7
|
+
# The minor version number, scoped to the {MAJOR} version number.
|
8
|
+
MINOR = 0
|
9
|
+
# The patch number, scoped to the {MINOR} version number.
|
10
|
+
PATCH = 2
|
11
|
+
|
12
|
+
# The full version string, including the {MAJOR}, {MINOR}, {PATCH}, and optionally, the PRERELEASE in the
|
13
|
+
# {http://semver.org/spec/v2.0.0.html semantic versioning v2.0.0} format.
|
14
|
+
#
|
15
|
+
# @return [String] '{MAJOR}.{MINOR}.{PATCH}' on master. '{MAJOR}.{MINOR}.{PATCH}-PRERELEASE' on any branch
|
16
|
+
# other than master.
|
17
|
+
def self.full
|
18
|
+
version = "#{MAJOR}.#{MINOR}.#{PATCH}"
|
19
|
+
|
20
|
+
if defined? PRERELEASE
|
21
|
+
version = "#{version}-#{PRERELEASE}"
|
22
|
+
end
|
23
|
+
|
24
|
+
version
|
25
|
+
end
|
26
|
+
|
27
|
+
# The full gem version string, including the {MAJOR}, {MINOR}, {PATCH}, and optionally, the PRERELEASE in the
|
28
|
+
# {http://guides.rubygems.org/specification-reference/#version RubyGems versioning} format.
|
29
|
+
#
|
30
|
+
# @return [String] '{MAJOR}.{MINOR}.{PATCH}' on master. '{MAJOR}.{MINOR}.{PATCH}.PRERELEASE' on any branch
|
31
|
+
# other than master.
|
32
|
+
def self.gem
|
33
|
+
full.gsub('-', '.pre.')
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# @see Version.gem
|
38
|
+
GEM_VERSION = Version.gem
|
39
|
+
|
40
|
+
# @see Version.full
|
41
|
+
VERSION = Version.full
|
42
|
+
end
|
43
|
+
end
|
data/lib/tasks/yard.rake
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# @note All options not specific to any given rake task should go in the .yardopts file so they are available to both
|
2
|
+
# the below rake tasks and when invoking `yard` from the command line
|
3
|
+
|
4
|
+
#
|
5
|
+
# Gems
|
6
|
+
#
|
7
|
+
# gems must load explicitly any gem declared in gemspec
|
8
|
+
# @see https://github.com/bundler/bundler/issues/2018#issuecomment-6819359
|
9
|
+
#
|
10
|
+
#
|
11
|
+
|
12
|
+
require 'yard'
|
13
|
+
|
14
|
+
namespace :yard do
|
15
|
+
YARD::Rake::YardocTask.new(:doc) do |t|
|
16
|
+
# --no-stats here as 'stats' task called after will print fuller stats
|
17
|
+
t.options = ['--no-stats']
|
18
|
+
|
19
|
+
t.after = Proc.new {
|
20
|
+
Rake::Task['yard:stats'].execute
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
desc "Shows stats for YARD Documentation including listing undocumented modules, classes, constants, and methods"
|
25
|
+
task :stats => :environment do
|
26
|
+
stats = YARD::CLI::Stats.new
|
27
|
+
stats.run('--compact', '--list-undoc')
|
28
|
+
|
29
|
+
threshold = 100.0
|
30
|
+
threshold_path = 'config/yard-stats-threshold'
|
31
|
+
|
32
|
+
if File.exist?(threshold_path)
|
33
|
+
threshold = File.read(threshold_path).to_f
|
34
|
+
end
|
35
|
+
|
36
|
+
# duplicates end of YARD::CLI::Stats#print_statistics
|
37
|
+
# @see https://github.com/lsegal/yard/blob/76c7525f46df38f7b24d4b3cb9daeef512fe58e8/lib/yard/cli/stats.rb#L63-L69
|
38
|
+
total = stats.instance_eval {
|
39
|
+
if @undocumented == 0
|
40
|
+
100
|
41
|
+
elsif @total == 0
|
42
|
+
0
|
43
|
+
else
|
44
|
+
(@total - @undocumented).to_f / @total.to_f * 100
|
45
|
+
end
|
46
|
+
}
|
47
|
+
|
48
|
+
if total < threshold
|
49
|
+
$stderr.puts "Documentation percentage (%<total>.2f%%) below threshold (%<threshold>.2f%%)" % { total: total, threshold: threshold}
|
50
|
+
exit 1
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# @todo Figure out how to just clone description from yard:doc
|
56
|
+
desc "Generate YARD documentation"
|
57
|
+
# allow calling namespace to as a task that goes to default task for namespace
|
58
|
+
task :yard => ['yard:doc']
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'metasploit/yard/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "metasploit-yard"
|
8
|
+
spec.version = Metasploit::Yard::VERSION
|
9
|
+
spec.authors = ["Luke Imhoff"]
|
10
|
+
spec.email = ["luke_imhoff@rapid7.com"]
|
11
|
+
spec.summary = "yard rake tasks"
|
12
|
+
spec.description = "YARD rake tasks used through the metasploit-* gem namespace"
|
13
|
+
spec.homepage = "https://github.com/rapid7/"
|
14
|
+
spec.license = "BSD-3-Clause"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# assert_valid_keys
|
22
|
+
spec.add_development_dependency 'activesupport'
|
23
|
+
spec.add_development_dependency 'aruba'
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.5'
|
25
|
+
spec.add_development_dependency 'codeclimate-test-reporter'
|
26
|
+
spec.add_development_dependency 'coveralls'
|
27
|
+
spec.add_development_dependency 'cucumber'
|
28
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
29
|
+
spec.add_development_dependency 'simplecov'
|
30
|
+
|
31
|
+
spec.add_runtime_dependency 'rake'
|
32
|
+
|
33
|
+
if RUBY_PLATFORM =~ /java/
|
34
|
+
# markdown library for YARD to enable proper parsing of README.md and CONTRIBUTING.md
|
35
|
+
spec.add_runtime_dependency 'kramdown'
|
36
|
+
|
37
|
+
# Cannot use Gem::Platform::JAVA as it is only defined by bundler, so `gem build *.gemspec` wouldn't work.
|
38
|
+
spec.platform = Gem::Platform.new('java')
|
39
|
+
else
|
40
|
+
# markdown library for YARD to enable proper parsing of README.md and CONTRIBUTING.md
|
41
|
+
spec.add_runtime_dependency 'redcarpet'
|
42
|
+
|
43
|
+
spec.platform = Gem::Platform::RUBY
|
44
|
+
end
|
45
|
+
|
46
|
+
spec.add_runtime_dependency 'yard'
|
47
|
+
|
48
|
+
# Ruby 1.9 JSON Hash syntax is used
|
49
|
+
spec.required_ruby_version = '>= 1.9'
|
50
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Metasploit::Yard::Aruba::RvmEnv::Export do
|
4
|
+
context 'CONSTANTS' do
|
5
|
+
context 'REGEXP' do
|
6
|
+
subject(:regexp) {
|
7
|
+
described_class::REGEXP
|
8
|
+
}
|
9
|
+
|
10
|
+
let(:name) {
|
11
|
+
'rvm_env_string'
|
12
|
+
}
|
13
|
+
|
14
|
+
let(:set) {
|
15
|
+
%Q{#{name}=#{quote}#{value}#{quote}}
|
16
|
+
}
|
17
|
+
|
18
|
+
let(:value) {
|
19
|
+
'ruby-1.9.3-p547@pro'
|
20
|
+
}
|
21
|
+
|
22
|
+
context 'with combined export and set' do
|
23
|
+
let(:line) {
|
24
|
+
%Q{export #{set}}
|
25
|
+
}
|
26
|
+
|
27
|
+
context 'with "' do
|
28
|
+
let(:quote) {
|
29
|
+
'"'
|
30
|
+
}
|
31
|
+
|
32
|
+
it 'matches groups correctly' do
|
33
|
+
expect(regexp).to match(line)
|
34
|
+
|
35
|
+
match = regexp.match(line)
|
36
|
+
|
37
|
+
expect(match[:name]).to eq(name)
|
38
|
+
expect(match[:value]).to eq(value)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context "with '" do
|
43
|
+
let(:quote) {
|
44
|
+
"'"
|
45
|
+
}
|
46
|
+
|
47
|
+
it 'matches groups correctly' do
|
48
|
+
expect(regexp).to match(line)
|
49
|
+
|
50
|
+
match = regexp.match(line)
|
51
|
+
|
52
|
+
expect(match[:name]).to eq(name)
|
53
|
+
expect(match[:value]).to eq(value)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'with separate export and set' do
|
59
|
+
let(:line) {
|
60
|
+
%Q{export #{name} ; #{set}}
|
61
|
+
}
|
62
|
+
|
63
|
+
context 'with "' do
|
64
|
+
let(:quote) {
|
65
|
+
'"'
|
66
|
+
}
|
67
|
+
|
68
|
+
it 'matches groups correctly' do
|
69
|
+
expect(regexp).to match(line)
|
70
|
+
|
71
|
+
match = regexp.match(line)
|
72
|
+
|
73
|
+
expect(match[:name]).to eq(name)
|
74
|
+
expect(match[:value]).to eq(value)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
context "with '" do
|
79
|
+
let(:quote) {
|
80
|
+
"'"
|
81
|
+
}
|
82
|
+
|
83
|
+
it 'matches groups correctly' do
|
84
|
+
expect(regexp).to match(line)
|
85
|
+
|
86
|
+
match = regexp.match(line)
|
87
|
+
|
88
|
+
expect(match[:name]).to eq(name)
|
89
|
+
expect(match[:value]).to eq(value)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Metasploit::Yard::Aruba::RvmEnv::Prepend do
|
4
|
+
context 'CONSTANTS' do
|
5
|
+
context 'REGEXP' do
|
6
|
+
subject(:regexp) {
|
7
|
+
described_class::REGEXP
|
8
|
+
}
|
9
|
+
|
10
|
+
let(:name) {
|
11
|
+
'PATH'
|
12
|
+
}
|
13
|
+
|
14
|
+
let(:prepend) {
|
15
|
+
%Q{#{name}=#{quote}#{value}$#{name}#{quote}}
|
16
|
+
}
|
17
|
+
|
18
|
+
let(:value) {
|
19
|
+
'/Users/bob/.rvm/gems/ruby-1.9.3-p547@pro/bin:/Users/bob/.rvm/gems/ruby-1.9.3-p547@global/bin:/Users/bob/.rvm/rubies/ruby-1.9.3-p547/bin:/Users/bob/.rvm/bin:'
|
20
|
+
}
|
21
|
+
|
22
|
+
context 'with combined export and prepend' do
|
23
|
+
let(:line) {
|
24
|
+
%Q{export #{prepend}}
|
25
|
+
}
|
26
|
+
|
27
|
+
context 'with "' do
|
28
|
+
let(:quote) {
|
29
|
+
'"'
|
30
|
+
}
|
31
|
+
|
32
|
+
it 'matches groups correctly' do
|
33
|
+
expect(regexp).to match(line)
|
34
|
+
|
35
|
+
match = regexp.match(line)
|
36
|
+
|
37
|
+
expect(match[:name]).to eq(name)
|
38
|
+
expect(match[:value]).to eq(value)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context "with '" do
|
43
|
+
let(:quote) {
|
44
|
+
"'"
|
45
|
+
}
|
46
|
+
|
47
|
+
it 'matches groups correctly' do
|
48
|
+
expect(regexp).to match(line)
|
49
|
+
|
50
|
+
match = regexp.match(line)
|
51
|
+
|
52
|
+
expect(match[:name]).to eq(name)
|
53
|
+
expect(match[:value]).to eq(value)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'with separate export and prepend' do
|
59
|
+
let(:line) {
|
60
|
+
%Q{export #{name} ; #{prepend}}
|
61
|
+
}
|
62
|
+
|
63
|
+
context 'with "' do
|
64
|
+
let(:quote) {
|
65
|
+
'"'
|
66
|
+
}
|
67
|
+
|
68
|
+
it 'matches groups correctly' do
|
69
|
+
expect(regexp).to match(line)
|
70
|
+
|
71
|
+
match = regexp.match(line)
|
72
|
+
|
73
|
+
expect(match[:name]).to eq(name)
|
74
|
+
expect(match[:value]).to eq(value)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
context "with '" do
|
79
|
+
let(:quote) {
|
80
|
+
"'"
|
81
|
+
}
|
82
|
+
|
83
|
+
it 'matches groups correctly' do
|
84
|
+
expect(regexp).to match(line)
|
85
|
+
|
86
|
+
match = regexp.match(line)
|
87
|
+
|
88
|
+
expect(match[:name]).to eq(name)
|
89
|
+
expect(match[:value]).to eq(value)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,143 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Metasploit::Yard::Version do
|
4
|
+
context 'CONSTANTS' do
|
5
|
+
context 'MAJOR' do
|
6
|
+
subject(:major) do
|
7
|
+
described_class::MAJOR
|
8
|
+
end
|
9
|
+
|
10
|
+
it { is_expected.to be_a Integer }
|
11
|
+
end
|
12
|
+
|
13
|
+
context 'MINOR' do
|
14
|
+
subject(:minor) do
|
15
|
+
described_class::MINOR
|
16
|
+
end
|
17
|
+
|
18
|
+
it { is_expected.to be_a Integer }
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'PATCH' do
|
22
|
+
subject(:patch) do
|
23
|
+
described_class::PATCH
|
24
|
+
end
|
25
|
+
|
26
|
+
it { is_expected.to be_a Integer }
|
27
|
+
end
|
28
|
+
|
29
|
+
pull_request = ENV['TRAVIS_PULL_REQUEST']
|
30
|
+
|
31
|
+
# a pull request cannot check PRERELEASE because it will be tested in the target branch, but the source itself
|
32
|
+
# is from the source branch and so has the source branch PRERELEASE.
|
33
|
+
#
|
34
|
+
# PRERELEASE can only be set appropriately for a merge by merging to the target branch and then updating PRERELEASE
|
35
|
+
# on the target branch before committing and/or pushing to github and travis-ci.
|
36
|
+
if pull_request.nil? || pull_request == 'false'
|
37
|
+
context 'PREPRELEASE' do
|
38
|
+
subject(:prerelease) do
|
39
|
+
described_class::PRERELEASE
|
40
|
+
end
|
41
|
+
|
42
|
+
branch = ENV['TRAVIS_BRANCH']
|
43
|
+
|
44
|
+
if branch.nil? || branch.empty?
|
45
|
+
branch = `git rev-parse --abbrev-ref HEAD`.strip
|
46
|
+
end
|
47
|
+
|
48
|
+
if branch == 'master'
|
49
|
+
it 'does not have a PRERELEASE' do
|
50
|
+
expect(defined? described_class::PRERELEASE).to be_nil
|
51
|
+
end
|
52
|
+
else
|
53
|
+
branch_regex = %r{\A(?:refs/remotes/)?(?<type>bug|chore|feature|staging)(/(?<story>[^/]+))?/(?<prerelease>[^\/]+)\z}
|
54
|
+
match = branch.match(branch_regex)
|
55
|
+
|
56
|
+
if match
|
57
|
+
it 'matches the branch relative name' do
|
58
|
+
expected_prerelease = match[:prerelease]
|
59
|
+
|
60
|
+
expect(defined? described_class::PRERELEASE).not_to be_nil,
|
61
|
+
"PRERELEASE should be defined as #{expected_prerelease.inspect}"
|
62
|
+
expect(prerelease).to eq(expected_prerelease)
|
63
|
+
end
|
64
|
+
else
|
65
|
+
tag_regex = /\Av(?<major>\d+).(?<minor>\d+).(?<patch>\d+)(\.pre\.(?<prerelease>.*))?\z/
|
66
|
+
# travis-ci sets TRAVIS_BRANCH to the tag name for tag builds
|
67
|
+
match = branch.match(tag_regex)
|
68
|
+
|
69
|
+
if match
|
70
|
+
tag_prerelease = match[:prerelease]
|
71
|
+
|
72
|
+
if tag_prerelease
|
73
|
+
it 'matches the tag prerelease converted from a gem version to a VERSION' do
|
74
|
+
expect(prerelease).to eq(tag_prerelease.gsub('.pre.', '-'))
|
75
|
+
end
|
76
|
+
else
|
77
|
+
it 'does not have a PRERELEASE' do
|
78
|
+
expect(defined? described_class::PRERELEASE).to be_nil
|
79
|
+
end
|
80
|
+
end
|
81
|
+
else
|
82
|
+
it 'has a abbreviated reference that can be parsed for prerelease' do
|
83
|
+
fail "Do not know how to parse #{branch.inspect} for PRERELEASE"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
context 'full' do
|
93
|
+
subject(:full) do
|
94
|
+
described_class.full
|
95
|
+
end
|
96
|
+
|
97
|
+
#
|
98
|
+
# lets
|
99
|
+
#
|
100
|
+
|
101
|
+
let(:major) do
|
102
|
+
1
|
103
|
+
end
|
104
|
+
|
105
|
+
let(:minor) do
|
106
|
+
2
|
107
|
+
end
|
108
|
+
|
109
|
+
let(:patch) do
|
110
|
+
3
|
111
|
+
end
|
112
|
+
|
113
|
+
before(:each) do
|
114
|
+
stub_const("#{described_class}::MAJOR", major)
|
115
|
+
stub_const("#{described_class}::MINOR", minor)
|
116
|
+
stub_const("#{described_class}::PATCH", patch)
|
117
|
+
end
|
118
|
+
|
119
|
+
context 'with PRERELEASE' do
|
120
|
+
let(:prerelease) do
|
121
|
+
'prerelease'
|
122
|
+
end
|
123
|
+
|
124
|
+
before(:each) do
|
125
|
+
stub_const("#{described_class}::PRERELEASE", prerelease)
|
126
|
+
end
|
127
|
+
|
128
|
+
it 'is <major>.<minor>.<patch>-<prerelease>' do
|
129
|
+
expect(full).to eq("#{major}.#{minor}.#{patch}-#{prerelease}")
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
context 'without PRERELEASE' do
|
134
|
+
before(:each) do
|
135
|
+
hide_const("#{described_class}::PRERELEASE")
|
136
|
+
end
|
137
|
+
|
138
|
+
it 'is <major>.<minor>.<patch>' do
|
139
|
+
expect(full).to eq("#{major}.#{minor}.#{patch}")
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|