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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1cedb314d7ce79f7a9fa00e594373d6d5ace7f2b176578453592b0316c327cad
4
- data.tar.gz: 8d5e644b4a97f4ed660def711051ecdb13a5fbb117b8e0b821730eef49d6c0cc
3
+ metadata.gz: 241e9b40114c50b1dec1b86784fde026ed03ac64f2e38e314f00ed1f35a010c5
4
+ data.tar.gz: 521fee14550bd2eebb9e26d9aa1928bd4ae51cc43a88692c5337dad7ab32cc11
5
5
  SHA512:
6
- metadata.gz: bd9a7daba3a515c0a81fcb98fc700eff18e37a9d10170c3d41ce82278ea196b4ed007b231aeb2f1ed6dac45b08130c26be5a972d866adb39abadc0a2e0b7ba65
7
- data.tar.gz: 8f19d1da02f1953cf2d7fba99f865aa8b95df5f5cb5fb45566d450b510663fb52df19863350c89d8a8786f5ff993cf2c7da3f55e5931e12c77530b23e90703fb
6
+ metadata.gz: 206b4e331e89760a0f47376401a48986b0ce2ec7e72d29cc566a93ae9b2341d7298a9738da3b9434c38a66d81b32bd6e109c9f52a0804d2575dcc0a8f46b2254
7
+ data.tar.gz: e42ec5540b5b3dab9688ef43d9872132ea8e78c33073aa8567e10dcfb3152e7c50b8d1d639b16d3a0bacd9bc088966fb32c915dfccb045c412b79552e37a3eec
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.35.4 (2024-04-25)
4
+
5
+ * Eval snippet on gist.github.com
6
+
3
7
  ## 1.35.3 (2024-04-18)
4
8
 
5
9
  * Update `prism_ext` to 0.3.2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- synvert-core (1.35.3)
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.25.0)
67
+ prism (0.27.0)
68
68
  prism_ext (0.3.2)
69
69
  prism
70
70
  pry (0.14.1)
@@ -88,9 +88,15 @@ module Synvert::Core
88
88
  end
89
89
 
90
90
  def convert_to_github_raw_url(url)
91
- return url unless url.include?('//github.com/')
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.sub('//github.com/', '//raw.githubusercontent.com/').sub('/blob/', '/')
99
+ url
94
100
  end
95
101
 
96
102
  # Filter only paths with `Configuration.only_paths`.
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Synvert
4
4
  module Core
5
- VERSION = '1.35.3'
5
+ VERSION = '1.35.4'
6
6
  end
7
7
  end
@@ -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.3
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-18 00:00:00.000000000 Z
11
+ date: 2024-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport