turbulence 1.2.4 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,10 @@
1
1
  require 'turbulence/scm/perforce'
2
- require 'rspec/mocks'
3
2
 
4
3
  describe Turbulence::Scm::Perforce do
5
- let (:p4_scm) { Turbulence::Scm::Perforce }
4
+ let(:p4_scm) { Turbulence::Scm::Perforce }
6
5
 
7
6
  before do
8
- p4_scm.stub(:p4_list_changes) do
7
+ allow(p4_scm).to receive(:p4_list_changes).and_return(
9
8
  "Change 62660 on 2005/11/28 by x@client 'CHANGED: adapted to DESCODE '
10
9
  Change 45616 on 2005/07/12 by x@client 'ADDED: trigger that builds and '
11
10
  Change 45615 on 2005/07/12 by x@client 'ADDED: for testing purposes '
@@ -13,9 +12,9 @@ Change 45614 on 2005/07/12 by x@client 'COSMETIC: updated header '
13
12
  Change 11250 on 2004/09/17 by x@client 'CHANGED: trigger now also allow'
14
13
  Change 9250 on 2004/08/20 by x@client 'BUGFIX: bug#1583 (People can so'
15
14
  Change 5560 on 2004/04/26 by x@client 'ADDED: The \"BRANCHED\" tag.'"
16
- end
15
+ )
17
16
 
18
- p4_scm.stub(:p4_describe_change).with("5560") do
17
+ allow(p4_scm).to receive(:p4_describe_change).with("5560").and_return(
19
18
  "Change 5560 by x@client on 2004/04/26 17:25:03
20
19
 
21
20
  ADDED: The \"BRANCHED\" tag.
@@ -38,105 +37,111 @@ changed 1 chunks 3 / 3 lines
38
37
  add 0 chunks 0 lines
39
38
  deleted 0 chunks 0 lines
40
39
  changed 1 chunks 3 / 1 lines"
41
- end
40
+ )
42
41
  end
43
42
 
44
43
  describe "::is_repo?" do
45
44
  before :each do
46
- ENV.stub(:[]).with("P4CLIENT").and_return(nil)
47
- ENV.stub(:[]).with("PATH").and_return("")
45
+ allow(ENV).to receive(:[]).with("P4CLIENT").and_return(nil)
46
+ allow(ENV).to receive(:[]).with("PATH").and_return("")
48
47
  end
49
48
 
50
49
  it "returns true if P4CLIENT is set " do
51
- ENV.stub(:[]).with("P4CLIENT").and_return("c-foo.bar")
50
+ allow(ENV).to receive(:[]).with("P4CLIENT").and_return("c-foo.bar")
52
51
 
53
- Turbulence::Scm::Perforce.is_repo?(".").should be_true
52
+ expect(Turbulence::Scm::Perforce.is_repo?(".")).to be true
54
53
  end
55
54
 
56
- it "returns false if P4CLIENT is empty" do
57
- Turbulence::Scm::Perforce.is_repo?(".").should be_false
55
+ it "returns false if P4CLIENT is empty" do
56
+ expect(Turbulence::Scm::Perforce.is_repo?(".")).to be false
58
57
  end
59
58
 
60
59
  it "returns false if p4 is not available" do
61
- Turbulence::Scm::Perforce.is_repo?(".").should be_false
60
+ expect(Turbulence::Scm::Perforce.is_repo?(".")).to be false
62
61
  end
63
62
  end
64
63
 
65
64
  describe "::log_command" do
66
65
  before do
67
- p4_scm.stub(:depot_to_local).with("//admin/scripts/triggers/enforce-submit-comment.py")\
66
+ allow(p4_scm).to receive(:depot_to_local)
67
+ .with("//admin/scripts/triggers/enforce-submit-comment.py")
68
68
  .and_return("triggers/enforce-submit-comments.py")
69
- p4_scm.stub(:depot_to_local).with("//admin/scripts/triggers/check-consistency.py")\
69
+ allow(p4_scm).to receive(:depot_to_local)
70
+ .with("//admin/scripts/triggers/check-consistency.py")
70
71
  .and_return("triggers/check-consistency.py")
