churn 0.0.3 → 0.0.4

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.
Files changed (5) hide show
  1. data/README.rdoc +50 -2
  2. data/Rakefile +2 -1
  3. data/VERSION +1 -1
  4. data/bin/churn +13 -4
  5. metadata +13 -2
@@ -1,7 +1,51 @@
1
1
  = churn
2
2
 
3
3
  A Project to give the churn file, class, and method for a project for a given checkin
4
- This will allow us over time to give the number of times a file, class, or method is changing during the life of a project.
4
+ Over time the tool adds up the history of chruns to give the number of times a file, class, or method is changing during the life of a project.
5
+ Churn for files is immediate, but classes and methods requires buildings up a history using churn between revisions. The history is stored in ./tmp
6
+
7
+ == Example Output
8
+ **********************************************************************
9
+ * Project Churn
10
+ **********************************************************************
11
+ files:
12
+ * {:file_path=>"lib/churn/churn_calculator.rb", :times_changed=>11}
13
+ * {:file_path=>"README.rdoc", :times_changed=>6}
14
+ * {:file_path=>"lib/tasks/churn_tasks.rb", :times_changed=>6}
15
+ * {:file_path=>"Rakefile", :times_changed=>4}
16
+ * {:file_path=>"lib/churn/git_analyzer.rb", :times_changed=>4}
17
+ * {:file_path=>"test/test_helper.rb", :times_changed=>4}
18
+ * {:file_path=>"test/unit/churn_calculator_test.rb", :times_changed=>3}
19
+ * {:file_path=>"test/churn_test.rb", :times_changed=>3}
20
+ * {:file_path=>"VERSION", :times_changed=>3}
21
+
22
+ classes:
23
+ * {"klass"=>{"klass"=>"ChurnCalculator", "file"=>"lib/churn/churn_calculator.rb"}, "times_changed"=>7}
24
+ * {"klass"=>{"klass"=>"LocationMapping", "file"=>"lib/churn/location_mapping.rb"}, "times_changed"=>1}
25
+ * {"klass"=>{"klass"=>"GitAnalyzer", "file"=>"lib/churn/git_analyzer.rb"}, "times_changed"=>1}
26
+ * {"klass"=>{"klass"=>"ChurnTest", "file"=>"test/churn_test.rb"}, "times_changed"=>1}
27
+ * {"klass"=>{"klass"=>"ChurnCalculatorTest", "file"=>"test/unit/churn_calculator_test.rb"}, "times_changed"=>1}
28
+
29
+ methods:
30
+ * {"method"=>{"klass"=>"ChurnCalculator", "method"=>"ChurnCalculator#to_h", "file"=>"lib/churn/churn_calculator.rb"}, "times_changed"=>3}
31
+ * {"method"=>{"klass"=>"ChurnCalculator", "method"=>"ChurnCalculator#analyze", "file"=>"lib/churn/churn_calculator.rb"}, "times_changed"=>2}
32
+ * {"method"=>{"klass"=>"ChurnCalculator", "method"=>"ChurnCalculator#report", "file"=>"lib/churn/churn_calculator.rb"}, "times_changed"=>2}
33
+ * {"method"=>{"klass"=>"ChurnCalculator", "method"=>"ChurnCalculator#calculate_changes!", "file"=>"lib/churn/churn_calculator.rb"}, "times_changed"=>1}
34
+ * {"method"=>{"klass"=>"ChurnCalculator", "method"=>"ChurnCalculator#display_array", "file"=>"lib/churn/churn_calculator.rb"}, "times_changed"=>1}
35
+ * {"method"=>{"klass"=>"ChurnCalculator", "method"=>"ChurnCalculator#calculate_revision_changes", "file"=>"lib/churn/churn_calculator.rb"}, "times_changed"=>1}
36
+ * {"method"=>{"klass"=>"ChurnCalculator", "method"=>"ChurnCalculator#initialize", "file"=>"lib/churn/churn_calculator.rb"}, "times_changed"=>1}
37
+ * {"method"=>{"klass"=>"ChurnCalculator", "method"=>"ChurnCalculator#set_source_control", "file"=>"lib/churn/churn_calculator.rb"}, "times_changed"=>1}
38
+ * {"method"=>{"klass"=>"ChurnCalculator", "method"=>"ChurnCalculator#get_changes", "file"=>"lib/churn/churn_calculator.rb"}, "times_changed"=>1}
39
+ * {"method"=>{"klass"=>"ChurnCalculator", "method"=>"ChurnCalculator#calculate_revision_data", "file"=>"lib/churn/churn_calculator.rb"}, "times_changed"=>1}
40
+ * {"method"=>{"klass"=>"ChurnCalculator", "method"=>"ChurnCalculator#emit", "file"=>"lib/churn/churn_calculator.rb"}, "times_changed"=>1}
41
+ * {"method"=>{"klass"=>"GitAnalyzer", "method"=>"GitAnalyzer#date_range", "file"=>"lib/churn/git_analyzer.rb"}, "times_changed"=>1}
42
+ * {"method"=>{"klass"=>"", "method"=>"#report_churn", "file"=>"lib/tasks/churn_tasks.rb"}, "times_changed"=>1}
43
+ * {"method"=>{"klass"=>"ChurnCalculator", "method"=>"ChurnCalculator#get_klass_for", "file"=>"lib/churn/churn_calculator.rb"}, "times_changed"=>1}
44
+ * {"method"=>{"klass"=>"GitAnalyzer", "method"=>"GitAnalyzer#get_recent_file", "file"=>"lib/churn/git_analyzer.rb"}, "times_changed"=>1}
45
+ * {"method"=>{"klass"=>"GitAnalyzer", "method"=>"GitAnalyzer#get_updated_files_change_info", "file"=>"lib/churn/git_analyzer.rb"}, "times_changed"=>1}
46
+ * {"method"=>{"klass"=>"GitAnalyzer", "method"=>"GitAnalyzer#get_changed_range", "file"=>"lib/churn/git_analyzer.rb"}, "times_changed"=>1}
47
+ * {"method"=>{"klass"=>"ChurnCalculator", "method"=>"ChurnCalculator#parse_logs_for_updated_files", "file"=>"lib/churn/churn_calculator.rb"}, "times_changed"=>1}
48
+ * {"method"=>{"klass"=>"LocationMapping", "method"=>"LocationMapping#process_class", "file"=>"lib/churn/location_mapping.rb"}, "times_changed"=>1}
5
49
 
