Class: Pupu::GitHub

Inherits:
Object
  • Object
show all
Extended by:
ShellExtensions
Defined in:
lib/pupu/github.rb

Class Method Summary collapse

Methods included from ShellExtensions

run

Class Method Details

.install(repo, options = Hash.new) ⇒ Object

GitHub.install(“autocompleter”) GitHub.install(“botanicus/autocompleter”, force: true)



25
26
27
28
29
30
31
32
33
# File 'lib/pupu/github.rb', line 25

def install(repo, options = Hash.new)
  user, repo = repo.split("/") if repo.match(%r{/})
  user = ENV["USER"] unless user
  url = "git://github.com/#{user}/pupu-#{repo}.git"
  info "Installing #{repo}"
  self.install_files(repo, url, options)
  self.install_dependencies(@pupu, options)
  # TODO: git commit [files] -m "Added pupu #{repo} from #{url}"
end

.search(query) ⇒ Object

search for pupu



58
59
60
61
62
# File 'lib/pupu/github.rb', line 58

def search(query)
  data = YAML::load("http://github.com/api/v1/yaml/search/pupu")
  data.map! { |result| OpenStruct.new(result) }
  data.select { |item| item.name.match(query) }
end

.update(pupu_name) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/pupu/github.rb', line 35

def update(pupu_name)
  if pupu_name
    pupu = Pupu[pupu_name]
    if ::Pupu.strategy.eql?(:submodules)
      puts %(git fetch)
      puts %(git reset origin/master --hard)
    else
      path = pupu.root.to_s # otherwise after we remove the path, we get error at mkdir telling us that the path doesn't exist
      pupu. # cache metadata
      FileUtils.rm_r(path)
      self.install_files(pupu_name, pupu..repozitory)
    end
  else
    Pupu.all.each do |pupu_name|
      self.update(pupu_name)
    end
  end
  pupu..dependencies.each do |dependency|
    self.update(dependency)
  end
end