71
- p4_scm.stub(:p4_list_changes) do
72
+ allow(p4_scm).to receive(:p4_list_changes).and_return(
72
73
  "Change 5560 on 2004/04/26 by x@client 'ADDED: The \"BRANCHED\" tag.'"
73
- end
74
+ )
74
75
  end
75
76
 
76
77
  it "takes an optional argument to specify the range" do
77
- expect{Turbulence::Scm::Perforce.log_command("@1,2")}.to_not raise_error
78
+ expect { Turbulence::Scm::Perforce.log_command("@1,2") }.to_not raise_error
78
79
  end
79
80
 
80
81
  it "lists insertions/deletions per file and change" do
81
- Turbulence::Scm::Perforce.log_command().should match(/\d+\t\d+\t[A-z.]*/)
82
+ expect(Turbulence::Scm::Perforce.log_command()).to match(/\d+\t\d+\t[A-z.]*/)
82
83
  end
83
84
  end
84
85
 
85
86
  describe "::changes" do
86
87
  it "lists changenumbers from parsing 'p4 changes' output" do
87
- p4_scm.changes.should =~ %w[62660 45616 45615 45614 11250 9250 5560]
88
+ expect(p4_scm.changes).to match_array(%w[62660 45616 45615 45614 11250 9250 5560])
88
89
  end
89
90
  end
90
91
 
91
92
  describe "::files_per_change" do
92
93
  before do
93
- p4_scm.stub(:depot_to_local).with("//admin/scripts/triggers/enforce-submit-comment.py")\
94
+ allow(p4_scm).to receive(:depot_to_local)
95
+ .with("//admin/scripts/triggers/enforce-submit-comment.py")
94
96
  .and_return("triggers/enforce-submit-comments.py")
95
- p4_scm.stub(:depot_to_local).with("//admin/scripts/triggers/check-consistency.py")\
97
+ allow(p4_scm).to receive(:depot_to_local)
98
+ .with("//admin/scripts/triggers/check-consistency.py")
96
99
  .and_return("triggers/check-consistency.py")
97
100
  end
98
101
 
99
102
  it "lists files with churn" do
100
- p4_scm.files_per_change("5560").should =~ [[4,"triggers/enforce-submit-comments.py"],
101
- [1,"triggers/check-consistency.py"]]
103
+ expect(p4_scm.files_per_change("5560")).to match_array([
104
+ [4, "triggers/enforce-submit-comments.py"],
105
+ [1, "triggers/check-consistency.py"]
106
+ ])
102
107
  end
103
108
  end
104
109
 
105
110
  describe "::transform_for_output" do
106
111
  it "adds a 0 for deletions" do
107
- p4_scm.transform_for_output([1,"triggers/check-consistency.py"]).should == "1\t0\ttriggers/check-consistency.py\n"
112
+ expect(p4_scm.transform_for_output([1, "triggers/check-consistency.py"])).to eq "1\t0\ttriggers/check-consistency.py\n"
108
113
  end
109
114
  end
110
115
 
111
116
  describe "::depot_to_local" do
112
117
  describe "on windows" do
113
118
  before do
114
- p4_scm.stub(:extract_clientfile_from_fstat_of).and_return("D:/Perforce/admin/scripts/triggers/enforce-no-head-change.py")
115
- FileUtils.stub(:pwd).and_return("D:/Perforce")
119
+ allow(p4_scm).to receive(:extract_clientfile_from_fstat_of)
120
+ .and_return("D:/Perforce/admin/scripts/triggers/enforce-no-head-change.py")
121
+ allow(FileUtils).to receive(:pwd).and_return("D:/Perforce")
116
122
  end
117
123
 
118
124
  it "converts depot-style paths to local paths using forward slashes" do
119
- p4_scm.depot_to_local("//admin/scripts/triggers/enforce-no-head-change.py").should \
120
- == "admin/scripts/triggers/enforce-no-head-change.py"
125
+ expect(p4_scm.depot_to_local("//admin/scripts/triggers/enforce-no-head-change.py")).to eq "admin/scripts/triggers/enforce-no-head-change.py"
121
126
  end
122
127
  end
123
128
 
124
129
  describe "on unix" do
125
130
  before do
126
- p4_scm.stub(:extract_clientfile_from_fstat_of).and_return("/home/jhwist/admin/scripts/triggers/enforce-no-head-change.py")
127
- FileUtils.stub(:pwd).and_return("/home/jhwist")
131
+ allow(p4_scm).to receive(:extract_clientfile_from_fstat_of)
132
+ .and_return("/home/jhwist/admin/scripts/triggers/enforce-no-head-change.py")
133
+ allow(FileUtils).to receive(:pwd).and_return("/home/jhwist")
128
134
  end
129
135
 
130
136
  it "converts depot-style paths to local paths using forward slashes" do
131
- p4_scm.depot_to_local("//admin/scripts/triggers/enforce-no-head-change.py").should \
132
- == "admin/scripts/triggers/enforce-no-head-change.py"
137
+ expect(p4_scm.depot_to_local("//admin/scripts/triggers/enforce-no-head-change.py")).to eq "admin/scripts/triggers/enforce-no-head-change.py"
133
138
  end
134
139
  end
135
140
  end
136
141
 
137
142
  describe "::extract_clientfile_from_fstat_of" do
138
143
  before do
139
- p4_scm.stub(:p4_fstat) do
144
+ allow(p4_scm).to receive(:p4_fstat).and_return(
140
145
  "... depotFile //admin/scripts/triggers/enforce-no-head-change.py
141
146
  ... clientFile /home/jhwist/admin/scripts/triggers/enforce-no-head-change.py
142
147
  ... isMapped
@@ -147,24 +152,23 @@ changed 1 chunks 3 / 1 lines"
147
152
  ... headChange 211211
148
153
  ... headModTime 1214555028
149
154
  ... haveRev 5"
150
- end
155
+ )
151
156
  end
152
157
 
153
- it "uses clientFile field" do
154
- p4_scm.extract_clientfile_from_fstat_of("//admin/scripts/triggers/enforce-no-head-change.py").should ==
155
- "/home/jhwist/admin/scripts/triggers/enforce-no-head-change.py"
158
+ it "uses clientFile field" do
159
+ expect(p4_scm.extract_clientfile_from_fstat_of("//admin/scripts/triggers/enforce-no-head-change.py")).to eq "/home/jhwist/admin/scripts/triggers/enforce-no-head-change.py"
156
160
  end
157
161
  end
158
162
 
159
163
  describe "::sum_of_changes" do
160
164
  it "sums up changes" do
161
165
  output = "add 1 chunks 1 lines\ndeleted 0 chunks 0 lines\nchanged 1 chunks 3 / 3 lines"
162
- p4_scm.sum_of_changes(output).should == 4
166
+ expect(p4_scm.sum_of_changes(output)).to eq 4
163
167
  end
164
168
 
165
169
  it "ignores junk" do
166
170
  output = "add nothing, change nothing"
167
- p4_scm.sum_of_changes(output).should == 0
171
+ expect(p4_scm.sum_of_changes(output)).to eq 0
168
172
  end
169
173
  end
170
174
  end
@@ -13,11 +13,11 @@ describe Turbulence do
13
13
  }
14
14
 
15
15
  it "finds files of interest" do
16
- turb.files_of_interest.should include "lib/turbulence.rb"
16
+ expect(turb.files_of_interest).to include "lib/turbulence.rb"
17
17
  end
18
-
19
- it "filters out exluded files" do
18
+
19
+ it "filters out excluded files" do
20
20
  config.exclusion_pattern = 'turbulence'
21
- turb.files_of_interest.should_not include "lib/turbulence.rb"
21
+ expect(turb.files_of_interest).not_to include "lib/turbulence.rb"
22
22
  end
23
23
  end
data/turbulence.gemspec CHANGED
@@ -1,4 +1,5 @@
1
- # -*- encoding: utf-8 -*-
1
+ # frozen_string_literal: true
2
+
2
3
  $:.push File.expand_path("../lib", __FILE__)
