open_code-rails 0.3.0 → 0.6.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/.travis.yml +1 -0
- data/Gemfile.lock +68 -65
- data/README.md +20 -0
- data/lib/open_code/rails/railtie.rb +25 -0
- data/lib/open_code/rails/vcr.js +20 -3
- data/lib/open_code/rails/version.rb +1 -1
- data/open_code-rails.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c34fdda9d2a73c18e7835c3c8598cb7773f3678099c90094f2fe808df74345b
|
4
|
+
data.tar.gz: d5d17fa18ea9dc4623260e771335fa811a618127ff7fe05020b40793a31029c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a11d06848544a5643b9f38e71ba47f8194d1a55d89c45a098635472753cba1e9ae9441711c42ebbfe70262cacb4af7e7585a23862ff7012d87384aad23ba6168
|
7
|
+
data.tar.gz: bb324baaf1676d73d5be77c6dc3e2c096d6c0c91a63da1189d84b2b67c92a4d8cb1b7a5ad4eeb8190defdf9e01e5e26c2917fec9cfa2c2f323ae54c062d1752b
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,104 +1,107 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
open_code-rails (0.
|
4
|
+
open_code-rails (0.6.0)
|
5
5
|
railties (>= 4.2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actionpack (
|
11
|
-
actionview (=
|
12
|
-
activesupport (=
|
13
|
-
rack (~> 2.0)
|
10
|
+
actionpack (6.0.3.4)
|
11
|
+
actionview (= 6.0.3.4)
|
12
|
+
activesupport (= 6.0.3.4)
|
13
|
+
rack (~> 2.0, >= 2.0.8)
|
14
14
|
rack-test (>= 0.6.3)
|
15
15
|
rails-dom-testing (~> 2.0)
|
16
|
-
rails-html-sanitizer (~> 1.0, >= 1.0
|
17
|
-
actionview (
|
18
|
-
activesupport (=
|
16
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
17
|
+
actionview (6.0.3.4)
|
18
|
+
activesupport (= 6.0.3.4)
|
19
19
|
builder (~> 3.1)
|
20
20
|
erubi (~> 1.4)
|
21
21
|
rails-dom-testing (~> 2.0)
|
22
|
-
rails-html-sanitizer (~> 1.
|
23
|
-
activesupport (
|
22
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
23
|
+
activesupport (6.0.3.4)
|
24
24
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
25
25
|
i18n (>= 0.7, < 2)
|
26
26
|
minitest (~> 5.1)
|
27
27
|
tzinfo (~> 1.1)
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
28
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
29
|
+
ast (2.4.1)
|
30
|
+
builder (3.2.4)
|
31
|
+
byebug (11.1.3)
|
32
|
+
coderay (1.1.3)
|
33
|
+
concurrent-ruby (1.1.7)
|
34
|
+
crass (1.0.6)
|
35
|
+
diff-lcs (1.4.4)
|
36
|
+
erubi (1.9.0)
|
37
|
+
i18n (1.8.5)
|
37
38
|
concurrent-ruby (~> 1.0)
|
38
|
-
|
39
|
-
loofah (2.2.3)
|
39
|
+
loofah (2.7.0)
|
40
40
|
crass (~> 1.0.2)
|
41
41
|
nokogiri (>= 1.5.9)
|
42
|
-
method_source (0.
|
42
|
+
method_source (1.0.0)
|
43
43
|
mini_portile2 (2.4.0)
|
44
|
-
minitest (5.
|
45
|
-
nokogiri (1.10.
|
44
|
+
minitest (5.14.2)
|
45
|
+
nokogiri (1.10.10)
|
46
46
|
mini_portile2 (~> 2.4.0)
|
47
|
-
parallel (1.
|
48
|
-
parser (2.
|
49
|
-
ast (~> 2.4.
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
pry-byebug (3.7.0)
|
47
|
+
parallel (1.19.2)
|
48
|
+
parser (2.7.2.0)
|
49
|
+
ast (~> 2.4.1)
|
50
|
+
pry (0.13.1)
|
51
|
+
coderay (~> 1.1)
|
52
|
+
method_source (~> 1.0)
|
53
|
+
pry-byebug (3.9.0)
|
55
54
|
byebug (~> 11.0)
|
56
|
-
pry (~> 0.
|
57
|
-
|
58
|
-
rack (2.0.6)
|
55
|
+
pry (~> 0.13.0)
|
56
|
+
rack (2.2.3)
|
59
57
|
rack-test (1.1.0)
|
60
58
|
rack (>= 1.0, < 3)
|
61
59
|
rails-dom-testing (2.0.3)
|
62
60
|
activesupport (>= 4.2.0)
|
63
61
|
nokogiri (>= 1.6)
|
64
|
-
rails-html-sanitizer (1.0
|
65
|
-
loofah (~> 2.
|
66
|
-
railties (
|
67
|
-
actionpack (=
|
68
|
-
activesupport (=
|
62
|
+
rails-html-sanitizer (1.3.0)
|
63
|
+
loofah (~> 2.3)
|
64
|
+
railties (6.0.3.4)
|
65
|
+
actionpack (= 6.0.3.4)
|
66
|
+
activesupport (= 6.0.3.4)
|
69
67
|
method_source
|
70
68
|
rake (>= 0.8.7)
|
71
|
-
thor (>= 0.
|
69
|
+
thor (>= 0.20.3, < 2.0)
|
72
70
|
rainbow (3.0.0)
|
73
|
-
rake (
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
rspec-
|
78
|
-
|
79
|
-
rspec-
|
80
|
-
rspec-
|
71
|
+
rake (13.0.1)
|
72
|
+
regexp_parser (1.8.1)
|
73
|
+
rexml (3.2.4)
|
74
|
+
rspec (3.9.0)
|
75
|
+
rspec-core (~> 3.9.0)
|
76
|
+
rspec-expectations (~> 3.9.0)
|
77
|
+
rspec-mocks (~> 3.9.0)
|
78
|
+
rspec-core (3.9.3)
|
79
|
+
rspec-support (~> 3.9.3)
|
80
|
+
rspec-expectations (3.9.2)
|
81
81
|
diff-lcs (>= 1.2.0, < 2.0)
|
82
|
-
rspec-support (~> 3.
|
83
|
-
rspec-mocks (3.
|
82
|
+
rspec-support (~> 3.9.0)
|
83
|
+
rspec-mocks (3.9.1)
|
84
84
|
diff-lcs (>= 1.2.0, < 2.0)
|
85
|
-
rspec-support (~> 3.
|
86
|
-
rspec-support (3.
|
87
|
-
rubocop (0.
|
88
|
-
jaro_winkler (~> 1.5.1)
|
85
|
+
rspec-support (~> 3.9.0)
|
86
|
+
rspec-support (3.9.3)
|
87
|
+
rubocop (0.93.0)
|
89
88
|
parallel (~> 1.10)
|
90
|
-
parser (>= 2.
|
91
|
-
powerpack (~> 0.1)
|
92
|
-
psych (>= 3.1.0)
|
89
|
+
parser (>= 2.7.1.5)
|
93
90
|
rainbow (>= 2.2.2, < 4.0)
|
91
|
+
regexp_parser (>= 1.8)
|
92
|
+
rexml
|
93
|
+
rubocop-ast (>= 0.6.0)
|
94
94
|
ruby-progressbar (~> 1.7)
|
95
|
-
unicode-display_width (
|
96
|
-
|
97
|
-
|
95
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
96
|
+
rubocop-ast (0.7.1)
|
97
|
+
parser (>= 2.7.1.5)
|
98
|
+
ruby-progressbar (1.10.1)
|
99
|
+
thor (1.0.1)
|
98
100
|
thread_safe (0.3.6)
|
99
|
-
tzinfo (1.2.
|
101
|
+
tzinfo (1.2.7)
|
100
102
|
thread_safe (~> 0.1)
|
101
|
-
unicode-display_width (1.
|
103
|
+
unicode-display_width (1.7.0)
|
104
|
+
zeitwerk (2.4.0)
|
102
105
|
|
103
106
|
PLATFORMS
|
104
107
|
ruby
|
@@ -107,9 +110,9 @@ DEPENDENCIES
|
|
107
110
|
bundler (>= 1.10)
|
108
111
|
open_code-rails!
|
109
112
|
pry-byebug
|
110
|
-
rake (~>
|
113
|
+
rake (~> 13.0)
|
111
114
|
rspec (~> 3.0)
|
112
115
|
rubocop
|
113
116
|
|
114
117
|
BUNDLED WITH
|
115
|
-
1.
|
118
|
+
2.1.4
|
data/README.md
CHANGED
@@ -12,6 +12,10 @@ Add links in exception page to open Application Trace file to line in VSCode. No
|
|
12
12
|

|
13
13
|
- Custom Settings and Full Trace
|
14
14
|

|
15
|
+
- Display URLs in console/log files
|
16
|
+

|
17
|
+
- Per browser settings in localStorage
|
18
|
+

|
15
19
|
|
16
20
|
## Installation
|
17
21
|
|
@@ -70,6 +74,12 @@ You should put settings in `config/environments/development.rb` because this gem
|
|
70
74
|
end
|
71
75
|
```
|
72
76
|
|
77
|
+
4. `config.open_code.logger_url` - default: `false`
|
78
|
+
|
79
|
+
Display VSCode/VSCodium urls rather than relative filenames in Rails Logger. So you should see URLs in dev mode console and `development.log`.
|
80
|
+
|
81
|
+
> This option directly replaces the results of `::Rails.backtrace_cleaner.clean`.
|
82
|
+
|
73
83
|
### Advanced
|
74
84
|
|
75
85
|
#### Environment Variables
|
@@ -96,6 +106,14 @@ Some flexibility is probably required for cooperation. Different people may have
|
|
96
106
|
|
97
107
|
$ /usr/bin/env FORCE_OPEN_CODE_ROOT_DIR='/my/project/path' rails s
|
98
108
|
|
109
|
+
4. `FORCE_OPEN_CODE_LOGGER_URL`
|
110
|
+
|
111
|
+
When is not blank, `config.open_code.logger_url` will be overridden.
|
112
|
+
|
113
|
+
Set to `false`, `off` or `disabled` to disable this functionality. Blank value will be ignored. All other values will enable this functionality.
|
114
|
+
|
115
|
+
$ /usr/bin/env FORCE_OPEN_CODE_LOGGER_URL=on rails s
|
116
|
+
|
99
117
|
#### Browser
|
100
118
|
|
101
119
|
This functionality requires [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage).
|
@@ -127,3 +145,5 @@ This functionality requires [localStorage](https://developer.mozilla.org/en-US/d
|
|
127
145
|
- `_openCode.reset()`
|
128
146
|
|
129
147
|
Reset all settings - back to default.
|
148
|
+
|
149
|
+
> Changing this settings only applies to the current browser. It does not have any impacts to Rails app.
|
@@ -5,6 +5,7 @@ module OpenCode
|
|
5
5
|
class Railtie < ::Rails::Railtie
|
6
6
|
config.open_code = ActiveSupport::OrderedOptions.new
|
7
7
|
config.open_code.editor = 'vscode'
|
8
|
+
config.open_code.logger_url = false
|
8
9
|
|
9
10
|
initializer "open_code.initialize" do
|
10
11
|
abort('open_code-rails should not be used in production mode!') if ::Rails.env.production?
|
@@ -24,6 +25,30 @@ module OpenCode
|
|
24
25
|
next unless Middleware.loadable?(cfg)
|
25
26
|
|
26
27
|
app.middleware.insert_before(ActionDispatch::DebugExceptions, Middleware)
|
28
|
+
|
29
|
+
logger_url = ENV['FORCE_OPEN_CODE_LOGGER_URL']
|
30
|
+
logger_url = if logger_url.blank?
|
31
|
+
cfg.logger_url
|
32
|
+
else
|
33
|
+
!%w[OFF FALSE DISABLED].include?(logger_url.upcase)
|
34
|
+
end
|
35
|
+
next unless logger_url
|
36
|
+
|
37
|
+
scheme = cfg.editor
|
38
|
+
root_dir = cfg.root_dir
|
39
|
+
|
40
|
+
bc = ::Rails.backtrace_cleaner
|
41
|
+
bc.class_eval { alias_method :vcr_clean, :clean }
|
42
|
+
bc.define_singleton_method(:clean) do |*args|
|
43
|
+
vcr_clean(*args).map do |ln|
|
44
|
+
begin
|
45
|
+
next ln unless ln =~ %r(^\w+\/.+?:in)
|
46
|
+
" #{scheme}://file/#{root_dir}/#{ln.split(':in').join(' in')}"
|
47
|
+
rescue => _e
|
48
|
+
ln
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
27
52
|
end
|
28
53
|
end
|
29
54
|
end
|
data/lib/open_code/rails/vcr.js
CHANGED
@@ -35,6 +35,19 @@
|
|
35
35
|
|
36
36
|
var cssStyle = null;
|
37
37
|
|
38
|
+
function removeLoggerUri() {
|
39
|
+
var items = document.querySelectorAll('[id^="Application-Trace"] .trace-frames, [id^="Full-Trace"] .trace-frames');
|
40
|
+
var rootPath = defaults.rootDir + '/';
|
41
|
+
for (var i = 0; i < items.length; i += 1) {
|
42
|
+
var item = items[i];
|
43
|
+
var line = item.innerText;
|
44
|
+
if (line.indexOf(rootPath) < 0) continue;
|
45
|
+
|
46
|
+
var parts = line.split(rootPath);
|
47
|
+
item.innerText = parts[parts.length - 1];
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
38
51
|
function generateLinks() {
|
39
52
|
if (cssStyle == null) {
|
40
53
|
cssStyle = document.querySelector('style#_open-code-rails_') || false;
|
@@ -50,11 +63,11 @@
|
|
50
63
|
cssStyle.innerText = cssStyle.innerText + iconStyle;
|
51
64
|
}
|
52
65
|
var tmp = document.createElement('div');
|
53
|
-
var items = document.querySelectorAll('
|
66
|
+
var items = document.querySelectorAll('[id^="Application-Trace"] .trace-frames');
|
54
67
|
var ph = current.placeHolder || '';
|
55
68
|
for (var i = 0; i < items.length; i += 1) {
|
56
69
|
var item = items[i];
|
57
|
-
var pathLine = item.innerText.split(
|
70
|
+
var pathLine = item.innerText.split(/:(\d+)/, 2);
|
58
71
|
var h = JSON.stringify(buildLink(pathLine[0], pathLine[1]));
|
59
72
|
var html = '<a href=' + h + ' class="open-code-rails-link">' + ph + '</a>';
|
60
73
|
|
@@ -68,7 +81,10 @@
|
|
68
81
|
}
|
69
82
|
}
|
70
83
|
|
71
|
-
setTimeout(
|
84
|
+
setTimeout(function () {
|
85
|
+
removeLoggerUri();
|
86
|
+
generateLinks();
|
87
|
+
}, 0);
|
72
88
|
if (!window.localStorage) return;
|
73
89
|
|
74
90
|
var ROOT_KEY = '_dbg-open_code_';
|
@@ -123,6 +139,7 @@
|
|
123
139
|
var val = current[key]
|
124
140
|
r[key] = val == null ? defaults[key] : val;
|
125
141
|
}
|
142
|
+
if (r.placeHolder) r.iconUrl = null;
|
126
143
|
return r;
|
127
144
|
},
|
128
145
|
getValue: function (key) {
|
data/open_code-rails.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_dependency("railties", ">= 4.2")
|
27
27
|
|
28
28
|
spec.add_development_dependency("bundler", ">= 1.10")
|
29
|
-
spec.add_development_dependency("rake", "~>
|
29
|
+
spec.add_development_dependency("rake", "~> 13.0")
|
30
30
|
spec.add_development_dependency("rspec", "~> 3.0")
|
31
31
|
spec.add_development_dependency("pry-byebug")
|
32
32
|
spec.add_development_dependency("rubocop")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: open_code-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Chen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '13.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '13.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
requirements: []
|
140
|
-
rubygems_version: 3.
|
140
|
+
rubygems_version: 3.1.4
|
141
141
|
signing_key:
|
142
142
|
specification_version: 4
|
143
143
|
summary: Open file in editor in Rails exception pages
|