source_position 0.0.3 → 0.1.0
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.
- data/.gitignore +1 -0
- data/.travis.yml +8 -0
- data/README.md +6 -2
- data/Rakefile +6 -0
- data/lib/source_position.rb +8 -0
- data/lib/source_position/rbx_source_location.rb +7 -0
- data/lib/source_position/version.rb +1 -1
- data/source_position.gemspec +6 -0
- data/spec/source_position_spec.rb +9 -6
- data/spec/spec_helper.rb +5 -0
- metadata +4 -2
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -2,9 +2,13 @@
|
|
2
2
|
|
3
3
|
Editor friendly source location
|
4
4
|
|
5
|
-
|
5
|
+
[](http://travis-ci.org/linjunpop/source_position)
|
6
|
+
[](https://gemnasium.com/linjunpop/source_position)
|
7
|
+
[](https://codeclimate.com/github/linjunpop/source_position)
|
8
|
+
|
9
|
+
Tested on 1.8.7, 1.9.3, ree, rbx-18mode, rbx-19mode
|
6
10
|
|
7
|
-
|
11
|
+
## Installation
|
8
12
|
|
9
13
|
Add this line to your application's Gemfile:
|
10
14
|
|
data/Rakefile
CHANGED
data/lib/source_position.rb
CHANGED
@@ -1,4 +1,11 @@
|
|
1
|
+
if RUBY_VERSION < '1.9'
|
2
|
+
unless defined?(RUBY_ENGINE) && RUBY_ENGINE =~ /rbx/
|
3
|
+
require 'ruby18_source_location'
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
1
7
|
require "source_position/version"
|
8
|
+
require "source_position/rbx_source_location"
|
2
9
|
|
3
10
|
module SourcePosition
|
4
11
|
def source_position
|
@@ -15,5 +22,6 @@ class UnboundMethod
|
|
15
22
|
end
|
16
23
|
|
17
24
|
class Proc
|
25
|
+
include SourcePosition::RbxSourceLocation
|
18
26
|
include SourcePosition
|
19
27
|
end
|
data/source_position.gemspec
CHANGED
@@ -15,5 +15,11 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = SourcePosition::VERSION
|
17
17
|
|
18
|
+
if RUBY_VERSION < '1.9'
|
19
|
+
unless defined?(RUBY_ENGINE) && RUBY_ENGINE =~ /rbx/
|
20
|
+
gem.add_dependency 'ruby18_source_location', '~> 0.2'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
18
24
|
gem.add_development_dependency 'rspec'
|
19
25
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
require 'source_position'
|
3
2
|
|
4
3
|
class Dummy
|
5
4
|
def self.foobar
|
@@ -14,26 +13,30 @@ end
|
|
14
13
|
describe SourcePosition do
|
15
14
|
subject { Dummy.method(:foobar) }
|
16
15
|
|
17
|
-
its(:source_position) { should eq "#{Dir.pwd}/spec/source_position_spec.rb:
|
16
|
+
its(:source_position) { should eq "#{Dir.pwd}/spec/source_position_spec.rb:4"}
|
18
17
|
|
19
18
|
context 'source_location returns nil value' do
|
20
19
|
subject { Object.method(:to_s) }
|
20
|
+
|
21
|
+
before do
|
22
|
+
subject.should_receive(:source_location) { nil }
|
23
|
+
end
|
24
|
+
|
21
25
|
its(:source_position) { should eq nil }
|
22
26
|
end
|
23
27
|
|
24
28
|
describe 'Method' do
|
25
29
|
subject { Dummy.method(:foobar) }
|
26
|
-
its(:source_position) { should eq "#{Dir.pwd}/spec/source_position_spec.rb:
|
30
|
+
its(:source_position) { should eq "#{Dir.pwd}/spec/source_position_spec.rb:4"}
|
27
31
|
end
|
28
32
|
|
29
33
|
describe 'UnboundMethod' do
|
30
34
|
subject { Dummy.instance_method(:test) }
|
31
|
-
its(:source_position) { should eq "#{Dir.pwd}/spec/source_position_spec.rb:
|
35
|
+
its(:source_position) { should eq "#{Dir.pwd}/spec/source_position_spec.rb:8"}
|
32
36
|
end
|
33
37
|
|
34
38
|
describe 'Proc' do
|
35
39
|
subject { Proc.new{} }
|
36
|
-
its(:source_position) { should eq "#{Dir.pwd}/spec/source_position_spec.rb:
|
40
|
+
its(:source_position) { should eq "#{Dir.pwd}/spec/source_position_spec.rb:39"}
|
37
41
|
end
|
38
42
|
end
|
39
|
-
|
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
require 'source_position'
|
5
|
+
|
1
6
|
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
7
|
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
8
|
# Require this file using `require "spec_helper"` to ensure that it is only
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: source_position
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -36,11 +36,13 @@ extra_rdoc_files: []
|
|
36
36
|
files:
|
37
37
|
- .gitignore
|
38
38
|
- .rspec
|
39
|
+
- .travis.yml
|
39
40
|
- Gemfile
|
40
41
|
- LICENSE
|
41
42
|
- README.md
|
42
43
|
- Rakefile
|
43
44
|
- lib/source_position.rb
|
45
|
+
- lib/source_position/rbx_source_location.rb
|
44
46
|
- lib/source_position/version.rb
|
45
47
|
- source_position.gemspec
|
46
48
|
- spec/source_position_spec.rb
|