git_fame 2.5.1 → 2.5.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9c0f291251379ffd12d8d5a82f8185cacaefa0f8
4
- data.tar.gz: 6cc2c5ffda6a473f738d8d00072f493ed878bdd1
3
+ metadata.gz: d193069cf48839443661210c94fd812dd1490568
4
+ data.tar.gz: e3fe0a34dacc2719ccb40cd641fbf3ec5024cfc1
5
5
  SHA512:
6
- metadata.gz: c3412be9da9e3e78cda2b4da3fa5f446692f496f19c49487e7f52866d3aed6647cec40133eb9e655c7aeeedb740e6aa05a0dd9c25a9c8259dae0dc00026c6539
7
- data.tar.gz: 63b0da5c88dff9c8925a0d647d17acae01006972e9481e64e6c7fd90d505d08788fa00dfcc3dab2d9b112b76f23cfcf5f9a8d0d968fb0f26d79f595ca62f8988
6
+ metadata.gz: 75453bb3d6694ccb3d934a3cb234278c6dfecbcd9f9f2550f5edce1a10c776d345d50a077cc4c33b94b5aba2c7d8ebd59c874fd2f80b642e07062daa3393bece
7
+ data.tar.gz: 645e9ccb6e9bf43b8fc7d39a3ab953bc16de8c927579f7647f24db4a755ccc02613a3fc945cf9db9753e64e8cef1caf5c9d0d584c98d37db87d5619976cd1be9
@@ -1,3 +1,3 @@
1
1
  [submodule "spec/fixtures/gash"]
2
2
  path = spec/fixtures/gash
3
- url = git://github.com/water/gash.git
3
+ url = https://github.com/water/gash.git
@@ -6,16 +6,11 @@ rvm:
6
6
  - 2.0.0
7
7
  - 1.9.3
8
8
  script:
9
- - 'rspec spec'
9
+ - bundle exec rspec spec
10
10
  notifications:
11
11
  webhooks:
12
12
  urls:
13
13
  - https://webhooks.gitter.im/e/e2b034ea2dbc919b02f7
14
- on_success: change # options: [always|never|change] default: always
15
- on_failure: change # options: [always|never|change] default: always
16
- on_start: false # default: false
17
- before_install:
18
- - sudo add-apt-repository ppa:git-core/ppa -y
19
- - sudo apt-get update -q
20
- - sudo apt-get install git -y
21
- - gem install bundler
14
+ on_success: change
15
+ on_failure: change
16
+ on_start: false
@@ -36,6 +36,7 @@ Generates stats like:
36
36
  gem.add_development_dependency("json", "~> 1.8.3")
37
37
  gem.add_development_dependency("tins", "~> 1.6.0")
38
38
  gem.add_development_dependency("term-ansicolor", "~> 1.3.2")
39
+ gem.add_development_dependency("colorize")
39
40
 
40
41
  gem.required_ruby_version = ">= 1.9.2"
41
42
  end
@@ -88,7 +88,6 @@ module GitFame
88
88
  ]
89
89
  @wopt = args.fetch(:whitespace, false) ? "-w" : ""
90
90
  @authors = {}
91
- @cache = {}
92
91
  @verbose = args.fetch(:verbose, false)
93
92
  populate
94
93
  end
@@ -368,6 +367,13 @@ module GitFame
368
367
  @authors[(email || "").strip] ||= Author.new({ parent: self, name: name })
369
368
  end
370
369
 
370
+ # Lists the paths to contained git submodules
371
+ def current_submodules
372
+ execute("git config --file .gitmodules --get-regexp path | awk '{ print $2 }'") do |result|
373
+ result.to_s.split(/\n/)
374
+ end
375
+ end
376
+
371
377
  # List all files in current git directory, excluding
372
378
  # extensions in @extensions defined by the user
373
379
  def current_files
@@ -376,13 +382,9 @@ module GitFame
376
382
  filter_files(result.to_s.split(/\n/))
377
383
  end
378
384
  else
379
- execute("git #{git_directory_params} ls-tree -r #{commit_range.to_s}") do |result|
380
- lines = result.to_s.split(/\n/).inject([]) do |lines, line|
381
- # Ignore submodules
382
- next lines if line.strip.match(/^160000/)
383
- next [line.split(/\s+/).last] + lines
384
- end
385
- filter_files(lines)
385
+ submodules = current_submodules
386
+ execute("git #{git_directory_params} ls-tree -r #{commit_range.to_s} --name-only") do |result|
387
+ filter_files(result.to_s.split(/\n/).select { |f| !submodules.index(f) })
386
388
  end
387
389
  end
388
390
  end
@@ -1,3 +1,3 @@
1
1
  module GitFame
2
- VERSION = "2.5.1"
2
+ VERSION = "2.5.2"
3
3
  end
@@ -134,8 +134,8 @@ describe GitFame::Base do
134
134
  })
135
135
  end
136
136
 
137
- let(:author) do
138
- subject.authors.find do |author|
137
+ let(:author) do
138
+ subject.authors.find do |author|
139
139
  author.name == "7rans"
140
140
  end
141
141
  end
@@ -461,4 +461,28 @@ describe GitFame::Base do
461
461
  }).commits.should eq(4)
462
462
  end
463
463
  end
464
+
465
+ describe "sub modules" do
466
+ it "should ignore any sub modules" do
467
+ before = GitFame::Base.new({repository: repository})
468
+ Dir.chdir(repository) do
469
+ `git submodule deinit levenshteinish 2>&1`
470
+ `git rm levenshteinish 2>&1`
471
+ `git submodule add https://github.com/oleander/levenshteinish.git`
472
+ `git submodule init`
473
+ `git add . && git commit -m "Add submodule"`
474
+ end
475
+ after = GitFame::Base.new({repository: repository})
476
+
477
+ before.authors.count.should eq(after.authors.count)
478
+ before.authors.zip(after.authors).each do |authors|
479
+ [:name, :raw_files, :raw_commits,
480
+ :raw_loc, :files_list,
481
+ :file_type_counts
482
+ ].each do |field|
483
+ authors[0].send(field).should eq(authors[1].send(field))
484
+ end
485
+ end
486
+ end
487
+ end
464
488
  end
@@ -4,6 +4,7 @@ require "coveralls"
4
4
  require "rspec/collection_matchers"
5
5
  require "rspec/expectations"
6
6
  require "pp"
7
+ require "colorize"
7
8
  require_relative "./support/startup"
8
9
 
9
10
  Coveralls.wear!
@@ -41,18 +42,18 @@ RSpec.configure do |config|
41
42
  mocks.syntax = :should
42
43
  end
43
44
  config.fail_fast = false
44
- config.before(:all) do
45
+ config.before(:each) do
45
46
  Dir.chdir(repository) { system "git checkout 7ab01bc5a720 > /dev/null 2>&1" }
46
47
  end
47
48
  config.before(:suite) do
48
49
  ENV["TZ"] = "GMT-2"
49
50
  warn "-----------"
50
- warn "Current environment:"
51
+ warn "Current environment:".yellow
51
52
  warn "\t#{`git --version`.strip}"
52
53
  warn "\t#{`grep --version`.strip}"
53
- warn "Spec notes:"
54
+ warn "Spec notes:".yellow
54
55
  if suppress_stdout
55
- warn "\tMessages to STDOUT has been suppressed. See spec/spec_helper.rb"
56
+ warn "\tMessages to STDOUT has been suppressed. See spec/spec_helper.rb".red
56
57
  end
57
58
  warn "\tRequires git 2.x for specs to pass"
58
59
  warn "\tTime zone during testing is set to #{ENV["TZ"]}"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_fame
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 2.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Linus Oleander
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-26 00:00:00.000000000 Z
11
+ date: 2017-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: progressbar
@@ -192,6 +192,20 @@ dependencies:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
194
  version: 1.3.2
195
+ - !ruby/object:Gem::Dependency
196
+ name: colorize
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
195
209
  description: A command-line tool that helps you summarize and pretty-print collaborators
196
210
  in a git repository based on contributions
197
211
  email: