open_source_location 0.1.0 → 0.2.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
  SHA256:
3
- metadata.gz: 61d2d5169811832ef4c13b63cc916da92ea1ea8d0850e62d5f78217a22076f38
4
- data.tar.gz: 64abde7fa0a7a4eb71fd99076602d023af953fbd7139734302a61c87267ca868
3
+ metadata.gz: 790d9910b6f28dbbf3f35c88dfc3c0258c2d8c15d8f9d21c32e21876daca6097
4
+ data.tar.gz: de5758fcd68a771c416dccaa1ed29a5fceb1f64259c0eabb12189b989c5e67cb
5
5
  SHA512:
6
- metadata.gz: 5a2b42a4ebb255d2beb1d9db015481a2b3ba3958d14d26b5658f41223d6e9334f495af71a3b2c61447494ad3445e16bfa2db359d5d3544b1fe9f37b5f5bb6588
7
- data.tar.gz: 012b9d0a3e46fe156ddc47ce0e39f8282eb1b59ab41f287bc6408e96027ddb14cce707b4cb0fa32d116bab687e98c74df5b6e0648455fdbbd0890d211bdc9dfe
6
+ metadata.gz: 639fd6b55007b1fee6d8d37e4471cf0aaa1ab238165c6dd182a872fa0e96756989b43a6dd989eef6121f2f61216074c492a51093b9fa38ed451d8e368206993d
7
+ data.tar.gz: 7cd21770039a45876519c5ecd88015723085dcb16fd78ff73880ea7a312af3c3c0a8c005c4dc9ab028583c65aaad06869175bb474196c196a5f1732bfbdcab73
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- open_source_location (0.1.0)
4
+ open_source_location (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenSource
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
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.1.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-07 00:00:00.000000000 Z
11
+ date: 2022-01-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: