rails_stats 0.0.4 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 944d0c8334fdcb76cec1a8f46b4df162318e79a8
4
- data.tar.gz: 937553b382a844f1eaf2e7aade385ba8440ec1b6
3
+ metadata.gz: dc2b547901355a943a7d01f85c3b44e0d7669f49
4
+ data.tar.gz: c913a7bfabc5a2e6e4883288846ba0d4786697e0
5
5
  SHA512:
6
- metadata.gz: 8ab477ff73f0e87134f71761397358388fb10947f8afad91da6ddc828c235eaf872116097be0747273a3c40d441808528e507c6e7814a89b5ea9da9702db832d
7
- data.tar.gz: 5803869bde15c3d38e2e41b6f1f279dc4993187cfe77e2d4148f67093b6b82fceab9e966e895e2ce0a874b1e80dbeb43b0084c555e34f868808257d97e4d4b81
6
+ metadata.gz: fe7e061a943858461c0cc8dc65d49213d8fdb2354db5ba25016eead9ae95f30fa5c6ed646f9bc55a3ee59a0bab14208629e41a70fe7cfad16994a8a44b08b26a
7
+ data.tar.gz: 52320637dea0bb648ba5ae8cb4c437274cc4ab7a6e5c76d9f0020a156ecab1b9503e808167168e1393debc08914566b3c745d81073171b381b5797fccfec1d48
data/Gemfile CHANGED
@@ -2,5 +2,3 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in rails_stats.gemspec
4
4
  gemspec
5
-
6
- gem 'debugger'
data/README.md CHANGED
@@ -2,10 +2,16 @@
2
2
 
3
3
  See stuff about a Rails app.
4
4
 
5
+ There were a few things missing to the included `rake stats`
6
+ RailsStats mainly adds the ability to be run from outside the project in question. This can be helpful if the app you are interested in can not be booted for some reason.
7
+
8
+ ### Run it
9
+
5
10
  ```bash
6
- $ bundle exec thor stats:calculate ~/path/to/app/
7
11
 
8
- Directory: ~/path/to/app/
12
+ $ bundle exec rake stats[/path/to/app/]
13
+
14
+ Directory: /path/to/app/
9
15
 
10
16
  +----------------------+-------+-------+---------+---------+-----+-------+
11
17
  | Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
@@ -30,11 +36,230 @@ Directory: ~/path/to/app/
30
36
 
31
37
  ```
32
38
 
39
+ ### Within your Rails project
40
+
41
+ You can also include it within your Rails application to _replace_ the default `rake stats` implementation.
42
+
43
+ Just add rails_stats to your Gemfile.
44
+ Depending on your setup, you might need to `require rails_stats` in your Rakefile.
45
+
46
+ Then you'll be able to just run:
47
+
48
+ ```bash
49
+ $ bundle exec rake stats
50
+ ```
51
+
52
+ ### Things it knows about
53
+
54
+ RailsStats adds more coverage than the default.
55
+
56
+ * Any concepts you've added within an `app` directory
57
+ * Configuration files
58
+ * Library files
59
+ * Gems that you've created and embedded in the project
60
+ * Engines and their code
61
+ * RSpec/Unit/Cucumber Tests
62
+
63
+ ### Example output
64
+
65
+ Here are some open source Rails projects an their output.
66
+
67
+ ```bash
68
+ $ bundle exec rake stats[/users/brian/examples/diaspora/]
69
+
70
+ Directory: /users/brian/examples/diaspora
71
+
72
+ +----------------------+-------+-------+---------+---------+-----+-------+
73
+ | Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
74
+ +----------------------+-------+-------+---------+---------+-----+-------+
75
+ | Collections | 259 | 198 | 0 | 56 | 0 | 1 |
76
+ | Helpers | 1863 | 1478 | 0 | 218 | 0 | 4 |
77
+ | Models | 4694 | 3517 | 55 | 580 | 10 | 4 |
78
+ | Pages | 201 | 158 | 0 | 21 | 0 | 5 |
79
+ | Controllers | 2797 | 2168 | 40 | 208 | 5 | 8 |
80
+ | Mailers | 313 | 263 | 13 | 32 | 2 | 6 |
81
+ | Presenters | 516 | 425 | 18 | 71 | 3 | 3 |
82
+ | Uploaders | 84 | 63 | 2 | 9 | 4 | 5 |
83
+ | Workers | 600 | 399 | 32 | 33 | 1 | 10 |
84
+ | Javascripts | 7550 | 4941 | 0 | 741 | 0 | 4 |
85
+ | Libraries | 7031 | 4890 | 69 | 701 | 10 | 4 |
86
+ | Configuration | 2556 | 833 | 5 | 10 | 2 | 81 |
87
+ | Controller Tests | 4628 | 3775 | 0 | 2 | 0 | 1885 |
88
+ | Spec Support | 1141 | 900 | 6 | 56 | 9 | 14 |
89
+ | Helper Tests | 771 | 615 | 0 | 6 | 0 | 100 |
90
+ | Integration Tests | 891 | 647 | 0 | 14 | 0 | 44 |
91
+ | Lib Tests | 4076 | 3259 | 2 | 4 | 2 | 812 |
92
+ | Other Tests | 120 | 101 | 0 | 0 | 0 | 0 |
93
+ | Mailer Tests | 412 | 328 | 0 | 0 | 0 | 0 |
94
+ | Model Tests | 6120 | 4964 | 0 | 1 | 0 | 4962 |
95
+ | Presenter Tests | 353 | 303 | 0 | 0 | 0 | 0 |
96
+ | Worker Tests | 821 | 648 | 0 | 0 | 0 | 0 |
97
+ | Cucumber Features | 2157 | 1863 | 47 | 155 | 3 | 10 |
98
+ +----------------------+-------+-------+---------+---------+-----+-------+
99
+ | Total | 49954 | 36736 | 289 | 2918 | 10 | 10 |
100
+ +----------------------+-------+-------+---------+---------+-----+-------+
101
+ Code LOC: 19333 Test LOC: 17403 Code to Test Ratio: 1:0.9
102
+
103
+
104
+ $ bundle exec rake stats[/users/brian/examples/discourse]
105
+
106
+ Directory: /users/brian/examples/discourse
107
+
108
+ +----------------------+-------+-------+---------+---------+-----+-------+
109
+ | Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
110
+ +----------------------+-------+-------+---------+---------+-----+-------+
111
+ | Controllers | 5005 | 3812 | 56 | 416 | 7 | 7 |
112
+ | Helpers | 286 | 218 | 0 | 32 | 0 | 4 |
113
+ | Jobs | 1830 | 1343 | 53 | 114 | 2 | 9 |
114
+ | Mailers | 438 | 340 | 7 | 24 | 3 | 12 |
115
+ | Models | 12378 | 8393 | 123 | 983 | 7 | 6 |
116
+ | Serializers | 2809 | 2223 | 73 | 374 | 5 | 3 |
117
+ | Services | 1353 | 1060 | 20 | 106 | 5 | 8 |
118
+ | Javascripts | 21722 | 13649 | 0 | 1844 | 0 | 5 |
119
+ | Libraries | 35298 | 27521 | 189 | 2565 | 13 | 8 |
120
+ | Configuration | 1758 | 1179 | 6 | 12 | 2 | 96 |
121
+ | Other Tests | 12998 | 9830 | 20 | 41 | 2 | 237 |
122
+ | Controller Tests | 7673 | 5911 | 0 | 4 | 0 | 1475 |
123
+ | Spec Support | 707 | 560 | 1 | 16 | 16 | 33 |
124
+ | Helper Tests | 88 | 71 | 0 | 0 | 0 | 0 |
125
+ | Integration Tests | 307 | 235 | 0 | 1 | 0 | 233 |
126
+ | Job Tests | 1343 | 1017 | 3 | 9 | 3 | 111 |
127
+ | Mailer Tests | 421 | 302 | 0 | 1 | 0 | 300 |
128
+ | Model Tests | 11236 | 8599 | 2 | 49 | 24 | 173 |
129
+ | Serializer Tests | 297 | 236 | 0 | 2 | 0 | 116 |
130
+ | Service Tests | 1767 | 1406 | 0 | 2 | 0 | 701 |
131
+ +----------------------+-------+-------+---------+---------+-----+-------+
132
+ | Total | 119714| 87905 | 553 | 6595 | 11 | 11 |
133
+ +----------------------+-------+-------+---------+---------+-----+-------+
134
+ Code LOC: 59738 Test LOC: 28167 Code to Test Ratio: 1:0.5
135
+
136
+
137
+ $ bundle exec rake stats[/users/brian/examples/gitlabhq]
138
+
139
+ Directory: /users/brian/examples/gitlabhq
140
+
141
+ +----------------------+-------+-------+---------+---------+-----+-------+
142
+ | Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
143
+ +----------------------+-------+-------+---------+---------+-----+-------+
144
+ | Controllers | 3690 | 2890 | 66 | 384 | 5 | 5 |
145
+ | Finders | 428 | 267 | 8 | 27 | 3 | 7 |
146
+ | Helpers | 2280 | 1761 | 0 | 222 | 0 | 5 |
147
+ | Mailers | 382 | 275 | 1 | 29 | 29 | 7 |
148
+ | Models | 6922 | 4680 | 58 | 714 | 12 | 4 |
149
+ | Services | 2021 | 1502 | 51 | 149 | 2 | 8 |
150
+ | Uploaders | 81 | 62 | 2 | 14 | 7 | 2 |
151
+ | Workers | 128 | 99 | 6 | 8 | 1 | 10 |
152
+ | Javascripts | 3843 | 2936 | 1 | 534 | 534 | 3 |
153
+ | Libraries | 7246 | 4785 | 120 | 438 | 3 | 8 |
154
+ | Configuration | 1421 | 782 | 4 | 11 | 2 | 69 |
155
+ | Controller Tests | 428 | 334 | 0 | 0 | 0 | 0 |
156
+ | Spec Support | 1119 | 715 | 2 | 27 | 13 | 24 |
157
+ | Other Tests | 67 | 55 | 0 | 0 | 0 | 0 |
158
+ | Feature Tests | 2209 | 1765 | 0 | 8 | 0 | 218 |
159
+ | Finder Tests | 281 | 230 | 0 | 0 | 0 | 0 |
160
+ | Helper Tests | 1608 | 1255 | 0 | 5 | 0 | 249 |
161
+ | Lib Tests | 1459 | 1180 | 1 | 11 | 11 | 105 |
162
+ | Mailer Tests | 630 | 478 | 0 | 0 | 0 | 0 |
163
+ | Model Tests | 3856 | 2669 | 0 | 10 | 0 | 264 |
164
+ | Request Tests | 4229 | 3600 | 0 | 10 | 0 | 358 |
165
+ | Routing Tests | 849 | 520 | 0 | 0 | 0 | 0 |
166
+ | Service Tests | 1611 | 1307 | 0 | 34 | 0 | 36 |
167
+ | Worker Tests | 45 | 35 | 0 | 2 | 0 | 15 |
168
+ | Cucumber Features | 6749 | 5734 | 141 | 947 | 6 | 4 |
169
+ | Cucumber Support | 6235 | 4980 | 65 | 71 | 1 | 68 |
170
+ +----------------------+-------+-------+---------+---------+-----+-------+
171
+ | Total | 59817 | 44896 | 526 | 3655 | 6 | 10 |
172
+ +----------------------+-------+-------+---------+---------+-----+-------+
173
+ Code LOC: 20039 Test LOC: 24857 Code to Test Ratio: 1:1.2
174
+
175
+
176
+ $ bundle exec rake stats[/users/brian/examples/redmine/]
177
+
178
+ Directory: /users/brian/examples/redmine
179
+
180
+ +----------------------+-------+-------+---------+---------+-----+-------+
181
+ | Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
182
+ +----------------------+-------+-------+---------+---------+-----+-------+
183
+ | Controllers | 6738 | 5005 | 51 | 416 | 8 | 10 |
184
+ | Helpers | 4445 | 3014 | 2 | 281 | 140 | 8 |
185
+ | Models | 13221 | 9369 | 86 | 1026 | 11 | 7 |
186
+ | Libraries | 19041 | 13499 | 137 | 1147 | 8 | 9 |
187
+ | Configuration | 779 | 550 | 14 | 18 | 1 | 28 |
188
+ | Integration Tests | 8286 | 6032 | 92 | 202 | 2 | 27 |
189
+ | Other Tests | 669 | 521 | 3 | 53 | 17 | 7 |
190
+ | Test Support | 1102 | 791 | 8 | 70 | 8 | 9 |
191
+ | Functional Tests | 18448 | 14784 | 61 | 1372 | 22 | 8 |
192
+ | Unit Tests | 23680 | 18217 | 117 | 1783 | 15 | 8 |
193
+ | Helper Tests | 3321 | 2567 | 16 | 171 | 10 | 13 |
194
+ +----------------------+-------+-------+---------+---------+-----+-------+
195
+ | Total | 99730 | 74349 | 587 | 6539 | 11 | 9 |
196
+ +----------------------+-------+-------+---------+---------+-----+-------+
197
+ Code LOC: 31437 Test LOC: 42912 Code to Test Ratio: 1:1.4
198
+
199
+
200
+ $ bundle exec rake stats[/users/brian/examples/refinerycms]
201
+
202
+ Directory: /users/brian/examples/refinerycms
203
+
204
+ +----------------------+-------+-------+---------+---------+-----+-------+
205
+ | Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
206
+ +----------------------+-------+-------+---------+---------+-----+-------+
207
+ | Controllers | 950 | 748 | 17 | 83 | 4 | 7 |
208
+ | Helpers | 399 | 308 | 0 | 28 | 0 | 9 |
209
+ | Mailers | 22 | 18 | 1 | 2 | 2 | 7 |
210
+ | Models | 846 | 570 | 14 | 86 | 6 | 4 |
211
+ | Presenters | 365 | 271 | 8 | 44 | 5 | 4 |
212
+ | Javascripts | 717 | 531 | 0 | 52 | 0 | 8 |
213
+ | Libraries | 4 | 4 | 0 | 0 | 0 | 0 |
214
+ | Gems | 4166 | 2997 | 44 | 372 | 8 | 6 |
215
+ | Controller Tests | 207 | 170 | 1 | 1 | 1 | 168 |
216
+ | Spec Support | 309 | 243 | 2 | 6 | 3 | 38 |
217
+ | Feature Tests | 1907 | 1484 | 0 | 4 | 0 | 369 |
218
+ | Lib Tests | 1952 | 1687 | 6 | 4 | 0 | 419 |
219
+ | Model Tests | 1323 | 1072 | 0 | 5 | 0 | 212 |
220
+ | Helper Tests | 324 | 264 | 0 | 1 | 0 | 262 |
221
+ | Presenter Tests | 355 | 299 | 0 | 0 | 0 | 0 |
222
+ +----------------------+-------+-------+---------+---------+-----+-------+
223
+ | Total | 13846 | 10666 | 93 | 688 | 7 | 13 |
224
+ +----------------------+-------+-------+---------+---------+-----+-------+
225
+ Code LOC: 5447 Test LOC: 5219 Code to Test Ratio: 1:1.0
226
+
227
+
228
+ $ bundle exec rake stats[/users/brian/examples/spree]
229
+
230
+ Directory: /users/brian/examples/spree
231
+
232
+ +----------------------+-------+-------+---------+---------+-----+-------+
233
+ | Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
234
+ +----------------------+-------+-------+---------+---------+-----+-------+
235
+ | Controllers | 4653 | 3800 | 86 | 492 | 5 | 5 |
236
+ | Helpers | 1142 | 949 | 0 | 90 | 0 | 8 |
237
+ | Models | 9893 | 7308 | 167 | 973 | 5 | 5 |
238
+ | Javascripts | 2770 | 2100 | 9 | 416 | 46 | 3 |
239
+ | Mailers | 63 | 58 | 5 | 8 | 1 | 5 |
240
+ | Libraries | 15 | 14 | 0 | 0 | 0 | 0 |
241
+ | Gems | 4690 | 3641 | 35 | 254 | 7 | 12 |
242
+ | Controller Tests | 7344 | 6000 | 6 | 19 | 3 | 313 |
243
+ | Model Tests | 16747 | 13452 | 20 | 27 | 1 | 496 |
244
+ | Request Tests | 32 | 24 | 0 | 0 | 0 | 0 |
245
+ | Spec Support | 577 | 427 | 3 | 9 | 3 | 45 |
246
+ | Feature Tests | 6079 | 4809 | 0 | 17 | 0 | 280 |
247
+ | Helper Tests | 602 | 470 | 2 | 1 | 0 | 468 |
248
+ | Lib Tests | 1455 | 1216 | 8 | 11 | 1 | 108 |
249
+ | Mailer Tests | 252 | 208 | 0 | 0 | 0 | 0 |
250
+ | Other Tests | 33 | 27 | 0 | 0 | 0 | 0 |
251
+ +----------------------+-------+-------+---------+---------+-----+-------+
252
+ | Total | 56347 | 44503 | 341 | 2317 | 6 | 17 |
253
+ +----------------------+-------+-------+---------+---------+-----+-------+
254
+ Code LOC: 17870 Test LOC: 26633 Code to Test Ratio: 1:1.5
255
+
256
+ ```
257
+
33
258
  ### TODO
34
259
 
35
- * option to print out by app directory (stats per engine)
260
+ * Option to print out by app directory (stats per engine)
36
261
  * Add views (jbuilder, erb, haml) but don't count towards ratios
37
- * Support JS for projects that have it in public
38
- * Add css but don't count towards ratios
39
- * output other metrics like number of tables and columns
40
- * test unit support
262
+ * Support JS for projects that have it in public (but not compiled)
263
+ * Add CSS but don't count towards ratios
264
+ * Output other metrics like number of tables and columns
265
+ * Different output formatters
data/Rakefile CHANGED
@@ -1,2 +1 @@
1
- require "bundler/gem_tasks"
2
-
1
+ require "rails_stats"
@@ -4,17 +4,6 @@ module RailsStats
4
4
 
5
5
  end
6
6
 
7
- require 'debugger'
7
+ require 'rake'
8
+ require 'rails_stats/tasks'
8
9
 
9
- require 'rails_stats/inflector'
10
- require 'rails_stats/code_statistics_calculator'
11
- require 'rails_stats/util'
12
- require 'rails_stats/app_statistics'
13
- require 'rails_stats/spec_statistics'
14
- require 'rails_stats/cucumber_statistics'
15
- require 'rails_stats/root_statistics'
16
- require 'rails_stats/gem_statistics'
17
- require 'rails_stats/code_statistics'
18
-
19
- require "rails_stats/rake"
20
- RailsStats.extend RailsStats::Rake
@@ -0,0 +1,10 @@
1
+ require 'rails_stats/inflector'
2
+ require 'rails_stats/code_statistics_calculator'
3
+ require 'rails_stats/util'
4
+ require 'rails_stats/app_statistics'
5
+ require 'rails_stats/test_statistics'
6
+ require 'rails_stats/spec_statistics'
7
+ require 'rails_stats/cucumber_statistics'
8
+ require 'rails_stats/root_statistics'
9
+ require 'rails_stats/gem_statistics'
10
+ require 'rails_stats/code_statistics'
@@ -69,21 +69,24 @@ module RailsStats
69
69
  end
