class Stubby::RegistryItem

Attributes

name[RW]
source[RW]

Public Class Methods

new(source) click to toggle source
# File lib/stubby/registry.rb, line 7
def initialize(source)
  @source = URI.parse(source)
  @name = @source.path
end

Public Instance Methods

config() click to toggle source
# File lib/stubby/registry.rb, line 29
def config
  "~/.stubby/#{@source.path}/stubby.json"
end
install() click to toggle source
# File lib/stubby/registry.rb, line 12
def install
  `mkdir -p #{path}`
  `cd #{path} && git clone #{@source} .`
end
installed?() click to toggle source
# File lib/stubby/registry.rb, line 25
def installed?
  File.exists? path
end
path() click to toggle source
# File lib/stubby/registry.rb, line 17
def path
  "~/.stubby/#{@source.path}"
end
stub(target=nil) click to toggle source
# File lib/stubby/registry.rb, line 33
def stub(target=nil)
  install unless installed?
  Stub.new(config, target)
end
uninstall() click to toggle source
# File lib/stubby/registry.rb, line 21
def uninstall
  `rm -rf ~/.stubby/#{@source.path}`
end