Skip to content

Commit

Permalink
Merge 9027247 into 8647c80
Browse files Browse the repository at this point in the history
  • Loading branch information
limhoff-r7 committed May 4, 2015
2 parents 8647c80 + 9027247 commit 32b2fda
Show file tree
Hide file tree
Showing 81 changed files with 747 additions and 786 deletions.
6 changes: 2 additions & 4 deletions .rspec
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
--backtrace
--colour
--drb
--format documentation
--color
--require spec_helper
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Next Release

* Enhancements
* Bug Fixes
* Deprecations
* Incompatible Changes
58 changes: 9 additions & 49 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,18 @@ issue tracking software.

### `PRERELEASE`

1. Update `PRERELEASE` to match the `SUMMARY` in the branch name. If you branched from `master`, and [version.rb](lib/metasploit/model/version.rb) does not have `PRERELEASE` defined, then adding the following lines after `PATCH`:
1. Update `PRERELEASE` to match the `SUMMARY` in the branch name. If you branched from `master`, and [version.rb](lib/metasploit/model/version.rb) does not have `PRERELEASE` defined, then adding the following lines after `PATCH`:
```
# The prerelease version, scoped to the {PATCH} version number.
# 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, commiting each with `git commit`.
Make your changes or however many commits you like, committing each with `git commit`.

### Pre-Pull Request Testing

Expand All @@ -46,12 +45,12 @@ Make your changes or however many commits you like, commiting each with `git com

### Push

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

### Pull Request

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