70
70
 
71
71
  def calculate_gem_projects
72
- gems = Util.calculate_projects(@root_directory, "**", "*.gemspec")
72
+ gems = Util.calculate_projects(@root_directory, "*", "**", "*.gemspec")
73
73
  gems.collect do |root_path|
74
74
  GemStatistics.new(root_path)
75
75
  end
76
76
  end
77
77
 
78
78
  def calculate_spec_projects
79
- specs = Util.calculate_projects(@root_directory, "**", "spec", "spec_helper.rb")
79
+ specs = Util.calculate_shared_projects("spec", @root_directory, "**", "spec", "**", "*_spec.rb")
80
80
  specs.collect do |root_path|
81
81
  SpecStatistics.new(root_path, @key_concepts)
82
82
  end
83
83
  end
84
84
 
85
85
  def calculate_test_projects
86
- [] # TODO: test unit
86
+ tests = Util.calculate_shared_projects("test", @root_directory, "**", "test", "**", "*_test.rb")
87
+ tests.collect do |root_path|
88
+ TestStatistics.new(root_path, @key_concepts)
89
+ end
87
90
  end
88
91
 
89
92
  def calculate_root_projects
@@ -11,7 +11,9 @@ module RailsStats
11
11
  'integrations',
12
12
  'integration',
