Class: Hubless

Inherits:
Object
  • Object
show all
Defined in:
lib/hubless.rb,
lib/application.rb,
lib/gem_description.rb

Defined Under Namespace

Classes: Application, GemDescription

Constant Summary collapse

ServiceError =
Class.new(RuntimeError)
@@io =
$stdout
@@timeout =
1

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.io=(io) ⇒ Object



7
8
9
# File 'lib/hubless.rb', line 7

def self.io=(io)
  @@io = io
end

.timeout=(t) ⇒ Object



11
12
13
# File 'lib/hubless.rb', line 11

def self.timeout=(t)
  @@timeout = t
end

Instance Method Details

#gem_breakdownObject



15
16
17
18
# File 'lib/hubless.rb', line 15

def gem_breakdown
  github_like_count = self.gems.select{|g| g.github_like? }.length
  @@io.puts "\nFound #{gems.length} local gems. Of those, #{github_like_count} look like GitHub gems."
end

#gemcutter_gemsObject



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/hubless.rb', line 34

def gemcutter_gems
  @@io.puts("\nSearching for matching gems on Gemcutter...")
  gemcutter_gem_count = 0
  self.gems.each do |g|
    if g.github?
      gemcutter_gem_count += 1 if is_on_gemcutter = g.gemcutter?
      @@io.print(is_on_gemcutter ? 'Y' : 'N')
      @@io.flush
      sleep @@timeout
    end
  end
  @@io.puts("\nFound #{gemcutter_gem_count} gems on Gemcutter.")
end

#github_reposObject



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/hubless.rb', line 20

def github_repos
  @@io.puts("\nSearching GitHub for matching repositories...")
  github_gem_count = 0
  self.gems.each do |g|
    if g.github_like?
      github_gem_count += 1 if is_on_github = g.github?
      @@io.print(is_on_github ? 'Y' : 'N')
      @@io.flush
      sleep @@timeout
    end
  end
  @@io.puts("\nFound #{github_gem_count} repositories on GitHub.")
end

#install_instructionsObject



53
54
55
56
# File 'lib/hubless.rb', line 53

def install_instructions
  @@io.puts("\nTo reinstall these gems from Gemcutter run:")
  self.gems.each {|g| @@io.puts(g.install_cmd) if g.github? && g.gemcutter? }
end

#uninstall_instructionsObject



48
49
50
51
# File 'lib/hubless.rb', line 48

def uninstall_instructions
  @@io.puts("\nTo uninstall these GitHub gems run:")
  self.gems.each {|g| @@io.puts(g.uninstall_cmd) if g.github? && g.gemcutter? }
end