```
# Verification Steps
Expand All @@ -62,6 +61,7 @@ Push your branch to your fork on gitub: `git push push TYPE/ISSUE/SUMMARY`
- [ ] `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
Expand Down Expand Up @@ -106,7 +106,7 @@ Perform these steps prior to pushing to DESTINATION or the build will be broke o
- [ ] Change `PRERELEASE` from `SOURCE_SUMMARY` to `DESTINATION_SUMMARY` to match the branch (DESTINATION) summary (DESTINATION_SUMMARY)
## Gem build
- [ ] gem build *.gemspec
- [ ] gem build metasploit-model.gemspec
- [ ] VERIFY the prerelease suffix has change on the gem.
## RSpec
Expand All @@ -118,45 +118,5 @@ Perform these steps prior to pushing to DESTINATION or the build will be broke o
- [ ] `git push origin DESTINATION`
```

* Add a 'Release Steps' comment

The 'Release Steps' are a reminder to the reviewer of the Pull Request of how to release the gem.

```
# Release
Complete these steps on DESTINATION
## Version
### Compatible changes
If the change are compatible with the previous branch's API, then increment [`PATCH`](lib/metasploit/model/version.rb).
### Incompatible changes
If your changes are incompatible with the previous branch's API, then increment
[`MINOR`](lib/metasploit/model/version.rb) and reset [`PATCH`](lib/metasploit/model/version.rb) to `0`.
- [ ] Following the rules for [semantic versioning 2.0](http://semver.org/spec/v2.0.0.html), update
[`MINOR`](lib/metasploit/model/version.rb) and [`PATCH`](lib/metasploit/model/version.rb) and commit the changes.
## JRuby
- [ ] `rvm use jruby@metasploit-model`
- [ ] `rm Gemfile.lock`
- [ ] `bundle install`
- [ ] `rake release`
## MRI Ruby
- [ ] `rvm use ruby-2.1@metasploit-model`
- [ ] `rm Gemfile.lock`
- [ ] `bundle install`
- [ ] `rake release`
```

### Downstream dependencies

When releasing new versions, the following projects may need to be updated:

* [metasploit_data_models](https://github.com/rapid7/metasploit_data_models)
* [metasploit-credential](https://github.com/rapid7/metasploit-credential)
To update the [CHANGELOG.md](CHANGELOG.md) with the merged changes or release the merged code see
[RELEASING.md](RELEASING.md)
8 changes: 4 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ group :test do
# rails is not used because activerecord should not be included, but rails would normally coordinate the versions
# between its dependencies, which is now handled by this constraint.
rails_version_constraint = [
'>= 3.2.0',
'< 4.0.0'
'>= 4.0.9',
'< 4.1.0'
]

# Dummy app uses actionpack for ActionController, but not rails since it doesn't use activerecord.
Expand All @@ -26,9 +26,9 @@ group :test do
gem 'coveralls', require: false
# Engine tasks are loaded using railtie
gem 'railties', *rails_version_constraint
gem 'rspec'
gem 'rspec', '~> 3.1'
# need rspec-core >= 2.14.0 because 2.14.0 introduced RSpec::Core::SharedExampleGroup::TopLevel
gem 'rspec-core', '>= 2.14.0', '< 3.0.0'
gem 'rspec-core', '>= 2.14.0'
# need rspec-rails >= 2.12.0 as 2.12.0 adds support for redefining named subject in nested context that uses the
# named subject from the outer context without causing a stack overflow.
gem 'rspec-rails', '>= 2.12.0'
Expand Down
89 changes: 89 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# 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-model/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.
### Bug fixes
If the [CHANGELOG.md](CHANGELOG.md) contains only Bug Fixes for the Next Release, then increment
[`PATCH`](lib/metasploit/model/version.rb).
### Compatible API changes
If the [CHANGELOG.md](CHANGELOG.md) contains any Enhancements or Deprecations, then increment
[`MINOR`](lib/metasploit/model/version.rb) and reset [`PATCH`](lib/metasploit/model/version.rb) to `0`.
### Incompatible API changes
If the [CHANGELOG.md](CHANGELOG.md) contains any Incompatible Change, then increment
[`MAJOR`](lib/metasploit/model/version.rb) and reset [`MINOR`](lib/metasploit/model/version.rb and
[`PATCH`](lib/metasploit/model/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
## jruby
- [ ] `rvm use jruby@metasploit-model`
- [ ] `rm Gemfile.lock`
- [ ] `bundle install`
- [ ] `rake release`
## ruby-2.1
- [ ] `rvm use ruby-2.1@metasploit-model`
- [ ] `rm Gemfile.lock`
- [ ] `bundle install`
- [ ] `rake release`
```

### Downstream dependencies

There are currently no known downstream dependencies
1 change: 1 addition & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
No Deprecations or Incompatible Changes have been introduced at this time
5 changes: 5 additions & 0 deletions lib/metasploit/model.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#
# Gems
#
# gems must load explicitly any gem declared in gemspec
# @see https://github.com/bundler/bundler/issues/2018#issuecomment-6819359
#
#

require 'active_model'
require 'active_support'

Expand Down
2 changes: 1 addition & 1 deletion lib/metasploit/model/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Metasploit::Model::Engine < Rails::Engine

# Remove ActiveSupport::Dependencies loading paths to save time during constant resolution and to ensure that
# metasploit-model is properly declaring all autoloads and not falling back on ActiveSupport::Dependencies
config.paths.each_value do |path|
config.paths.values.each do |path|
path.skip_autoload!
path.skip_autoload_once!
path.skip_eager_load!
Expand Down
38 changes: 27 additions & 11 deletions lib/metasploit/model/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,31 @@ module Metasploit
module Model
# 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
MAJOR = 1
# The minor version number, scoped to the {MAJOR} version number.
MINOR = 30
# The patch number, scoped to the {MAJOR} and {MINOR} version numbers.
MINOR = 0
# The patch version number, scoped to the {MAJOR} and {MINOR} version numbers.
PATCH = 0
# The prerelease version, scoped to the {MAJOR}, {MINOR}, and {PATCH} version numbers.
PRERELEASE = '1-0-0-plus'

#
# Module Methods
#

# The full version string, including the {MAJOR}, {MINOR}, {PATCH}, and optionally, the {PRERELEASE} in the
# The full version string, including the {Metasploit::Model::Version::MAJOR},
# {Metasploit::Model::Version::MINOR}, {Metasploit::Model::Version::PATCH}, and optionally, the
# `Metasploit::Model::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::Model::Version::MAJOR}.{Metasploit::Model::Version::MINOR}.{Metasploit::Model::Version::PATCH}'
# on master. '{Metasploit::Model::Version::MAJOR}.{Metasploit::Model::Version::MINOR}.{Metasploit::Model::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::Model::Version::MAJOR},
# {Metasploit::Model::Version::MINOR}, {Metasploit::Model::Version::PATCH}, and optionally, the
# `Metasploit::Model::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::Model::Version::MAJOR}.{Metasploit::Model::Version::MINOR}.{Metasploit::Model::Version::PATCH}'
# on master. '{Metasploit::Model::Version::MAJOR}.{Metasploit::Model::Version::MINOR}.{Metasploit::Model::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
9 changes: 7 additions & 2 deletions metasploit-model.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
spec.required_ruby_version = '>= 2.1'

spec.add_development_dependency 'bundler', '~> 1.3'
spec.add_development_dependency 'metasploit-version', '~> 0.1.3'
spec.add_development_dependency 'metasploit-yard', '~> 1.0'
spec.add_development_dependency 'rake'

Expand All @@ -27,8 +28,12 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'yard', '< 0.8.7.4'

# Dependency loading
spec.add_runtime_dependency 'activesupport'
spec.add_runtime_dependency 'railties', '< 4.0.0'
rails_version_constraints = ['>= 4.0.9', '< 4.1.0']

spec.add_runtime_dependency 'activemodel', *rails_version_constraints
spec.add_runtime_dependency 'activesupport', *rails_version_constraints

spec.add_runtime_dependency 'railties', *rails_version_constraints

if RUBY_PLATFORM =~ /java/
# markdown formatting for yard
Expand Down
12 changes: 5 additions & 7 deletions spec/app/models/metasploit/model/association/reflection_spec.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
require 'spec_helper'

describe Metasploit::Model::Association::Reflection do
RSpec.describe Metasploit::Model::Association::Reflection, type: :model do
context 'validations' do
it { should validate_presence_of :model }
it { should validate_presence_of :name }
it { should validate_presence_of :class_name }
it { is_expected.to validate_presence_of :model }
it { is_expected.to validate_presence_of :name }
it { is_expected.to validate_presence_of :class_name }
end

context '#klass' do
Expand Down Expand Up @@ -42,7 +40,7 @@
end

it 'should return Class with Class#name #class_name' do
klass.should == class_name_class
expect(klass).to eq(class_name_class)
end
end
end
6 changes: 2 additions & 4 deletions spec/app/models/metasploit/model/search/group/base_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require 'spec_helper'

describe Metasploit::Model::Search::Group::Base do
it { should ensure_length_of(:children).is_at_least(1) }
RSpec.describe Metasploit::Model::Search::Group::Base, type: :model do
it { is_expected.to ensure_length_of(:children).is_at_least(1) }
end
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require 'spec_helper'

describe Metasploit::Model::Search::Group::Intersection do
it { should be_a Metasploit::Model::Search::Group::Base }
RSpec.describe Metasploit::Model::Search::Group::Intersection, type: :model do
it { is_expected.to be_a Metasploit::Model::Search::Group::Base }
end
6 changes: 2 additions & 4 deletions spec/app/models/metasploit/model/search/group/union_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require 'spec_helper'

describe Metasploit::Model::Search::Group::Union do
it { should be_a Metasploit::Model::Search::Group::Base }
RSpec.describe Metasploit::Model::Search::Group::Union, type: :model do
it { is_expected.to be_a Metasploit::Model::Search::Group::Base }
end

0 comments on commit 32b2fda

Please sign in to comment.