Sha256: 9263eaf4755ad9d0d5d349ea7089b3e0ff9722df677bd2ec103d18e65fc33633

Contents?: true

Size: 656 Bytes

Versions: 3

Compression:

Stored size: 656 Bytes

Contents

# coding: utf-8
require 'open-uri'
require 'json'

module Synvert
  # Manage synvert snippets.
  class Snippet
    # synchronize snippets from github.
    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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
synvert-0.9.0 lib/synvert/snippet.rb
synvert-0.5.3 lib/synvert/snippet.rb
synvert-0.5.0 lib/synvert/snippet.rb