synvert 0.12.1 → 0.13.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: 6850587d42a82286479a86f22018a83b4e6f3b6d23d65a6518120acde4c4a52c
4
- data.tar.gz: e9a223cae6a39601d7bd9f793c109d28db4483664da77a20a88c267a4432568e
3
+ metadata.gz: 43ccf2486b37c9a73a8f014901e152ff5229bbcac7a35922d6cb5811318c9621
4
+ data.tar.gz: 0d9a816901fd978e550f976a6678513a516872f8c41ec3c1a1f21751e8b0a781
5
5
  SHA512:
6
- metadata.gz: eca37ac2eda8ea96d555b32061336b2576f0efbd5471dbfb0ca58594e21a55e17559675d8f2880d5b0f9740564f719311eb06bb34f90491bed713c0b7d6e3267
7
- data.tar.gz: 796ce440e914222563a41741b54a89584da3ee2418fe830a37bdfa076beabb794c69312d38e3a319f42c2d483dd72ccb402666dd97e0b0aa539ef47726b0c2b9
6
+ metadata.gz: eafeb5f93d44b239f1c48dda8be7426491d126adb1b3ba4a7a17f16b93ec9b48b79db1af3be89a60469891b5b25c4afd31326fc1ef11094fc05d24e0e118f4bc
7
+ data.tar.gz: 37c977345a20633089077628dc58d1db3dc7a382f64550f42aa912450437886555f2b372fd4edf1fa54bb6ecdefe222a8a08d9d56af5f8d7e6032252f7eb82c1
data/CHANGELOG.md CHANGED
@@ -1,7 +1,8 @@
1
1
  # CHANGELOG
2
2
 
3
- ## 0.12.1 (2021-03-01)
3
+ ## 0.13.0 (2021-03-02)
4
4
 
5
+ * Use `ENV['SYNVERT_SNIPPETS_HOME']` to change default snippets home
5
6
  * Display snippet source code for showing a snippet
6
7
 
7
8
  ## 0.12.0 (2021-03-01)
data/lib/synvert/cli.rb CHANGED
@@ -137,7 +137,7 @@ module Synvert
137
137
 
138
138
  # Load all rewriters.
139
139
  def load_rewriters
140
- Dir.glob(File.join(default_snippets_path, 'lib/**/*.rb')).each { |file| require file }
140
+ Dir.glob(File.join(default_snippets_home, 'lib/**/*.rb')).each { |file| require file }
141
141
 
142
142
  @options[:custom_snippet_paths].each do |snippet_path|
143
143
  if /^http/.match?(snippet_path)
@@ -148,7 +148,7 @@ module Synvert
148
148
  end
149
149
  end
150
150
  rescue StandardError
151
- FileUtils.rm_rf default_snippets_path
151
+ FileUtils.rm_rf default_snippets_home
152
152
  retry
153
153
  end
154
154
 
@@ -194,7 +194,7 @@ module Synvert
194
194
  editor = [ENV['SYNVERT_EDITOR'], ENV['EDITOR']].find { |e| !e.nil? && !e.empty? }
195
195
  return puts 'To open a synvert snippet, set $EDITOR or $SYNVERT_EDITOR' unless editor
196
196
 
197
- path = File.expand_path(File.join(default_snippets_path, "lib/#{@options[:snippet_name]}.rb"))
197
+ path = File.expand_path(File.join(default_snippets_home, "lib/#{@options[:snippet_name]}.rb"))
198
198
  if File.exist? path
199
199
  system editor, path
200
200
  else
@@ -222,7 +222,7 @@ module Synvert
222
222
 
223
223
  # Show and print one rewriter.
224
224
  def show_rewriter
225
- path = File.expand_path(File.join(default_snippets_path, "lib/#{@options[:snippet_name]}.rb"))
225
+ path = File.expand_path(File.join(default_snippets_home, "lib/#{@options[:snippet_name]}.rb"))
226
226
  if File.exist?(path)
227
227
  puts File.read(path)
228
228
  else
@@ -232,7 +232,7 @@ module Synvert
232
232
 
233
233
  # sync snippets
234
234
  def sync_snippets
235
- Snippet.new(default_snippets_path).sync
235
+ Snippet.new(default_snippets_home).sync
236
236
  puts 'synvert snippets are synced'
237
237
  core_version = Snippet.fetch_core_version
238
238
  if Gem::Version.new(core_version) > Gem::Version.new(Synvert::Core::VERSION)
@@ -288,8 +288,8 @@ module Synvert
288
288
  File.write("spec/#{group}/#{name}_spec.rb", spec_content)
289
289
  end
290
290
 
291
- def default_snippets_path
292
- File.join(ENV['HOME'], '.synvert')
291
+ def default_snippets_home
292
+ ENV['SYNVERT_SNIPPETS_HOME'] || File.join(ENV['HOME'], '.synvert')
293
293
  end
294
294
  end
295
295
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Synvert
4
- VERSION = '0.12.1'
4
+ VERSION = '0.13.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: synvert
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.1
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-01 00:00:00.000000000 Z
11
+ date: 2021-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: synvert-core