open_source_location 0.1.0 → 0.2.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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +21 -1
- data/lib/open_source/version.rb +1 -1
- data/lib/open_source.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 790d9910b6f28dbbf3f35c88dfc3c0258c2d8c15d8f9d21c32e21876daca6097
|
4
|
+
data.tar.gz: de5758fcd68a771c416dccaa1ed29a5fceb1f64259c0eabb12189b989c5e67cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 639fd6b55007b1fee6d8d37e4471cf0aaa1ab238165c6dd182a872fa0e96756989b43a6dd989eef6121f2f61216074c492a51093b9fa38ed451d8e368206993d
|
7
|
+
data.tar.gz: 7cd21770039a45876519c5ecd88015723085dcb16fd78ff73880ea7a312af3c3c0a8c005c4dc9ab028583c65aaad06869175bb474196c196a5f1732bfbdcab73
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -10,23 +10,42 @@ Then use as you wish
|
|
10
10
|
|
11
11
|
```ruby
|
12
12
|
# probably in a console, though doesn't have to be
|
13
|
+
require 'open_source' # not needed if it's in your Gemfile, and this environment is loaded by bundler
|
14
|
+
|
13
15
|
open_source "User" # opens file where User class is defined
|
14
16
|
oso User # same as above; use the aliases for ease of use!
|
15
17
|
oso Authenticable # opens file where Authenticable module is defined
|
16
18
|
oso :log # opens file where "log" method is defined
|
17
19
|
oso "log" # same
|
18
20
|
oso method :log # you get the idea
|
21
|
+
oso Rails.method(:application)
|
19
22
|
oso User.instance_method(:name)
|
20
23
|
```
|
21
24
|
|
22
25
|
Line numbers are supported too, currently for Vi and VsCode.
|
23
26
|
|
27
|
+
### Configuration
|
28
|
+
|
29
|
+
#### Using a specific editor for this gem
|
30
|
+
|
31
|
+
It's possible to use the `OPEN_SOURCE_GEM_EDITOR` env variable to set a specific editor for use with this gem, if you don't want to use your standard `EDITOR`.
|
32
|
+
|
33
|
+
For example:
|
34
|
+
|
35
|
+
```bash
|
36
|
+
# .bashrc or wherever
|
37
|
+
EDITOR=vim # standard terminal based editor
|
38
|
+
OPEN_SOURCE_GEM_EDITOR=gvim # a GUI version; opens in a different window. Takes priority over EDITOR
|
39
|
+
```
|
40
|
+
|
41
|
+
This is optional, and if you normally use a GUI editor anyway it probably won't be needed.
|
42
|
+
|
24
43
|
## Installation
|
25
44
|
|
26
45
|
Add this line to your application's Gemfile:
|
27
46
|
|
28
47
|
```ruby
|
29
|
-
gem 'open_source_location'
|
48
|
+
gem 'open_source_location', require: "open_source"
|
30
49
|
```
|
31
50
|
|
32
51
|
And then execute:
|
@@ -37,6 +56,7 @@ Or install it yourself as:
|
|
37
56
|
|
38
57
|
$ gem install open_source_location
|
39
58
|
|
59
|
+
Just make sure you then `require 'open_source'` where you need it.
|
40
60
|
|
41
61
|
## Development
|
42
62
|
|
data/lib/open_source/version.rb
CHANGED
data/lib/open_source.rb
CHANGED
@@ -75,13 +75,13 @@ module OpenSource
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def get_command(file, line)
|
78
|
-
editor = ENV["EDITOR"]
|
78
|
+
editor = ENV["OPEN_SOURCE_GEM_EDITOR"] || ENV["EDITOR"]
|
79
79
|
|
80
80
|
# different editors handle going to specific lines differently
|
81
81
|
case editor
|
82
82
|
when nil
|
83
83
|
raise NoEditorError, "the EDITOR env variable must be set to use this feature"
|
84
|
-
when /\s?n?vim?(\s|\z)/
|
84
|
+
when /\s?(?:n|m|g)?vim?(\s|\z)/
|
85
85
|
[editor, "+#{line}", file]
|
86
86
|
when /\s?code(\s|\z)/
|
87
87
|
[editor, "--goto", "#{file}:#{line}"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: open_source_location
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joseph Johansen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|