metasploit-version 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +2 -0
  3. data/.travis.yml +10 -3
  4. data/CHANGELOG.md +6 -0
  5. data/CONTRIBUTING.md +10 -44
  6. data/Gemfile +12 -8
  7. data/RELEASING.md +86 -0
  8. data/Rakefile +5 -4
  9. data/UPGRADING.md +1 -0
  10. data/app/templates/.rspec.tt +2 -0
  11. data/app/templates/CHANGELOG.md.tt +18 -0
  12. data/app/templates/CONTRIBUTING.md.tt +122 -0
  13. data/app/templates/RELEASING.md.tt +99 -0
  14. data/app/templates/Rakefile.tt +7 -0
  15. data/app/templates/UPGRADING.md.tt +1 -0
  16. data/app/templates/lib/versioned/version.rb.tt +64 -0
  17. data/app/templates/spec/lib/versioned/version_spec.rb.tt +3 -0
  18. data/app/templates/spec/lib/versioned_spec.rb.tt +4 -0
  19. data/app/templates/spec/spec_helper.rb.tt +76 -0
  20. data/bin/metasploit-version +12 -0
  21. data/config/cucumber.yml +3 -0
  22. data/features/metasploit-version/install/add_development_dependency.feature +68 -0
  23. data/features/metasploit-version/install/bundle_install.feature +24 -0
  24. data/features/metasploit-version/install/changelog.feature +29 -0
  25. data/features/metasploit-version/install/conflict.feature +45 -0
  26. data/features/metasploit-version/install/contributing.feature +139 -0
  27. data/features/metasploit-version/install/namespace_spec/gem_version_constant.feature +154 -0
  28. data/features/metasploit-version/install/namespace_spec/namespace.feature +33 -0
  29. data/features/metasploit-version/install/namespace_spec/version_constant.feature +179 -0
  30. data/features/metasploit-version/install/rake_spec.feature +27 -0
  31. data/features/metasploit-version/install/releasing/ruby_versions.feature +50 -0
  32. data/features/metasploit-version/install/releasing/versioning.feature +138 -0
  33. data/features/metasploit-version/install/steps/gemspec_steps.rb +19 -0
  34. data/features/metasploit-version/install/upgrading.feature +19 -0
  35. data/features/metasploit-version/install/version.feature +11 -0
  36. data/features/metasploit-version/install/version/namespace.feature +157 -0
  37. data/features/metasploit-version/install/version/prerelease.feature +154 -0
  38. data/features/metasploit-version/install/version_spec/namespace.feature +32 -0
  39. data/features/metasploit-version/install/version_spec/testing/branch_from_master.feature +40 -0
  40. data/features/metasploit-version/install/version_spec/testing/branching_from_branch.feature +161 -0
  41. data/features/metasploit-version/install/version_spec/testing/merge_branch_to_master.feature +97 -0
  42. data/features/{shared/examples/metasploit/version/version_module/prerelease/git/step_definitions → step_definitions}/environment_variable_steps.rb +1 -1
  43. data/features/{shared/examples/metasploit/version/version_module/prerelease/git/step_definitions → step_definitions}/git_steps.rb +11 -3
  44. data/features/support/env.rb +15 -11
  45. data/lib/metasploit/version.rb +1 -0
  46. data/lib/metasploit/version/cli.rb +321 -0
  47. data/lib/metasploit/version/version.rb +2 -2
  48. data/metasploit-version.gemspec +2 -2
  49. data/spec/lib/metasploit/version/branch_spec.rb +1 -3
  50. data/spec/lib/metasploit/version/cli_spec.rb +514 -0
  51. data/spec/lib/metasploit/version/version_spec.rb +2 -4
  52. data/spec/lib/metasploit/version_spec.rb +2 -4
  53. data/spec/spec_helper.rb +63 -1
  54. data/spec/support/shared/examples/metasploit/version/version_module.rb +3 -1
  55. metadata +82 -8
@@ -0,0 +1,154 @@
1
+ Feature: metasploit-version install's <namespace>_spec.rb uses 'Metasploit::Version GEM_VERSION constant' shared example
2
+
3
+ The <namespace>_spec.rb will check that GEM_VERSION is defined correctly using the
4
+ 'Metasploit::Version GEM_VERSION constant' shared example.
5
+
6
+ Background:
7
+ Given I successfully run `bundle gem namespace_spec`
8
+ And I cd to "namespace_spec"
9
+ And my git identity is configured
10
+ And I successfully run `git commit --message "bundle gem namespace_spec"`
11
+ And I unset the environment variable "TRAVIS_BRANCH"
12
+ And I set the environment variables to:
13
+ | variable | value |
14
+ | TRAVIS_PULL_REQUEST | false |
15
+ And I successfully run `metasploit-version install --force --no-bundle-install`
16
+ And I successfully run `git add *`
17
+ And I successfully run `git commit --all --message "metasploit-version install"`
18
+ And I successfully run `git checkout -b feature/MSP-1337/super-cool`
19
+
20
+ Scenario: GEM_VERSION is not defined
21
+ Given I overwrite "lib/namespace_spec/version.rb" with:
22
+ """
23
+ module NamespaceSpec
24
+ module Version
25
+ #
26
+ # CONSTANTS
27
+ #
28
+
29
+ # The major version number.
30
+ MAJOR = 0
31
+ # The minor version number, scoped to the {MAJOR} version number.
32
+ MINOR = 0
33
+ # The patch version number, scoped to the {MAJOR} and {MINOR} version numbers.
34
+ PATCH = 1
35
+ # The prerelease version, scoped to the {MAJOR}, {MINOR}, and {PATCH} version numbers.
36
+ PRERELEASE = 'super-cool'
37
+
38
+ #
39
+ # Module Methods
40
+ #
41
+
42
+ # The full version string, including the {NamespaceSpec::Version::MAJOR},
43
+ # {NamespaceSpec::Version::MINOR}, {NamespaceSpec::Version::PATCH}, and optionally, the
44
+ # `NamespaceSpec::Version::PRERELEASE` in the
45
+ # {http://semver.org/spec/v2.0.0.html semantic versioning v2.0.0} format.
46
+ #
47
+ # @return [String] '{NamespaceSpec::Version::MAJOR}.{NamespaceSpec::Version::MINOR}.{NamespaceSpec::Version::PATCH}' on master.
48
+ # '{NamespaceSpec::Version::MAJOR}.{NamespaceSpec::Version::MINOR}.{NamespaceSpec::Version::PATCH}-PRERELEASE'
49
+ # on any branch other than master.
50
+ def self.full
51
+ version = "#{MAJOR}.#{MINOR}.#{PATCH}"
52
+
53
+ if defined? PRERELEASE
54
+ version = "#{version}-#{PRERELEASE}"
55
+ end
56
+
57
+ version
58
+ end
59
+
60
+ # The full gem version string, including the {NamespaceSpec::Version::MAJOR},
61
+ # {NamespaceSpec::Version::MINOR}, {NamespaceSpec::Version::PATCH}, and optionally, the
62
+ # `NamespaceSpec::Version::PRERELEASE` in the
63
+ # {http://guides.rubygems.org/specification-reference/#version RubyGems versioning} format.
64
+ #
65
+ # @return [String] '{NamespaceSpec::Version::MAJOR}.{NamespaceSpec::Version::MINOR}.{NamespaceSpec::Version::PATCH}'
66
+ # on master. '{NamespaceSpec::Version::MAJOR}.{NamespaceSpec::Version::MINOR}.{NamespaceSpec::Version::PATCH}.PRERELEASE'
67
+ # on any branch other than master.
68
+ def self.gem
69
+ full.gsub('-', '.pre.')
70
+ end
71
+ end
72
+
73
+ # (see Version.full)
74
+ VERSION = Version.full
75
+ end
76
+ """
77
+ When I run `rake spec`
78
+ Then the exit status should not be 0
79
+ And the output should contain:
80
+ """
81
+ expected NamespaceSpec::GEM_VERSION to be defined
82
+ """
83
+ # On MRI and JRuby, the error is "uninitialized constant NamespaceSpace::GEM_VERSION", but on Rubinius the error is
84
+ # "Missing or uninitialized constant: NamespaceSpec::GEM_VERSION", so have to use match
85
+ And the output should match /uninitialized constant.*NamespaceSpec::GEM_VERSION/
86
+ And the output should contain " 2 failures"
87
+
88
+ Scenario: GEM_VERSION is not equal to Version.gem
89
+ Given I overwrite "lib/namespace_spec/version.rb" with:
90
+ """
91
+ module NamespaceSpec
92
+ module Version
93
+ #
94
+ # CONSTANTS
95
+ #
96
+
97
+ # The major version number.
98
+ MAJOR = 0
99
+ # The minor version number, scoped to the {MAJOR} version number.
100
+ MINOR = 0
101
+ # The patch version number, scoped to the {MAJOR} and {MINOR} version numbers.
102
+ PATCH = 1
103
+ # The prerelease version, scoped to the {MAJOR}, {MINOR}, and {PATCH} version numbers.
104
+ PRERELEASE = 'super-cool'
105
+
106
+ #
107
+ # Module Methods
108
+ #
109
+
110
+ # The full version string, including the {NamespaceSpec::Version::MAJOR},
111
+ # {NamespaceSpec::Version::MINOR}, {NamespaceSpec::Version::PATCH}, and optionally, the
112
+ # `NamespaceSpec::Version::PRERELEASE` in the
113
+ # {http://semver.org/spec/v2.0.0.html semantic versioning v2.0.0} format.
114
+ #
115
+ # @return [String] '{NamespaceSpec::Version::MAJOR}.{NamespaceSpec::Version::MINOR}.{NamespaceSpec::Version::PATCH}' on master.
116
+ # '{NamespaceSpec::Version::MAJOR}.{NamespaceSpec::Version::MINOR}.{NamespaceSpec::Version::PATCH}-PRERELEASE'
117
+ # on any branch other than master.
118
+ def self.full
119
+ version = "#{MAJOR}.#{MINOR}.#{PATCH}"
120
+
121
+ if defined? PRERELEASE
122
+ version = "#{version}-#{PRERELEASE}"
123
+ end
124
+
125
+ version
126
+ end
127
+
128
+ # The full gem version string, including the {NamespaceSpec::Version::MAJOR},
129
+ # {NamespaceSpec::Version::MINOR}, {NamespaceSpec::Version::PATCH}, and optionally, the
130
+ # `NamespaceSpec::Version::PRERELEASE` in the
131
+ # {http://guides.rubygems.org/specification-reference/#version RubyGems versioning} format.
132
+ #
133
+ # @return [String] '{NamespaceSpec::Version::MAJOR}.{NamespaceSpec::Version::MINOR}.{NamespaceSpec::Version::PATCH}'
134
+ # on master. '{NamespaceSpec::Version::MAJOR}.{NamespaceSpec::Version::MINOR}.{NamespaceSpec::Version::PATCH}.PRERELEASE'
135
+ # on any branch other than master.
136
+ def self.gem
137
+ full.gsub('-', '.pre.')
138
+ end
139
+ end
140
+
141
+ # (see Version.full)
142
+ GEM_VERSION = Version.full
143
+
144
+ # (see Version.full)
145
+ VERSION = Version.full
146
+ end
147
+ """
148
+ When I run `rake spec`
149
+ Then the exit status should not be 0
150
+ And the output should contain:
151
+ """
152
+ expected NamespaceSpec::GEM_VERSION to equal NamespaceSpec::Version.gem
153
+ """
154
+ And the output should contain " 1 failure"
@@ -0,0 +1,33 @@
1
+ Feature: metasploit-version install's <namespace>_spec.rb generates proper namespace for gem name
2
+
3
+ The <namespace>_spec.rb that checks that GEM_VERSION and VERSION are defined correctly will use the fully-qualified
4
+ name for the gem namespace with proper conversion of underscored and dashes in the gem name to camel case and separate
5
+ modules, respectively.
6
+
7
+ Scenario Outline:
8
+ Given I successfully run `bundle gem <gem_name>`
9
+ And I cd to "<gem_name>"
10
+ And my git identity is configured
11
+ And I successfully run `git commit --message "bundle gem <gem_name>"`
12
+ And I unset the environment variable "TRAVIS_BRANCH"
13
+ And I set the environment variables to:
14
+ | variable | value |
15
+ | TRAVIS_PULL_REQUEST | false |
16
+ When I successfully run `metasploit-version install --force --no-bundle-install`
17
+ Then the file "<namespace_spec_rb_path>" should contain exactly:
18
+ """
19
+ RSpec.describe <gem_namespace_module> do
20
+ it_should_behave_like 'Metasploit::Version GEM_VERSION constant'
21
+ it_should_behave_like 'Metasploit::Version VERSION constant'
22
+ end
23
+
24
+ """
25
+
26
+ Examples:
27
+ | gem_name | namespace_spec_rb_path | gem_namespace_module |
28
+ | single | spec/lib/single_spec.rb | Single |
29
+ | two_words | spec/lib/two_words_spec.rb | TwoWords |
30
+ | parent-child | spec/lib/parent/child_spec.rb | Parent::Child |
31
+ | two_words-child | spec/lib/two_words/child_spec.rb | TwoWords::Child |
32
+ | parent-two_words | spec/lib/parent/two_words_spec.rb | Parent::TwoWords |
33
+ | two_words-more_words | spec/lib/two_words/more_words_spec.rb | TwoWords::MoreWords |
@@ -0,0 +1,179 @@
1
+ Feature: metasploit-version install's <namespace>_spec.rb uses 'Metasploit::Version VERSION constant' shared example
2
+
3
+ The <namespace>_spec.rb will check that VERSION is defined correctly using the 'Metasploit::Version VERSION constant'
4
+ shared example.
5
+
6
+ Background:
7
+ Given I successfully run `bundle gem namespace_spec`
8
+ And I cd to "namespace_spec"
9
+ And my git identity is configured
10
+ And I successfully run `git commit --message "bundle gem namespace_spec"`
11
+ And I unset the environment variable "TRAVIS_BRANCH"
12
+ And I set the environment variables to:
13
+ | variable | value |
14
+ | TRAVIS_PULL_REQUEST | false |
15
+ And I successfully run `metasploit-version install --force --no-bundle-install`
16
+ And I successfully run `git add *`
17
+ And I successfully run `git commit --all --message "metasploit-version install"`
18
+ And I successfully run `git checkout -b feature/MSP-1337/super-cool`
19
+
20
+ Scenario: VERSION is not defined
21
+ # Have to ensure that gemspec doesn't reference the undefined NamespaceSpec::VERSION or rake spec won't even run
22
+ # due to NameError when gemspec is loaded by bundler.
23
+ Given I overwrite "namespace_spec.gemspec" with:
24
+ """
25
+ # coding: utf-8
26
+
27
+ Gem::Specification.new do |spec|
28
+ spec.name = "add_development_dependency"
29
+ spec.version = '0.0.0'
30
+ spec.authors = ["Luke Imhoff"]
31
+ spec.email = ["luke_imhoff@rapid7.com"]
32
+ spec.summary = %q{TODO: Write a short summary. Required.}
33
+ spec.description = %q{TODO: Write a longer description. Optional.}
34
+ spec.homepage = ""
35
+ spec.license = "MIT"
36
+
37
+ spec.files = `git ls-files -z`.split("\x0")
38
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
39
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
40
+ spec.require_paths = ["lib"]
41
+
42
+ spec.add_development_dependency "bundler", "~> 1.6"
43
+ spec.add_development_dependency 'metasploit-version'
44
+ spec.add_development_dependency "rake"
45
+ end
46
+ """
47
+ And I overwrite "lib/namespace_spec/version.rb" with:
48
+ """
49
+ module NamespaceSpec
50
+ module Version
51
+ #
52
+ # CONSTANTS
53
+ #
54
+
55
+ # The major version number.
56
+ MAJOR = 0
57
+ # The minor version number, scoped to the {MAJOR} version number.
58
+ MINOR = 0
59
+ # The patch version number, scoped to the {MAJOR} and {MINOR} version numbers.
60
+ PATCH = 1
61
+ # The prerelease version, scoped to the {MAJOR}, {MINOR}, and {PATCH} version numbers.
62
+ PRERELEASE = 'super-cool'
63
+
64
+ #
65
+ # Module Methods
66
+ #
67
+
68
+ # The full version string, including the {NamespaceSpec::Version::MAJOR},
69
+ # {NamespaceSpec::Version::MINOR}, {NamespaceSpec::Version::PATCH}, and optionally, the
70
+ # `NamespaceSpec::Version::PRERELEASE` in the
71
+ # {http://semver.org/spec/v2.0.0.html semantic versioning v2.0.0} format.
72
+ #
73
+ # @return [String] '{NamespaceSpec::Version::MAJOR}.{NamespaceSpec::Version::MINOR}.{NamespaceSpec::Version::PATCH}' on master.
74
+ # '{NamespaceSpec::Version::MAJOR}.{NamespaceSpec::Version::MINOR}.{NamespaceSpec::Version::PATCH}-PRERELEASE'
75
+ # on any branch other than master.
76
+ def self.full
77
+ version = "#{MAJOR}.#{MINOR}.#{PATCH}"
78
+
79
+ if defined? PRERELEASE
80
+ version = "#{version}-#{PRERELEASE}"
81
+ end
82
+
83
+ version
84
+ end
85
+
86
+ # The full gem version string, including the {NamespaceSpec::Version::MAJOR},
87
+ # {NamespaceSpec::Version::MINOR}, {NamespaceSpec::Version::PATCH}, and optionally, the
88
+ # `NamespaceSpec::Version::PRERELEASE` in the
89
+ # {http://guides.rubygems.org/specification-reference/#version RubyGems versioning} format.
90
+ #
91
+ # @return [String] '{NamespaceSpec::Version::MAJOR}.{NamespaceSpec::Version::MINOR}.{NamespaceSpec::Version::PATCH}'
92
+ # on master. '{NamespaceSpec::Version::MAJOR}.{NamespaceSpec::Version::MINOR}.{NamespaceSpec::Version::PATCH}.PRERELEASE'
93
+ # on any branch other than master.
94
+ def self.gem
95
+ full.gsub('-', '.pre.')
96
+ end
97
+ end
98
+
99
+ # (see Version.gem)
100
+ GEM_VERSION = Version.gem
101
+ end
102
+ """
103
+ When I run `rake spec`
104
+ Then the exit status should not be 0
105
+ And the output should contain:
106
+ """
107
+ expected NamespaceSpec::VERSION to be defined
108
+ """
109
+ # On MRI and JRuby, the error is "uninitialized constant NamespaceSpace::VERSION", but on Rubinius the error is
110
+ # "Missing or uninitialized constant: NamespaceSpec::VERSION", so have to use match
111
+ And the output should match /uninitialized constant.*NamespaceSpec::VERSION/
112
+ And the output should contain " 2 failures"
113
+
114
+ Scenario: VERSION is not equal to Version.full
115
+ Given I overwrite "lib/namespace_spec/version.rb" with:
116
+ """
117
+ module NamespaceSpec
118
+ module Version
119
+ #
120
+ # CONSTANTS
121
+ #
122
+
123
+ # The major version number.
124
+ MAJOR = 0
125
+ # The minor version number, scoped to the {MAJOR} version number.
126
+ MINOR = 0
127
+ # The patch version number, scoped to the {MAJOR} and {MINOR} version numbers.
128
+ PATCH = 1
129
+ # The prerelease version, scoped to the {MAJOR}, {MINOR}, and {PATCH} version numbers.
130
+ PRERELEASE = 'super-cool'
131
+
132
+ #
133
+ # Module Methods
134
+ #
135
+
136
+ # The full version string, including the {NamespaceSpec::Version::MAJOR},
137
+ # {NamespaceSpec::Version::MINOR}, {NamespaceSpec::Version::PATCH}, and optionally, the
138
+ # `NamespaceSpec::Version::PRERELEASE` in the
139
+ # {http://semver.org/spec/v2.0.0.html semantic versioning v2.0.0} format.
140
+ #
141
+ # @return [String] '{NamespaceSpec::Version::MAJOR}.{NamespaceSpec::Version::MINOR}.{NamespaceSpec::Version::PATCH}' on master.
142
+ # '{NamespaceSpec::Version::MAJOR}.{NamespaceSpec::Version::MINOR}.{NamespaceSpec::Version::PATCH}-PRERELEASE'
143
+ # on any branch other than master.
144
+ def self.full
145
+ version = "#{MAJOR}.#{MINOR}.#{PATCH}"
146
+
147
+ if defined? PRERELEASE
148
+ version = "#{version}-#{PRERELEASE}"
149
+ end
150
+
151
+ version
152
+ end
153
+
154
+ # The full gem version string, including the {NamespaceSpec::Version::MAJOR},
155
+ # {NamespaceSpec::Version::MINOR}, {NamespaceSpec::Version::PATCH}, and optionally, the
156
+ # `NamespaceSpec::Version::PRERELEASE` in the
157
+ # {http://guides.rubygems.org/specification-reference/#version RubyGems versioning} format.
158
+ #
159
+ # @return [String] '{NamespaceSpec::Version::MAJOR}.{NamespaceSpec::Version::MINOR}.{NamespaceSpec::Version::PATCH}'
160
+ # on master. '{NamespaceSpec::Version::MAJOR}.{NamespaceSpec::Version::MINOR}.{NamespaceSpec::Version::PATCH}.PRERELEASE'
161
+ # on any branch other than master.
162
+ def self.gem
163
+ full.gsub('-', '.pre.')
164
+ end
165
+ end
166
+
167
+ # (see Version.gem)
168
+ GEM_VERSION = Version.gem
169
+
170
+ VERSION = '1.2.3'
171
+ end
172
+ """
173
+ When I run `rake spec`
174
+ Then the exit status should not be 0
175
+ And the output should contain:
176
+ """
177
+ expected NamespaceSpec::VERSION to equal NamespaceSpec::Version.full
178
+ """
179
+ And the output should contain " 1 failure"
@@ -0,0 +1,27 @@
1
+ Feature: metasploit-version install will setup rspec and rake spec
2
+
3
+ metasploit-version will call setup `spec/spec_helper.rb` and the `Rakefile` so that the user can run `rake spec` after
4
+ `metasploit-version install` completes
5
+
6
+ Background:
7
+ Given I successfully run `bundle gem specced`
8
+ And I cd to "specced"
9
+ And my git identity is configured
10
+ And I successfully run `git commit --message "bundle gem specced"`
11
+ And I unset the environment variable "TRAVIS_BRANCH"
12
+ And I set the environment variables to:
13
+ | variable | value |
14
+ | TRAVIS_PULL_REQUEST | false |
15
+ And I successfully run `metasploit-version install --force --no-bundle-install`
16
+
17
+ Scenario: spec is a listed task
18
+ When I run `rake -T`
19
+ Then the output should contain "rake spec"
20
+
21
+ Scenario: `rake spec` runs without error
22
+ When I successfully run `rake spec`
23
+ Then the output should contain "0 failures"
24
+
25
+ Scenario: `rake` runs `rake spec` by default
26
+ When I successfully run `rake`
27
+ Then the output should contain "0 failures"
@@ -0,0 +1,50 @@
1
+ Feature: metasplopit install should add RELEASING.md that handles multiple ruby versions
2
+
3
+ `metasploit-version` install should default to release instructions for MRI `ruby` and `jruby` with the ability to
4
+ override this default.
5
+
6
+ Background:
7
+ Given I successfully run `bundle gem released`
8
+ And I cd to "released"
9
+ And my git identity is configured
10
+ And I successfully run `git commit --message "bundle gem released"`
11
+ And I unset the environment variable "TRAVIS_BRANCH"
12
+ And I set the environment variables to:
13
+ | variable | value |
14
+ | TRAVIS_PULL_REQUEST | false |
15
+
16
+ Scenario: Default ruby versions
17
+ When I successfully run `metasploit-version install --force --no-bundle-install`
18
+ Then the file "RELEASING.md" should contain:
19
+ """
20
+
21
+ ## jruby
22
+ - [ ] `rvm use jruby@released`
23
+ - [ ] `rm Gemfile.lock`
24
+ - [ ] `bundle install`
25
+ - [ ] `rake release`
26
+
27
+ ## ruby-2.1
28
+ - [ ] `rvm use ruby-2.1@released`
29
+ - [ ] `rm Gemfile.lock`
30
+ - [ ] `bundle install`
31
+ - [ ] `rake release`
32
+ ```
33
+
34
+ ### Downstream dependencies
35
+ """
36
+
37
+ Scenario: Overridden ruby versions
38
+ When I successfully run `metasploit-version install --force --no-bundle-install --ruby-versions maglev`
39
+ Then the file "RELEASING.md" should contain:
40
+ """
41
+
42
+ ## maglev
43
+ - [ ] `rvm use maglev@released`
44
+ - [ ] `rm Gemfile.lock`
45
+ - [ ] `bundle install`
46
+ - [ ] `rake release`
47
+ ```
48
+
49
+ ### Downstream dependencies
50
+ """
@@ -0,0 +1,138 @@
1
+ Feature: metasploit-version install should add RELEASING.md that handles pre-1.0.0 and post-1.0.0 versioning
2
+
3
+ `metasploit-version install` should have different directions for update the semantic version when it is < 1.0.0 and
4
+ >= 1.0.0. These instructions should be based on the contents of CHANGELOG.md.
5
+
6
+ Background:
7
+ Given I successfully run `bundle gem released`
8
+ And I cd to "released"
9
+ And my git identity is configured
10
+ And I successfully run `git commit --message "bundle gem released"`
11
+ And I unset the environment variable "TRAVIS_BRANCH"
12
+ And I set the environment variables to:
13
+ | variable | value |
14
+ | TRAVIS_PULL_REQUEST | false |
15
+
16
+ Scenario: < 1.0.0
17
+ When I successfully run `metasploit-version install --force --major 0 --minor 1 --patch 2 --no-bundle-install`
18
+ Then the file "RELEASING.md" should contain:
19
+ """
20
+ ### Compatible changes
21
+
22
+ If the [CHANGELOG.md](CHANGELOG.md) contains only Enhancements, Bug Fixes, and/or Deprecations for the Next Release then
23
+ increment [`PATCH`](lib/released/version.rb).
24
+
25
+ ### Incompatible changes
26
+
27
+ If the [CHANGELOG.md](CHANGELOG.md) contains any Incompatible Changes for the Next Release, then you can either (1)
28
+ decide to remain pre-1.0.0 or (2) advance to 1.0.0.
29
+
30
+ 1. To remain pre-1..0.0, then increment [`MINOR`](lib/released/version.rb) and reset [`PATCH`](lib/released/version.rb) to `0`.
31
+ 2. To advance to 1.0.0, increment [`MAJOR`](lib/released/version.rb) and reset [`MINOR`](lib/released/version.rb and [`PATCH`](lib/released/version.rb) to `0`.
32
+
33
+ """
34
+
35
+ Scenario: 1.0.0
36
+ When I successfully run `metasploit-version install --force --major 1 --minor 0 --patch 0 --no-bundle-install`
37
+ Then the file "RELEASING.md" should contain:
38
+ """
39
+ ### Bug fixes
40
+
41
+ If the [CHANGELOG.md](CHANGELOG.md) contains only Bug Fixes for the Next Release, then increment
42
+ [`PATCH`](lib/released/version.rb).
43
+
44
+ ### Compatible API changes
45
+
46
+ If the [CHANGELOG.md](CHANGELOG.md) contains any Enhancements or Deprecations, then increment
47
+ [`MINOR`](lib/released/version.rb) and reset [`PATCH`](lib/released/version.rb) to `0`.
48
+
49
+ ### Incompatible API changes
50
+
51
+ If the [CHANGELOG.md](CHANGELOG.md) contains any Incompatible Change, then increment [`MAJOR`](lib/released/version.rb) and
52
+ reset [`MINOR`](lib/released/version.rb and [`PATCH`](lib/released/version.rb) to `0`.
53
+
54
+ """
55
+
56
+ Scenario: Version indepedent
57
+ When I successfully run `metasploit-version install --force --major 0 --minor 1 --patch 2 --no-bundle-install`
58
+ Then the file "RELEASING.md" should contain:
59
+ """
60
+ # Releasing
61
+
62
+ These steps can be added to the Pull Request description's task list to remind the reviewer of how to release the
63
+ gem.
64
+
65
+ ```
66
+ # Release
67
+
68
+ Complete these steps on DESTINATION
69
+
70
+ ## [CHANGELOG.md](CHANGELOG.md)
71
+
72
+ ### Terminology
73
+
74
+ * "Enhancements" are widdening the API, such as by adding new classes or methods.
75
+ * "Bug Fixes" are fixes to the implementation that do not affect the public API. If the public API is affected then
76
+ the change should be listed as both a "Bug Fix" and either an "Enhancement" or "Incompatible Change" depending on how
77
+ the bug was fixed.
78
+ * "Deprecations" are changes to the implementation that cause deprecation warnings to be issued for APIs which will be
79
+ removed in a future major release. "Deprecations" are usually accompanied by an Enhancement that creates a new API
80
+ that is meant to be used in favor of the deprecated API.
81
+ * "Incompatbile Changes" are the removal of classes or methods or new required arguments or setup that shrink the API.
82
+ It is best practice to make a "Deprecation" for the API prior to its removal.
83
+
84
+ ### Task List
85
+
86
+ - [ ] Generate the list of changes since the last release: `git log v<LAST_MAJOR>.<LAST_MINOR>.<LAST_PATCH>..HEAD`
87
+ - [ ] For each commit in the release, find the corresponding PR by search for the commit on Github.
88
+ - [ ] For each PR, determine whether it is an Enhancement, Bug Fix, Deprecation, and/or Incompatible Change. A PR can
89
+ be in more than one category, in which case it should be listed in each category it belongs, but with a category
90
+ specific description of the change.
91
+ - [ ] Add an item to each category's list in the following format: `[#<PR>](https://github.com/rapid7/released/pull/<PR>) <consumer summary> - [@<github_user>](https://github.com/<github_user>)`
92
+ `consumer_summary` should be a summary of the Enhancement, Bug Fix, Deprecation, or Incompatible Change from a
93
+ downstream consumer's of the library's perspective. `github_user` should be Github handle of the author of the
94
+ PR.
95
+ - [ ] If you added any Deprecations or Incompatible Changes, then adding upgrading information to
96
+ [UPGRADING.md](UPGRADING.md)
97
+
98
+ ## `VERSION`
99
+
100
+ The entries in the [CHANGELOG.md](CHANGELOG.md) can be used to help determine how the `VERSION` should be bumped.
101
+
102
+ """
103
+ And the file "RELEASING.md" should contain:
104
+ """
105
+
106
+ ## Setup [CHANGELOG.md](CHANGELOG.md) for next release
107
+
108
+ - [ ] Change `Next Release` section name at the top of [CHANGELOG.md](CHANGELOG.md) to match the current `VERSION`.
109
+ - [ ] Add a new `Next Release` section above the `VERSION`'s section you just renamed:
110
+ <pre>
111
+ # Next Release
112
+
113
+ * Enhancements
114
+ * Bug Fixes
115
+ * Deprecations
116
+ * Incompatible Changes
117
+ </pre>
118
+
119
+ ## Release to rubygems.org
120
+
121
+ ## jruby
122
+ - [ ] `rvm use jruby@released`
123
+ - [ ] `rm Gemfile.lock`
124
+ - [ ] `bundle install`
125
+ - [ ] `rake release`
126
+
127
+ ## ruby-2.1
128
+ - [ ] `rvm use ruby-2.1@released`
129
+ - [ ] `rm Gemfile.lock`
130
+ - [ ] `bundle install`
131
+ - [ ] `rake release`
132
+ ```
133
+
134
+ ### Downstream dependencies
135
+
136
+ There are currently no known downstream dependenci
137
+ """
138
+