class Synvert::Snippet
Manage synvert snippets.
Public Class Methods
fetch_core_version()
click to toggle source
# File lib/synvert/snippet.rb, line 10 def self.fetch_core_version content = URI.open('https://rubygems.org/api/v1/versions/synvert-core.json').read JSON.parse(content).first['number'] end
new(snippets_path)
click to toggle source
# File lib/synvert/snippet.rb, line 15 def initialize(snippets_path) @snippets_path = snippets_path end
Public Instance Methods
sync()
click to toggle source
synchronize snippets from github.
# File lib/synvert/snippet.rb, line 20 def sync if File.exist?(@snippets_path) FileUtils.cd @snippets_path Kernel.system('git checkout .; git pull --rebase') else Kernel.system("git clone https://github.com/xinminlabs/synvert-snippets-ruby.git #{@snippets_path}") end end