synvert-core 0.18.0 → 0.19.0
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/lib/synvert/core/configuration.rb +9 -17
- data/lib/synvert/core/rewriter.rb +2 -2
- data/lib/synvert/core/rewriter/gem_spec.rb +1 -1
- data/lib/synvert/core/rewriter/instance.rb +2 -2
- data/lib/synvert/core/version.rb +1 -1
- data/spec/spec_helper.rb +0 -5
- metadata +1 -3
- data/spec/synvert/core/configuration_spec.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1248f2c7c2721ea6135b6adb3a5d40afc95497c63d91e8b1b508febb6e7d4b1
|
4
|
+
data.tar.gz: 9e7f64e254dc25e1bf9894559c7586eb6fb96f3aea07bedd09d71a17d930e0fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a940b5ea3029c9cbc7b10034e3e6eca05370d4015a4c98af28a1eb8b2a825133627f1d25da20e8986d89f52da00c7056893eb9946aff5a017979bc720d097755
|
7
|
+
data.tar.gz: 37a51398a51fec8cac11b2b3aae8353f5483bfbd7e9485d1b644b8000dea5186036438f1a01b9f4c0d4ce8b940ab6b40261673eb309a663c6f61df45afcf1b45
|
data/CHANGELOG.md
CHANGED
@@ -1,26 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'singleton'
|
4
|
-
|
5
3
|
module Synvert::Core
|
6
4
|
# Synvert global configuration.
|
7
|
-
class Configuration
|
8
|
-
|
5
|
+
class Configuration
|
6
|
+
class << self
|
7
|
+
attr_writer :path, :skip_files
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
# @param value [Object] configuration value.
|
14
|
-
def set(key, value)
|
15
|
-
self[key] = value
|
16
|
-
end
|
9
|
+
def path
|
10
|
+
@path || '.'
|
11
|
+
end
|
17
12
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
# @return [Object] configuration value.
|
22
|
-
def get(key)
|
23
|
-
self[key]
|
13
|
+
def skip_files
|
14
|
+
@skip_files || []
|
15
|
+
end
|
24
16
|
end
|
25
17
|
end
|
26
18
|
end
|
@@ -233,7 +233,7 @@ module Synvert::Core
|
|
233
233
|
def add_file(filename, content)
|
234
234
|
return if @sandbox
|
235
235
|
|
236
|
-
filepath = File.join(Configuration.
|
236
|
+
filepath = File.join(Configuration.path, filename)
|
237
237
|
if File.exist?(filepath)
|
238
238
|
puts "File #{filepath} already exists."
|
239
239
|
return
|
@@ -251,7 +251,7 @@ module Synvert::Core
|
|
251
251
|
def remove_file(filename)
|
252
252
|
return if @sandbox
|
253
253
|
|
254
|
-
file_path = File.join(Configuration.
|
254
|
+
file_path = File.join(Configuration.path, filename)
|
255
255
|
File.delete(file_path) if File.exist?(file_path)
|
256
256
|
end
|
257
257
|
|
@@ -26,7 +26,7 @@ module Synvert::Core
|
|
26
26
|
# @return [Boolean] true if matches, otherwise false.
|
27
27
|
# @raise [Synvert::Core::GemfileLockNotFound] raise if Gemfile.lock does not exist.
|
28
28
|
def match?
|
29
|
-
gemfile_lock_path = File.join(Configuration.
|
29
|
+
gemfile_lock_path = File.join(Configuration.path, 'Gemfile.lock')
|
30
30
|
|
31
31
|
# if Gemfile.lock does not exist, just ignore this check
|
32
32
|
return true unless File.exist?(gemfile_lock_path)
|
@@ -86,11 +86,11 @@ module Synvert::Core
|
|
86
86
|
# It finds all files, for each file, it executes the block code, gets all rewrite actions,
|
87
87
|
# and rewrite source code back to original file.
|
88
88
|
def process
|
89
|
-
file_pattern = File.join(Configuration.
|
89
|
+
file_pattern = File.join(Configuration.path, @file_pattern)
|
90
90
|
Dir
|
91
91
|
.glob(file_pattern)
|
92
92
|
.each do |file_path|
|
93
|
-
next if Configuration.
|
93
|
+
next if Configuration.skip_files.include? file_path
|
94
94
|
|
95
95
|
begin
|
96
96
|
conflict_actions = []
|
data/lib/synvert/core/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: synvert-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.19.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
@@ -167,7 +167,6 @@ files:
|
|
167
167
|
- lib/synvert/core/version.rb
|
168
168
|
- spec/spec_helper.rb
|
169
169
|
- spec/support/parser_helper.rb
|
170
|
-
- spec/synvert/core/configuration_spec.rb
|
171
170
|
- spec/synvert/core/engine/erb_spec.rb
|
172
171
|
- spec/synvert/core/node_ext_spec.rb
|
173
172
|
- spec/synvert/core/rewriter/action/append_action_spec.rb
|
@@ -216,7 +215,6 @@ summary: convert ruby code to better syntax.
|
|
216
215
|
test_files:
|
217
216
|
- spec/spec_helper.rb
|
218
217
|
- spec/support/parser_helper.rb
|
219
|
-
- spec/synvert/core/configuration_spec.rb
|
220
218
|
- spec/synvert/core/engine/erb_spec.rb
|
221
219
|
- spec/synvert/core/node_ext_spec.rb
|
222
220
|
- spec/synvert/core/rewriter/action/append_action_spec.rb
|