3
4
  require "turbulence/version"
4
5
 
@@ -8,21 +9,24 @@ Gem::Specification.new do |s|
8
9
  s.platform = Gem::Platform::RUBY
9
10
  s.authors = ["Chad Fowler", "Michael Feathers", "Corey Haines"]
10
11
  s.email = ["chad@chadfowler.com", "mfeathers@obtiva.com", "coreyhaines@gmail.com"]
11
- s.homepage = "http://chadfowler.com"
12
- s.add_dependency "flog", "~>4.1"
13
- s.add_dependency "json", ">= 1.4.6"
12
+ s.homepage = "https://github.com/chad/turbulence"
13
+ s.license = "MIT"
14
+
15
+ s.add_dependency "flog", ">= 4.1"
16
+ s.add_dependency "json"
14
17
  s.add_dependency "launchy", ">= 2.0.0"
15
- s.add_development_dependency 'rspec', '~> 2.14.0'
18
+ s.add_dependency "racc" # Required by flog's ruby_parser, removed from stdlib in Ruby 3.3+
19
+
20
+ s.add_development_dependency 'rspec', '~> 3.0'
21
+ s.add_development_dependency 'rspec-its'
16
22
  s.add_development_dependency 'rake'
17
23
 
18
24
  s.summary = %q{Automates churn + flog scoring on a git repo for a Ruby project}
