Sha256: 75d04c43538622a9c0d9a5d95af40f76fcc6a3b058453f085f1278f02795c847

Contents?: true

Size: 669 Bytes

Versions: 1

Compression:

Stored size: 669 Bytes

Contents

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

module Synvert
  # Manage synvert snippets.
  class Snippet
    def initialize(snippets_path)
      @snippets_path = snippets_path
    end

    # synchronize snippets from github.
    def sync
      if File.exist?(@snippets_path)
        FileUtils.cd @snippets_path
        Kernel.system('git pull --rebase')
      else
        Kernel.system("git clone https://github.com/xinminlabs/synvert-snippets.git #{@snippets_path}")
      end
    end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
synvert-0.10.0 lib/synvert/snippet.rb