File tree Expand file tree Collapse file tree 5 files changed +22
-13
lines changed Expand file tree Collapse file tree 5 files changed +22
-13
lines changed Original file line number Diff line number Diff line change 1
1
# main ([ unreleased] ( https://github.com/fastruby/rails_stats/compare/v1.0.2...main ) )
2
2
3
- *
3
+ * [ FEATURE: Simplify running outside of an app ] ( https://github.com/fastruby/rails_stats/pull/34 )
4
4
5
5
# v2.0.1 ([ commits] ( https://github.com/fastruby/rails_stats/compare/v2.0.0...v2.0.1 ) )
6
6
22
22
# v1.0.1 / 2018-10-8
23
23
24
24
* [ FEATURE: add more aggregate stats] ( https://github.com/fastruby/rails_stats/pull/5 )
25
- * [ FEATURE: More detailed introspection of app] ( https://github.com/fastruby/rails_stats/pull/1 )
25
+ * [ FEATURE: More detailed introspection of app] ( https://github.com/fastruby/rails_stats/pull/1 )
Original file line number Diff line number Diff line change @@ -8,18 +8,20 @@ RailsStats mainly adds the ability to be run from outside the project in questio
8
8
9
9
### Run it outside Rails project
10
10
11
- You will need a ` Rakefile ` in the directory where you call ` rake ` and you will
12
- need to require ` rails_stats ` :
11
+ Install the gem globally with:
13
12
14
- ``` ruby
15
- # Rakefile
16
- require " rails_stats"
17
- ```
13
+ ` gem install rails_stats `
14
+
15
+ You can then run:
16
+
17
+ ` rails_stats PATH_TO_APP [FORMAT] `
18
+
19
+ (the format is optional and defaults to the console formatter).
18
20
19
21
Then you can call it:
20
22
21
23
``` bash
22
- $ rake stats \[ /path/to/app/\]
24
+ $ rails_stats /path/to/app/
23
25
24
26
Directory: /path/to/app/
25
27
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH. unshift File . expand_path ( "../lib" , __dir__ )
4
+ require "rails_stats/all"
5
+
6
+ root_directory = ARGV [ 0 ]
7
+ fmt = ARGV [ 1 ] || ""
8
+
9
+ RailsStats ::CodeStatistics . new ( root_directory , { format : fmt } ) . to_s
Original file line number Diff line number Diff line change 3
3
module RailsStats
4
4
class ConsoleFormatter < StatsFormatter
5
5
def to_s
6
- Bundler ::Stats ::CLI . start
7
-
8
6
print_header
9
7
sorted_keys = @statistics . keys . sort
10
8
sorted_keys . each { |key | print_line ( key , @statistics [ key ] ) }
@@ -54,4 +52,4 @@ def print_code_test_stats
54
52
puts ""
55
53
end
56
54
end
57
- end
55
+ end
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
spec . license = "MIT"
15
15
16
16
spec . files = `git ls-files -z` . split ( "\x0 " )
17
- spec . executables = spec . files . grep ( %r{^bin /} ) { |f | File . basename ( f ) }
17
+ spec . executables = spec . files . grep ( %r{^exe /} ) { |f | File . basename ( f ) }
18
18
spec . test_files = spec . files . grep ( %r{^(test|spec|features)/} )
19
19
spec . require_paths = [ "lib" ]
20
20
You can’t perform that action at this time.
0 commit comments