19
- s.description = %q{Based on this http://www.stickyminds.com/sitewide.asp?Function=edetail&ObjectType=COL&ObjectId=16679&tth=DYN&tt=siteemail&iDyn=2}
20
-
21
- s.rubyforge_project = "turbulence"
25
+ s.description = %q{Automates churn + flog scoring on a git repo for a Ruby project. Based on the article https://www.stickyminds.com/article/getting-empirical-about-refactoring}
22
26
 
23
27
  s.files = `git ls-files`.split("\n")
24
28
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
25
29
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
26
30
  s.require_paths = ["lib"]
27
- s.required_ruby_version = '>= 1.8.7'
31
+ s.required_ruby_version = '>= 3.0'
28
32
  end
metadata CHANGED
@@ -1,88 +1,116 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turbulence
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chad Fowler
8
8
  - Michael Feathers
9
9
  - Corey Haines
10
- autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2014-07-07 00:00:00.000000000 Z
12
+ date: 1980-01-02 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: flog
17
16
  requirement: !ruby/object:Gem::Requirement
18
17
  requirements:
19
- - - ~>
18
+ - - ">="
20
19
  - !ruby/object:Gem::Version
21
20
  version: '4.1'
22
21
  type: :runtime
23
22
  prerelease: false
24
23
  version_requirements: !ruby/object:Gem::Requirement
25
24
  requirements:
26
- - - ~>
25
+ - - ">="
27
26
  - !ruby/object:Gem::Version
28
27
  version: '4.1'
29
28
  - !ruby/object:Gem::Dependency
30
29
  name: json
31
30
  requirement: !ruby/object:Gem::Requirement
32
31
  requirements:
33
- - - '>='
32
+ - - ">="
34
33
  - !ruby/object:Gem::Version
35
- version: 1.4.6
34
+ version: '0'
36
35
  type: :runtime
37
36
  prerelease: false
38
37
  version_requirements: !ruby/object:Gem::Requirement
39
38
  requirements:
40
- - - '>='
39
+ - - ">="
41
40
  - !ruby/object:Gem::Version
42
- version: 1.4.6
41
+ version: '0'
43
42
  - !ruby/object:Gem::Dependency
44
43
  name: launchy
45
44
  requirement: !ruby/object:Gem::Requirement
46
45
  requirements:
47
- - - '>='
46
+ - - ">="
48
47
  - !ruby/object:Gem::Version
49
48
  version: 2.0.0
50
49
  type: :runtime
51
50
  prerelease: false
52
51
  version_requirements: !ruby/object:Gem::Requirement
53
52
  requirements:
54
- - - '>='
53
+ - - ">="
55
54
  - !ruby/object:Gem::Version
56
55
  version: 2.0.0
56
+ - !ruby/object:Gem::Dependency
57
+ name: racc
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
57
70
  - !ruby/object:Gem::Dependency
58
71
  name: rspec
59
72
  requirement: !ruby/object:Gem::Requirement
60
73
  requirements:
61
- - - ~>
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '3.0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '3.0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: rspec-its
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
62
89
  - !ruby/object:Gem::Version
63
- version: 2.14.0
90
+ version: '0'
64
91
  type: :development
65
92
  prerelease: false
66
93
  version_requirements: !ruby/object:Gem::Requirement
67
94
  requirements:
68
- - - ~>
95
+ - - ">="
69
96
  - !ruby/object:Gem::Version
70
- version: 2.14.0
97
+ version: '0'
71
98
  - !ruby/object:Gem::Dependency
72
99
  name: rake
73
100
  requirement: !ruby/object:Gem::Requirement
74
101
  requirements:
75
- - - '>='
102
+ - - ">="
76
103
  - !ruby/object:Gem::Version
77
104
  version: '0'
78
105
  type: :development
79
106
  prerelease: false
80
107
  version_requirements: !ruby/object:Gem::Requirement
81
108
  requirements:
82
- - - '>='
109
+ - - ">="
83
110
  - !ruby/object:Gem::Version
84
111
  version: '0'
85
- description: Based on this http://www.stickyminds.com/sitewide.asp?Function=edetail&ObjectType=COL&ObjectId=16679&tth=DYN&tt=siteemail&iDyn=2
112
+ description: Automates churn + flog scoring on a git repo for a Ruby project. Based
113
+ on the article https://www.stickyminds.com/article/getting-empirical-about-refactoring
86
114
  email:
87
115
  - chad@chadfowler.com
88
116
  - mfeathers@obtiva.com
@@ -92,13 +120,17 @@ executables:
92
120
  extensions: []
93
121
  extra_rdoc_files: []
94
122
  files:
95
- - .gitignore
96
- - .travis.yml
123
+ - ".github/workflows/ci.yml"
124
+ - ".gitignore"
125
+ - CHANGELOG.md
97
126
  - Gemfile
98
127
  - Gemfile.lock
128
+ - LICENSE.txt
99
129
  - README.md
100
130
  - Rakefile
101
131
  - bin/bule
132
+ - docs/scatter-plot.png
133
+ - docs/treemap.png
102
134
  - lib/turbulence.rb
103
135
  - lib/turbulence/calculators/churn.rb
104
136
  - lib/turbulence/calculators/complexity.rb
@@ -129,27 +161,25 @@ files:
129
161
  - template/turbulence.html
130
162
  - turbulence.gemspec
131
163
  - win_rakefile_location_fix.rb
132
- homepage: http://chadfowler.com
133
- licenses: []
164
+ homepage: https://github.com/chad/turbulence
165
+ licenses:
166
+ - MIT
134
167
  metadata: {}
135
- post_install_message:
136
168
  rdoc_options: []
137
169
  require_paths:
138
170
  - lib
139
171
  required_ruby_version: !ruby/object:Gem::Requirement
140
172
  requirements:
141
- - - '>='
173
+ - - ">="
142
174
  - !ruby/object:Gem::Version
143
- version: 1.8.7
175
+ version: '3.0'
144
176
  required_rubygems_version: !ruby/object:Gem::Requirement
145
177
  requirements:
146
- - - '>='
178
+ - - ">="
147
179
  - !ruby/object:Gem::Version
148
180
  version: '0'
149
181
  requirements: []
150
- rubyforge_project: turbulence
151
- rubygems_version: 2.0.6
152
- signing_key:
182
+ rubygems_version: 4.0.10
153
183
  specification_version: 4
154
184
  summary: Automates churn + flog scoring on a git repo for a Ruby project
155
185
  test_files:
data/.travis.yml DELETED
@@ -1,6 +0,0 @@
1
- rvm:
2
- - "1.9.3"
3
- - "1.9.2"
4
- - "1.8.7"
5
- - jruby-18mode
6
- - jruby-19mode