inch 0.5.0.rc5 → 0.5.0.rc6
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +0 -6
- data/.rubocop_todo.yml +40 -34
- data/Gemfile +3 -3
- data/Rakefile +10 -6
- data/bin/inch +5 -5
- data/config/base.rb +4 -4
- data/config/nodejs.rb +44 -1
- data/config/ruby.rb +1 -1
- data/inch.gemspec +17 -17
- data/lib/inch.rb +13 -13
- data/lib/inch/api.rb +10 -10
- data/lib/inch/api/compare.rb +2 -2
- data/lib/inch/api/compare/code_objects.rb +1 -1
- data/lib/inch/api/diff.rb +1 -1
- data/lib/inch/api/options/suggest.rb +1 -1
- data/lib/inch/api/suggest.rb +1 -1
- data/lib/inch/cli.rb +6 -6
- data/lib/inch/cli/command.rb +15 -15
- data/lib/inch/cli/command/base.rb +5 -3
- data/lib/inch/cli/command/base_list.rb +0 -1
- data/lib/inch/cli/command/console.rb +5 -5
- data/lib/inch/cli/command/diff.rb +6 -6
- data/lib/inch/cli/command/inspect.rb +5 -5
- data/lib/inch/cli/command/list.rb +4 -4
- data/lib/inch/cli/command/options/base.rb +17 -15
- data/lib/inch/cli/command/options/base_list.rb +17 -17
- data/lib/inch/cli/command/options/base_object.rb +1 -1
- data/lib/inch/cli/command/options/console.rb +13 -13
- data/lib/inch/cli/command/options/diff.rb +19 -19
- data/lib/inch/cli/command/options/inspect.rb +5 -5
- data/lib/inch/cli/command/options/list.rb +7 -7
- data/lib/inch/cli/command/options/show.rb +5 -5
- data/lib/inch/cli/command/options/stats.rb +2 -2
- data/lib/inch/cli/command/options/suggest.rb +12 -12
- data/lib/inch/cli/command/output/base.rb +1 -1
- data/lib/inch/cli/command/output/diff.rb +9 -9
- data/lib/inch/cli/command/output/inspect.rb +13 -13
- data/lib/inch/cli/command/output/list.rb +1 -1
- data/lib/inch/cli/command/output/show.rb +4 -4
- data/lib/inch/cli/command/output/stats.rb +14 -14
- data/lib/inch/cli/command/output/suggest.rb +14 -14
- data/lib/inch/cli/command/show.rb +4 -4
- data/lib/inch/cli/command/stats.rb +4 -4
- data/lib/inch/cli/command/suggest.rb +4 -4
- data/lib/inch/cli/command_parser.rb +4 -4
- data/lib/inch/cli/sparkline_helper.rb +1 -1
- data/lib/inch/cli/trace_helper.rb +1 -1
- data/lib/inch/cli/yardopts_helper.rb +1 -1
- data/lib/inch/code_object.rb +3 -3
- data/lib/inch/code_object/provider.rb +3 -3
- data/lib/inch/code_object/proxy.rb +3 -4
- data/lib/inch/codebase.rb +5 -5
- data/lib/inch/codebase/object.rb +2 -1
- data/lib/inch/codebase/serializer.rb +2 -2
- data/lib/inch/config.rb +6 -6
- data/lib/inch/config/codebase.rb +5 -5
- data/lib/inch/core_ext.rb +1 -1
- data/lib/inch/core_ext/string.rb +1 -1
- data/lib/inch/evaluation.rb +8 -8
- data/lib/inch/evaluation/proxy.rb +2 -3
- data/lib/inch/evaluation/role.rb +1 -1
- data/lib/inch/language/elixir/code_object/base.rb +6 -4
- data/lib/inch/language/elixir/evaluation/base.rb +2 -1
- data/lib/inch/language/elixir/evaluation/function_object.rb +1 -1
- data/lib/inch/language/elixir/import.rb +14 -14
- data/lib/inch/language/elixir/provider/reader.rb +1 -1
- data/lib/inch/language/elixir/provider/reader/docstring.rb +13 -0
- data/lib/inch/language/elixir/provider/reader/object.rb +5 -5
- data/lib/inch/language/elixir/provider/reader/object/base.rb +13 -5
- data/lib/inch/language/elixir/provider/reader/object/function_object.rb +1 -1
- data/lib/inch/language/elixir/provider/reader/parser.rb +21 -7
- data/lib/inch/language/elixir/roles/base.rb +3 -3
- data/lib/inch/language/elixir/roles/function.rb +2 -1
- data/lib/inch/language/elixir/roles/object.rb +1 -1
- data/lib/inch/language/nodejs/code_object/base.rb +199 -0
- data/lib/inch/language/nodejs/code_object/function_object.rb +74 -0
- data/lib/inch/language/nodejs/code_object/member_object.rb +11 -0
- data/lib/inch/language/nodejs/code_object/module_object.rb +23 -0
- data/lib/inch/language/nodejs/evaluation/base.rb +29 -0
- data/lib/inch/language/nodejs/evaluation/function_object.rb +31 -0
- data/lib/inch/language/nodejs/evaluation/member_object.rb +11 -0
- data/lib/inch/language/nodejs/evaluation/module_object.rb +27 -0
- data/lib/inch/language/nodejs/import.rb +17 -1
- data/lib/inch/language/nodejs/provider/jsdoc.rb +1 -1
- data/lib/inch/language/nodejs/provider/jsdoc/docstring.rb +13 -0
- data/lib/inch/language/nodejs/provider/jsdoc/object.rb +16 -8
- data/lib/inch/language/nodejs/provider/jsdoc/object/base.rb +82 -45
- data/lib/inch/language/nodejs/provider/jsdoc/object/function_object.rb +18 -0
- data/lib/inch/language/nodejs/provider/jsdoc/object/member_object.rb +15 -0
- data/lib/inch/language/nodejs/provider/jsdoc/object/module_object.rb +22 -0
- data/lib/inch/language/nodejs/provider/jsdoc/parser.rb +9 -10
- data/lib/inch/language/nodejs/roles/base.rb +32 -0
- data/lib/inch/language/nodejs/roles/function.rb +113 -0
- data/lib/inch/language/nodejs/roles/member.rb +13 -0
- data/lib/inch/language/nodejs/roles/module.rb +64 -0
- data/lib/inch/language/nodejs/roles/object.rb +76 -0
- data/lib/inch/language/ruby/code_object/base.rb +6 -4
- data/lib/inch/language/ruby/evaluation/base.rb +2 -1
- data/lib/inch/language/ruby/evaluation/method_object.rb +2 -1
- data/lib/inch/language/ruby/import.rb +24 -24
- data/lib/inch/language/ruby/provider/yard.rb +10 -10
- data/lib/inch/language/ruby/provider/yard/nodoc_helper.rb +2 -2
- data/lib/inch/language/ruby/provider/yard/object.rb +9 -9
- data/lib/inch/language/ruby/provider/yard/object/base.rb +25 -28
- data/lib/inch/language/ruby/provider/yard/object/method_object.rb +4 -3
- data/lib/inch/language/ruby/provider/yard/object/method_parameter_object.rb +4 -3
- data/lib/inch/language/ruby/provider/yard/object/method_signature.rb +2 -2
- data/lib/inch/language/ruby/provider/yard/object/namespace_object.rb +2 -1
- data/lib/inch/language/ruby/provider/yard/parser.rb +2 -2
- data/lib/inch/language/ruby/roles/base.rb +1 -1
- data/lib/inch/language/ruby/roles/method.rb +2 -1
- data/lib/inch/language/ruby/roles/method_parameter.rb +1 -1
- data/lib/inch/language/ruby/roles/missing.rb +2 -2
- data/lib/inch/language/ruby/roles/object.rb +6 -6
- data/lib/inch/rake.rb +2 -2
- data/lib/inch/rake/suggest.rb +5 -5
- data/lib/inch/utils/code_location.rb +12 -0
- data/lib/inch/utils/read_write_methods.rb +2 -2
- data/lib/inch/utils/ui.rb +8 -8
- data/lib/inch/version.rb +1 -1
- data/test/fixtures/elixir/simple/all.json +321 -0
- data/test/integration/api/compare/codebases.rb +6 -6
- data/test/integration/cli/command/console_test.rb +13 -13
- data/test/integration/cli/command/diff_test.rb +12 -14
- data/test/integration/cli/command/inspect_test.rb +30 -30
- data/test/integration/cli/command/list_test.rb +34 -34
- data/test/integration/cli/command/show_test.rb +26 -26
- data/test/integration/cli/command/stats_test.rb +23 -23
- data/test/integration/cli/command/suggest_test.rb +58 -49
- data/test/integration/stats_options_test.rb +9 -9
- data/test/integration/visibility_options_test.rb +49 -45
- data/test/shared/base_list.rb +41 -41
- data/test/test_helper.rb +18 -10
- data/test/unit/api/filter_test.rb +9 -9
- data/test/unit/api/get_test.rb +6 -6
- data/test/unit/api/list_test.rb +3 -3
- data/test/unit/api/options/base_test.rb +6 -6
- data/test/unit/api/stats_test.rb +3 -3
- data/test/unit/api/suggest_test.rb +4 -4
- data/test/unit/cli/arguments_test.rb +25 -25
- data/test/unit/cli/command/base_test.rb +3 -3
- data/test/unit/cli/command/options/base_list_test.rb +14 -14
- data/test/unit/cli/command/options/base_object_test.rb +6 -6
- data/test/unit/cli/command/options/base_test.rb +3 -3
- data/test/unit/cli/command_parser_test.rb +29 -29
- data/test/unit/cli/trace_helper_test.rb +2 -2
- data/test/unit/cli/yardopts_helper_test.rb +35 -35
- data/test/unit/code_object/converter_test.rb +3 -3
- data/test/unit/code_object/provider_test.rb +2 -2
- data/test/unit/code_object/proxy_test.rb +11 -11
- data/test/unit/codebase/objects_test.rb +8 -8
- data/test/unit/codebase/proxy_test.rb +5 -5
- data/test/unit/config/codebase_test.rb +3 -3
- data/test/unit/config_test.rb +4 -4
- data/test/unit/evaluation/role_test.rb +8 -8
- data/test/unit/language/elixir/code_object/function_object_test.rb +35 -0
- data/test/unit/language/ruby/code_object/method_object_test.rb +128 -126
- data/test/unit/language/ruby/provider/yard/docstring_test.rb +27 -23
- data/test/unit/language/ruby/provider/yard/nodoc_helper_test.rb +21 -20
- data/test/unit/language/ruby/provider/yard/object/method_object_test.rb +20 -17
- data/test/unit/language/ruby/provider/yard_test.rb +4 -4
- data/test/unit/utils/buffered_ui_test.rb +20 -20
- data/test/unit/utils/ui_test.rb +20 -20
- data/test/unit/utils/weighted_list_test.rb +7 -7
- metadata +25 -2
data/lib/inch/api/suggest.rb
CHANGED
data/lib/inch/cli.rb
CHANGED
@@ -11,7 +11,7 @@ module Inch
|
|
11
11
|
# @return [Fixnum]
|
12
12
|
def get_term_columns(default = 80)
|
13
13
|
str = `stty size`
|
14
|
-
rows_cols = str.split(
|
14
|
+
rows_cols = str.split(' ').map(&:to_i)
|
15
15
|
rows_cols[1] || default
|
16
16
|
rescue
|
17
17
|
default
|
@@ -21,9 +21,9 @@ module Inch
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
require
|
25
|
-
require
|
26
|
-
require
|
27
|
-
require
|
24
|
+
require 'inch/cli/arguments'
|
25
|
+
require 'inch/cli/sparkline_helper'
|
26
|
+
require 'inch/cli/trace_helper'
|
27
|
+
require 'inch/cli/yardopts_helper'
|
28
28
|
|
29
|
-
require
|
29
|
+
require 'inch/cli/command'
|
data/lib/inch/cli/command.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require 'inch/cli/command/base'
|
2
|
+
require 'inch/cli/command/base_list'
|
3
|
+
require 'inch/cli/command/base_object'
|
4
4
|
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
5
|
+
require 'inch/cli/command/options/base'
|
6
|
+
require 'inch/cli/command/options/base_list'
|
7
|
+
require 'inch/cli/command/options/base_object'
|
8
8
|
|
9
|
-
require
|
9
|
+
require 'inch/cli/command/output/base'
|
10
10
|
|
11
|
-
require
|
11
|
+
require 'inch/cli/command_parser'
|
12
12
|
|
13
|
-
require
|
14
|
-
require
|
15
|
-
require
|
16
|
-
require
|
17
|
-
require
|
18
|
-
require
|
19
|
-
require
|
13
|
+
require 'inch/cli/command/list'
|
14
|
+
require 'inch/cli/command/show'
|
15
|
+
require 'inch/cli/command/stats'
|
16
|
+
require 'inch/cli/command/suggest'
|
17
|
+
require 'inch/cli/command/console'
|
18
|
+
require 'inch/cli/command/inspect'
|
19
|
+
require 'inch/cli/command/diff'
|
@@ -69,7 +69,7 @@ module Inch
|
|
69
69
|
#
|
70
70
|
# @return [String]
|
71
71
|
def description
|
72
|
-
|
72
|
+
''
|
73
73
|
end
|
74
74
|
|
75
75
|
# Returns the name of the command by which it is referenced
|
@@ -101,7 +101,7 @@ module Inch
|
|
101
101
|
protected
|
102
102
|
|
103
103
|
def initialize_cli_options
|
104
|
-
name = self.class.to_s.split(
|
104
|
+
name = self.class.to_s.split('::').last
|
105
105
|
options_class = Command::Options.const_get(name)
|
106
106
|
@options = options_class.new
|
107
107
|
@options.usage = usage
|
@@ -116,7 +116,9 @@ module Inch
|
|
116
116
|
def to_config(options)
|
117
117
|
config = Config.for(@options.language, Dir.pwd).codebase
|
118
118
|
config.included_files = options.paths unless options.paths.empty?
|
119
|
-
|
119
|
+
unless options.excluded.empty?
|
120
|
+
config.excluded_files = options.excluded
|
121
|
+
end
|
120
122
|
config.read_dump_file = options.read_dump_file
|
121
123
|
config
|
122
124
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require 'pry'
|
2
|
+
require 'inch/cli/command/options/console'
|
3
|
+
require 'inch/cli/command/output/console'
|
4
4
|
|
5
5
|
module Inch
|
6
6
|
module CLI
|
@@ -9,11 +9,11 @@ module Inch
|
|
9
9
|
register_command_as :console
|
10
10
|
|
11
11
|
def description
|
12
|
-
|
12
|
+
'Shows a console'
|
13
13
|
end
|
14
14
|
|
15
15
|
def usage
|
16
|
-
|
16
|
+
'Usage: inch console [paths] [OBJECT_NAME] [options]'
|
17
17
|
end
|
18
18
|
|
19
19
|
def run(*args)
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require 'pry'
|
2
|
+
require 'inch/cli/command/options/diff'
|
3
|
+
require 'inch/cli/command/output/diff'
|
4
4
|
|
5
5
|
module Inch
|
6
6
|
module CLI
|
@@ -11,11 +11,11 @@ module Inch
|
|
11
11
|
register_command_as :diff
|
12
12
|
|
13
13
|
def description
|
14
|
-
|
14
|
+
'Shows a diff'
|
15
15
|
end
|
16
16
|
|
17
17
|
def usage
|
18
|
-
|
18
|
+
'Usage: inch diff [REV..[REV]] [options]'
|
19
19
|
end
|
20
20
|
|
21
21
|
def run(*args)
|
@@ -24,7 +24,7 @@ module Inch
|
|
24
24
|
|
25
25
|
before_rev, after_rev = revisions[0], revisions[1]
|
26
26
|
diff = API::Diff.new(work_dir, to_config(@options),
|
27
|
-
|
27
|
+
before_rev, after_rev)
|
28
28
|
|
29
29
|
Output::Diff.new(@options, diff.comparer)
|
30
30
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'inch/cli/command/options/inspect'
|
2
|
+
require 'inch/cli/command/output/inspect'
|
3
3
|
|
4
4
|
module Inch
|
5
5
|
module CLI
|
@@ -8,12 +8,12 @@ module Inch
|
|
8
8
|
register_command_as :inspect
|
9
9
|
|
10
10
|
def description
|
11
|
-
|
11
|
+
'Inspects an object'
|
12
12
|
end
|
13
13
|
|
14
14
|
def usage
|
15
|
-
|
16
|
-
|
15
|
+
'Usage: inch inspect [paths] OBJECT_NAME [[OBJECT_NAME2] ...] ' \
|
16
|
+
'[options]'
|
17
17
|
end
|
18
18
|
|
19
19
|
def run(*args)
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'inch/cli/command/options/list'
|
2
|
+
require 'inch/cli/command/output/list'
|
3
3
|
|
4
4
|
module Inch
|
5
5
|
module CLI
|
@@ -8,11 +8,11 @@ module Inch
|
|
8
8
|
register_command_as :list
|
9
9
|
|
10
10
|
def description
|
11
|
-
|
11
|
+
'Lists all objects with their results'
|
12
12
|
end
|
13
13
|
|
14
14
|
def usage
|
15
|
-
|
15
|
+
'Usage: inch list [paths] [options]'
|
16
16
|
end
|
17
17
|
|
18
18
|
# Runs the commandline utility, parsing arguments and displaying a
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'optparse'
|
2
2
|
|
3
3
|
module Inch
|
4
4
|
module CLI
|
@@ -36,8 +36,8 @@ module Inch
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
attribute :usage,
|
40
|
-
attribute :language,
|
39
|
+
attribute :usage, '' # usage description for the command
|
40
|
+
attribute :language, 'ruby' # the programming language
|
41
41
|
attribute :read_dump_file, nil
|
42
42
|
attribute :paths, [] # the paths of the to-be-analysed sources
|
43
43
|
attribute :excluded, [] # paths to be excluded from the analysis
|
@@ -53,7 +53,7 @@ module Inch
|
|
53
53
|
opts.banner = usage
|
54
54
|
|
55
55
|
descriptions.each do |text|
|
56
|
-
opts.separator
|
56
|
+
opts.separator ' ' + text
|
57
57
|
end
|
58
58
|
|
59
59
|
set_options(opts)
|
@@ -95,9 +95,9 @@ module Inch
|
|
95
95
|
#
|
96
96
|
# @return [String]
|
97
97
|
def description_hint_arrows
|
98
|
-
arrows = Evaluation::PriorityRange.all.map(&:arrow).join(
|
98
|
+
arrows = Evaluation::PriorityRange.all.map(&:arrow).join(' ')
|
99
99
|
"Arrows (#{arrows}) hint at the importance of the object " \
|
100
|
-
|
100
|
+
'being documented.'
|
101
101
|
end
|
102
102
|
|
103
103
|
# Returns a decriptive hint explaining the arrows used to represent
|
@@ -106,8 +106,8 @@ module Inch
|
|
106
106
|
# @return [String]
|
107
107
|
def description_hint_grades
|
108
108
|
grades = Evaluation::Grade.all
|
109
|
-
"School grades (#{grades.join(
|
110
|
-
|
109
|
+
"School grades (#{grades.join(', ')}) are assigned and " \
|
110
|
+
'displayed with each object.'
|
111
111
|
end
|
112
112
|
|
113
113
|
def get_paths(args)
|
@@ -120,22 +120,24 @@ module Inch
|
|
120
120
|
# @param [OptionParser] opts the option parser object
|
121
121
|
# @return [void]
|
122
122
|
def common_options(opts)
|
123
|
-
opts.separator
|
124
|
-
opts.separator
|
125
|
-
opts.on(
|
123
|
+
opts.separator ''
|
124
|
+
opts.separator 'Other options:'
|
125
|
+
opts.on('--[no-]color', 'Run without color') do |v|
|
126
126
|
Term::ANSIColor.coloring = v
|
127
127
|
end
|
128
|
-
opts.on_tail(
|
128
|
+
opts.on_tail('-v', '--version', 'Show version.') do
|
129
129
|
ui.trace "inch #{Inch::VERSION}"
|
130
130
|
exit
|
131
131
|
end
|
132
|
-
opts.on_tail(
|
132
|
+
opts.on_tail('-l', '--language [LANGUAGE]',
|
133
|
+
'Set language (elixir|nodejs|ruby).') do |language|
|
133
134
|
@language = language
|
134
135
|
end
|
135
|
-
opts.on_tail(
|
136
|
+
opts.on_tail('-r', '--read-from-dump [FILE]',
|
137
|
+
'Read objects from dump.') do |file|
|
136
138
|
@read_dump_file = file
|
137
139
|
end
|
138
|
-
opts.on_tail(
|
140
|
+
opts.on_tail('-h', '--help', 'Show this help.') do
|
139
141
|
ui.trace opts
|
140
142
|
exit
|
141
143
|
end
|
@@ -18,7 +18,7 @@ module Inch
|
|
18
18
|
opts.banner = usage
|
19
19
|
|
20
20
|
descriptions.each do |text|
|
21
|
-
opts.separator
|
21
|
+
opts.separator ' ' + text
|
22
22
|
end
|
23
23
|
|
24
24
|
set_options(opts)
|
@@ -42,43 +42,43 @@ module Inch
|
|
42
42
|
# @param opts [OptionParser]
|
43
43
|
# @return [void]
|
44
44
|
def list_options(opts)
|
45
|
-
opts.separator
|
46
|
-
opts.separator
|
45
|
+
opts.separator ''
|
46
|
+
opts.separator 'List options:'
|
47
47
|
|
48
|
-
opts.on(
|
48
|
+
opts.on('--all', 'Show all objects in the output') do
|
49
49
|
@show_all = true
|
50
50
|
end
|
51
51
|
|
52
|
-
opts.on(
|
53
|
-
|
52
|
+
opts.on('--only-namespaces',
|
53
|
+
'Only show namespaces (classes, modules)') do
|
54
54
|
@namespaces = :only
|
55
55
|
end
|
56
|
-
opts.on(
|
57
|
-
|
58
|
-
|
56
|
+
opts.on('--no-namespaces',
|
57
|
+
'Only show namespace children (methods, constants, ' \
|
58
|
+
'attributes)') do
|
59
59
|
@namespaces = :none
|
60
60
|
end
|
61
61
|
|
62
|
-
opts.on(
|
62
|
+
opts.on('--no-public', 'Do not show public objects') do
|
63
63
|
set_visibility :public, false
|
64
64
|
end
|
65
|
-
opts.on(
|
65
|
+
opts.on('--no-protected', 'Do not show protected objects') do
|
66
66
|
set_visibility :protected, false
|
67
67
|
end
|
68
|
-
opts.on(
|
68
|
+
opts.on('--private', 'Show private objects') do
|
69
69
|
set_visibility :private, true
|
70
70
|
end
|
71
71
|
|
72
|
-
opts.on(
|
72
|
+
opts.on('--only-undocumented', 'Only show undocumented objects') do
|
73
73
|
@undocumented = :only
|
74
74
|
end
|
75
|
-
opts.on(
|
75
|
+
opts.on('--no-undocumented', 'Only show documented objects') do
|
76
76
|
@undocumented = :none
|
77
77
|
end
|
78
78
|
|
79
|
-
opts.on(
|
80
|
-
|
81
|
-
|
79
|
+
opts.on('--depth [DEPTH]',
|
80
|
+
'Only show objects up to a given DEPTH ' \
|
81
|
+
'in the class tree') do |depth|
|
82
82
|
@depth = depth.to_i
|
83
83
|
end
|
84
84
|
end
|
@@ -5,19 +5,19 @@ module Inch
|
|
5
5
|
class Console < BaseObject
|
6
6
|
def descriptions
|
7
7
|
[
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
8
|
+
'',
|
9
|
+
'Provides a PRY based REPL to inspect objects.',
|
10
|
+
'',
|
11
|
+
'Example: ' +
|
12
|
+
'$ inch console lib/**/*.rb Foo::Bar#initialize'.color(:cyan),
|
13
|
+
'',
|
14
|
+
'Shortcut commands on the prompt are:',
|
15
|
+
'',
|
16
|
+
'all'.ljust(5) + ' returns all code objects',
|
17
|
+
'f'.ljust(5) + ' finds an object by its path',
|
18
|
+
'ff'.ljust(5) + ' finds all objects given a partial path',
|
19
|
+
'o'.ljust(5) +
|
20
|
+
' returns the code object for OBJECT_NAME (if present)'
|
21
21
|
]
|
22
22
|
end
|
23
23
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'inch/utils/shell_helper'
|
2
2
|
|
3
3
|
module Inch
|
4
4
|
module CLI
|
@@ -8,18 +8,18 @@ module Inch
|
|
8
8
|
include Utils::ShellHelper
|
9
9
|
|
10
10
|
def initialize
|
11
|
-
@before_rev =
|
11
|
+
@before_rev = 'HEAD'
|
12
12
|
@after_rev = nil
|
13
13
|
end
|
14
14
|
|
15
15
|
def descriptions
|
16
16
|
[
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
'',
|
18
|
+
'Shows changes in documentation between two revisions ' \
|
19
|
+
'(defaults to last commit against current)',
|
20
|
+
'',
|
21
|
+
'Example: ' + '$ inch diff HEAD^..HEAD'.color(:cyan),
|
22
|
+
'',
|
23
23
|
description_hint_grades,
|
24
24
|
description_hint_arrows
|
25
25
|
]
|
@@ -41,12 +41,12 @@ module Inch
|
|
41
41
|
if object_names.empty?
|
42
42
|
[@before_rev, @after_rev]
|
43
43
|
else
|
44
|
-
object_names.first.split(
|
44
|
+
object_names.first.split('..')
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
48
|
def since_last_commit?
|
49
|
-
revisions == [
|
49
|
+
revisions == ['HEAD', nil]
|
50
50
|
end
|
51
51
|
|
52
52
|
def since_last_push?
|
@@ -56,15 +56,15 @@ module Inch
|
|
56
56
|
private
|
57
57
|
|
58
58
|
def diff_options(opts)
|
59
|
-
opts.separator
|
60
|
-
opts.separator
|
59
|
+
opts.separator ''
|
60
|
+
opts.separator 'Diff options:'
|
61
61
|
|
62
|
-
opts.on(
|
63
|
-
|
64
|
-
@before_rev =
|
62
|
+
opts.on('--since-last-commit',
|
63
|
+
'Run diff against last commit (default)') do
|
64
|
+
@before_rev = 'HEAD'
|
65
65
|
end
|
66
|
-
opts.on(
|
67
|
-
|
66
|
+
opts.on('-p', '--since-last-push',
|
67
|
+
'Run diff against last pushed commit') do
|
68
68
|
@before_rev = pushed_rev
|
69
69
|
@since_last_push = true
|
70
70
|
end
|
@@ -79,11 +79,11 @@ module Inch
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def current_branch
|
82
|
-
git Dir.pwd,
|
82
|
+
git Dir.pwd, 'rev-parse --abbrev-ref HEAD'
|
83
83
|
end
|
84
84
|
|
85
85
|
def remote
|
86
|
-
|
86
|
+
'origin'
|
87
87
|
end
|
88
88
|
end
|
89
89
|
end
|