churn 1.0.2 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +5 -5
  2. data/{LICENSE → LICENSE.txt} +0 -0
  3. data/README.md +137 -120
  4. data/bin/churn +27 -12
  5. data/churn.gemspec +7 -21
  6. data/lib/churn/calculator.rb +24 -11
  7. data/lib/churn/history.rb +1 -1
  8. data/lib/churn/location_mapping.rb +1 -1
  9. data/lib/churn/options.rb +7 -3
  10. data/lib/churn/scm/bzr_analyzer.rb +11 -4
  11. data/lib/churn/scm/git_analyzer.rb +5 -3
  12. data/lib/churn/scm/hg_analyzer.rb +11 -4
  13. data/lib/churn/scm/source_control.rb +6 -8
  14. data/lib/churn/scm/svn_analyzer.rb +9 -3
  15. data/lib/churn/version.rb +1 -1
  16. metadata +24 -190
  17. data/.deferred_server +0 -1
  18. data/.document +0 -5
  19. data/.gitignore +0 -11
  20. data/.travis.yml +0 -6
  21. data/Gemfile +0 -3
  22. data/Gemfile.lock +0 -79
  23. data/Rakefile +0 -41
  24. data/doc/Churn.html +0 -165
  25. data/doc/Churn/BzrAnalyzer.html +0 -276
  26. data/doc/Churn/ChurnCalculator.html +0 -578
  27. data/doc/Churn/ChurnHistory.html +0 -250
  28. data/doc/Churn/ChurnOptions.html +0 -393
  29. data/doc/Churn/GitAnalyzer.html +0 -311
  30. data/doc/Churn/HgAnalyzer.html +0 -276
  31. data/doc/Churn/LocationMapping.html +0 -448
  32. data/doc/Churn/SourceControl.html +0 -451
  33. data/doc/Churn/SvnAnalyzer.html +0 -311
  34. data/doc/LICENSE.html +0 -123
  35. data/doc/Object.html +0 -246
  36. data/doc/created.rid +0 -15
  37. data/doc/images/add.png +0 -0
  38. data/doc/images/arrow_up.png +0 -0
  39. data/doc/images/brick.png +0 -0
  40. data/doc/images/brick_link.png +0 -0
  41. data/doc/images/bug.png +0 -0
  42. data/doc/images/bullet_black.png +0 -0
  43. data/doc/images/bullet_toggle_minus.png +0 -0
  44. data/doc/images/bullet_toggle_plus.png +0 -0
  45. data/doc/images/date.png +0 -0
  46. data/doc/images/delete.png +0 -0
  47. data/doc/images/find.png +0 -0
  48. data/doc/images/loadingAnimation.gif +0 -0
  49. data/doc/images/macFFBgHack.png +0 -0
  50. data/doc/images/package.png +0 -0
  51. data/doc/images/page_green.png +0 -0
  52. data/doc/images/page_white_text.png +0 -0
  53. data/doc/images/page_white_width.png +0 -0
  54. data/doc/images/plugin.png +0 -0
  55. data/doc/images/ruby.png +0 -0
  56. data/doc/images/tag_blue.png +0 -0
  57. data/doc/images/tag_green.png +0 -0
  58. data/doc/images/transparent.png +0 -0
  59. data/doc/images/wrench.png +0 -0
  60. data/doc/images/wrench_orange.png +0 -0
  61. data/doc/images/zoom.png +0 -0
  62. data/doc/index.html +0 -100
  63. data/doc/js/darkfish.js +0 -155
  64. data/doc/js/jquery.js +0 -18
  65. data/doc/js/navigation.js +0 -142
  66. data/doc/js/search.js +0 -94
  67. data/doc/js/search_index.js +0 -1
  68. data/doc/js/searcher.js +0 -228
  69. data/doc/rdoc.css +0 -595
  70. data/doc/table_of_contents.html +0 -167
  71. data/test/data/churn_calculator.rb +0 -217
  72. data/test/data/test_helper.rb +0 -14
  73. data/test/test_helper.rb +0 -21
  74. data/test/unit/bzr_analyzer_test.rb +0 -65
  75. data/test/unit/churn_calculator_test.rb +0 -181
  76. data/test/unit/churn_history_test.rb +0 -24
  77. data/test/unit/churn_options_test.rb +0 -16
  78. data/test/unit/git_analyzer_test.rb +0 -88
  79. data/test/unit/hg_analyzer_test.rb +0 -66
  80. data/test/unit/location_mapping_test.rb +0 -35
  81. data/test/unit/source_control_test.rb +0 -22
  82. data/test/unit/svn_analyzer_test.rb +0 -65
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c816b4eab0ce4a1311378d6aebf5a7ab04d4ac1d
4
- data.tar.gz: 380238f8db9acad2b7cf0c1f3760f0e75767eb79
2
+ SHA256:
3
+ metadata.gz: dbe39389e7238ce9ac55fb37224083a50b65692de78df6189e1b2cba21819211
4
+ data.tar.gz: adf3e40ea5e98297181a1bf78316fc42c368c560e336797f1d59c38dabfcee4a
5
5
  SHA512:
6
- metadata.gz: 64e214dd33714eba3d30b6f22689b3edc60d1c7d9b6a09085df33aa0aeed8f3fa49607fdd841f39bdb8c49f18752ab966f929bec3ddbd0807cf65844da07a867
7
- data.tar.gz: 884d1fa121966359dcb8df8d457bbc2dc209bde2084ce496a972dcc8820c24a5de9ffe2aee239421a783a7d026248ce3016c38719f5078bc42308fee61cc3a43
6
+ metadata.gz: fca92c6967f4873fa57836bf5ebbc2f05d80a510eda2b61b3fd9fce40b2ca80338962cef98d56930a5520cd73bb53d4665753d41512cb33c86ac3edf40b1470f
7
+ data.tar.gz: d8228f4bcf60a6777e0a590170462019b46d0cfde0fcba4324b2ca5bffef8cf351ce4d4b6036861ac7eb1d6de6d0e77739d5436e45beee8eb1ccbff72be17609
File without changes
data/README.md CHANGED
@@ -1,134 +1,132 @@
1
- Churn
2
- ===
1
+ [![Build Status](https://travis-ci.org/danmayer/churn.svg?branch=master)](http://travis-ci.org/danmayer/churn)
2
+
3
+ # Churn
3
4
 
4
5
  A Project to give the churn file, class, and method for a project for a given checkin. Over time the tool adds up the history of churns to give the number of times a file, class, or method is changing during the life of a project.
5
6
  Churn for files is immediate, but classes and methods requires building up a history using churn between revisions. The history is stored in ./tmp
6
7
 
7
8
  Currently has full Git, Mercurial (hg), Bazaar (bzr) support, and partial SVN support (supports only file level churn currently)
8
9
 
9
- File changes can be calculated on any single commit to look at method changes you need to be running churn over time. Using a git post-commit hook, configuring your CI to run churn, or using [churn-site](http://churn.picoappz.com) is the best way to build up your churn history. See the --past_history (-p) option to do a one time run building up past class and method level churn.
10
-
11
- ####Authors:
12
- * danmayer
13
- * ajwalters
14
- * cldwalker
15
- * absurdhero
16
- * bf4
17
-
18
- ## CI Build Status
10
+ File changes can be calculated on any single commit to look at method changes you need to be running churn over time. Using a git post-commit hook, configuring your CI to run churn. See the --past_history (-p) option to do a one time run building up past class and method level churn.
19
11
 
20
- [![Build Status](https://travis-ci.org/danmayer/churn.svg?branch=master)](http://travis-ci.org/danmayer/churn)
12
+ ## TODO
21
13
 
22
- This project runs [travis-ci.org](http://travis-ci.org)
14
+ Want to help out, there are easy tasks ready for some attention. The list of items is hosted on [github issues](https://github.com/danmayer/churn/issues)
23
15
 
24
- ## TODO
16
+ ## Churn Usage
25
17
 
26
- Want to help out, there are easy tasks ready for some attention. The list of items has been moved to the [churn wafflie.io](http://waffle.io/danmayer/churn)
18
+ Install with `gem install churn` or for bundler add to your Gemfile
27
19
 
28
- [![Stories in Ready](https://badge.waffle.io/danmayer/churn.png)](http://waffle.io/danmayer/churn)
29
20
 
30
- ## Churn Usage
21
+ ```
22
+ group :development do
23
+ gem 'churn'
24
+ end
25
+ ```
31
26
 
32
- Install with `gem install churn` or for bundler add to your Gemfile `gem 'churn', :require => false`.
27
+ ### Rake
33
28
 
34
- The reason you want require false is that when required by default churn is expecting to add some rake tasks, you don't really want or need it loading when running your server or tests.
29
+ * Add `require 'churn'` to Rakefile
30
+ * Then run `rake churn` or `bundle exec rake churn`
31
+ * Use environment variables to control churn defaults
35
32
 
36
- * rake:
37
- * add `require 'churn'` to Rakefile
38
- * then run`rake churn` or `bundle exec rake churn`
39
- * use environment variables to control churn defaults
33
+ ``` ruby
34
+ ENV['CHURN_MINIMUM_CHURN_COUNT']
35
+ ENV['CHURN_START_DATE']
36
+ ENV['CHURN_IGNORES']
37
+ ```
40
38
 
41
- ``` ruby
42
- ENV['CHURN_MINIMUM_CHURN_COUNT']
43
- ENV['CHURN_START_DATE']
44
- ENV['CHURN_IGNORE_FILES']
45
- ```
39
+ ### CLI
46
40
 
47
- * CLI:
48
- * on command line run `churn` or `bundle exec churn`
49
- * need help run `churn -h` to get additional information
50
- * run the executable passing in options to override defaults
41
+ * On the command line run `churn` or `bundle exec churn`
42
+ * Need help? Run `churn -h` to get additional information
43
+ * Run the executable, passing in options to override defaults
51
44
 
52
- ``` bash
53
- churn -i "churn.gemspec, Gemfile" #ignore files
54
- churn -y #output yaml format opposed to text
55
- churn -c 10 #set minimum churn count on a file to 10
56
- churn -c 5 -y -i "Gemfile" #mix and match
57
- churn --start_date "6 months ago" #Start looking at file changes from 6 months ago
58
- churn -p "4 months ago" #churn the past history to build up data for the last 4 months
59
- churn --past_history #churn the past history for default 3 months to build up data
60
- ```
45
+ ```shell
46
+ churn -i "churn.gemspec, Gemfile" # Ignore files
47
+ churn -y # Output yaml format opposed to text
48
+ churn -c 10 # Set minimum churn count on a file to 10
49
+ churn -c 5 -y -i "Gemfile" # Mix and match
50
+ churn -e rb # Specify a file extension. The dot will be prepended automatically ("rb" -> ".rb")
51
+ churn -f app # Specify a file prefix, e.g. app/models
52
+ churn --start_date "6 months ago" # Start looking at file changes from 6 months ago
53
+ churn -p "4 months ago" # Churn the past history to build up data for the last 4 months
54
+ churn --past_history # Churn the past history for default 3 months to build up data
55
+ ```
61
56
 
62
57
  ## Example Output
63
58
 
64
- **********************************************************************
65
- * Revision Changes
66
- **********************************************************************
67
- Files:
68
- +-------------------------------+
69
- | file |
70
- +-------------------------------+
71
- | Rakefile |
72
- | lib/churn/churn_calculator.rb |
73
- +-------------------------------+
74
-
75
- Classes:
76
- +-------------------------------+-----------------+
77
- | file | klass |
78
- +-------------------------------+-----------------+
79
- | lib/churn/churn_calculator.rb | ChurnCalculator |
80
- +-------------------------------+-----------------+
81
-
82
- Methods:
83
- +-------------------------------+----------------- +-------------------------------+
84
- | file | klass | method |
85
- +-------------------------------+-----------------+-------------------------------+
86
- | lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#filters |
87
- | lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#display_array |
88
- | lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#to_s |
89
- +-------------------------------+-----------------+-------------------------------+
90
-
91
- **********************************************************************
92
- * Project Churn
93
- **********************************************************************
94
- Files:
95
- +------------------------------------+---------------+
96
- | file_path | times_changed |
97
- +------------------------------------+---------------+
98
- | lib/churn/churn_calculator.rb | 14 |
99
- | README.rdoc | 7 |
100
- | lib/tasks/churn_tasks.rb | 6 |
101
- | Rakefile | 6 |
102
- | lib/churn/git_analyzer.rb | 4 |
103
- | VERSION | 4 |
104
- | test/test_helper.rb | 4 |
105
- | test/unit/churn_calculator_test.rb | 3 |
106
- | test/churn_test.rb | 3 |
107
- +------------------------------------+---------------+
108
-
109
- Classes:
110
- +-------------------------------+-----------------+---------------+
111
- | file | klass | times_changed |
112
- +-------------------------------+-----------------+---------------+
113
- | lib/churn/churn_calculator.rb | ChurnCalculator | 1 |
114
- | lib/churn/churn_calculator.rb | ChurnCalculator | 1 |
115
- +-------------------------------+-----------------+---------------+
116
-
117
- Methods:
118
- +-------------------------------+-----------------+-----------------------------------------+---------------+
119
- | file | klass | method | times_changed |
120
- +-------------------------------+-----------------+-----------------------------------------+---------------+
121
- | lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#to_s | 1 |
122
- | lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#display_array | 1 |
123
- | lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#calculate_revision_data | 1 |
124
- | lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#filters | 1 |
125
- | lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#initialize | 1 |
126
- | lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#filters | 1 |
127
- | lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#to_s | 1 |
128
- +-------------------------------+-----------------+-----------------------------------------+---------------+
59
+ ```
60
+ **********************************************************************
61
+ * Revision Changes
62
+ **********************************************************************
63
+ Files:
64
+ +-------------------------------+
65
+ | file |
66
+ +-------------------------------+
67
+ | Rakefile |
68
+ | lib/churn/churn_calculator.rb |
69
+ +-------------------------------+
70
+
71
+ Classes:
72
+ +-------------------------------+-----------------+
73
+ | file | klass |
74
+ +-------------------------------+-----------------+
75
+ | lib/churn/churn_calculator.rb | ChurnCalculator |
76
+ +-------------------------------+-----------------+
77
+
78
+ Methods:
79
+ +-------------------------------+-----------------+-------------------------------+
80
+ | file | klass | method |
81
+ +-------------------------------+-----------------+-------------------------------+
82
+ | lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#filters |
83
+ | lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#display_array |
84
+ | lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#to_s |
85
+ +-------------------------------+-----------------+-------------------------------+
86
+
87
+ **********************************************************************
88
+ * Project Churn
89
+ **********************************************************************
90
+ Files:
91
+ +------------------------------------+---------------+
92
+ | file_path | times_changed |
93
+ +------------------------------------+---------------+
94
+ | lib/churn/churn_calculator.rb | 14 |
95
+ | README.rdoc | 7 |
96
+ | lib/tasks/churn_tasks.rb | 6 |
97
+ | Rakefile | 6 |
98
+ | lib/churn/git_analyzer.rb | 4 |
99
+ | VERSION | 4 |
100
+ | test/test_helper.rb | 4 |
101
+ | test/unit/churn_calculator_test.rb | 3 |
102
+ | test/churn_test.rb | 3 |
103
+ +------------------------------------+---------------+
104
+
105
+ Classes:
106
+ +-------------------------------+-----------------+---------------+
107
+ | file | klass | times_changed |
108
+ +-------------------------------+-----------------+---------------+
109
+ | lib/churn/churn_calculator.rb | ChurnCalculator | 1 |
110
+ | lib/churn/churn_calculator.rb | ChurnCalculator | 1 |
111
+ +-------------------------------+-----------------+---------------+
112
+
113
+ Methods:
114
+ +-------------------------------+-----------------+-----------------------------------------+---------------+
115
+ | file | klass | method | times_changed |
116
+ +-------------------------------+-----------------+-----------------------------------------+---------------+
117
+ | lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#to_s | 1 |
118
+ | lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#display_array | 1 |
119
+ | lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#calculate_revision_data | 1 |
120
+ | lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#filters | 1 |
121
+ | lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#initialize | 1 |
122
+ | lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#filters | 1 |
123
+ | lib/churn/churn_calculator.rb | ChurnCalculator | ChurnCalculator#to_s | 1 |
124
+ +-------------------------------+-----------------+-----------------------------------------+---------------+
125
+ ```
129
126
 
130
127
  ## CLI Options
131
128
 
129
+ ```
132
130
  [~/projects/churn] churn -h
133
131
  NAME
134
132
  churn
@@ -140,28 +138,35 @@ The reason you want require false is that when required by default churn is expe
140
138
  --minimum_churn_count=minimum_churn_count, -c (0 ~>
141
139
  int(minimum_churn_count=3))
142
140
  --yaml, -y
141
+ --extension, -e (0 ~> string(file_extension=))
142
+ --prefix, -f (0 ~> string(file_prefix=))
143
143
  --ignore_files=[ignore_files], -i (0 ~> string(ignore_files=))
144
144
  --start_date=[start_date], -s (0 ~> string(start_date=))
145
145
  --data_directory=[data_directory], -d (0 ~> string(data_directory=))
146
146
  --past_history=[past_history], -p (0 ~> string(past_history=))
147
147
  --help, -h
148
+ ```
148
149
 
149
150
  ## Library Options
150
151
 
151
152
  All the CLI options are parsed and just passed into the library. If you want to run the library directly from other code. The best way to see current options is where the [churn executable](https://github.com/danmayer/churn/blob/master/bin/churn) passes the parsed options into the `ChurnCalculator` class
152
153
 
153
- ###
154
- # Available options
155
- ###
156
- options = {:minimum_churn_count => params['minimum_churn_count'].value,
157
- :ignore_files => params['ignore_files'].value,
158
- :start_date => params['start_date'].value,
159
- :data_directory => params['data_directory'].value,
160
- :history => params['past_history'].value,
161
- :report => params['report'].value,
162
- :name => params['name'].value
163
- }
164
- result = Churn::ChurnCalculator.new(options).report(false)
154
+ ```ruby
155
+ ###
156
+ # Available options
157
+ ###
158
+ options = {:minimum_churn_count => params['minimum_churn_count'].value,
159
+ :ignore_files => params['ignore_files'].value,
160
+ :file_extension => params['file_extension'].value,
161
+ :file_prefix => params['file_prefix'].value,
162
+ :start_date => params['start_date'].value,
163
+ :data_directory => params['data_directory'].value,
164
+ :history => params['past_history'].value,
165
+ :report => params['report'].value,
166
+ :name => params['name'].value
167
+ }
168
+ result = Churn::ChurnCalculator.new(options).report(false)
169
+ ```
165
170
 
166
171
  ## Notes on Patches/Pull Requests
167
172
 
@@ -174,6 +179,18 @@ All the CLI options are parsed and just passed into the library. If you want to
174
179
  bump version in a commit by itself I can ignore when I pull)
175
180
  * Send me a pull request. Bonus points for topic branches.
176
181
 
182
+ ## Authors
183
+
184
+ * danmayer
185
+ * ajwalters
186
+ * cldwalker
187
+ * absurdhero
188
+ * bf4
189
+
190
+ ## Code of Conduct
191
+
192
+ Please see our [Code of Conduct](https://github.com/danmayer/churn/blob/master/CODE_OF_CONDUCT.md)
193
+
177
194
  ## Copyright
178
195
 
179
- Copyright (c) 2013 Dan Mayer. See LICENSE for details.
196
+ Copyright (c) 2019 Dan Mayer. See LICENSE for details.
data/bin/churn CHANGED
@@ -39,7 +39,7 @@ Main do
39
39
  cast :string
40
40
  argument :optional
41
41
  default ''
42
- description 'name is require if remotely reporting churn results. If available as a github project, pass name in the form of username/project_name'
42
+ description 'name is required if remotely reporting churn results. If available as a github project, pass name in the form of username/project_name'
43
43
  end
44
44
 
45
45
  option('start_date', 's') do
@@ -61,25 +61,40 @@ Main do
61
61
  default ''
62
62
  end
63
63
 
64
+ option('extension', 'e') do
65
+ cast :string
66
+ argument :optional
67
+ default ''
68
+ end
69
+
70
+ option('prefix', 'f') do
71
+ cast :string
72
+ argument :optional
73
+ default ''
74
+ end
75
+
64
76
  def report_churn(output_string)
65
- options = {:minimum_churn_count => params['minimum_churn_count'].value,
66
- :ignore_files => params['ignore_files'].value,
67
- :start_date => params['start_date'].value,
68
- :data_directory => params['data_directory'].value,
69
- :history => params['past_history'].value,
70
- :report => params['report'].value,
71
- :name => params['name'].value
77
+ options = {
78
+ minimum_churn_count: params['minimum_churn_count'].value,
79
+ ignore_files: params['ignore_files'].value,
80
+ start_date: params['start_date'].value,
81
+ data_directory: params['data_directory'].value,
82
+ history: params['past_history'].value,
83
+ report: params['report'].value,
84
+ name: params['name'].value,
85
+ file_extension: params['extension'].value,
86
+ file_prefix: params['prefix'].value
72
87
  }
73
88
  result = Churn::ChurnCalculator.new(options).report(output_string)
74
- unless output_string
75
- result = YAML::dump(result)
89
+ if output_string
90
+ result
91
+ else
92
+ YAML::dump(result)
76
93
  end
77
- result
78
94
  end
79
95
 
80
96
  def run
81
97
  report = report_churn(!params['yaml'].value)
82
98
  puts report
83
99
  end
84
-
85
100
  end
@@ -6,34 +6,20 @@ Gem::Specification.new do |s|
6
6
  s.name = "churn"
7
7
  s.version = Churn::VERSION
8
8
 
9
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
10
- s.authors = ["Dan Mayer"]
11
- s.date = "2012-12-17"
9
+ s.author = "Dan Mayer"
12
10
  s.summary = "Providing additional churn metrics over the original metric_fu churn"
13
11
  s.description = "High method and class churn has been shown to have increased bug and error rates. This gem helps you know what is changing a lot so you can do additional testing, code review, or refactoring to try to tame the volatile code. "
14
12
  s.email = "dan@mayerdan.com"
15
13
  s.homepage = "http://github.com/danmayer/churn"
16
- s.rubyforge_project = "churn"
17
14
 
18
- s.files = `git ls-files`.split("\n")
19
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
- s.require_paths = ["lib"]
15
+ s.executables = %w[churn]
22
16
 
23
- s.license = 'MIT'
24
- s.extra_rdoc_files = [
25
- "LICENSE",
26
- "README.md"
27
- ]
17
+ s.files = %w[churn.gemspec LICENSE.txt README.md] + Dir["bin/*", "lib/**/*.rb", "man/*"]
18
+ s.license = "MIT"
19
+ s.require_paths = %w[lib]
20
+ s.required_ruby_version = ">= 1.9.3"
21
+ s.requirements = "bzr, git, hg or svn"
28
22
 
29
- s.add_development_dependency "minitest", "~> 5.3"
30
- s.add_development_dependency "shoulda", ">= 0"
31
- s.add_development_dependency "test_construct", "~> 2.0.0"
32
- s.add_development_dependency "rake", ">= 0"
33
- s.add_development_dependency "mocha", "~> 1.1.0"
34
- s.add_development_dependency "simplecov", ">= 0"
35
- s.add_development_dependency "rdoc", ">= 0"
36
- #s.add_development_dependency "ruby-debug", "~> 0.10.4"
37
23
  s.add_runtime_dependency "main", ">= 0"
38
24
  s.add_runtime_dependency "json_pure", ">= 0"
39
25
  s.add_runtime_dependency "chronic", ">= 0.2.3"
@@ -6,16 +6,16 @@ require 'hirb'
6
6
  require 'fileutils'
7
7
  require 'rest_client'
8
8
 
9
- $LOAD_PATH.unshift(File.dirname(__FILE__))
10
- require 'scm/source_control'
11
- require 'scm/git_analyzer'
12
- require 'scm/svn_analyzer'
13
- require 'scm/hg_analyzer'
14
- require 'scm/bzr_analyzer'
15
9
 
16
- require 'location_mapping'
17
- require 'history'
18
- require 'options'
10
+ require_relative 'scm/source_control'
11
+ require_relative 'scm/git_analyzer'
12
+ require_relative 'scm/svn_analyzer'
13
+ require_relative 'scm/hg_analyzer'
14
+ require_relative 'scm/bzr_analyzer'
15
+
16
+ require_relative 'location_mapping'
17
+ require_relative 'history'
18
+ require_relative 'options'
19
19
 
20
20
  module Churn
21
21
 
@@ -45,7 +45,7 @@ module Churn
45
45
  # prepares the data for the given project to be reported.
46
46
  # reads git/svn logs analyzes the output, generates a report and either
47
47
  # formats as a nice string or returns hash.
48
- # @param [Boolean] format to return the data, true for string or false for hash
48
+ # @param [Boolean] print to return the data, true for string or false for hash
49
49
  # @return [Object] returns either a pretty string or a hash representing the
50
50
  # churn of the project
51
51
  def report(print = true)
@@ -89,6 +89,7 @@ module Churn
89
89
  # on the edited files
90
90
  def analyze
91
91
  @changes = sort_changes(@changes)
92
+ @changes = filter_changes(@changes)
92
93
  @changes = @changes.map {|file_path, times_changed| {:file_path => file_path, :times_changed => times_changed }}
93
94
 
94
95
  calculate_revision_changes
@@ -157,6 +158,18 @@ module Churn
157
158
  changes.to_a.sort! {|first,second| second[1] <=> first[1]}
158
159
  end
159
160
 
161
+ def filter_changes(changes)
162
+ if @churn_options.file_extension && !@churn_options.file_extension.empty?
163
+ changes = changes.select { |file_path, _revision_count| file_path =~ /\.#{@churn_options.file_extension}\z/ }
164
+ end
165
+
166
+ if @churn_options.file_prefix && !@churn_options.file_prefix.empty?
167
+ changes = changes.select! { |file_path, _revision_count| file_path =~ /\A#{@churn_options.file_prefix}/ }
168
+ end
169
+
170
+ changes
171
+ end
172
+
160
173
  def filters
161
174
  /.*\.rb/
162
175
  end
@@ -226,7 +239,7 @@ module Churn
226
239
  classes = classes.map{ |klass| {'file' => file, 'klass' => klass} }
227
240
  methods = methods.map{ |method| {'file' => file, 'klass' => get_klass_for(method), 'method' => method} }
228
241
  [classes, methods]
229
- rescue => error
242
+ rescue
230
243
  [[],[]]
231
244
  end
232
245