Skip to content

Commit

Permalink
Merge b87e131 into 62f4273
Browse files Browse the repository at this point in the history
  • Loading branch information
limhoff-r7 committed Apr 16, 2015
2 parents 62f4273 + b87e131 commit 924847a
Show file tree
Hide file tree
Showing 23 changed files with 376 additions and 214 deletions.
3 changes: 1 addition & 2 deletions .rspec
@@ -1,3 +1,2 @@
--format documentation
--color
--backtrace
--require spec_helper
6 changes: 6 additions & 0 deletions CHANGELOG.md
@@ -0,0 +1,6 @@
# Next Release

* Enhancements
* Bug Fixes
* Deprecations
* Incompatible Changes
122 changes: 122 additions & 0 deletions CONTRIBUTING.md
@@ -0,0 +1,122 @@
# Contributing

## Forking

[Fork this repository](https://github.com/rapid7/metasploit-erd/fork)

## Branching

Branch names follow the format `TYPE/ISSUE/SUMMARY`. You can create it with `git checkout -b TYPE/ISSUE/SUMMARY`.

### `TYPE`

`TYPE` can be `bug`, `chore`, or `feature`.

### `ISSUE`

`ISSUE` is either a [Github issue](https://github.com/rapid7/metasploit-erd/issues) or an issue from some other
issue tracking software.

### `SUMMARY`

`SUMMARY` is is short summary of the purpose of the branch composed of lower case words separated by '-' so that it is a valid `PRERELEASE` for the Gem version.

## Changes

### `PRERELEASE`

1. Update `PRERELEASE` to match the `SUMMARY` in the branch name. If you branched from `master`, and [version.rb](lib/metasploit/erd/version.rb) does not have `PRERELEASE` defined, then adding the following lines after `PATCH`:
```
# The prerelease version, scoped to the {MAJOR}, {MINOR}, and {PATCH} version number.
PRERELEASE = '<SUMMARY>'
```
2. `rake spec`
3. Verify the specs pass, which indicates that `PRERELEASE` was updated correctly.
4. Commit the change `git commit -a`

### Your changes

Make your changes or however many commits you like, committing each with `git commit`.

### Pre-Pull Request Testing

1. Run specs one last time before opening the Pull Request: `rake spec`
2. Verify there was no failures.

### Push

Push your branch to your fork on gitub: `git push TYPE/ISSUE/SUMMARY`

### Pull Request

* [Create new Pull Request](https://github.com/rapid7/metasploit-erd/compare/)
* Add a Verification Steps to the description comment

```
# Verification Steps
- [ ] `bundle install`
## `rake spec`
- [ ] `rake spec`
- [ ] VERIFY no failures
```

You should also include at least one scenario to manually check the changes outside of specs.

* Add a Post-merge Steps comment

The 'Post-merge Steps' are a reminder to the reviewer of the Pull Request of how to update the [`PRERELEASE`](lib/metasploit/erd/version.rb) so that [version_spec.rb](spec/lib/metasploit/erd/version.rb_spec.rb) passes on the target branch after the merge.

DESTINATION is the name of the destination branch into which the merge is being made. SOURCE_SUMMARY is the SUMMARY from TYPE/ISSUE/SUMMARY branch name for the SOURCE branch that is being made.

When merging to `master`:

```
# Post-merge Steps
Perform these steps prior to pushing to master or the build will be broke on master.
## Version
- [ ] Edit `lib/metasploit/erd/version.rb`
- [ ] Remove `PRERELEASE` and its comment as `PRERELEASE` is not defined on master.
## Gem build
- [ ] gem build *.gemspec
- [ ] VERIFY the gem has no '.pre' version suffix.
## RSpec
- [ ] `rake spec`
- [ ] VERIFY version examples pass without failures
## Commit & Push
- [ ] `git commit -a`
- [ ] `git push origin master`
```

When merging to DESTINATION other than `master`:

```
# Post-merge Steps
Perform these steps prior to pushing to DESTINATION or the build will be broke on DESTINATION.
## Version
- [ ] Edit `lib/metasploit/erd/version.rb`
- [ ] Change `PRERELEASE` from `SOURCE_SUMMARY` to `DESTINATION_SUMMARY` to match the branch (DESTINATION) summary (DESTINATION_SUMMARY)
## Gem build
- [ ] gem build metasploit-erd.gemspec
- [ ] VERIFY the prerelease suffix has change on the gem.
## RSpec
- [ ] `rake spec`
- [ ] VERIFY version examples pass without failures
## Commit & Push
- [ ] `git commit -a`
- [ ] `git push origin DESTINATION`
```

To update the [CHANGELOG.md](CHANGELOG.md) with the merged changes or release the merged code see
[RELEASING.md](RELEASING.md)
80 changes: 80 additions & 0 deletions RELEASING.md
@@ -0,0 +1,80 @@
# Releasing

These steps can be added to the Pull Request description's task list to remind the reviewer of how to release the
gem.

```
# Release
Complete these steps on DESTINATION
## [CHANGELOG.md](CHANGELOG.md)
### Terminology
* "Enhancements" are widdening the API, such as by adding new classes or methods.
* "Bug Fixes" are fixes to the implementation that do not affect the public API. If the public API is affected then
the change should be listed as both a "Bug Fix" and either an "Enhancement" or "Incompatible Change" depending on how
the bug was fixed.
* "Deprecations" are changes to the implementation that cause deprecation warnings to be issued for APIs which will be
removed in a future major release. "Deprecations" are usually accompanied by an Enhancement that creates a new API
that is meant to be used in favor of the deprecated API.
* "Incompatbile Changes" are the removal of classes or methods or new required arguments or setup that shrink the API.
It is best practice to make a "Deprecation" for the API prior to its removal.
### Task List
- [ ] Generate the list of changes since the last release: `git log v<LAST_MAJOR>.<LAST_MINOR>.<LAST_PATCH>..HEAD`
- [ ] For each commit in the release, find the corresponding PR by search for the commit on Github.
- [ ] For each PR, determine whether it is an Enhancement, Bug Fix, Deprecation, and/or Incompatible Change. A PR can
be in more than one category, in which case it should be listed in each category it belongs, but with a category
specific description of the change.
- [ ] Add an item to each category's list in the following format: `[#<PR>](https://github.com/rapid7/metasploit-erd/pull/<PR>) <consumer summary> - [@<github_user>](https://github.com/<github_user>)`
`consumer_summary` should be a summary of the Enhancement, Bug Fix, Deprecation, or Incompatible Change from a
downstream consumer's of the library's perspective. `github_user` should be Github handle of the author of the
PR.
- [ ] If you added any Deprecations or Incompatible Changes, then adding upgrading information to
[UPGRADING.md](UPGRADING.md)
## `VERSION`
The entries in the [CHANGELOG.md](CHANGELOG.md) can be used to help determine how the `VERSION` should be bumped.
### Compatible changes
If the [CHANGELOG.md](CHANGELOG.md) contains only Enhancements, Bug Fixes, and/or Deprecations for the Next Release then
increment [`PATCH`](lib/metasploit/erd/version.rb).
### Incompatible changes
If the [CHANGELOG.md](CHANGELOG.md) contains any Incompatible Changes for the Next Release, then you can either (1)
decide to remain pre-1.0.0 or (2) advance to 1.0.0.
1. To remain pre-1..0.0, then increment [`MINOR`](lib/metasploit/erd/version.rb) and reset [`PATCH`](lib/metasploit/erd/version.rb) to `0`.
2. To advance to 1.0.0, increment [`MAJOR`](lib/metasploit/erd/version.rb) and reset [`MINOR`](lib/metasploit/erd/version.rb and [`PATCH`](lib/metasploit/erd/version.rb) to `0`.
## Setup [CHANGELOG.md](CHANGELOG.md) for next release
- [ ] Change `Next Release` section name at the top of [CHANGELOG.md](CHANGELOG.md) to match the current `VERSION`.
- [ ] Add a new `Next Release` section above the `VERSION`'s section you just renamed:
<pre>
# Next Release
* Enhancements
* Bug Fixes
* Deprecations
* Incompatible Changes
</pre>
## Release to rubygems.org
## ruby-2.1
- [ ] `rvm use ruby-2.1@metasploit-erd`
- [ ] `rm Gemfile.lock`
- [ ] `bundle install`
- [ ] `rake release`
```

### Downstream dependencies

There are currently no known downstream dependencies
10 changes: 4 additions & 6 deletions Rakefile
@@ -1,9 +1,7 @@
require "bundler/gem_tasks"
require "rspec/core/rake_task"

require 'yard'
load 'tasks/yard.rake'
require 'bundler/gem_tasks'
require 'bundler/setup'
require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec)

task :default => :spec
task default: :spec
1 change: 1 addition & 0 deletions UPGRADING.md
@@ -0,0 +1 @@
No Deprecations or Incompatible Changes have been introduced at this time
6 changes: 3 additions & 3 deletions lib/metasploit/erd/cluster.rb
Expand Up @@ -21,9 +21,9 @@ def class_set

class_entity = Metasploit::ERD::Entity::Class.new(klass)

class_entity.class_set.each do |klass|
unless visited_class_set.include? klass
class_queue << klass
class_entity.class_set.each do |set_class|
unless visited_class_set.include? set_class
class_queue << set_class
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/metasploit/erd/diagram.rb
Expand Up @@ -59,7 +59,7 @@ class Metasploit::ERD::Diagram < RailsERD::Diagram::Graphviz
parent.mkpath
end

instance_eval &supersave
instance_eval(&supersave)
}

#
Expand Down
36 changes: 26 additions & 10 deletions lib/metasploit/erd/version.rb
Expand Up @@ -2,18 +2,31 @@ module Metasploit
module ERD
# Holds components of {VERSION} as defined by {http://semver.org/spec/v2.0.0.html semantic versioning v2.0.0}.
module Version
#
# CONSTANTS
#

# The major version number.
MAJOR = 0
# The minor version number, scoped to the {MAJOR} version number.
MINOR = 0
# The patch number, scoped to the {MINOR} version number.
PATCH = 1
# The patch version number, scoped to the {MAJOR} and {MINOR} version numbers.
PATCH = 3
# The prerelease version, scoped to the {MAJOR}, {MINOR}, and {PATCH} version numbers.
PRERELEASE = 'metasploit-version'

#
# Module Methods
#

# The full version string, including the {MAJOR}, {MINOR}, {PATCH}, and optionally, the `PRERELEASE` in the
# The full version string, including the {Metasploit::ERD::Version::MAJOR},
# {Metasploit::ERD::Version::MINOR}, {Metasploit::ERD::Version::PATCH}, and optionally, the
# `Metasploit::ERD::Version::PRERELEASE` in the
# {http://semver.org/spec/v2.0.0.html semantic versioning v2.0.0} format.
#
# @return [String] '{MAJOR}.{MINOR}.{PATCH}' on master. '{MAJOR}.{MINOR}.{PATCH}-`<PRERELEASE>`' on any branch
# other than master.
# @return [String] '{Metasploit::ERD::Version::MAJOR}.{Metasploit::ERD::Version::MINOR}.{Metasploit::ERD::Version::PATCH}'
# on master. '{Metasploit::ERD::Version::MAJOR}.{Metasploit::ERD::Version::MINOR}.{Metasploit::ERD::Version::PATCH}-PRERELEASE'
# on any branch other than master.
def self.full
version = "#{MAJOR}.#{MINOR}.#{PATCH}"

Expand All @@ -24,20 +37,23 @@ def self.full
version
end

# The full gem version string, including the {MAJOR}, {MINOR}, {PATCH}, and optionally, the {PRERELEASE} in the
# The full gem version string, including the {Metasploit::ERD::Version::MAJOR},
# {Metasploit::ERD::Version::MINOR}, {Metasploit::ERD::Version::PATCH}, and optionally, the
# `Metasploit::ERD::Version::PRERELEASE` in the
# {http://guides.rubygems.org/specification-reference/#version RubyGems versioning} format.
#
# @return [String] '{MAJOR}.{MINOR}.{PATCH}' on master. '{MAJOR}.{MINOR}.{PATCH}.{PRERELEASE}' on any branch
# other than master.
# @return [String] '{Metasploit::ERD::Version::MAJOR}.{Metasploit::ERD::Version::MINOR}.{Metasploit::ERD::Version::PATCH}'
# on master. '{Metasploit::ERD::Version::MAJOR}.{Metasploit::ERD::Version::MINOR}.{Metasploit::ERD::Version::PATCH}.PRERELEASE'
# on any branch other than master.
def self.gem
full.gsub('-', '.pre.')
end
end

# @see Version.gem
# (see Version.gem)
GEM_VERSION = Version.gem

# @see Version.full
# (see Version.full)
VERSION = Version.full
end
end
3 changes: 2 additions & 1 deletion metasploit-erd.gemspec
Expand Up @@ -22,8 +22,9 @@ Gem::Specification.new do |spec|
spec.required_ruby_version = '>= 2.1'

spec.add_development_dependency 'bundler', '~> 1.5'
spec.add_development_dependency 'metasploit-version', '~> 0.1.3'
spec.add_development_dependency 'rake', '~> 10.3'
spec.add_development_dependency 'rspec', '~> 2.14'
spec.add_development_dependency 'rspec', '~> 3.2'

# restrict from rails 4.0 to be compatible with rest of metasploit ecosystem.
# @todo Update to work with rails 4 (MSP-9836)
Expand Down
3 changes: 3 additions & 0 deletions spec/lib/metasploit/erd/version_spec.rb
@@ -0,0 +1,3 @@
RSpec.describe Metasploit::ERD::Version do
it_should_behave_like 'Metasploit::Version Version Module'
end
4 changes: 4 additions & 0 deletions spec/lib/metasploit/erd_spec.rb
@@ -0,0 +1,4 @@
RSpec.describe Metasploit::ERD do
it_should_behave_like 'Metasploit::Version GEM_VERSION constant'
it_should_behave_like 'Metasploit::Version VERSION constant'
end
8 changes: 3 additions & 5 deletions spec/metasploit/erd/cluster_spec.rb
@@ -1,6 +1,4 @@
require 'spec_helper'

describe Metasploit::ERD::Cluster do
RSpec.describe Metasploit::ERD::Cluster do
include_context 'ActiveRecord::Base connection'
include_context 'ActiveRecord::Base.descendants cleaner'

Expand Down Expand Up @@ -151,8 +149,8 @@
[]
end

it { should be_a Set }
it { should be_empty }
it { is_expected.to be_a Set }
it { is_expected.to be_empty }
end
end
end

0 comments on commit 924847a

Please sign in to comment.