6
50
  TODO:
7
51
  * SVN only supports file
@@ -9,7 +53,11 @@ TODO:
9
53
  * allow passing in directories to churn, directories to ignore
10
54
  * todo add a filter that allows for other files besides. *.rb
11
55
 
12
- Usage:
56
+ Executable Usage:
57
+ * 'gem install churn'
58
+ * go to project root run 'churn'
59
+
60
+ Rake Usage:
13
61
  * 'gem install churn'
14
62
  * on any project you want to use churn, add "require 'churn'" to your rake file
15
63
  * run 'rake churn' to view the current output, file churn history is immediate, class and method churn builds up a history as it is run on each revision
data/Rakefile CHANGED
@@ -12,7 +12,8 @@ begin
12
12
  gem.homepage = "http://github.com/danmayer/churn"
13
13
  gem.authors = ["Dan Mayer"]
14
14
  gem.add_development_dependency "thoughtbot-shoulda"
15
- gem.add_development_dependency "main"
15
+ gem.add_dependency "main"
16
+ gem.add_dependency "json"
16
17
  gem.executables = ['churn']
17
18
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
18
19
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
data/bin/churn CHANGED
@@ -4,18 +4,27 @@ require 'main'
4
4
  #example usage. In the root of a project 'churn', or 'churn --help'
5
5
  Main do
6
6
  option('minimum_churn_count', 'c') do
7
- argument :required
7
+ argument :required
8
8
  cast :int
9
9
  default 3
10
10
  end
11
11
 
12
- def report_churn()
12
+ option('yaml', 'y') do
13
+ cast :boolean
14
+ default false
15
+ end
16
+
17
+ def report_churn(output_string)
13
18
  require File.join(File.dirname(__FILE__), '..', 'lib', 'churn', 'churn_calculator')
14
- Churn::ChurnCalculator.new({:minimum_churn_count => params['minimum_churn_count'].value}).report
19
+ result = Churn::ChurnCalculator.new({:minimum_churn_count => params['minimum_churn_count'].value}).report(output_string)
20
+ unless output_string
21
+ result = YAML::dump(result)
22
+ end
23
+ result
15
24
  end
16
25
 
17
26
  def run
18
- report = report_churn
27
+ report = report_churn(!params['yaml'].value)
19
28
  puts report
20
29
  end
21
30
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: churn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Mayer
@@ -24,7 +24,17 @@ dependencies:
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: main
27
- type: :development
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: json
37
+ type: :runtime
28
38
  version_requirement:
29
39
  version_requirements: !ruby/object:Gem::Requirement
30
40
  requirements:
@@ -48,6 +58,7 @@ files:
48
58
  - README.rdoc
49
59
  - Rakefile
50
60
  - VERSION
61
+ - bin/churn
51
62
  - lib/churn.rb
52
63
  - lib/churn/churn_calculator.rb
53
64
  - lib/churn/churn_history.rb