13
13
  'mailers',
14
- 'lib']
14
+ 'lib',
15
+ 'acceptance',
16
+ 'factories']
15
17
 
16
18
  def initialize(directory, key_concepts)
17
19
  @test = true
@@ -0,0 +1,13 @@
1
+ desc "Report code statistics (KLOCs, etc) from the current (or given) application"
2
+ task :stats, [:path] do |t, args|
3
+ Rake::Task["stats"].clear # clear out normal one if there
4
+ require 'rails_stats/all'
5
+
6
+ path = args[:path]
7
+ path = Rails.root.to_s if defined?(Rails)
8
+ raise "no path given for stats" unless path
9
+
10
+ root_directory = File.absolute_path(path)
11
+ puts "\nDirectory: #{root_directory}\n\n" if args[:path]
12
+ RailsStats::CodeStatistics.new(root_directory).to_s
13
+ end
@@ -0,0 +1,74 @@
1
+ module RailsStats
2
+ class TestStatistics
3
+ attr_reader :statistics, :total, :test
4
+
5
+ SPEC_FOLDERS = ['controllers',
6
+ 'functional',
7
+ 'helpers',
8
+ 'models',
9
+ 'requests',
10
+ 'unit',
11
+ 'integrations',
12
+ 'integration',
13
+ 'mailers',
14
+ 'lib']
15
+
16
+ def initialize(directory, key_concepts)
17
+ @test = true
18
+ @directory = directory
19
+ @key_concepts = key_concepts
20
+ @statistics = calculate_statistics
21
+ @total = calculate_total
22
+ end
23
+
24
+ private
25
+
26
+ def calculate_total
27
+ out = CodeStatisticsCalculator.new(true)
28
+ @statistics.each do |key, stats|
29
+ out.add(stats)
30
+ end
31
+ out
32
+ end
33
+
34
+ def calculate_statistics
35
+ out = {}
36
+ categorize_files.each do |key, list|
37
+ out[key] = Util.calculate_file_statistics(list)
38
+ end
39
+ out
40
+ end
41
+
42
+ def categorize_files
43
+ out = {}
44
+ Dir[File.join(@directory, "**", "*.rb")].each do |file_path|
45
+ if file_path =~ /.*_test.rb$/
46
+ key = categorize_file(file_path)
47
+ else
48
+ key = "Test Support"
49
+ end
50
+
51
+ out[key] ||= []
52
+ out[key] << file_path
53
+ end
54
+
55
+ out
56
+ end
57
+
58
+ def categorize_file(file_path)
59
+ types = (@key_concepts + SPEC_FOLDERS).uniq
60
+ types.each do |folder|
61
+ if file_path =~ /\/#{folder}\//
62
+ folder = Inflector.humanize(folder)
63
+ folder = Inflector.titleize(folder)
64
+ folder = Inflector.singularize(folder)
65
+ return "#{folder} Tests"
66
+ end
67
+ end
68
+
69
+ # something else
70
+ return "Other Tests"
71
+ end
72
+ end
73
+
74
+ end
@@ -22,6 +22,20 @@ module RailsStats
22
22
  out
23
23
  end
24
24
 
25
+ def calculate_shared_projects(shared, *args)
26
+ projects = {}
27
+ calculate_projects(*args).each do |path|
28
+ if path =~ /(^.*\/#{shared}\/).*/
29
+ projects[$1] = true
30
+ end
31
+ end
32
+
33
+ out = projects.keys
34
+
35
+ # TODO: make sure none are children of other ones in there
36
+ out
37
+ end
38
+
25
39
  def calculate_file_statistics(file, type = :code, &block)
26
40
  stats = CodeStatisticsCalculator.new
27
41
 
@@ -1,3 +1,3 @@
1
1
  module RailsStats
2
- VERSION = "0.0.4"
2
+ VERSION = "1.0.2"
3
3
  end
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["brian@bleonard.com"]
11
11
  spec.summary = %q{Analyze a Rails project}
12
12
  spec.description = %q{Point it to a directory and see stuff about the app}
13
- spec.homepage = ""
13
+ spec.homepage = "https://github.com/bleonard/rails_stats"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
@@ -18,7 +18,6 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "thor"
22
- spec.add_development_dependency "bundler", "~> 1.6"
23
- spec.add_development_dependency "rake"
21
+ spec.add_dependency "rake"
22
+ spec.add_development_dependency "bundler", ">= 1.6", "< 3.0"
24
23
  end
metadata CHANGED
@@ -1,57 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_stats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Leonard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-04 00:00:00.000000000 Z
11
+ date: 2020-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: thor
14
+ name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.6'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '3.0'
34
37
  type: :development
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - ~>
41
+ - - ">="
39
42
  - !ruby/object:Gem::Version
40
43
  version: '1.6'
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - '>='
44
+ - - "<"
46
45
  - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
46
+ version: '3.0'
55
47
  description: Point it to a directory and see stuff about the app
56
48
  email:
57
49
  - brian@bleonard.com
@@ -59,26 +51,27 @@ executables: []
59
51
  extensions: []
60
52
  extra_rdoc_files: []
61
53
  files:
62
- - .gitignore
54
+ - ".gitignore"
63
55
  - Gemfile
64
56
  - LICENSE.txt
65
57
  - README.md
66
58
  - Rakefile
67
59
  - lib/rails_stats.rb
60
+ - lib/rails_stats/all.rb
68
61
  - lib/rails_stats/app_statistics.rb
69
62
  - lib/rails_stats/code_statistics.rb
70
63
  - lib/rails_stats/code_statistics_calculator.rb
71
64
  - lib/rails_stats/cucumber_statistics.rb
72
65
  - lib/rails_stats/gem_statistics.rb
73
66
  - lib/rails_stats/inflector.rb
74
- - lib/rails_stats/rake.rb
75
67
  - lib/rails_stats/root_statistics.rb
76
68
  - lib/rails_stats/spec_statistics.rb
69
+ - lib/rails_stats/tasks.rb
70
+ - lib/rails_stats/test_statistics.rb
77
71
  - lib/rails_stats/util.rb
78
72
  - lib/rails_stats/version.rb
79
73
  - rails_stats.gemspec
80
- - stats.thor
81
- homepage: ''
74
+ homepage: https://github.com/bleonard/rails_stats
82
75
  licenses:
83
76
  - MIT
84
77
  metadata: {}
@@ -88,17 +81,17 @@ require_paths:
88
81
  - lib
89
82
  required_ruby_version: !ruby/object:Gem::Requirement
90
83
  requirements:
91
- - - '>='
84
+ - - ">="
92
85
  - !ruby/object:Gem::Version
93
86
  version: '0'
94
87
  required_rubygems_version: !ruby/object:Gem::Requirement
95
88
  requirements:
96
- - - '>='
89
+ - - ">="
97
90
  - !ruby/object:Gem::Version
98
91
  version: '0'
99
92
  requirements: []
100
93
  rubyforge_project:
101
- rubygems_version: 2.0.3
94
+ rubygems_version: 2.6.14.3
102
95
  signing_key:
103
96
  specification_version: 4
104
97
  summary: Analyze a Rails project
@@ -1,37 +0,0 @@
1
- # railties/lib/rails/tasks/statistics.rake
2
-
3
- module RailsStats
4
- module Rake
5
- STATS_DIRECTORIES = [
6
- %w(Controllers app/controllers),
7
- %w(Helpers app/helpers),
8
- %w(Models app/models),
9
- %w(Mailers app/mailers),
10
- %w(Observers app/observers),
11
- %w(Javascripts app/assets/javascripts),
12
- %w(Libraries lib/),
13
- %w(APIs app/apis),
14
- %w(Controller\ tests test/controllers),
15
- %w(Helper\ tests test/helpers),
16
- %w(Model\ tests test/models),
17
- %w(Mailer\ tests test/mailers),
18
- %w(Integration\ tests test/integration),
19
- %w(Functional\ tests\ (old) test/functional),
20
- %w(Unit\ tests \ (old) test/unit),
21
- %w(Controller\ tests spec/controllers),
22
- %w(Helper\ tests spec/helpers),
23
- %w(Model\ tests spec/models),
24
- %w(Mailer\ tests spec/mailers),
25
- %w(Integration\ tests spec/integration),
26
- %w(Integration\ tests spec/integrations),
27
- %w(Request\ tests spec/requests),
28
- %w(Library\ tests spec/lib),
29
- %w(Cucumber\ tests features),
30
- ]
31
-
32
- def calculate(root_directory)
33
- puts "\nDirectory: #{root_directory}\n\n"
34
- CodeStatistics.new(root_directory).to_s
35
- end
36
- end
37
- end
data/stats.thor DELETED
@@ -1,8 +0,0 @@
1
- require "rails_stats"
2
-
3
- class Stats < Thor
4
- desc "calculate", "get details on a Rails project"
5
- def calculate(directory)
6
- RailsStats.calculate(directory)
7
- end
8
- end