hotspots 0.1.0 → 0.1.1

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,12 +1,20 @@
1
+ v0.1.1
2
+ -------
3
+
4
+ * Sort for an array of array via spaceship operator returns different result on each run on ruby 1.8.7. Store has a string representation breaks intermittently on 1.8.7. Tests fail intermittently on 1.8.7. So support for ruby 1.9.x only
5
+ * Simplify Rakefile
6
+ * Pull out a minitest_helper
7
+ * Allow gem to be used as a library
8
+
1
9
  v0.1.0
2
10
  ------
3
11
 
4
- * Version bump to force gem install to donwload latest version
12
+ * Version bump to force gem install to download latest version
5
13
 
6
14
  v0.0.13
7
15
  -------
8
16
 
9
- * Fix switch 'since' for git 1.7.2.5 (Thanks to Phil Hofmann)
17
+ * Fix switch 'since' for git 1.7.2.5 (Thanks to Phil Hofmann https://github.com/branch14)
10
18
  * Display a warning and run tests without reporting coverage if simplecov is not present
11
19
  * Change format in verbose mode
12
20
 
@@ -1,3 +1,5 @@
1
+ [![Build Status](https://secure.travis-ci.org/chiku/hotspots.png?branch=master)](https://travis-ci.org/chiku/hotspots)
2
+
1
3
  Overview
2
4
  --------
3
5
 
@@ -28,7 +30,7 @@ Specific options:
28
30
  -f, --file-filter [REGEX] Regular expression to filtering file names. All files are allowed when not specified
29
31
  -m, --message-filter [PIPE SEPARATED] Values to filter files names against each commit message separated by pipe.
30
32
  All files are allowed when not specified
31
- -c, --cutoff [CUTOFF] The minimum occurance to consider for a file to appear in the list. Defaults to zero
33
+ -c, --cutoff [CUTOFF] The minimum occurrence to consider for a file to appear in the list. Defaults to zero
32
34
  -v, --verbose Show verbose output
33
35
  --version Show version information
34
36
  -h, --help Show this message
@@ -61,6 +63,15 @@ gem install simplecov
61
63
  rake
62
64
  ```
63
65
 
66
+ Contributing
67
+ ------------
68
+
69
+ * Fork the project.
70
+ * Make your feature addition or bug fix.
71
+ * Add tests for it. This is important so I don't break it in a future version unintentionally.
72
+ * Commit, but do not mess with the VERSION. If you want to have your own version, that is fine but bump the version in a commit by itself in another branch so I can ignore it when I pull.
73
+ * Send me a pull request.
74
+
64
75
  License
65
76
  -------
66
77
 
data/TODO.md ADDED
@@ -0,0 +1,4 @@
1
+ * Allow better use as a library - add documentation
2
+ * Don't barf if not inside root directory of git
3
+ * Hotspots#initialize validates presence of mandatory arguments - useful when used as library
4
+ * Optional support for colors
@@ -1,8 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
4
- $LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
5
-
6
3
  require 'hotspots'
7
4
 
8
5
  Hotspots::Main.new.execute!
@@ -9,8 +9,8 @@ module Hotspots
9
9
  attr_reader :logger, :options, :repository, :verbose,
10
10
  :exit_strategy, :driver, :parser, :store
11
11
 
12
- def initialize
13
- @options = Hotspots::OptionsParser.new.parse(*ARGV)
12
+ def initialize(opts = nil)
13
+ @options = opts || Hotspots::OptionsParser.new.parse(*ARGV)
14
14
  @repository = options[:repository]
15
15
  @verbose = options[:verbose]
16
16
  @exit_strategy = options[:exit_strategy]
@@ -25,7 +25,7 @@ module Hotspots
25
25
  end
26
26
 
27
27
  def format(message)
28
- "<#{Time.now}> #{message}\n"
28
+ "[#{Time.now}] #{message}\n"
29
29
  end
30
30
  end
31
- end
31
+ end
@@ -23,7 +23,7 @@ module Hotspots
23
23
  private
24
24
 
25
25
  def sorted_array
26
- @store.sort do |(key1, value1), (key2, value2)|
26
+ @sorted_array ||= @store.sort do |(key1, value1), (key2, value2)|
27
27
  value2 <=> value1
28
28
  end
29
29
  end
@@ -1,3 +1,3 @@
1
1
  module Hotspots
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -1,5 +1,7 @@
1
- require File.join(File.expand_path(File.dirname(__FILE__)), '..', '..', 'lib', 'hotspots', 'options_parser')
2
1
  require File.join(File.expand_path(File.dirname(__FILE__)), '..', '..', 'lib', 'hotspots', 'exit_strategy')
2
+ require File.join(File.expand_path(File.dirname(__FILE__)), '..', '..', 'lib', 'hotspots', 'options_parser')
3
+
4
+ require File.join(File.expand_path(File.dirname(__FILE__)), '..', 'minitest_helper')
3
5
 
4
6
  module Hotspots
5
7
  describe "OptionsParser" do
@@ -1,5 +1,7 @@
1
1
  require File.join(File.expand_path(File.dirname(__FILE__)), '..', '..', '..', '..', 'lib', 'hotspots', 'repository', 'parser', 'git')
2
2
 
3
+ require File.join(File.expand_path(File.dirname(__FILE__)), '..', '..', '..', 'minitest_helper')
4
+
3
5
  module Hotspots::Repository
4
6
  describe "Parser::Git" do
5
7
  it "fetches a commit hash based on filter and time" do
@@ -1,5 +1,7 @@
1
1
  require File.join(File.expand_path(File.dirname(__FILE__)), '..', '..', 'lib', 'hotspots', 'store')
2
2
 
3
+ require File.join(File.expand_path(File.dirname(__FILE__)), '..', 'minitest_helper')
4
+
3
5
  module Hotspots
4
6
  describe "Store" do
5
7
  it "counts occurances of a line present once" do
@@ -0,0 +1,17 @@
1
+ begin
2
+ require 'simplecov'
3
+ SimpleCov.start do
4
+ add_filter "/test/"
5
+ end
6
+ rescue LoadError
7
+ puts "\nPlease install simplecov to generate coverage report!\n\n"
8
+ end
9
+
10
+ # eager load all files
11
+ Dir["lib/**/*.rb"].each do |file|
12
+ require File.expand_path(file)
13
+ end
14
+
15
+
16
+ require 'minitest/autorun'
17
+ require 'minitest/spec'
metadata CHANGED
@@ -1,115 +1,126 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: hotspots
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 1
8
- - 0
9
- version: 0.1.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Chirantan Mitra
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2012-08-11 00:00:00 +05:30
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: simplecov
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
12
+ date: 2012-12-22 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- segments:
29
- - 0
30
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
31
22
  type: :development
32
- version_requirements: *id001
33
- - !ruby/object:Gem::Dependency
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
34
31
  name: minitest
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
35
39
  prerelease: false
36
- requirement: &id002 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: simplecov
48
+ requirement: !ruby/object:Gem::Requirement
37
49
  none: false
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- segments:
42
- - 0
43
- version: "0"
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
44
54
  type: :development
45
- version_requirements: *id002
46
- description: |
47
- Find all files that changed over the past days for a git repository. If the same file is modified over
48
- and over again, it may require re-design. Watch out for file changes that don't have a corresponding
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ description: ! 'Find all files that changed over the past days for a git repository.
63
+ If the same file is modified over
64
+
65
+ and over again, it may require re-design. Watch out for file changes that don''t
66
+ have a corresponding
67
+
49
68
  test change.
50
69
 
51
- email:
70
+ '
71
+ email:
52
72
  - chirantan.mitra@gmail.com
53
- executables:
73
+ executables:
54
74
  - hotspots
55
75
  extensions: []
56
-
57
76
  extra_rdoc_files: []
58
-
59
- files:
60
- - .gitignore
61
- - CHANGELOG.markdown
62
- - Gemfile
63
- - LICENSE
64
- - README.markdown
65
- - Rakefile
66
- - bin/hotspots
67
- - hotspots.gemspec
68
- - lib/hotspots.rb
77
+ files:
69
78
  - lib/hotspots/exit_strategy.rb
70
79
  - lib/hotspots/logger.rb
71
80
  - lib/hotspots/options_parser.rb
72
- - lib/hotspots/repository.rb
73
- - lib/hotspots/repository/driver.rb
74
81
  - lib/hotspots/repository/driver/git.rb
75
- - lib/hotspots/repository/parser.rb
82
+ - lib/hotspots/repository/driver.rb
76
83
  - lib/hotspots/repository/parser/git.rb
84
+ - lib/hotspots/repository/parser.rb
85
+ - lib/hotspots/repository.rb
77
86
  - lib/hotspots/store.rb
78
87
  - lib/hotspots/version.rb
88
+ - lib/hotspots.rb
89
+ - bin/hotspots
79
90
  - test/hotspots/options_parser_test.rb
80
91
  - test/hotspots/repository/parser/git_test.rb
81
92
  - test/hotspots/store_test.rb
82
- has_rdoc: true
93
+ - test/minitest_helper.rb
94
+ - LICENSE
95
+ - README.md
96
+ - CHANGELOG.md
97
+ - TODO.md
83
98
  homepage: https://github.com/chiku/hotspots
84
99
  licenses: []
85
-
86
100
  post_install_message:
87
101
  rdoc_options: []
88
-
89
- require_paths:
102
+ require_paths:
90
103
  - lib
91
- required_ruby_version: !ruby/object:Gem::Requirement
104
+ required_ruby_version: !ruby/object:Gem::Requirement
92
105
  none: false
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- segments:
97
- - 0
98
- version: "0"
99
- required_rubygems_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
111
  none: false
101
- requirements:
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- segments:
105
- - 0
106
- version: "0"
112
+ requirements:
113
+ - - ! '>='
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
107
116
  requirements: []
108
-
109
117
  rubyforge_project: hotspots
110
- rubygems_version: 1.3.7
118
+ rubygems_version: 1.8.24
111
119
  signing_key:
112
120
  specification_version: 3
113
121
  summary: Find all files that changed over the past in a git repository based on conditions
114
- test_files: []
115
-
122
+ test_files:
123
+ - test/hotspots/options_parser_test.rb
124
+ - test/hotspots/repository/parser/git_test.rb
125
+ - test/hotspots/store_test.rb
126
+ - test/minitest_helper.rb
data/.gitignore DELETED
@@ -1,2 +0,0 @@
1
- coverage
2
- *.gem
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- # Specify your gem's dependencies in hotspots.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1,53 +0,0 @@
1
- def load_all_tests
2
- require 'rake/runtest'
3
- require 'minitest/autorun'
4
- require 'minitest/spec'
5
-
6
- lib = File.expand_path(File.dirname(__FILE__) + '/lib')
7
- $LOAD_PATH.unshift(lib) if File.directory?(lib) && !$LOAD_PATH.include?(lib)
8
- end
9
-
10
- def load_all_source_files
11
- Dir[File.join(File.expand_path(File.dirname(__FILE__)), "lib", "**", "*.rb")].each do |file|
12
- require file
13
- end
14
- end
15
-
16
- def run_all_tests
17
- Dir[File.join(File.expand_path(File.dirname(__FILE__)), "test", "**", "*_test.rb")].each do |file|
18
- Rake.run_tests file
19
- end
20
- end
21
-
22
- def require_simplecov
23
- begin
24
- require 'simplecov'
25
-
26
- SimpleCov.start do
27
- add_filter "/test/"
28
- end
29
-
30
- rescue LoadError
31
- $stderr.puts <<-EOS
32
-
33
- Could bot generate coverage report since 'simplecov' is unavailable.
34
- Please install simplecov and re-run to generate coverage report.
35
- [sudo] gem install simplecov
36
-
37
- EOS
38
- end
39
- end
40
-
41
- task :test do
42
- load_all_tests
43
- run_all_tests
44
- end
45
-
46
- task :coverage do
47
- require_simplecov
48
- load_all_tests
49
- load_all_source_files
50
- run_all_tests
51
- end
52
-
53
- task :default => [:coverage]
@@ -1,27 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- $:.push File.expand_path("../lib", __FILE__)
4
-
5
- require "hotspots/version"
6
-
7
- Gem::Specification.new do |s|
8
- s.name = "hotspots"
9
- s.version = Hotspots::VERSION
10
- s.authors = ["Chirantan Mitra"]
11
- s.email = ["chirantan.mitra@gmail.com"]
12
- s.homepage = "https://github.com/chiku/hotspots"
13
- s.summary = "Find all files that changed over the past in a git repository based on conditions"
14
- s.description = <<-EOS
15
- Find all files that changed over the past days for a git repository. If the same file is modified over
16
- and over again, it may require re-design. Watch out for file changes that don't have a corresponding
17
- test change.
18
- EOS
19
- s.rubyforge_project = "hotspots"
20
- s.files = `git ls-files`.split("\n")
21
- s.test_files = `git ls-files -- {test}/*`.split("\n")
22
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
23
- s.require_paths = ["lib"]
24
-
25
- s.add_development_dependency "simplecov"
26
- s.add_development_dependency "minitest"
27
- end