lib/synvert/snippet.rb in synvert-1.2.0 vs lib/synvert/snippet.rb in synvert-1.2.1
- old
+ new
@@ -1,10 +1,9 @@
# frozen_string_literal: true
require 'open-uri'
require 'json'
-require 'fileutils'
module Synvert
# Manage synvert snippets.
class Snippet
def self.fetch_core_version
@@ -17,11 +16,12 @@
end
# synchronize snippets from github.
def sync
if File.exist?(@snippets_path)
- FileUtils.cd @snippets_path
- Kernel.system('git checkout .; git pull --rebase')
+ Dir.chdir(@snippets_path) do
+ Kernel.system('git checkout . && git pull --rebase')
+ end
else
Kernel.system("git clone https://github.com/xinminlabs/synvert-snippets-ruby.git #{@snippets_path}")
end
end