method_log 0.0.7 → 0.1.0

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: d5660d61fbe34eb21e9a16dd770b6a3d75626377
4
- data.tar.gz: 0927d7ead89d3bc2a39d6fe315898ef2568c0f8f
3
+ metadata.gz: 4c9ece9dbca9c3d3cd0fa665a1467c7f4984e12f
4
+ data.tar.gz: 801beef47c6efa48e7501e2d875b6860a2b1359d
5
5
  SHA512:
6
- metadata.gz: 0e6fc68bda02985c28fd73977432feb8b5ab81c57732a4612644b42d5951d188a3df3cdf14c38518d0ce3cc1ebebfac7f2035dea433e724d280c8919ec3a7cb3
7
- data.tar.gz: 5383fb07797d935f46b71f8685443ac5ac8c44e5e5d630d6c269cd24eec4d5d8308f2b2dffc873c4f891cfa997ed01a37c0e978bd9cc493872c7890ddbf94a67
6
+ metadata.gz: c9791976fc166cd947c08572fc17b6ca8d9bd95e8889c09195d4640fef1791363f8557b56c9a7dc6e7ce53289b4678007bb4a0af8c1cbd82212a09e6db7725be
7
+ data.tar.gz: 4a292a85258e169a3b0e05523c9acda795b9f2df604b6aab36b3d42b98e269696d2c9ab5f5efa79e6dad626d91a80c82a7db26f2438384c0bdd180f652875584
data/README.md CHANGED
@@ -33,8 +33,6 @@ Trace the history of an individual method in a git repository (experimental).
33
33
  * Default to looking for commits in current git branch
34
34
  * Check what happens with merge commits
35
35
  * Maybe add as new git command or extension to existing command e.g. `git log`
36
- * Optimise search for method definitions:
37
- * First look in file where method was last defined
38
36
  * Find "similar" method implementations e.g. by comparing ASTs of implementations
39
37
 
40
38
  ### Credits
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'bundler/setup'
4
- require 'trollop'
3
+ require 'method_log'
5
4
 
6
5
  options = Trollop::options do
7
6
  opt :patch, 'Generate patch.', short: 'p'
@@ -17,7 +17,7 @@ module MethodLog
17
17
  if last_source_file && commit.contains?(last_source_file)
18
18
  last_method_commit.update(commit)
19
19
  else
20
- method_definition = commit.find(method_identifier)
20
+ method_definition = commit.find(method_identifier, last_source_file)
21
21
  yielder << last_method_commit if last_method_commit
22
22
  last_method_commit = MethodCommit.new(commit, method_definition)
23
23
  yielder << last_method_commit
@@ -39,10 +39,10 @@ module MethodLog
39
39
  source_files_by_path[source_file.path] == source_file
40
40
  end
41
41
 
42
- def find(method_identifier)
42
+ def find(method_identifier, last_source_file = nil)
43
43
  method_definition = nil
44
44
  method_name = method_identifier.split(Regexp.union('#', '.')).last
45
- source_files.each do |source_file|
45
+ source_files.sort_by { |sf| last_source_file == sf ? 1 : 0 }.each do |source_file|
46
46
  next unless source_file.source[Regexp.new(method_name)]
47
47
  method_finder = MethodFinder.new(source_file)
48
48
  break if method_definition = method_finder.find(method_identifier)
@@ -1,3 +1,3 @@
1
1
  module MethodLog
2
- VERSION = '0.0.7'
2
+ VERSION = '0.1.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: method_log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Mead
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-03 00:00:00.000000000 Z
11
+ date: 2014-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rugged