Class: Hubless
- Inherits:
-
Object
show all
- Defined in:
- lib/hubless.rb,
lib/application.rb,
lib/gem_description.rb
Defined Under Namespace
Classes: Application, GemDescription, GemInstallError, ServiceError
Constant Summary
collapse
- @@io =
$stdout
- @@timeout =
1
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.io=(io) ⇒ Object
11
12
13
|
# File 'lib/hubless.rb', line 11
def self.io=(io)
@@io = io
end
|
.timeout=(t) ⇒ Object
15
16
17
|
# File 'lib/hubless.rb', line 15
def self.timeout=(t)
@@timeout = t
end
|
Instance Method Details
#gem_breakdown ⇒ Object
19
20
21
22
|
# File 'lib/hubless.rb', line 19
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_gems ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/hubless.rb', line 38
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_repos ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/hubless.rb', line 24
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_gems ⇒ Object
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/hubless.rb', line 62
def install_gems
@@io.puts("\nInstalling gems:")
self.gems.each do |g|
if g.github? && g.gemcutter? && !g.blacklisted?
cmd = g.install_cmd
@@io.puts cmd
raise GemInstallError unless Kernel.system(cmd)
end
end
end
|
#install_instructions ⇒ Object
57
58
59
60
|
# File 'lib/hubless.rb', line 57
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? && !g.blacklisted? }
end
|
#uninstall_instructions ⇒ Object
52
53
54
55
|
# File 'lib/hubless.rb', line 52
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? && !g.blacklisted? }
end
|