Class: Ghundle::Command::Fetch
- Defined in:
- lib/ghundle/command/fetch.rb
Overview
Tries to figure out what kind of a source the given identifier represents and fetches the hook locally.
Instance Attribute Summary
Attributes inherited from Common
Instance Method Summary collapse
Methods inherited from Common
Constructor Details
This class inherits a constructor from Ghundle::Command::Common
Instance Method Details
#call ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/ghundle/command/fetch.rb', line 12 def call args.each do |identifier| if identifier =~ /^github.com/ source = Source::Github.new(identifier) elsif File.directory?(identifier) source = Source::Directory.new(identifier) elsif File.directory?(config.hook_path(identifier)) # already fetched, do nothing return else error "Can't identify hook source from identifier: #{identifier}" end hook_name = source.hook_name say "Fetching hook #{source.hook_name}..." source.fetch(config.hook_path(source.hook_name)) end end |