lookout 2.3.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README +351 -181
- data/Rakefile +20 -5
- data/lib/lookout-3.0.rb +138 -0
- data/lib/lookout-3.0/actual.rb +30 -0
- data/lib/lookout-3.0/actual/method.rb +31 -0
- data/lib/lookout-3.0/actual/not.rb +13 -0
- data/lib/lookout-3.0/actual/not/method.rb +10 -0
- data/lib/lookout-3.0/aphonic.rb +44 -0
- data/lib/lookout-3.0/diff.rb +29 -0
- data/lib/{lookout → lookout-3.0}/diff/algorithms.rb +1 -1
- data/lib/lookout-3.0/diff/algorithms/difflib.rb +62 -0
- data/lib/lookout-3.0/diff/algorithms/difflib/position.rb +63 -0
- data/lib/{lookout/diff/algorithms/difflib/position/to.rb → lookout-3.0/diff/algorithms/difflib/position/new.rb} +8 -17
- data/lib/lookout-3.0/diff/formats.rb +5 -0
- data/lib/lookout-3.0/diff/formats/inline.rb +43 -0
- data/lib/lookout-3.0/diff/formats/set.rb +48 -0
- data/lib/lookout-3.0/diff/formats/unified.rb +56 -0
- data/lib/lookout-3.0/diff/group.rb +57 -0
- data/lib/lookout-3.0/diff/groups.rb +47 -0
- data/lib/lookout-3.0/diff/match.rb +31 -0
- data/lib/lookout-3.0/diff/operation.rb +41 -0
- data/lib/lookout-3.0/diff/operations.rb +35 -0
- data/lib/lookout-3.0/diff/operations/copy.rb +25 -0
- data/lib/lookout-3.0/diff/operations/delete.rb +5 -0
- data/lib/lookout-3.0/diff/operations/insert.rb +5 -0
- data/lib/lookout-3.0/diff/operations/replace.rb +6 -0
- data/lib/lookout-3.0/diff/slice.rb +97 -0
- data/lib/lookout-3.0/difference.rb +10 -0
- data/lib/lookout-3.0/difference/array.rb +22 -0
- data/lib/lookout-3.0/difference/exception.rb +40 -0
- data/lib/lookout-3.0/difference/hash.rb +31 -0
- data/lib/lookout-3.0/difference/lookout.rb +5 -0
- data/lib/lookout-3.0/difference/lookout/actual.rb +6 -0
- data/lib/lookout-3.0/difference/lookout/actual/method.rb +13 -0
- data/lib/lookout-3.0/difference/lookout/actual/not.rb +6 -0
- data/lib/lookout-3.0/difference/lookout/actual/not/method.rb +9 -0
- data/lib/lookout-3.0/difference/lookout/output.rb +8 -0
- data/lib/lookout-3.0/difference/lookout/reception.rb +21 -0
- data/lib/lookout-3.0/difference/lookout/warning.rb +9 -0
- data/lib/lookout-3.0/difference/module.rb +12 -0
- data/lib/lookout-3.0/difference/object.rb +73 -0
- data/lib/lookout-3.0/difference/range.rb +12 -0
- data/lib/lookout-3.0/difference/regexp.rb +12 -0
- data/lib/lookout-3.0/difference/string.rb +21 -0
- data/lib/lookout-3.0/difference/symbol.rb +21 -0
- data/lib/lookout-3.0/encode.rb +20 -0
- data/lib/lookout-3.0/exception.rb +79 -0
- data/lib/lookout-3.0/exception/backtrace.rb +65 -0
- data/lib/lookout-3.0/exception/unknown.rb +25 -0
- data/lib/lookout-3.0/expect.rb +32 -0
- data/lib/lookout-3.0/expect/classes.rb +6 -0
- data/lib/lookout-3.0/expect/classes/exception.rb +27 -0
- data/lib/lookout-3.0/expect/exception.rb +30 -0
- data/lib/lookout-3.0/expect/object.rb +54 -0
- data/lib/lookout-3.0/expect/object/context.rb +149 -0
- data/lib/lookout-3.0/expectations.rb +69 -0
- data/lib/lookout-3.0/expectations/context.rb +52 -0
- data/lib/lookout-3.0/expected.rb +10 -0
- data/lib/lookout-3.0/expected/array.rb +16 -0
- data/lib/lookout-3.0/expected/classes.rb +5 -0
- data/lib/lookout-3.0/expected/classes/exception.rb +14 -0
- data/lib/lookout-3.0/expected/exception.rb +46 -0
- data/lib/lookout-3.0/expected/falseclass.rb +9 -0
- data/lib/lookout-3.0/expected/hash.rb +14 -0
- data/lib/lookout-3.0/expected/lookout.rb +5 -0
- data/lib/lookout-3.0/expected/lookout/actual.rb +5 -0
- data/lib/lookout-3.0/expected/lookout/actual/method.rb +13 -0
- data/lib/lookout-3.0/expected/lookout/actual/not.rb +6 -0
- data/lib/lookout-3.0/expected/lookout/actual/not/method.rb +13 -0
- data/lib/lookout-3.0/expected/lookout/output.rb +26 -0
- data/lib/lookout-3.0/expected/lookout/reception.rb +24 -0
- data/lib/lookout-3.0/expected/lookout/warning.rb +29 -0
- data/lib/lookout-3.0/expected/module.rb +12 -0
- data/lib/lookout-3.0/expected/object.rb +30 -0
- data/lib/lookout-3.0/expected/range.rb +12 -0
- data/lib/lookout-3.0/expected/regexp.rb +12 -0
- data/lib/lookout-3.0/expected/string.rb +11 -0
- data/lib/lookout-3.0/expected/symbol.rb +21 -0
- data/lib/lookout-3.0/expected/trueclass.rb +9 -0
- data/lib/lookout-3.0/inspect.rb +45 -0
- data/lib/lookout-3.0/interfaces.rb +5 -0
- data/lib/lookout-3.0/interfaces/commandline.rb +109 -0
- data/lib/lookout-3.0/literal.rb +18 -0
- data/lib/lookout-3.0/mock.rb +24 -0
- data/lib/lookout-3.0/object.rb +6 -0
- data/lib/lookout-3.0/object/not.rb +16 -0
- data/lib/lookout-3.0/object/not/receive.rb +18 -0
- data/lib/lookout-3.0/object/to.rb +12 -0
- data/lib/lookout-3.0/object/to/receive.rb +18 -0
- data/lib/lookout-3.0/output.rb +20 -0
- data/lib/lookout-3.0/plugins.rb +7 -0
- data/lib/lookout-3.0/reception.rb +128 -0
- data/lib/lookout-3.0/reception/arguments.rb +20 -0
- data/lib/lookout-3.0/reception/arguments/any.rb +16 -0
- data/lib/lookout-3.0/reception/arguments/error.rb +5 -0
- data/lib/lookout-3.0/reception/arguments/list.rb +17 -0
- data/lib/lookout-3.0/reception/arguments/none.rb +6 -0
- data/lib/lookout-3.0/reception/error.rb +24 -0
- data/lib/lookout-3.0/result.rb +16 -0
- data/lib/lookout-3.0/results.rb +5 -0
- data/lib/lookout-3.0/results/error.rb +18 -0
- data/lib/lookout-3.0/results/failure.rb +15 -0
- data/lib/lookout-3.0/results/success.rb +7 -0
- data/lib/lookout-3.0/stub.rb +55 -0
- data/lib/lookout-3.0/version.rb +133 -0
- data/lib/lookout-3.0/warning.rb +40 -0
- data/test/unit/examples.rb +208 -83
- data/test/unit/{lookout.rb → lookout-3.0.rb} +0 -0
- data/test/unit/lookout-3.0/actual.rb +13 -0
- data/test/unit/lookout-3.0/actual/method.rb +31 -0
- data/test/unit/lookout-3.0/actual/not.rb +15 -0
- data/test/unit/lookout-3.0/actual/not/method.rb +7 -0
- data/test/unit/lookout-3.0/aphonic.rb +31 -0
- data/test/unit/{lookout → lookout-3.0}/diff.rb +0 -0
- data/test/unit/{lookout/diff/group.rb → lookout-3.0/diff/algorithms.rb} +0 -0
- data/test/unit/lookout-3.0/diff/algorithms/difflib.rb +56 -0
- data/test/unit/lookout-3.0/diff/algorithms/difflib/position.rb +92 -0
- data/test/unit/{lookout/diff/algorithms/difflib/position/to.rb → lookout-3.0/diff/algorithms/difflib/position/new.rb} +1 -2
- data/test/unit/{lookout/results.rb → lookout-3.0/diff/formats.rb} +0 -0
- data/test/unit/{lookout → lookout-3.0}/diff/formats/inline.rb +0 -0
- data/test/unit/lookout-3.0/diff/formats/set.rb +26 -0
- data/test/unit/{lookout → lookout-3.0}/diff/formats/unified.rb +0 -0
- data/test/unit/{lookout/results/error.rb → lookout-3.0/diff/group.rb} +0 -0
- data/test/unit/lookout-3.0/diff/groups.rb +102 -0
- data/test/unit/{lookout → lookout-3.0}/diff/match.rb +0 -0
- data/test/unit/lookout-3.0/diff/operation.rb +17 -0
- data/test/unit/lookout-3.0/diff/operations.rb +22 -0
- data/test/unit/lookout-3.0/diff/operations/copy.rb +50 -0
- data/test/unit/lookout-3.0/diff/operations/delete.rb +45 -0
- data/test/unit/lookout-3.0/diff/operations/insert.rb +45 -0
- data/test/unit/lookout-3.0/diff/operations/replace.rb +45 -0
- data/test/unit/lookout-3.0/diff/slice.rb +56 -0
- data/test/unit/{lookout/results/failures/behavior.rb → lookout-3.0/difference.rb} +0 -0
- data/test/unit/lookout-3.0/difference/array.rb +32 -0
- data/test/unit/lookout-3.0/difference/exception.rb +69 -0
- data/test/unit/lookout-3.0/difference/hash.rb +30 -0
- data/test/unit/{lookout/results/failures/state.rb → lookout-3.0/difference/lookout.rb} +0 -0
- data/test/unit/{lookout/results/fulfilled.rb → lookout-3.0/difference/lookout/actual.rb} +0 -0
- data/test/unit/lookout-3.0/difference/lookout/actual/method.rb +7 -0
- data/test/unit/{lookout/runners/console.rb → lookout-3.0/difference/lookout/actual/not.rb} +0 -0
- data/test/unit/lookout-3.0/difference/lookout/actual/not/method.rb +7 -0
- data/test/unit/lookout-3.0/difference/lookout/output.rb +11 -0
- data/test/unit/lookout-3.0/difference/lookout/reception.rb +11 -0
- data/test/unit/lookout-3.0/difference/lookout/warning.rb +11 -0
- data/test/unit/lookout-3.0/difference/module.rb +11 -0
- data/test/unit/lookout-3.0/difference/object.rb +31 -0
- data/test/unit/lookout-3.0/difference/range.rb +11 -0
- data/test/unit/lookout-3.0/difference/regexp.rb +11 -0
- data/test/unit/lookout-3.0/difference/string.rb +29 -0
- data/test/unit/lookout-3.0/difference/symbol.rb +11 -0
- data/test/unit/lookout-3.0/encode.rb +28 -0
- data/test/unit/lookout-3.0/exception.rb +107 -0
- data/test/unit/lookout-3.0/exception/backtrace.rb +75 -0
- data/test/unit/lookout-3.0/exception/unknown.rb +23 -0
- data/test/unit/lookout-3.0/expect.rb +15 -0
- data/test/unit/{lookout/ui/console.rb → lookout-3.0/expect/classes.rb} +0 -0
- data/test/unit/lookout-3.0/expect/classes/exception.rb +41 -0
- data/test/unit/lookout-3.0/expect/exception.rb +63 -0
- data/test/unit/lookout-3.0/expect/object.rb +55 -0
- data/test/unit/lookout-3.0/expect/object/context.rb +120 -0
- data/test/unit/lookout-3.0/expectations.rb +55 -0
- data/test/unit/lookout-3.0/expectations/context.rb +44 -0
- data/test/unit/lookout-3.0/expected.rb +4 -0
- data/test/unit/lookout-3.0/expected/array.rb +19 -0
- data/test/unit/lookout-3.0/expected/classes.rb +4 -0
- data/test/unit/lookout-3.0/expected/classes/exception.rb +7 -0
- data/test/unit/lookout-3.0/expected/exception.rb +24 -0
- data/test/unit/lookout-3.0/expected/falseclass.rb +23 -0
- data/test/unit/lookout-3.0/expected/hash.rb +23 -0
- data/test/unit/lookout-3.0/expected/lookout.rb +4 -0
- data/test/unit/lookout-3.0/expected/lookout/actual.rb +4 -0
- data/test/unit/lookout-3.0/expected/lookout/actual/method.rb +11 -0
- data/test/unit/lookout-3.0/expected/lookout/actual/not.rb +4 -0
- data/test/unit/lookout-3.0/expected/lookout/actual/not/method.rb +11 -0
- data/test/unit/lookout-3.0/expected/lookout/output.rb +27 -0
- data/test/unit/lookout-3.0/expected/lookout/reception.rb +25 -0
- data/test/unit/lookout-3.0/expected/lookout/warning.rb +48 -0
- data/test/unit/lookout-3.0/expected/module.rb +23 -0
- data/test/unit/lookout-3.0/expected/object.rb +24 -0
- data/test/unit/lookout-3.0/expected/range.rb +19 -0
- data/test/unit/lookout-3.0/expected/regexp.rb +19 -0
- data/test/unit/lookout-3.0/expected/string.rb +44 -0
- data/test/unit/lookout-3.0/expected/symbol.rb +35 -0
- data/test/unit/lookout-3.0/expected/trueclass.rb +23 -0
- data/test/unit/lookout-3.0/inspect.rb +39 -0
- data/test/unit/lookout-3.0/interfaces.rb +4 -0
- data/test/unit/lookout-3.0/interfaces/commandline.rb +4 -0
- data/test/unit/lookout-3.0/literal.rb +15 -0
- data/test/unit/lookout-3.0/mock.rb +22 -0
- data/test/unit/lookout-3.0/object.rb +4 -0
- data/test/unit/lookout-3.0/object/not.rb +7 -0
- data/test/unit/lookout-3.0/object/not/receive.rb +9 -0
- data/test/unit/lookout-3.0/object/to.rb +7 -0
- data/test/unit/lookout-3.0/object/to/receive.rb +9 -0
- data/test/unit/lookout-3.0/output.rb +31 -0
- data/test/unit/lookout-3.0/plugins.rb +4 -0
- data/test/unit/lookout-3.0/reception.rb +86 -0
- data/test/unit/lookout-3.0/reception/arguments.rb +23 -0
- data/test/unit/lookout-3.0/reception/arguments/any.rb +15 -0
- data/test/unit/lookout-3.0/reception/arguments/error.rb +4 -0
- data/test/unit/lookout-3.0/reception/arguments/list.rb +19 -0
- data/test/unit/lookout-3.0/reception/arguments/none.rb +15 -0
- data/test/unit/lookout-3.0/reception/error.rb +4 -0
- data/test/unit/lookout-3.0/result.rb +27 -0
- data/test/unit/lookout-3.0/results.rb +4 -0
- data/test/unit/lookout-3.0/results/error.rb +37 -0
- data/test/unit/lookout-3.0/results/failure.rb +21 -0
- data/test/unit/lookout-3.0/results/success.rb +4 -0
- data/test/unit/lookout-3.0/stub.rb +53 -0
- data/test/unit/lookout-3.0/version.rb +4 -0
- data/test/unit/lookout-3.0/warning.rb +47 -0
- metadata +1159 -456
- data/lib/lookout.rb +0 -30
- data/lib/lookout/aphonic.rb +0 -40
- data/lib/lookout/diff.rb +0 -10
- data/lib/lookout/diff/algorithms/difflib.rb +0 -38
- data/lib/lookout/diff/algorithms/difflib/position.rb +0 -92
- data/lib/lookout/diff/formats.rb +0 -7
- data/lib/lookout/diff/formats/hash.rb +0 -53
- data/lib/lookout/diff/formats/inline.rb +0 -39
- data/lib/lookout/diff/formats/unified.rb +0 -57
- data/lib/lookout/diff/group.rb +0 -61
- data/lib/lookout/diff/groups.rb +0 -34
- data/lib/lookout/diff/match.rb +0 -36
- data/lib/lookout/diff/operation.rb +0 -33
- data/lib/lookout/diff/operations.rb +0 -36
- data/lib/lookout/diff/operations/delete.rb +0 -9
- data/lib/lookout/diff/operations/equal.rb +0 -27
- data/lib/lookout/diff/operations/insert.rb +0 -9
- data/lib/lookout/diff/operations/replace.rb +0 -9
- data/lib/lookout/diff/range.rb +0 -91
- data/lib/lookout/equalities.rb +0 -13
- data/lib/lookout/equalities/array.rb +0 -22
- data/lib/lookout/equalities/boolean.rb +0 -9
- data/lib/lookout/equalities/hash.rb +0 -25
- data/lib/lookout/equalities/include.rb +0 -9
- data/lib/lookout/equalities/object.rb +0 -24
- data/lib/lookout/equalities/output.rb +0 -19
- data/lib/lookout/equalities/standarderror.rb +0 -32
- data/lib/lookout/equalities/string.rb +0 -19
- data/lib/lookout/equalities/warning.rb +0 -16
- data/lib/lookout/equality.rb +0 -36
- data/lib/lookout/expectation.rb +0 -69
- data/lib/lookout/expectations.rb +0 -49
- data/lib/lookout/expectations/behavior.rb +0 -20
- data/lib/lookout/expectations/line.rb +0 -29
- data/lib/lookout/expectations/state.rb +0 -31
- data/lib/lookout/expectations/state/warning.rb +0 -26
- data/lib/lookout/mock.rb +0 -20
- data/lib/lookout/mock/method.rb +0 -70
- data/lib/lookout/mock/method/arguments.rb +0 -33
- data/lib/lookout/mock/method/arguments/any.rb +0 -11
- data/lib/lookout/mock/method/arguments/anything.rb +0 -11
- data/lib/lookout/mock/method/arguments/list.rb +0 -15
- data/lib/lookout/mock/method/arguments/none.rb +0 -11
- data/lib/lookout/mock/method/arguments/one.rb +0 -11
- data/lib/lookout/mock/method/calls.rb +0 -11
- data/lib/lookout/mock/method/calls/class.rb +0 -21
- data/lib/lookout/mock/method/calls/exactly.rb +0 -28
- data/lib/lookout/mock/method/calls/instance.rb +0 -25
- data/lib/lookout/mock/method/calls/lower.rb +0 -22
- data/lib/lookout/mock/method/calls/upper.rb +0 -22
- data/lib/lookout/mock/methods.rb +0 -12
- data/lib/lookout/mock/object.rb +0 -12
- data/lib/lookout/object.rb +0 -11
- data/lib/lookout/output.rb +0 -21
- data/lib/lookout/rake/tasks.rb +0 -36
- data/lib/lookout/rake/tasks/gem.rb +0 -49
- data/lib/lookout/rake/tasks/tags.rb +0 -16
- data/lib/lookout/rake/tasks/test.rb +0 -46
- data/lib/lookout/rake/tasks/test/loader.rb +0 -22
- data/lib/lookout/recorder.rb +0 -45
- data/lib/lookout/recorder/not.rb +0 -11
- data/lib/lookout/recorder/tape.rb +0 -21
- data/lib/lookout/recorders.rb +0 -6
- data/lib/lookout/recorders/reception.rb +0 -47
- data/lib/lookout/recorders/state.rb +0 -35
- data/lib/lookout/result.rb +0 -13
- data/lib/lookout/results.rb +0 -25
- data/lib/lookout/results/error.rb +0 -18
- data/lib/lookout/results/error/exception.rb +0 -34
- data/lib/lookout/results/error/exception/backtrace.rb +0 -50
- data/lib/lookout/results/failure.rb +0 -16
- data/lib/lookout/results/failures.rb +0 -6
- data/lib/lookout/results/failures/behavior.rb +0 -5
- data/lib/lookout/results/failures/state.rb +0 -5
- data/lib/lookout/results/fulfilled.rb +0 -5
- data/lib/lookout/results/unsuccessful.rb +0 -31
- data/lib/lookout/runners.rb +0 -6
- data/lib/lookout/runners/console.rb +0 -49
- data/lib/lookout/runners/trackers.rb +0 -5
- data/lib/lookout/runners/trackers/failure.rb +0 -14
- data/lib/lookout/stub.rb +0 -18
- data/lib/lookout/stub/method.rb +0 -105
- data/lib/lookout/stub/methods.rb +0 -18
- data/lib/lookout/stub/object.rb +0 -11
- data/lib/lookout/ui.rb +0 -7
- data/lib/lookout/ui/console.rb +0 -19
- data/lib/lookout/ui/silent.rb +0 -9
- data/lib/lookout/version.rb +0 -5
- data/lib/lookout/warning.rb +0 -7
- data/lib/lookout/xml.rb +0 -17
- data/test/unit/lookout/diff/algorithms/difflib.rb +0 -56
- data/test/unit/lookout/diff/algorithms/difflib/position.rb +0 -92
- data/test/unit/lookout/diff/groups.rb +0 -102
- data/test/unit/lookout/diff/operations.rb +0 -22
- data/test/unit/lookout/diff/operations/delete.rb +0 -45
- data/test/unit/lookout/diff/operations/equal.rb +0 -45
- data/test/unit/lookout/diff/operations/insert.rb +0 -45
- data/test/unit/lookout/diff/operations/replace.rb +0 -45
- data/test/unit/lookout/diff/range.rb +0 -50
- data/test/unit/lookout/equality.rb +0 -113
- data/test/unit/lookout/expectation.rb +0 -47
- data/test/unit/lookout/expectations.rb +0 -36
- data/test/unit/lookout/expectations/behavior.rb +0 -35
- data/test/unit/lookout/expectations/line.rb +0 -29
- data/test/unit/lookout/expectations/state.rb +0 -29
- data/test/unit/lookout/mock/method.rb +0 -143
- data/test/unit/lookout/mock/method/arguments.rb +0 -57
- data/test/unit/lookout/mock/method/arguments/any.rb +0 -11
- data/test/unit/lookout/recorder.rb +0 -11
- data/test/unit/lookout/results/error/exception/backtrace.rb +0 -20
- data/test/unit/lookout/results/unsuccessful.rb +0 -9
- data/test/unit/lookout/runners/trackers/failure.rb +0 -30
- data/test/unit/lookout/stub/method.rb +0 -48
- data/test/unit/lookout/stub/methods.rb +0 -19
- data/test/unit/lookout/xml.rb +0 -55
data/lib/lookout.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
module Lookout
|
4
|
-
autoload :Aphonic, 'lookout/aphonic'
|
5
|
-
autoload :Diff, 'lookout/diff'
|
6
|
-
autoload :Equality, 'lookout/equality'
|
7
|
-
autoload :Expectation, 'lookout/expectation'
|
8
|
-
autoload :Expectations, 'lookout/expectations'
|
9
|
-
autoload :Output, 'lookout/output'
|
10
|
-
autoload :Mock, 'lookout/mock'
|
11
|
-
autoload :Recorder, 'lookout/recorder'
|
12
|
-
autoload :Recorders, 'lookout/recorders'
|
13
|
-
autoload :Result, 'lookout/result'
|
14
|
-
autoload :Results, 'lookout/results'
|
15
|
-
autoload :Runners, 'lookout/runners'
|
16
|
-
autoload :Stub, 'lookout/stub'
|
17
|
-
autoload :UI, 'lookout/ui'
|
18
|
-
autoload :Version, 'lookout/version'
|
19
|
-
autoload :Warning, 'lookout/warning'
|
20
|
-
autoload :XML, 'lookout/xml'
|
21
|
-
|
22
|
-
class << self
|
23
|
-
def location(location)
|
24
|
-
return nil, nil unless match = /\A(.*):(\d+)(?::in .*)?\z/.match(location)
|
25
|
-
[match[1], match[2].to_i]
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
require 'lookout/object'
|
data/lib/lookout/aphonic.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
class Lookout::Aphonic
|
4
|
-
Methods = [
|
5
|
-
:__id__, :__send__, :object_id, # Methods that must be defined
|
6
|
-
:extend, :is_a? # Methods that we need
|
7
|
-
]
|
8
|
-
|
9
|
-
def self.silence(name)
|
10
|
-
undef_method name if
|
11
|
-
instance_methods.include?(RUBY_VERSION < '1.9' ? name.to_s : name.to_sym) and
|
12
|
-
not Methods.include? name.to_sym
|
13
|
-
end
|
14
|
-
|
15
|
-
instance_methods.each do |name|
|
16
|
-
silence name
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
[Kernel, Object].each do |object|
|
21
|
-
object.instance_eval{ class << self; self; end }.instance_eval do
|
22
|
-
method_added = method(:method_added)
|
23
|
-
define_method :method_added do |name|
|
24
|
-
result = method_added.call(name)
|
25
|
-
Lookout::Aphonic.silence name if self == object
|
26
|
-
result
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
class Module
|
32
|
-
append_features = instance_method(:append_features)
|
33
|
-
define_method :append_features do |mod|
|
34
|
-
result = append_features.bind(self).call(mod)
|
35
|
-
instance_methods.each do |name|
|
36
|
-
Lookout::Aphonic.silence name
|
37
|
-
end if mod == Object
|
38
|
-
result
|
39
|
-
end
|
40
|
-
end
|
data/lib/lookout/diff.rb
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
module Lookout::Diff
|
2
|
-
autoload :Algorithms, 'lookout/diff/algorithms'
|
3
|
-
autoload :Formats, 'lookout/diff/formats'
|
4
|
-
autoload :Group, 'lookout/diff/group'
|
5
|
-
autoload :Groups, 'lookout/diff/groups'
|
6
|
-
autoload :Match, 'lookout/diff/match'
|
7
|
-
autoload :Operation, 'lookout/diff/operation'
|
8
|
-
autoload :Operations, 'lookout/diff/operations'
|
9
|
-
autoload :Range, 'lookout/diff/range'
|
10
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
class Lookout::Diff::Algorithms::Difflib
|
4
|
-
autoload :Position, 'lookout/diff/algorithms/difflib/position'
|
5
|
-
|
6
|
-
include Enumerable
|
7
|
-
|
8
|
-
def initialize(from, to, &is_junk)
|
9
|
-
@from, @to, @is_junk = from, to, is_junk
|
10
|
-
end
|
11
|
-
|
12
|
-
def each
|
13
|
-
current = Lookout::Diff::Match.new(Lookout::Diff::Range.new(@from, 0...0),
|
14
|
-
Lookout::Diff::Range.new(@to, 0...0))
|
15
|
-
stack = [Position.origin(@from, @to, &@is_junk)]
|
16
|
-
until stack.empty?
|
17
|
-
case item = stack.pop
|
18
|
-
when Position
|
19
|
-
match = item.match
|
20
|
-
next if match.empty?
|
21
|
-
stack.push item.begin_after(match) if item.ends_after? match
|
22
|
-
stack.push match
|
23
|
-
stack.push item.end_before(match) if item.begins_before? match
|
24
|
-
when Lookout::Diff::Match
|
25
|
-
if current.touches? item
|
26
|
-
current += item
|
27
|
-
else
|
28
|
-
yield current unless current.empty?
|
29
|
-
current = item
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
yield current unless current.empty?
|
34
|
-
yield Lookout::Diff::Match.new(current.from.at(@from.size...@from.size),
|
35
|
-
current.to.at(@to.size...@to.size))
|
36
|
-
self
|
37
|
-
end
|
38
|
-
end
|
@@ -1,92 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
class Lookout::Diff::Algorithms::Difflib::Position
|
4
|
-
autoload :To, 'lookout/diff/algorithms/difflib/position/to'
|
5
|
-
|
6
|
-
class << self
|
7
|
-
def origin(from, to)
|
8
|
-
to = To.new(to)
|
9
|
-
new(Lookout::Diff::Range.new(from),
|
10
|
-
to,
|
11
|
-
block_given? ?
|
12
|
-
to.indexes.reduce({}){ |j, (k, _)| j[k] = yield(k); j } :
|
13
|
-
{})
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def initialize(from, to, junk)
|
18
|
-
@from, @to, @junk = from, to, junk
|
19
|
-
end
|
20
|
-
|
21
|
-
def match
|
22
|
-
match = leftmost_longest
|
23
|
-
junk.empty? ? match : expand(expand(match, false), true)
|
24
|
-
end
|
25
|
-
|
26
|
-
def begins_before?(match)
|
27
|
-
from.begins_before? match.from and to.begins_before? match.to
|
28
|
-
end
|
29
|
-
|
30
|
-
def ends_after?(match)
|
31
|
-
from.ends_after? match.from and to.ends_after? match.to
|
32
|
-
end
|
33
|
-
|
34
|
-
def begin_after(match)
|
35
|
-
self.class.new(from.begin_after(match.from), to.begin_after(match.to), junk)
|
36
|
-
end
|
37
|
-
|
38
|
-
def end_before(match)
|
39
|
-
self.class.new(from.end_before(match.from), to.end_before(match.to), junk)
|
40
|
-
end
|
41
|
-
|
42
|
-
def ==(other)
|
43
|
-
from == other.from and to == other.to and junk == other.junk
|
44
|
-
end
|
45
|
-
|
46
|
-
def inspect
|
47
|
-
'#<%s %p,%p>' % [self.class, from, to]
|
48
|
-
end
|
49
|
-
|
50
|
-
protected
|
51
|
-
|
52
|
-
attr_reader :from, :to, :junk
|
53
|
-
|
54
|
-
private
|
55
|
-
|
56
|
-
def leftmost_longest
|
57
|
-
match = Lookout::Diff::Match.new(@from.at(0...0), @to.at(0...0))
|
58
|
-
sizes = Hash.new(0)
|
59
|
-
@from.each_with_index do |item, from|
|
60
|
-
_sizes = Hash.new(0)
|
61
|
-
@to.each_index(item) do |to|
|
62
|
-
size = _sizes[to] = sizes[to - 1] + 1
|
63
|
-
match = Lookout::Diff::Match.
|
64
|
-
new(@from.at(from - size + 1..from),
|
65
|
-
@to.at(to - size + 1..to)) if size > match.size
|
66
|
-
end unless junk[item]
|
67
|
-
sizes = _sizes
|
68
|
-
end
|
69
|
-
match
|
70
|
-
end
|
71
|
-
|
72
|
-
def expand(match, junking)
|
73
|
-
from_begin, to_begin = match.from.begin, match.to.begin
|
74
|
-
while from_begin > @from.begin and to_begin > @to.begin and
|
75
|
-
junk[@to[to_begin - 1]] ^ !junking and
|
76
|
-
@from[from_begin - 1] == @to[to_begin - 1]
|
77
|
-
from_begin -= 1
|
78
|
-
to_begin -= 1
|
79
|
-
end
|
80
|
-
|
81
|
-
from_end, to_end = match.from.end, match.to.end
|
82
|
-
while from_end + 1 <= @from.end and to_end + 1 <= @to.end and
|
83
|
-
junk[@to[to_end + 1]] ^ !junking and
|
84
|
-
@from[from_end + 1] == @to[to_end + 1]
|
85
|
-
from_end += 1
|
86
|
-
to_end += 1
|
87
|
-
end
|
88
|
-
|
89
|
-
Lookout::Diff::Match.new(from.at(from_begin..from_end),
|
90
|
-
to.at(to_begin..to_end))
|
91
|
-
end
|
92
|
-
end
|
data/lib/lookout/diff/formats.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
class Lookout::Diff::Formats::Hash
|
4
|
-
include Enumerable
|
5
|
-
|
6
|
-
def initialize(operations)
|
7
|
-
@operations = operations
|
8
|
-
end
|
9
|
-
|
10
|
-
def each
|
11
|
-
@operations.each do |op|
|
12
|
-
operation = Operation.new(op)
|
13
|
-
yield operation.to_s unless operation.empty?
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
private
|
18
|
-
|
19
|
-
class Operation
|
20
|
-
def initialize(operation)
|
21
|
-
@lines = operation.apply(self)
|
22
|
-
end
|
23
|
-
|
24
|
-
def empty?
|
25
|
-
@lines.nil?
|
26
|
-
end
|
27
|
-
|
28
|
-
def delete(operation)
|
29
|
-
mark('-', operation.from)
|
30
|
-
end
|
31
|
-
|
32
|
-
def equal(operation)
|
33
|
-
end
|
34
|
-
|
35
|
-
def insert(operation)
|
36
|
-
mark('+', operation.to)
|
37
|
-
end
|
38
|
-
|
39
|
-
def replace(operation)
|
40
|
-
delete(operation) + insert(operation)
|
41
|
-
end
|
42
|
-
|
43
|
-
def to_s
|
44
|
-
@lines.join("\n")
|
45
|
-
end
|
46
|
-
|
47
|
-
private
|
48
|
-
|
49
|
-
def mark(mark, range)
|
50
|
-
range.map{ |item| '%s%s' % [mark, item] }
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
class Lookout::Diff::Formats::Inline
|
4
|
-
def initialize(operations)
|
5
|
-
@to_s = ToS.new(operations).to_s
|
6
|
-
end
|
7
|
-
|
8
|
-
def to_s
|
9
|
-
@to_s
|
10
|
-
end
|
11
|
-
|
12
|
-
private
|
13
|
-
|
14
|
-
class ToS
|
15
|
-
def initialize(operations)
|
16
|
-
@to_s = operations.map{ |o| o.apply(self) }.join('').freeze
|
17
|
-
end
|
18
|
-
|
19
|
-
def delete(operation)
|
20
|
-
'[-%s-]' % operation.from.to_items
|
21
|
-
end
|
22
|
-
|
23
|
-
def equal(operation)
|
24
|
-
operation.from.to_items
|
25
|
-
end
|
26
|
-
|
27
|
-
def insert(operation)
|
28
|
-
'{+%s+}' % operation.to.to_items
|
29
|
-
end
|
30
|
-
|
31
|
-
def replace(operation)
|
32
|
-
delete(operation) + insert(operation)
|
33
|
-
end
|
34
|
-
|
35
|
-
def to_s
|
36
|
-
@to_s
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
class Lookout::Diff::Formats::Unified
|
4
|
-
include Enumerable
|
5
|
-
|
6
|
-
def initialize(groups)
|
7
|
-
@groups = groups
|
8
|
-
end
|
9
|
-
|
10
|
-
def each
|
11
|
-
@groups.each do |group|
|
12
|
-
next if group.parity?
|
13
|
-
yield Group.new(group).to_s
|
14
|
-
end
|
15
|
-
self
|
16
|
-
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
class Group
|
21
|
-
def initialize(group)
|
22
|
-
@group = group
|
23
|
-
end
|
24
|
-
|
25
|
-
def delete(operation)
|
26
|
-
mark('-', operation.from)
|
27
|
-
end
|
28
|
-
|
29
|
-
def equal(operation)
|
30
|
-
mark(' ', operation.from)
|
31
|
-
end
|
32
|
-
|
33
|
-
def insert(operation)
|
34
|
-
mark('+', operation.to)
|
35
|
-
end
|
36
|
-
|
37
|
-
def replace(operation)
|
38
|
-
delete(operation).concat(insert(operation))
|
39
|
-
end
|
40
|
-
|
41
|
-
def to_s
|
42
|
-
lines = ['@@ -%d,%d +%d,%d @@' %
|
43
|
-
[@group.from.begin + 1, @group.from.size,
|
44
|
-
@group.to.begin + 1, @group.to.size]]
|
45
|
-
@group.each do |operation|
|
46
|
-
lines.concat operation.apply(self)
|
47
|
-
end
|
48
|
-
lines.join("\n")
|
49
|
-
end
|
50
|
-
|
51
|
-
private
|
52
|
-
|
53
|
-
def mark(mark, range)
|
54
|
-
range.map{ |item| '%s%s' % [mark, item] }
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
data/lib/lookout/diff/group.rb
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
class Lookout::Diff::Group
|
4
|
-
include Enumerable
|
5
|
-
|
6
|
-
def initialize(*operations)
|
7
|
-
@operations = operations
|
8
|
-
end
|
9
|
-
|
10
|
-
def empty?
|
11
|
-
operations.empty?
|
12
|
-
end
|
13
|
-
|
14
|
-
def <<(operation)
|
15
|
-
operations << operation
|
16
|
-
self
|
17
|
-
end
|
18
|
-
|
19
|
-
def fold(context)
|
20
|
-
operations[-1] = operations[-1] << context
|
21
|
-
self
|
22
|
-
end
|
23
|
-
|
24
|
-
def parity?
|
25
|
-
operations.size == 1 and operations.first.parity?
|
26
|
-
end
|
27
|
-
|
28
|
-
def each
|
29
|
-
operations.each do |operation|
|
30
|
-
yield operation
|
31
|
-
end
|
32
|
-
self
|
33
|
-
end
|
34
|
-
|
35
|
-
def from
|
36
|
-
range(:from)
|
37
|
-
end
|
38
|
-
|
39
|
-
def to
|
40
|
-
range(:to)
|
41
|
-
end
|
42
|
-
|
43
|
-
def ==(other)
|
44
|
-
operations == other.operations
|
45
|
-
end
|
46
|
-
|
47
|
-
def inspect
|
48
|
-
'<#%s %p>' % [self.class, operations]
|
49
|
-
end
|
50
|
-
|
51
|
-
protected
|
52
|
-
|
53
|
-
attr_reader :operations
|
54
|
-
|
55
|
-
private
|
56
|
-
|
57
|
-
def range(target)
|
58
|
-
operations.first.send(target).
|
59
|
-
at(operations.first.send(target).begin..operations.last.send(target).end)
|
60
|
-
end
|
61
|
-
end
|
data/lib/lookout/diff/groups.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
class Lookout::Diff::Groups
|
4
|
-
include Enumerable
|
5
|
-
|
6
|
-
def initialize(operations, context = 3)
|
7
|
-
@operations, @context = operations, context
|
8
|
-
end
|
9
|
-
|
10
|
-
def each
|
11
|
-
saved = nil
|
12
|
-
group = Lookout::Diff::Group.new
|
13
|
-
@operations.each do |operation|
|
14
|
-
if saved
|
15
|
-
yield saved
|
16
|
-
saved = nil
|
17
|
-
end
|
18
|
-
if group.empty?
|
19
|
-
operation = operation >> @context
|
20
|
-
group << operation
|
21
|
-
elsif operation.foldable? @context * 2
|
22
|
-
saved = group << (operation << @context)
|
23
|
-
group = Lookout::Diff::Group.new(operation >> @context)
|
24
|
-
else
|
25
|
-
group << operation
|
26
|
-
end
|
27
|
-
end
|
28
|
-
if saved
|
29
|
-
yield saved
|
30
|
-
elsif not group.empty?
|
31
|
-
yield group.fold(@context)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|