metasploit-erd 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- OWM3NzNkYTA5NTA2NmYxZGIwMDdkYTA5OTcxMTUwOGZlNDM0MTcxYw==
5
- data.tar.gz: !binary |-
6
- ZmFmYjJjYWJkYzYyMDkwNWZhODNmNTQyOTFkNTk1NjMyODNmYmVhYQ==
2
+ SHA1:
3
+ metadata.gz: ef6368293df1c4dfd65ee566fa8f21d28150a397
4
+ data.tar.gz: 4a276d31b8c8f608b8fa063eb95ea61b41ad0528
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- ZWNmNWIyZjc0YTBkMDMzNWNkY2JmOTVkZGNiNWNlZTQzM2RkYmY3MDMxMTcx
10
- MmFjNDZhNmVlNWQ2MjQzZDdkZWJmZDUxZWY2NWE2ZTQ4ZjcwNWNhMDA0MWNm
11
- NmQ3MDBlNGIzNjBjZjY3NGZkOWEyNTAwNDkyZmUyZjUwMTNmNzc=
12
- data.tar.gz: !binary |-
13
- NmNhZDFmOGE1ODI4MjhjZmMyYTFmMmQ5YjUzYzAzMjgzZWJjNzRhNzYwZGY3
14
- OGFlZTMxZjI5YTA5NmYyMjUxYWFlZjEwYjYxNzAyNWQ1YjliNjE1YTM5ODI2
15
- Yjg1NDE0MDg2NzJhOTUyZjU1MGQ1ZTI3ZDcxYzI2N2E4ZjM0ZTM=
6
+ metadata.gz: aac17a79ded8d3425edb1beeb0a9698a7168db8847b2fd17d973dbb40a89d849a0f258af4e8eb973dd24097f1b78f57cc47ee5a98b1f948329a326d3182cdeae
7
+ data.tar.gz: 003b1e194a7bb06c20091a060ae2755b6fe3928031e4a6e215c3810aaa1625aed22495a15315e07883ec16fb6fb7c1b235a818c0068dfd66b1cd32c5f27d57ae
data/.rspec CHANGED
@@ -1,3 +1,2 @@
1
- --format documentation
2
1
  --color
3
- --backtrace
2
+ --require spec_helper
@@ -4,4 +4,5 @@ before_install:
4
4
  - sudo apt-get install -qq graphviz
5
5
  language: ruby
6
6
  rvm:
7
- - 1.9.3
7
+ - 2.1
8
+ script: bundle exec rake spec yard
@@ -0,0 +1,6 @@
1
+ # Next Release
2
+
3
+ * Enhancements
4
+ * Bug Fixes
5
+ * Deprecations
6
+ * Incompatible Changes
@@ -0,0 +1,122 @@
1
+ # Contributing
2
+
3
+ ## Forking
4
+
5
+ [Fork this repository](https://github.com/rapid7/metasploit-erd/fork)
6
+
7
+ ## Branching
8
+
9
+ Branch names follow the format `TYPE/ISSUE/SUMMARY`. You can create it with `git checkout -b TYPE/ISSUE/SUMMARY`.
10
+
11
+ ### `TYPE`
12
+
13
+ `TYPE` can be `bug`, `chore`, or `feature`.
14
+
15
+ ### `ISSUE`
16
+
17
+ `ISSUE` is either a [Github issue](https://github.com/rapid7/metasploit-erd/issues) or an issue from some other
18
+ issue tracking software.
19
+
20
+ ### `SUMMARY`
21
+
22
+ `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.
23
+
24
+ ## Changes
25
+
26
+ ### `PRERELEASE`
27
+
28
+ 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`:
29
+ ```
30
+ # The prerelease version, scoped to the {MAJOR}, {MINOR}, and {PATCH} version number.
31
+ PRERELEASE = '<SUMMARY>'
32
+ ```
33
+ 2. `rake spec`
34
+ 3. Verify the specs pass, which indicates that `PRERELEASE` was updated correctly.
35
+ 4. Commit the change `git commit -a`
36
+
37
+ ### Your changes
38
+
39
+ Make your changes or however many commits you like, committing each with `git commit`.
40
+
41
+ ### Pre-Pull Request Testing
42
+
43
+ 1. Run specs one last time before opening the Pull Request: `rake spec`
44
+ 2. Verify there was no failures.
45
+
46
+ ### Push
47
+
48
+ Push your branch to your fork on gitub: `git push TYPE/ISSUE/SUMMARY`
49
+
50
+ ### Pull Request
51
+
52
+ * [Create new Pull Request](https://github.com/rapid7/metasploit-erd/compare/)
53
+ * Add a Verification Steps to the description comment
54
+
55
+ ```
56
+ # Verification Steps
57
+
58
+ - [ ] `bundle install`
59
+
60
+ ## `rake spec`
61
+ - [ ] `rake spec`
62
+ - [ ] VERIFY no failures
63
+ ```
64
+
65
+ You should also include at least one scenario to manually check the changes outside of specs.
66
+
67
+ * Add a Post-merge Steps comment
68
+
69
+ 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.
70
+
71
+ 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.
72
+
73
+ When merging to `master`:
74
+
75
+ ```
76
+ # Post-merge Steps
77
+
78
+ Perform these steps prior to pushing to master or the build will be broke on master.
79
+
80
+ ## Version
81
+ - [ ] Edit `lib/metasploit/erd/version.rb`
82
+ - [ ] Remove `PRERELEASE` and its comment as `PRERELEASE` is not defined on master.
83
+
84
+ ## Gem build
85
+ - [ ] gem build *.gemspec
86
+ - [ ] VERIFY the gem has no '.pre' version suffix.
87
+
88
+ ## RSpec
89
+ - [ ] `rake spec`
90
+ - [ ] VERIFY version examples pass without failures
91
+
92
+ ## Commit & Push
93
+ - [ ] `git commit -a`
94
+ - [ ] `git push origin master`
95
+ ```
96
+
97
+ When merging to DESTINATION other than `master`:
98
+
99
+ ```
100
+ # Post-merge Steps
101
+
102
+ Perform these steps prior to pushing to DESTINATION or the build will be broke on DESTINATION.
103
+
104
+ ## Version
105
+ - [ ] Edit `lib/metasploit/erd/version.rb`
106
+ - [ ] Change `PRERELEASE` from `SOURCE_SUMMARY` to `DESTINATION_SUMMARY` to match the branch (DESTINATION) summary (DESTINATION_SUMMARY)
107
+
108
+ ## Gem build
109
+ - [ ] gem build metasploit-erd.gemspec
110
+ - [ ] VERIFY the prerelease suffix has change on the gem.
111
+
112
+ ## RSpec
113
+ - [ ] `rake spec`
114
+ - [ ] VERIFY version examples pass without failures
115
+
116
+ ## Commit & Push
117
+ - [ ] `git commit -a`
118
+ - [ ] `git push origin DESTINATION`
119
+ ```
120
+
121
+ To update the [CHANGELOG.md](CHANGELOG.md) with the merged changes or release the merged code see
122
+ [RELEASING.md](RELEASING.md)
@@ -0,0 +1,80 @@
1
+ # Releasing
2
+
3
+ These steps can be added to the Pull Request description's task list to remind the reviewer of how to release the
4
+ gem.
5
+
6
+ ```
7
+ # Release
8
+
9
+ Complete these steps on DESTINATION
10
+
11
+ ## [CHANGELOG.md](CHANGELOG.md)
12
+
13
+ ### Terminology
14
+
15
+ * "Enhancements" are widdening the API, such as by adding new classes or methods.
16
+ * "Bug Fixes" are fixes to the implementation that do not affect the public API. If the public API is affected then
17
+ the change should be listed as both a "Bug Fix" and either an "Enhancement" or "Incompatible Change" depending on how
18
+ the bug was fixed.
19
+ * "Deprecations" are changes to the implementation that cause deprecation warnings to be issued for APIs which will be
20
+ removed in a future major release. "Deprecations" are usually accompanied by an Enhancement that creates a new API
21
+ that is meant to be used in favor of the deprecated API.
22
+ * "Incompatbile Changes" are the removal of classes or methods or new required arguments or setup that shrink the API.
23
+ It is best practice to make a "Deprecation" for the API prior to its removal.
24
+
25
+ ### Task List
26
+
27
+ - [ ] Generate the list of changes since the last release: `git log v<LAST_MAJOR>.<LAST_MINOR>.<LAST_PATCH>..HEAD`
28
+ - [ ] For each commit in the release, find the corresponding PR by search for the commit on Github.
29
+ - [ ] For each PR, determine whether it is an Enhancement, Bug Fix, Deprecation, and/or Incompatible Change. A PR can
30
+ be in more than one category, in which case it should be listed in each category it belongs, but with a category
31
+ specific description of the change.
32
+ - [ ] 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>)`
33
+ `consumer_summary` should be a summary of the Enhancement, Bug Fix, Deprecation, or Incompatible Change from a
34
+ downstream consumer's of the library's perspective. `github_user` should be Github handle of the author of the
35
+ PR.
36
+ - [ ] If you added any Deprecations or Incompatible Changes, then adding upgrading information to
37
+ [UPGRADING.md](UPGRADING.md)
38
+
39
+ ## `VERSION`
40
+
41
+ The entries in the [CHANGELOG.md](CHANGELOG.md) can be used to help determine how the `VERSION` should be bumped.
42
+
43
+ ### Compatible changes
44
+
45
+ If the [CHANGELOG.md](CHANGELOG.md) contains only Enhancements, Bug Fixes, and/or Deprecations for the Next Release then
46
+ increment [`PATCH`](lib/metasploit/erd/version.rb).
47
+
48
+ ### Incompatible changes
49
+
50
+ If the [CHANGELOG.md](CHANGELOG.md) contains any Incompatible Changes for the Next Release, then you can either (1)
51
+ decide to remain pre-1.0.0 or (2) advance to 1.0.0.
52
+
53
+ 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`.
54
+ 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`.
55
+
56
+ ## Setup [CHANGELOG.md](CHANGELOG.md) for next release
57
+
58
+ - [ ] Change `Next Release` section name at the top of [CHANGELOG.md](CHANGELOG.md) to match the current `VERSION`.
59
+ - [ ] Add a new `Next Release` section above the `VERSION`'s section you just renamed:
60
+ <pre>
61
+ # Next Release
62
+
63
+ * Enhancements
64
+ * Bug Fixes
65
+ * Deprecations
66
+ * Incompatible Changes
67
+ </pre>
68
+
69
+ ## Release to rubygems.org
70
+
71
+ ## ruby-2.1
72
+ - [ ] `rvm use ruby-2.1@metasploit-erd`
73
+ - [ ] `rm Gemfile.lock`
74
+ - [ ] `bundle install`
75
+ - [ ] `rake release`
76
+ ```
77
+
78
+ ### Downstream dependencies
79
+
80
+ There are currently no known downstream dependencies
data/Rakefile CHANGED
@@ -1,9 +1,14 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'bundler/setup'
2
3
  require "rspec/core/rake_task"
3
4
 
4
- require 'yard'
5
- load 'tasks/yard.rake'
6
-
7
5
  RSpec::Core::RakeTask.new(:spec)
8
6
 
9
7
  task :default => :spec
8
+
9
+ # Use find_all_by_name instead of find_by_name as find_all_by_name will return pre-release versions
10
+ gem_specification = Gem::Specification.find_all_by_name('metasploit-yard').first
11
+
12
+ Dir[File.join(gem_specification.gem_dir, 'lib', 'tasks', '**', '*.rake')].each do |rake|
13
+ load rake
14
+ end
@@ -0,0 +1 @@
1
+ No Deprecations or Incompatible Changes have been introduced at this time
@@ -21,9 +21,9 @@ class Metasploit::ERD::Cluster
21
21
 
22
22
  class_entity = Metasploit::ERD::Entity::Class.new(klass)
23
23
 
24
- class_entity.class_set.each do |klass|
25
- unless visited_class_set.include? klass
26
- class_queue << klass
24
+ class_entity.class_set.each do |set_class|
25
+ unless visited_class_set.include? set_class
26
+ class_queue << set_class
27
27
  end
28
28
  end
29
29
 
@@ -59,7 +59,7 @@ class Metasploit::ERD::Diagram < RailsERD::Diagram::Graphviz
59
59
  parent.mkpath
60
60
  end
61
61
 
62
- instance_eval &supersave
62
+ instance_eval(&supersave)
63
63
  }
64
64
 
65
65
  #
@@ -2,18 +2,29 @@ module Metasploit
2
2
  module ERD
3
3
  # Holds components of {VERSION} as defined by {http://semver.org/spec/v2.0.0.html semantic versioning v2.0.0}.
4
4
  module Version
5
+ #
6
+ # CONSTANTS
7
+ #
8
+
5
9
  # The major version number.
6
10
  MAJOR = 0
7
11
  # 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 = 1
12
+ MINOR = 1
13
+ # The patch number, scoped to the {MAJOR} and {MINOR} version numbers.
14
+ PATCH = 0
15
+
16
+ #
17
+ # Module Methods
18
+ #
11
19
 
12
- # The full version string, including the {MAJOR}, {MINOR}, {PATCH}, and optionally, the `PRERELEASE` in the
20
+ # The full version string, including the {Metasploit::ERD::Version::MAJOR},
21
+ # {Metasploit::ERD::Version::MINOR}, {Metasploit::ERD::Version::PATCH}, and optionally, the
22
+ # `Metasploit::ERD::Version::PRERELEASE` in the
13
23
  # {http://semver.org/spec/v2.0.0.html semantic versioning v2.0.0} format.
14
24
  #
15
- # @return [String] '{MAJOR}.{MINOR}.{PATCH}' on master. '{MAJOR}.{MINOR}.{PATCH}-`<PRERELEASE>`' on any branch
16
- # other than master.
25
+ # @return [String] '{Metasploit::ERD::Version::MAJOR}.{Metasploit::ERD::Version::MINOR}.{Metasploit::ERD::Version::PATCH}'
26
+ # on master. '{Metasploit::ERD::Version::MAJOR}.{Metasploit::ERD::Version::MINOR}.{Metasploit::ERD::Version::PATCH}-PRERELEASE'
27
+ # on any branch other than master.
17
28
  def self.full
18
29
  version = "#{MAJOR}.#{MINOR}.#{PATCH}"
19
30
 
@@ -23,9 +34,24 @@ module Metasploit
23
34
 
24
35
  version
25
36
  end
37
+
38
+ # The full gem version string, including the {Metasploit::ERD::Version::MAJOR},
39
+ # {Metasploit::ERD::Version::MINOR}, {Metasploit::ERD::Version::PATCH}, and optionally, the
40
+ # `Metasploit::ERD::Version::PRERELEASE` in the
41
+ # {http://guides.rubygems.org/specification-reference/#version RubyGems versioning} format.
42
+ #
43
+ # @return [String] '{Metasploit::ERD::Version::MAJOR}.{Metasploit::ERD::Version::MINOR}.{Metasploit::ERD::Version::PATCH}'
44
+ # on master. '{Metasploit::ERD::Version::MAJOR}.{Metasploit::ERD::Version::MINOR}.{Metasploit::ERD::Version::PATCH}.PRERELEASE'
45
+ # on any branch other than master.
46
+ def self.gem
47
+ full.gsub('-', '.pre.')
48
+ end
26
49
  end
27
50
 
28
- # @see Version.full
51
+ # (see Version.gem)
52
+ GEM_VERSION = Version.gem
53
+
54
+ # (see Version.full)
29
55
  VERSION = Version.full
30
56
  end
31
57
  end
@@ -5,7 +5,7 @@ require 'metasploit/erd/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'metasploit-erd'
8
- spec.version = Metasploit::ERD::VERSION
8
+ spec.version = Metasploit::ERD::GEM_VERSION
9
9
  spec.authors = ['Luke Imhoff']
10
10
  spec.email = ['luke_imhoff@rapid7.com']
11
11
  spec.summary = 'Extensions to rails-erd to find clusters of models to generate subdomains specific to each model'
@@ -19,9 +19,13 @@ Gem::Specification.new do |spec|
19
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
20
  spec.require_paths = ['lib']
21
21
 
22
+ spec.required_ruby_version = '>= 2.1'
23
+
22
24
  spec.add_development_dependency 'bundler', '~> 1.5'
25
+ spec.add_development_dependency 'metasploit-version', '~> 0.1.3'
26
+ spec.add_development_dependency 'metasploit-yard', '~> 1.0'
23
27
  spec.add_development_dependency 'rake', '~> 10.3'
24
- spec.add_development_dependency 'rspec', '~> 2.14'
28
+ spec.add_development_dependency 'rspec', '~> 3.2'
25
29
 
26
30
  # restrict from rails 4.0 to be compatible with rest of metasploit ecosystem.
27
31
  # @todo Update to work with rails 4 (MSP-9836)
@@ -0,0 +1,3 @@
1
+ RSpec.describe Metasploit::ERD::Version do
2
+ it_should_behave_like 'Metasploit::Version Version Module'
3
+ end
@@ -0,0 +1,4 @@
1
+ RSpec.describe Metasploit::ERD do
2
+ it_should_behave_like 'Metasploit::Version GEM_VERSION constant'
3
+ it_should_behave_like 'Metasploit::Version VERSION constant'
4
+ end
@@ -1,6 +1,4 @@
1
- require 'spec_helper'
2
-
3
- describe Metasploit::ERD::Cluster do
1
+ RSpec.describe Metasploit::ERD::Cluster do
4
2
  include_context 'ActiveRecord::Base connection'
5
3
  include_context 'ActiveRecord::Base.descendants cleaner'
6
4
 
@@ -151,8 +149,8 @@ describe Metasploit::ERD::Cluster do
151
149
  []
152
150
  end
153
151
 
154
- it { should be_a Set }
155
- it { should be_empty }
152
+ it { is_expected.to be_a Set }
153
+ it { is_expected.to be_empty }
156
154
  end
157
155
  end
158
156
  end
@@ -1,6 +1,4 @@
1
- require 'spec_helper'
2
-
3
- describe Metasploit::ERD::Diagram do
1
+ RSpec.describe Metasploit::ERD::Diagram do
4
2
  subject(:diagram) {
5
3
  described_class.new(*arguments)
6
4
  }
@@ -15,7 +13,7 @@ describe Metasploit::ERD::Diagram do
15
13
  RailsERD::Domain.new
16
14
  }
17
15
 
18
- it { should be_a RailsERD::Diagram::Graphviz }
16
+ it { is_expected.to be_a RailsERD::Diagram::Graphviz }
19
17
 
20
18
  context 'CONSTANTS' do
21
19
  context 'ATTRIBUTES' do
@@ -23,10 +21,10 @@ describe Metasploit::ERD::Diagram do
23
21
  described_class::ATTRIBUTES
24
22
  }
25
23
 
26
- it { should include :content }
27
- it { should include :foreign_keys }
28
- it { should include :primary_keys }
29
- it { should include :timestamps }
24
+ it { is_expected.to include :content }
25
+ it { is_expected.to include :foreign_keys }
26
+ it { is_expected.to include :primary_keys }
27
+ it { is_expected.to include :timestamps }
30
28
  end
31
29
 
32
30
  context 'DEFAULT_OPTIONS' do
@@ -100,7 +98,7 @@ describe Metasploit::ERD::Diagram do
100
98
  described_class::FILETYPE
101
99
  }
102
100
 
103
- it { should == :png }
101
+ it { is_expected.to eq(:png) }
104
102
  end
105
103
 
106
104
  context 'INDIRECT' do
@@ -108,7 +106,7 @@ describe Metasploit::ERD::Diagram do
108
106
  described_class::INDIRECT
109
107
  }
110
108
 
111
- it { should be_false }
109
+ it { is_expected.to eq(false) }
112
110
  end
113
111
 
114
112
  context 'INHERITANCE' do
@@ -116,7 +114,7 @@ describe Metasploit::ERD::Diagram do
116
114
  described_class::INHERITANCE
117
115
  }
118
116
 
119
- it { should be_true }
117
+ it { is_expected.to eq(true) }
120
118
  end
121
119
 
122
120
  context 'NOTATION' do
@@ -124,7 +122,7 @@ describe Metasploit::ERD::Diagram do
124
122
  described_class::NOTATION
125
123
  }
126
124
 
127
- it { should == :crowsfoot }
125
+ it { is_expected.to eq(:crowsfoot) }
128
126
  end
129
127
 
130
128
  context 'POLYMORPHISM' do
@@ -132,7 +130,7 @@ describe Metasploit::ERD::Diagram do
132
130
  described_class::POLYMORPHISM
133
131
  }
134
132
 
135
- it { should be_true }
133
+ it { is_expected.to eq(true) }
136
134
  end
137
135
  end
138
136
 
@@ -146,7 +144,7 @@ describe Metasploit::ERD::Diagram do
146
144
  callbacks[:each_entity]
147
145
  }
148
146
 
149
- it { should_not be_nil }
147
+ it { is_expected.to_not be_nil }
150
148
 
151
149
  it 'uses RailsERD::Diagram::Graphviz.callbacks[:each_entity]' do
152
150
  expect(each_entity).to eq(RailsERD::Diagram::Graphviz.send(:callbacks)[:each_entity])
@@ -158,7 +156,7 @@ describe Metasploit::ERD::Diagram do
158
156
  callbacks[:each_relationship]
159
157
  }
160
158
 
161
- it { should_not be_nil }
159
+ it { is_expected.to_not be_nil }
162
160
 
163
161
  it 'uses RailsERD::Diagram::Graphviz.callbacks[:each_relationship]' do
164
162
  expect(each_relationship).to eq(RailsERD::Diagram::Graphviz.send(:callbacks)[:each_relationship])
@@ -170,7 +168,7 @@ describe Metasploit::ERD::Diagram do
170
168
  callbacks[:each_specialization]
171
169
  }
172
170
 
173
- it { should_not be_nil }
171
+ it { is_expected.to_not be_nil }
174
172
 
175
173
  it 'uses RailsERD::Diagram::Graphviz.callbacks[:each_specialization]' do
176
174
  expect(each_specialization).to eq(RailsERD::Diagram::Graphviz.send(:callbacks)[:each_specialization])
@@ -182,7 +180,7 @@ describe Metasploit::ERD::Diagram do
182
180
  callbacks[:save]
183
181
  }
184
182
 
185
- it { should_not be_nil }
183
+ it { is_expected.to_not be_nil }
186
184
 
187
185
  it 'extends RailsERD::Diagram::Graphviz.callbacks[:save]' do
188
186
  expect(save).not_to eq(RailsERD::Diagram::Graphviz.send(:callbacks)[:save])
@@ -194,7 +192,7 @@ describe Metasploit::ERD::Diagram do
194
192
  callbacks[:setup]
195
193
  }
196
194
 
197
- it { should_not be_nil }
195
+ it { is_expected.to_not be_nil }
198
196
 
199
197
  it 'uses RailsERD::Diagram::Graphviz.callbacks[:setup]' do
200
198
  expect(setup).to eq(RailsERD::Diagram::Graphviz.send(:callbacks)[:setup])
@@ -1,6 +1,4 @@
1
- require 'spec_helper'
2
-
3
- describe Metasploit::ERD::Entity::Class do
1
+ RSpec.describe Metasploit::ERD::Entity::Class do
4
2
  include_context 'ActiveRecord::Base.descendants cleaner'
5
3
 
6
4
  subject(:class_entity) {
@@ -116,7 +114,7 @@ describe Metasploit::ERD::Entity::Class do
116
114
  end
117
115
 
118
116
  it 'includes class once' do
119
- expect(class_set).to have(1).items
117
+ expect(class_set.length).to eq(1)
120
118
  expect(class_set).to include(target)
121
119
  end
122
120
  end
@@ -208,7 +206,7 @@ describe Metasploit::ERD::Entity::Class do
208
206
  end
209
207
 
210
208
  it 'includes belongs_to target classes' do
211
- expect(class_set).to include(belongs_to_target)
209
+ expect(class_set.map(&:name)).to include(belongs_to_target.name)
212
210
  end
213
211
 
214
212
  it 'does not include has_many target classes' do
@@ -218,7 +216,7 @@ describe Metasploit::ERD::Entity::Class do
218
216
  end
219
217
 
220
218
  context 'without belongs_to associations' do
221
- it { should be_empty }
219
+ it { is_expected.to be_empty }
222
220
  end
223
221
  end
224
222
 
@@ -1,6 +1,4 @@
1
- require 'spec_helper'
2
-
3
- describe Metasploit::ERD::Entity::Namespace do
1
+ RSpec.describe Metasploit::ERD::Entity::Namespace do
4
2
  include_context 'ActiveRecord::Base.descendants cleaner'
5
3
 
6
4
  subject(:namespace_entity) {
@@ -107,7 +105,7 @@ describe Metasploit::ERD::Entity::Namespace do
107
105
  end
108
106
 
109
107
  context 'without ActiveRecord::Base descendants' do
110
- it { should be_empty }
108
+ it { is_expected.to be_empty }
111
109
  end
112
110
  end
113
111
 
@@ -1,6 +1,4 @@
1
- require 'spec_helper'
2
-
3
- describe Metasploit::ERD::Relationship do
1
+ RSpec.describe Metasploit::ERD::Relationship do
4
2
  include_context 'ActiveRecord::Base connection'
5
3
  include_context 'ActiveRecord::Base.descendants cleaner'
6
4
 
@@ -75,7 +73,7 @@ describe Metasploit::ERD::Relationship do
75
73
  end
76
74
  end
77
75
 
78
- it { should be_a Set }
76
+ it { is_expected.to be_a Set }
79
77
 
80
78
  it 'includes association.klass' do
81
79
  expect(class_set).to include(association.klass)
@@ -137,7 +135,7 @@ describe Metasploit::ERD::Relationship do
137
135
  end
138
136
  end
139
137
 
140
- it { should be_a Set }
138
+ it { is_expected.to be_a Set }
141
139
 
142
140
  it 'includes all classes that have has_many <inverse>, as: <reflection.name>' do
143
141
  expect(class_set).to eq(Set.new(things))
@@ -225,7 +223,7 @@ describe Metasploit::ERD::Relationship do
225
223
  end
226
224
  end
227
225
 
228
- it { should be_a Set }
226
+ it { is_expected.to be_a Set }
229
227
 
230
228
  context 'with has_many as: <association.name>' do
231
229
  it 'includes classes' do
@@ -1,4 +1,4 @@
1
- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
1
+ require 'bundler/setup'
2
2
 
3
3
  # require before 'metasploit/erd' so coverage is shown for files required by 'metasploit/erd'
4
4
  require 'simplecov'
@@ -14,13 +14,95 @@ else
14
14
  ]
15
15
  end
16
16
 
17
+ #
18
+ # Gems
19
+ #
20
+
21
+ require 'metasploit/version'
22
+
23
+ #
24
+ # Project
25
+ #
26
+
17
27
  require 'metasploit/erd'
18
28
 
19
- # Requires supporting ruby files with custom matchers and macros, etc,
20
- # in spec/support/ and its subdirectories.
21
- spec_pathname = Pathname.new(__FILE__).realpath.parent
22
- glob_pathname = spec_pathname.join('support', '**', '*.rb')
29
+ roots = []
30
+ roots << Pathname.new(__FILE__).realpath.parent.parent.to_path
31
+
32
+ # Use find_all_by_name instead of find_by_name as find_all_by_name will return pre-release versions
33
+ gem_specification = Gem::Specification.find_all_by_name('metasploit-version').first
34
+ roots << gem_specification.gem_dir
35
+
36
+ roots.each do |root|
37
+ Dir[File.join(root, 'spec', 'support', '**', '*.rb')].each do |f|
38
+ require f
39
+ end
40
+ end
41
+
42
+ RSpec.configure do |config|
43
+ # rspec-expectations config goes here. You can use an alternate
44
+ # assertion/expectation library such as wrong or the stdlib/minitest
45
+ # assertions if you prefer.
46
+ config.expect_with :rspec do |expectations|
47
+ # This option will default to `true` in RSpec 4. It makes the `description`
48
+ # and `failure_message` of custom matchers include text for helper methods
49
+ # defined using `chain`, e.g.:
50
+ # be_bigger_than(2).and_smaller_than(4).description
51
+ # # => "be bigger than 2 and smaller than 4"
52
+ # ...rather than:
53
+ # # => "be bigger than 2"
54
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
55
+ expectations.syntax = :expect
56
+ end
57
+
58
+ config.expose_dsl_globally = false
59
+
60
+ # These two settings work together to allow you to limit a spec run
61
+ # to individual examples or groups you care about by tagging them with
62
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
63
+ # get run.
64
+ config.filter_run :focus
65
+ config.run_all_when_everything_filtered = true
66
+
67
+ # Many RSpec users commonly either run the entire suite or an individual
68
+ # file, and it's useful to allow more verbose output when running an
69
+ # individual spec file.
70
+ if config.files_to_run.one?
71
+ # Use the documentation formatter for detailed output,
72
+ # unless a formatter has already been configured
73
+ # (e.g. via a command-line flag).
74
+ config.default_formatter = 'doc'
75
+ end
76
+
77
+ # rspec-mocks config goes here. You can use an alternate test double
78
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
79
+ config.mock_with :rspec do |mocks|
80
+ mocks.syntax = :expect
81
+ mocks.patch_marshal_to_support_partial_doubles = false
82
+ # Prevents you from mocking or stubbing a method that does not exist on
83
+ # a real object. This is generally recommended, and will default to
84
+ # `true` in RSpec 4.
85
+ mocks.verify_partial_doubles = true
86
+ end
87
+
88
+ # Run specs in random order to surface order dependencies. If you find an
89
+ # order dependency and want to debug it, you can fix the order by providing
90
+ # the seed, which is printed after each run.
91
+ # --seed 1234
92
+ config.order = :random
93
+
94
+ # Seed global randomization in this process using the `--seed` CLI option.
95
+ # Setting this allows you to use `--seed` to deterministically reproduce
96
+ # test failures related to randomization by passing the same `--seed` value
97
+ # as the one that triggered the failure.
98
+ Kernel.srand config.seed
99
+
100
+ # Print the 10 slowest examples and example groups at the
101
+ # end of the spec run, to help surface which specs are running
102
+ # particularly slow.
103
+ config.profile_examples = 10
23
104
 
24
- Dir[glob_pathname].each do |f|
25
- require f
105
+ # This setting enables warnings. It's recommended, but in some cases may
106
+ # be too noisy due to issues in dependencies.
107
+ config.warnings = true
26
108
  end
@@ -1,4 +1,4 @@
1
- shared_context 'ActiveRecord::Base connection' do
1
+ RSpec.shared_context 'ActiveRecord::Base connection' do
2
2
  before(:each) do
3
3
  ActiveRecord::Base.establish_connection(
4
4
  adapter: 'sqlite3',
@@ -1,4 +1,4 @@
1
- shared_context 'ActiveRecord::Base.descendants cleaner' do
1
+ RSpec.shared_context 'ActiveRecord::Base.descendants cleaner' do
2
2
  before(:each) do
3
3
  expect(ActiveRecord::Base.direct_descendants).to be_empty
4
4
  end
@@ -1,4 +1,4 @@
1
- shared_examples_for 'Metasploit::ERD::Clusterable' do
1
+ RSpec.shared_examples_for 'Metasploit::ERD::Clusterable' do
2
2
  include_context 'ActiveRecord::Base connection'
3
3
 
4
4
  #
@@ -68,7 +68,7 @@ shared_examples_for 'Metasploit::ERD::Clusterable' do
68
68
  []
69
69
  }
70
70
 
71
- it { should be_a Metasploit::ERD::Diagram }
71
+ it { is_expected.to be_a Metasploit::ERD::Diagram }
72
72
 
73
73
  context 'Metasploit::ERD::Diagram#create' do
74
74
  subject(:create) {
@@ -256,7 +256,7 @@ shared_examples_for 'Metasploit::ERD::Clusterable' do
256
256
  options[:title]
257
257
  }
258
258
 
259
- it { should be_a String }
259
+ it { is_expected.to be_a String }
260
260
  end
261
261
  end
262
262
  end
metadata CHANGED
@@ -1,109 +1,137 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metasploit-erd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Imhoff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-25 00:00:00.000000000 Z
11
+ date: 2015-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.5'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: metasploit-version
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.1.3
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.1.3
41
+ - !ruby/object:Gem::Dependency
42
+ name: metasploit-yard
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: rake
29
57
  requirement: !ruby/object:Gem::Requirement
30
58
  requirements:
31
- - - ~>
59
+ - - "~>"
32
60
  - !ruby/object:Gem::Version
33
61
  version: '10.3'
34
62
  type: :development
35
63
  prerelease: false
36
64
  version_requirements: !ruby/object:Gem::Requirement
37
65
  requirements:
38
- - - ~>
66
+ - - "~>"
39
67
  - !ruby/object:Gem::Version
40
68
  version: '10.3'
41
69
  - !ruby/object:Gem::Dependency
42
70
  name: rspec
43
71
  requirement: !ruby/object:Gem::Requirement
44
72
  requirements:
45
- - - ~>
73
+ - - "~>"
46
74
  - !ruby/object:Gem::Version
47
- version: '2.14'
75
+ version: '3.2'
48
76
  type: :development
49
77
  prerelease: false
50
78
  version_requirements: !ruby/object:Gem::Requirement
51
79
  requirements:
52
- - - ~>
80
+ - - "~>"
53
81
  - !ruby/object:Gem::Version
54
- version: '2.14'
82
+ version: '3.2'
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: activerecord
57
85
  requirement: !ruby/object:Gem::Requirement
58
86
  requirements:
59
- - - ! '>='
87
+ - - ">="
60
88
  - !ruby/object:Gem::Version
61
89
  version: '3.2'
62
- - - <
90
+ - - "<"
63
91
  - !ruby/object:Gem::Version
64
92
  version: 4.0.0
65
93
  type: :runtime
66
94
  prerelease: false
67
95
  version_requirements: !ruby/object:Gem::Requirement
68
96
  requirements:
69
- - - ! '>='
97
+ - - ">="
70
98
  - !ruby/object:Gem::Version
71
99
  version: '3.2'
72
- - - <
100
+ - - "<"
73
101
  - !ruby/object:Gem::Version
74
102
  version: 4.0.0
75
103
  - !ruby/object:Gem::Dependency
76
104
  name: activesupport
77
105
  requirement: !ruby/object:Gem::Requirement
78
106
  requirements:
79
- - - ! '>='
107
+ - - ">="
80
108
  - !ruby/object:Gem::Version
81
109
  version: '3.2'
82
- - - <
110
+ - - "<"
83
111
  - !ruby/object:Gem::Version
84
112
  version: 4.0.0
85
113
  type: :runtime
86
114
  prerelease: false
87
115
  version_requirements: !ruby/object:Gem::Requirement
88
116
  requirements:
89
- - - ! '>='
117
+ - - ">="
90
118
  - !ruby/object:Gem::Version
91
119
  version: '3.2'
92
- - - <
120
+ - - "<"
93
121
  - !ruby/object:Gem::Version
94
122
  version: 4.0.0
95
123
  - !ruby/object:Gem::Dependency
96
124
  name: rails-erd
97
125
  requirement: !ruby/object:Gem::Requirement
98
126
  requirements:
99
- - - ~>
127
+ - - "~>"
100
128
  - !ruby/object:Gem::Version
101
129
  version: '1.1'
102
130
  type: :runtime
103
131
  prerelease: false
104
132
  version_requirements: !ruby/object:Gem::Requirement
105
133
  requirements:
106
- - - ~>
134
+ - - "~>"
107
135
  - !ruby/object:Gem::Version
108
136
  version: '1.1'
109
137
  description: Traces the belongs_to associations on ActiveRecord::Base descendants
@@ -115,16 +143,20 @@ executables: []
115
143
  extensions: []
116
144
  extra_rdoc_files: []
117
145
  files:
118
- - .coveralls.yml
119
- - .gitignore
120
- - .rspec
121
- - .simplecov
122
- - .travis.yml
123
- - .yardopts
146
+ - ".coveralls.yml"
147
+ - ".gitignore"
148
+ - ".rspec"
149
+ - ".simplecov"
150
+ - ".travis.yml"
151
+ - ".yardopts"
152
+ - CHANGELOG.md
153
+ - CONTRIBUTING.md
124
154
  - Gemfile
125
155
  - LICENSE
126
156
  - README.md
157
+ - RELEASING.md
127
158
  - Rakefile
159
+ - UPGRADING.md
128
160
  - lib/metasploit/erd.rb
129
161
  - lib/metasploit/erd/cluster.rb
130
162
  - lib/metasploit/erd/clusterable.rb
@@ -134,15 +166,14 @@ files:
134
166
  - lib/metasploit/erd/entity/namespace.rb
135
167
  - lib/metasploit/erd/relationship.rb
136
168
  - lib/metasploit/erd/version.rb
137
- - lib/tasks/yard.rake
138
169
  - metasploit-erd.gemspec
170
+ - spec/lib/metasploit/erd/version_spec.rb
171
+ - spec/lib/metasploit/erd_spec.rb
139
172
  - spec/metasploit/erd/cluster_spec.rb
140
173
  - spec/metasploit/erd/diagram_spec.rb
141
174
  - spec/metasploit/erd/entity/class_spec.rb
142
175
  - spec/metasploit/erd/entity/namespace_spec.rb
143
176
  - spec/metasploit/erd/relationship_spec.rb
144
- - spec/metasploit/erd/version_spec.rb
145
- - spec/metasploit/erd_spec.rb
146
177
  - spec/spec_helper.rb
147
178
  - spec/support/shared/contexts/active_record_base_connection.rb
148
179
  - spec/support/shared/contexts/active_record_base_descendants_cleaner.rb
@@ -157,29 +188,29 @@ require_paths:
157
188
  - lib
158
189
  required_ruby_version: !ruby/object:Gem::Requirement
159
190
  requirements:
160
- - - ! '>='
191
+ - - ">="
161
192
  - !ruby/object:Gem::Version
162
- version: '0'
193
+ version: '2.1'
163
194
  required_rubygems_version: !ruby/object:Gem::Requirement
164
195
  requirements:
165
- - - ! '>='
196
+ - - ">="
166
197
  - !ruby/object:Gem::Version
167
198
  version: '0'
168
199
  requirements: []
169
200
  rubyforge_project:
170
- rubygems_version: 2.2.2
201
+ rubygems_version: 2.4.3
171
202
  signing_key:
172
203
  specification_version: 4
173
204
  summary: Extensions to rails-erd to find clusters of models to generate subdomains
174
205
  specific to each model
175
206
  test_files:
207
+ - spec/lib/metasploit/erd/version_spec.rb
208
+ - spec/lib/metasploit/erd_spec.rb
176
209
  - spec/metasploit/erd/cluster_spec.rb
177
210
  - spec/metasploit/erd/diagram_spec.rb
178
211
  - spec/metasploit/erd/entity/class_spec.rb
179
212
  - spec/metasploit/erd/entity/namespace_spec.rb
180
213
  - spec/metasploit/erd/relationship_spec.rb
181
- - spec/metasploit/erd/version_spec.rb
182
- - spec/metasploit/erd_spec.rb
183
214
  - spec/spec_helper.rb
184
215
  - spec/support/shared/contexts/active_record_base_connection.rb
185
216
  - spec/support/shared/contexts/active_record_base_descendants_cleaner.rb
@@ -1,32 +0,0 @@
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
- if defined? YARD
5
- namespace :yard do
6
- YARD::Rake::YardocTask.new(:doc) do |t|
7
- # --no-stats here as 'stats' task called after will print fuller stats
8
- t.options = ['--no-stats']
9
-
10
- t.after = Proc.new {
11
- Rake::Task['yard:stats'].execute
12
- }
13
- end
14
-
15
- task :doc
16
-
17
- desc "Shows stats for YARD Documentation including listing undocumented modules, classes, constants, and methods"
18
- task :stats do
19
- stats = YARD::CLI::Stats.new
20
- stats.run('--compact', '--list-undoc')
21
- end
22
- end
23
-
24
- # @todo Figure out how to just clone description from yard:doc
25
- desc "Generate YARD documentation"
26
- # allow calling namespace to as a task that goes to default task for namespace
27
- task :yard => ['yard:doc']
28
-
29
- task :default => :yard
30
- else
31
- puts 'YARD not defined, so yard tasks cannot be setup.'
32
- end
@@ -1,125 +0,0 @@
1
- require 'spec_helper'
2
-
3
- require 'active_support/core_ext/object/blank'
4
-
5
- describe Metasploit::ERD::Version do
6
- context 'CONSTANTS' do
7
- context 'MAJOR' do
8
- subject(:major) do
9
- described_class::MAJOR
10
- end
11
-
12
- it 'is 0 because the API is not locked yet' do
13
- expect(major).to eq(0)
14
- end
15
- end
16
-
17
- context 'MINOR' do
18
- subject(:minor) do
19
- described_class::MINOR
20
- end
21
-
22
- it { should be_a Integer }
23
- end
24
-
25
- context 'PATCH' do
26
- subject(:patch) do
27
- described_class::PATCH
28
- end
29
-
30
- it { should be_a Integer }
31
- end
32
-
33
- pull_request = ENV['TRAVIS_PULL_REQUEST']
34
-
35
- # a pull request cannot check PRERELEASE because it will be tested in the target branch, but the source itself
36
- # is from the source branch and so has the source branch PRERELEASE.
37
- #
38
- # PRERELEASE can only be set appropriately for a merge by merging to the target branch and then updating PRERELEASE
39
- # on the target branch before committing and/or pushing to github and travis-ci.
40
- if pull_request.nil? || pull_request == 'false'
41
- context 'PREPRELEASE' do
42
- subject(:prerelease) do
43
- described_class::PRERELEASE
44
- end
45
-
46
- branch = ENV['TRAVIS_BRANCH']
47
-
48
- if branch.blank?
49
- branch = `git rev-parse --abbrev-ref HEAD`.strip
50
- end
51
-
52
- if branch == 'master'
53
- it 'does not have a PRERELEASE' do
54
- expect(defined? described_class::PRERELEASE).to be_nil
55
- end
56
- else
57
- feature_regex = /(feature|staging)\/(?<prerelease>.*)/
58
- match = branch.match(feature_regex)
59
-
60
- if match
61
- it 'matches the branch relative name' do
62
- expect(prerelease).to eq(match[:prerelease])
63
- end
64
- else
65
- it 'has a abbreviated reference that can be parsed for prerelease' do
66
- fail "Do not know how to parse #{branch.inspect} for PRERELEASE"
67
- end
68
- end
69
- end
70
- end
71
- end
72
- end
73
-
74
- context 'full' do
75
- subject(:full) do
76
- described_class.full
77
- end
78
-
79
- #
80
- # lets
81
- #
82
-
83
- let(:major) do
84
- 1
85
- end
86
-
87
- let(:minor) do
88
- 2
89
- end
90
-
91
- let(:patch) do
92
- 3
93
- end
94
-
95
- before(:each) do
96
- stub_const("#{described_class}::MAJOR", major)
97
- stub_const("#{described_class}::MINOR", minor)
98
- stub_const("#{described_class}::PATCH", patch)
99
- end
100
-
101
- context 'with PRERELEASE' do
102
- let(:prerelease) do
103
- 'prerelease'
104
- end
105
-
106
- before(:each) do
107
- stub_const("#{described_class}::PRERELEASE", prerelease)
108
- end
109
-
110
- it 'is <major>.<minor>.<patch>-<prerelease>' do
111
- expect(full).to eq("#{major}.#{minor}.#{patch}-#{prerelease}")
112
- end
113
- end
114
-
115
- context 'without PRERELEASE' do
116
- before(:each) do
117
- hide_const("#{described_class}::PRERELEASE")
118
- end
119
-
120
- it 'is <major>.<minor>.<patch>' do
121
- expect(full).to eq("#{major}.#{minor}.#{patch}")
122
- end
123
- end
124
- end
125
- end
@@ -1,15 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Metasploit::ERD do
4
- context 'CONSTANTS' do
5
- context 'VERSION' do
6
- subject(:version) do
7
- described_class::VERSION
8
- end
9
-
10
- it 'is Metasploit::ERD::Version.full' do
11
- expect(version).to eq(Metasploit::ERD::Version.full)
12
- end
13
- end
14
- end
15
- end