synvert-core 1.35.3 → 1.35.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +2 -2
- data/lib/synvert/core/utils.rb +8 -2
- data/lib/synvert/core/version.rb +1 -1
- data/spec/synvert/core/utils_spec.rb +16 -0
- 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: 241e9b40114c50b1dec1b86784fde026ed03ac64f2e38e314f00ed1f35a010c5
|
4
|
+
data.tar.gz: 521fee14550bd2eebb9e26d9aa1928bd4ae51cc43a88692c5337dad7ab32cc11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 206b4e331e89760a0f47376401a48986b0ce2ec7e72d29cc566a93ae9b2341d7298a9738da3b9434c38a66d81b32bd6e109c9f52a0804d2575dcc0a8f46b2254
|
7
|
+
data.tar.gz: e42ec5540b5b3dab9688ef43d9872132ea8e78c33073aa8567e10dcfb3152e7c50b8d1d639b16d3a0bacd9bc088966fb32c915dfccb045c412b79552e37a3eec
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
synvert-core (1.35.
|
4
|
+
synvert-core (1.35.4)
|
5
5
|
activesupport (< 7.0.0)
|
6
6
|
node_mutation (>= 1.24.4)
|
7
7
|
node_query (>= 1.15.2)
|
@@ -64,7 +64,7 @@ GEM
|
|
64
64
|
parser_node_ext (1.3.2)
|
65
65
|
parser
|
66
66
|
prettier_print (1.2.1)
|
67
|
-
prism (0.
|
67
|
+
prism (0.27.0)
|
68
68
|
prism_ext (0.3.2)
|
69
69
|
prism
|
70
70
|
pry (0.14.1)
|
data/lib/synvert/core/utils.rb
CHANGED
@@ -88,9 +88,15 @@ module Synvert::Core
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def convert_to_github_raw_url(url)
|
91
|
-
|
91
|
+
if url.starts_with?('https://github.com')
|
92
|
+
return url.sub('//github.com/', '//raw.githubusercontent.com/').sub('/blob/', '/')
|
93
|
+
end
|
94
|
+
|
95
|
+
if url.starts_with?('https://gist.github.com')
|
96
|
+
return url.sub('gist.github.com/', 'gist.githubusercontent.com/') + '/raw'
|
97
|
+
end
|
92
98
|
|
93
|
-
url
|
99
|
+
url
|
94
100
|
end
|
95
101
|
|
96
102
|
# Filter only paths with `Configuration.only_paths`.
|
data/lib/synvert/core/version.rb
CHANGED
@@ -12,6 +12,22 @@ module Synvert::Core
|
|
12
12
|
expect(rewriter.name).to eq 'name'
|
13
13
|
end
|
14
14
|
|
15
|
+
it 'evals github url' do
|
16
|
+
expect(described_class).to receive(:remote_snippet_exists?).with(URI.parse('https://raw.githubusercontent.com/synvert-hq/synvert-snippets-ruby/main/lib/bundler/use_shortcut_git_source.rb')).and_return(true)
|
17
|
+
expect_any_instance_of(URI::HTTP).to receive(:open).and_return(StringIO.new("Rewriter.new 'group', 'name' do\nend"))
|
18
|
+
rewriter = described_class.eval_snippet('https://github.com/synvert-hq/synvert-snippets-ruby/blob/main/lib/bundler/use_shortcut_git_source.rb')
|
19
|
+
expect(rewriter.group).to eq 'group'
|
20
|
+
expect(rewriter.name).to eq 'name'
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'evals gist url' do
|
24
|
+
expect(described_class).to receive(:remote_snippet_exists?).with(URI.parse('https://gist.githubusercontent.com/flyerhzm/6b868cf6cceba0e2fa253f1936acf1f6/raw')).and_return(true)
|
25
|
+
expect_any_instance_of(URI::HTTP).to receive(:open).and_return(StringIO.new("Rewriter.new 'group', 'name' do\nend"))
|
26
|
+
rewriter = described_class.eval_snippet('https://gist.github.com/flyerhzm/6b868cf6cceba0e2fa253f1936acf1f6')
|
27
|
+
expect(rewriter.group).to eq 'group'
|
28
|
+
expect(rewriter.name).to eq 'name'
|
29
|
+
end
|
30
|
+
|
15
31
|
it 'raises error' do
|
16
32
|
expect(described_class).to receive(:remote_snippet_exists?).and_return(false)
|
17
33
|
expect do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: synvert-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.35.
|
4
|
+
version: 1.35.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-04-
|
11
|
+
date: 2024-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|