Sha256: 5d25525e10b4b039492e25c60157887c706a4791eb0b3d40d458a7e8478bee75
Contents?: true
Size: 999 Bytes
Versions: 1
Compression:
Stored size: 999 Bytes
Contents
module Chest PLUGINS_FOLDER = File.expand_path('~/Library/Containers/com.bohemiancoding.sketch3/Data/Library/Application Support/com.bohemiancoding.sketch3/Plugins') class Plugin attr_reader :path, :name, :kind def initialize(path) @path = path @name = File.basename(path) @kind = guess_kind(path) end def updatable? @kind != :local end def update case @kind when :git update_git else puts "#{@name} is kind of un-updatable plugin" false end end class << self def all Dir.glob(File.join(PLUGINS_FOLDER, '*')).collect do |path| Dir.exist?(path) ? Plugin.new(path) : nil end.compact end end private def guess_kind(path) if Dir.exist? File.join(path, '.git') :git else :local end end def update_git puts "Updating '#{@name}' ..." system "cd '#{@path}' && git pull" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
chest-1.0.0 | lib/chest/plugin.rb |