Class: Synvert::Snippet

Inherits:
Object
  • Object
show all
Defined in:
lib/synvert/snippet.rb

Overview

Manage synvert snippets.

Class Method Summary collapse

Class Method Details

.fetch_core_versionObject



19
20
21
22
# File 'lib/synvert/snippet.rb', line 19

def self.fetch_core_version
  content = open("https://rubygems.org/api/v1/versions/synvert-core.json").read
  JSON.parse(content).first["number"]
end

.syncObject

synchronize snippets from github.



9
10
11
12
13
14
15
16
17
# File 'lib/synvert/snippet.rb', line 9

def self.sync
  snippets_path = Core::Configuration.instance.get :default_snippets_path
  if File.exist?(snippets_path)
    FileUtils.cd snippets_path
    system("git pull --rebase")
  else
    system("git clone https://github.com/xinminlabs/synvert-snippets.git #{snippets_path}")
  end
end