Class: Synvert::Snippet
- Inherits:
-
Object
- Object
- Synvert::Snippet
- Defined in:
- lib/synvert/snippet.rb
Overview
Manage synvert snippets.
Instance Method Summary collapse
-
#initialize(snippets_path) ⇒ Snippet
constructor
A new instance of Snippet.
-
#sync ⇒ Object
synchronize snippets from github.
Constructor Details
#initialize(snippets_path) ⇒ Snippet
Returns a new instance of Snippet.
6 7 8 |
# File 'lib/synvert/snippet.rb', line 6 def initialize(snippets_path) @snippets_path = snippets_path end |
Instance Method Details
#sync ⇒ Object
synchronize snippets from github.
11 12 13 14 15 16 17 18 19 |
# File 'lib/synvert/snippet.rb', line 11 def sync if File.exist?(@snippets_path) 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 |