method_match 0.0.7 → 0.0.8

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: 04f4be0c89b1e594a80e3e1a77985b834b7b057c
4
- data.tar.gz: 72297df9db368558a9b2a556cdee68cc96a6ad9d
3
+ metadata.gz: c43c7e1f446657a8fe84df85e1f76e946abc025b
4
+ data.tar.gz: 525d92aef7eac93fd4afacb2c246946eb899614a
5
5
  SHA512:
6
- metadata.gz: 018f8230801be8a258e7b370f4b96260c8a4930f0af7168a1fa9b03740bf8a8fd8598898c366f9f2727211fb5f6b887a76542abd591dade90aeb53d0b467a715
7
- data.tar.gz: 4721a5db95029799ed0dd11ff601786179ad1736264df9f671ae1a36e82a107be80729e191ee1cb2648eb51592944c4659736195d00946f1e17d2f942c3895e6
6
+ metadata.gz: 5e37c5969d398a782723cf3275ec20bb782d34b126b30e74a300261c06d5256cb81134607aa01e272f56ed463c06007cb52b16147784d168eaf20c6259162d56
7
+ data.tar.gz: 4c112a1acd85ad25b061f3f12f3ac02d064a9aee41aaea4fadfa625e189a7aba0551ffb8711d6bb8cae71b21dca07ee76c57c74121b36b6e0ceb78f628136290
@@ -5,7 +5,7 @@ module MethodMatch
5
5
  CODE_MODE = 'code'
6
6
 
7
7
  def initialize name, line
8
- @name = name
8
+ @name = NameExtractor.new( name ).name
9
9
  @line = line
10
10
  create_spec_name
11
11
  end
@@ -0,0 +1,19 @@
1
+ module MethodMatch
2
+ class NameExtractor
3
+ attr_reader :name
4
+
5
+ def initialize name
6
+ @name = name
7
+ end
8
+
9
+ def name
10
+ p = pwd
11
+ return @name.sub "#{p}/", '' if @name.index( p ) == 0
12
+ @name
13
+ end
14
+
15
+ def pwd
16
+ `pwd`
17
+ end
18
+ end
19
+ end
@@ -1,3 +1,3 @@
1
1
  module MethodMatch
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
data/lib/method_match.rb CHANGED
@@ -4,5 +4,6 @@ module MethodMatch
4
4
  autoload :Matcher, 'method_match/matcher'
5
5
  autoload :Pry, 'method_match/pry'
6
6
  autoload :CommandRunner, 'method_match/command_runner'
7
+ autoload :NameExtractor, 'method_match/name_extractor'
7
8
  Pry.setup
8
9
  end
@@ -0,0 +1,21 @@
1
+ require File.join(File.dirname(__FILE__), %w[.. spec_helper])
2
+ describe MethodMatch::NameExtractor do
3
+ let(:extractor) do
4
+ e = MethodMatch::NameExtractor.new filename
5
+ e.stub(:pwd) { '/home/name/project'}
6
+ e
7
+ end
8
+
9
+ describe '#name' do
10
+ subject { extractor.name }
11
+ context 'project dir' do
12
+ let(:filename) { '/home/name/project/file.rb'}
13
+ it { should eq( 'file.rb')}
14
+ end
15
+
16
+ context 'somwhere else' do
17
+ let(:filename) { '/home/othername/project/file.rb'}
18
+ it { should eq( '/home/othername/project/file.rb')}
19
+ end
20
+ end
21
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: method_match
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomasz Tokarski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-10 00:00:00.000000000 Z
11
+ date: 2013-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -83,11 +83,13 @@ files:
83
83
  - lib/method_match.rb
84
84
  - lib/method_match/command_runner.rb
85
85
  - lib/method_match/matcher.rb
86
+ - lib/method_match/name_extractor.rb
86
87
  - lib/method_match/pry.rb
87
88
  - lib/method_match/version.rb
88
89
  - method_match.gemspec
89
90
  - spec/method_match/command_runner_spec.rb
90
91
  - spec/method_match/matcher_spec.rb
92
+ - spec/method_match/name_extractor_spec.rb
91
93
  - spec/spec_helper.rb
92
94
  homepage: http://tomasztokarski.com/method_match
93
95
  licenses: []
@@ -116,5 +118,6 @@ summary: It runs specs for given file based on line number and file name. Suppos
116
118
  test_files:
117
119
  - spec/method_match/command_runner_spec.rb
118
120
  - spec/method_match/matcher_spec.rb
121
+ - spec/method_match/name_extractor_spec.rb
119
122
  - spec/spec_helper.rb
120
123
  has_rdoc: