hubless 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/BLACKLIST.yml +4 -0
- data/README.markdown +6 -2
- data/VERSION +1 -1
- data/hubless.gemspec +3 -2
- data/lib/gem_description.rb +12 -1
- data/lib/hubless.rb +3 -3
- data/test/test_gem_description.rb +13 -0
- data/test/test_hubless.rb +10 -14
- metadata +3 -2
data/BLACKLIST.yml
ADDED
data/README.markdown
CHANGED
@@ -21,7 +21,6 @@ Search your local gem repository for gems installed from GitHub that have since
|
|
21
21
|
To uninstall these GitHub gems run:
|
22
22
|
gem uninstall thoughtbot-shoulda -v 2.10.1
|
23
23
|
gem uninstall thoughtbot-factory_girl -v 1.2.1
|
24
|
-
gem uninstall sqlite3-ruby -v 1.2.4
|
25
24
|
gem uninstall rubyist-aasm -v 2.1.1
|
26
25
|
gem uninstall relevance-rcov -v 0.8.6
|
27
26
|
gem uninstall mojombo-chronic -v 0.3.0
|
@@ -32,7 +31,6 @@ Search your local gem repository for gems installed from GitHub that have since
|
|
32
31
|
To reinstall these gems from Gemcutter run:
|
33
32
|
gem install shoulda -v 2.10.1
|
34
33
|
gem install factory_girl -v 1.2.1
|
35
|
-
gem install ruby -v 1.2.4
|
36
34
|
gem install aasm -v 2.1.1
|
37
35
|
gem install rcov -v 0.8.6
|
38
36
|
gem install chronic -v 0.3.0
|
@@ -40,6 +38,12 @@ Search your local gem repository for gems installed from GitHub that have since
|
|
40
38
|
gem install metric_fu -v 1.1.5
|
41
39
|
gem install whenever -v 0.3.6
|
42
40
|
|
41
|
+
## Blacklist
|
42
|
+
|
43
|
+
Hubless now has a blacklist of gems with unfortunate names, that should not be reinstalled. For example: [sqlite3-ruby](http://github.com/sqlite3/ruby).
|
44
|
+
|
45
|
+
If you encounter any of these gems, please fork this project, add them to BLACKLIST.yml and submit a Pull Request. Thanks!
|
46
|
+
|
43
47
|
## Copyright
|
44
48
|
|
45
49
|
Copyright (c) 2010 Greg Sterndale. See LICENSE for details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/hubless.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{hubless}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Greg Sterndale"]
|
12
|
-
s.date = %q{2010-01-
|
12
|
+
s.date = %q{2010-01-19}
|
13
13
|
s.default_executable = %q{hubless}
|
14
14
|
s.description = %q{Search your local gem repository for gems installed from GitHub that have since moved to Gemcutter}
|
15
15
|
s.email = %q{greg@plectix.com}
|
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.files = [
|
22
22
|
".document",
|
23
23
|
".gitignore",
|
24
|
+
"BLACKLIST.yml",
|
24
25
|
"LICENSE",
|
25
26
|
"README.markdown",
|
26
27
|
"Rakefile",
|
data/lib/gem_description.rb
CHANGED
@@ -6,12 +6,14 @@ class Hubless
|
|
6
6
|
|
7
7
|
class GemDescription
|
8
8
|
|
9
|
+
BLACKLIST = File.join(File.dirname(__FILE__), '..', 'BLACKLIST.yml')
|
10
|
+
|
9
11
|
attr_reader :name
|
10
12
|
attr_accessor :version
|
11
13
|
|
12
14
|
# GemDescriptions of all gems installed locally
|
13
15
|
def self.local_gems
|
14
|
-
@@local_gems ||= Gem.cache.map {|g| new(g.first) }.sort!{|x,y|
|
16
|
+
@@local_gems ||= Gem.cache.map {|g| new(g.first) }.sort!{|x,y| x.name <=> y.name }
|
15
17
|
end
|
16
18
|
|
17
19
|
# New GemDescription from a one-liner or options Hash
|
@@ -33,6 +35,11 @@ class Hubless
|
|
33
35
|
@name = str
|
34
36
|
end
|
35
37
|
|
38
|
+
# Does this name appear on the blacklist
|
39
|
+
def blacklisted?
|
40
|
+
! self.class.blacklist.detect{|b| /\A#{b}\Z/i =~ self.name }.nil?
|
41
|
+
end
|
42
|
+
|
36
43
|
# Does a repo exist on GitHub that matches this gem
|
37
44
|
def github?
|
38
45
|
if @is_github.nil?
|
@@ -83,6 +90,10 @@ class Hubless
|
|
83
90
|
|
84
91
|
protected
|
85
92
|
|
93
|
+
def self.blacklist
|
94
|
+
@@blacklist ||= YAML.load_file(BLACKLIST)
|
95
|
+
end
|
96
|
+
|
86
97
|
def clear
|
87
98
|
@is_gemcutter = @is_github = nil
|
88
99
|
end
|
data/lib/hubless.rb
CHANGED
@@ -51,18 +51,18 @@ class Hubless
|
|
51
51
|
|
52
52
|
def uninstall_instructions
|
53
53
|
@@io.puts("\nTo uninstall these GitHub gems run:")
|
54
|
-
self.gems.each {|g| @@io.puts(g.uninstall_cmd) if g.github? && g.gemcutter? }
|
54
|
+
self.gems.each {|g| @@io.puts(g.uninstall_cmd) if g.github? && g.gemcutter? && !g.blacklisted? }
|
55
55
|
end
|
56
56
|
|
57
57
|
def install_instructions
|
58
58
|
@@io.puts("\nTo reinstall these gems from Gemcutter run:")
|
59
|
-
self.gems.each {|g| @@io.puts(g.install_cmd) if g.github? && g.gemcutter? }
|
59
|
+
self.gems.each {|g| @@io.puts(g.install_cmd) if g.github? && g.gemcutter? && !g.blacklisted? }
|
60
60
|
end
|
61
61
|
|
62
62
|
def install_gems
|
63
63
|
@@io.puts("\nInstalling gems:")
|
64
64
|
self.gems.each do |g|
|
65
|
-
if g.github? && g.gemcutter?
|
65
|
+
if g.github? && g.gemcutter? && !g.blacklisted?
|
66
66
|
cmd = g.install_cmd
|
67
67
|
@@io.puts cmd
|
68
68
|
raise GemInstallError unless Kernel.system(cmd)
|
@@ -43,6 +43,19 @@ class TestGemDescription < Test::Unit::TestCase
|
|
43
43
|
assert_equal name, gem_description.name
|
44
44
|
end
|
45
45
|
|
46
|
+
def test_blacklisted?
|
47
|
+
legit_name = 'my-github_and_gemcutter_gem'
|
48
|
+
illigit_name1 = 'github-exploit'
|
49
|
+
illigit_name2 = '.*-ruby'
|
50
|
+
YAML.expects(:load_file).once.with(Hubless::GemDescription::BLACKLIST).returns([illigit_name1, illigit_name2])
|
51
|
+
legit_gem_description = Hubless::GemDescription.new(:name => legit_name)
|
52
|
+
illigit_gem1_description = Hubless::GemDescription.new(:name => illigit_name1)
|
53
|
+
illigit_gem2_description = Hubless::GemDescription.new(:name => 'foo-ruby')
|
54
|
+
assert ! legit_gem_description.blacklisted?
|
55
|
+
assert illigit_gem1_description.blacklisted?
|
56
|
+
assert illigit_gem2_description.blacklisted?
|
57
|
+
end
|
58
|
+
|
46
59
|
def test_github_name
|
47
60
|
user = 'my'
|
48
61
|
repo = 'github_and_gemcutter_gem'
|
data/test/test_hubless.rb
CHANGED
@@ -66,9 +66,9 @@ class TestHubless < Test::Unit::TestCase
|
|
66
66
|
|
67
67
|
def test_uninstall_instructions
|
68
68
|
local_gems = [
|
69
|
-
mock(:uninstall_cmd => 'foo', :github? => true, :gemcutter? => true),
|
70
|
-
mock(:uninstall_cmd => 'bar', :github? => true, :gemcutter? => true),
|
71
|
-
mock(:
|
69
|
+
mock(:uninstall_cmd => 'foo', :github? => true, :gemcutter? => true, :blacklisted? => false),
|
70
|
+
mock(:uninstall_cmd => 'bar', :github? => true, :gemcutter? => true, :blacklisted? => false),
|
71
|
+
mock(:github? => true, :gemcutter? => true, :blacklisted? => true),
|
72
72
|
mock(:github? => true, :gemcutter? => false),
|
73
73
|
mock(:github? => false)
|
74
74
|
]
|
@@ -76,16 +76,15 @@ class TestHubless < Test::Unit::TestCase
|
|
76
76
|
@io.expects(:puts).with{|s| s =~ /To uninstall these GitHub gems run:/ }
|
77
77
|
@io.expects(:puts).once.with{|s| s =~ /foo/ }
|
78
78
|
@io.expects(:puts).once.with{|s| s =~ /bar/ }
|
79
|
-
@io.expects(:puts).once.with{|s| s =~ /abc/ }
|
80
79
|
hubless = Hubless.new
|
81
80
|
hubless.uninstall_instructions
|
82
81
|
end
|
83
82
|
|
84
83
|
def test_install_instructions
|
85
84
|
local_gems = [
|
86
|
-
mock(:install_cmd => 'foo', :github? => true, :gemcutter? => true),
|
87
|
-
mock(:install_cmd => 'bar', :github? => true, :gemcutter? => true),
|
88
|
-
mock(:
|
85
|
+
mock(:install_cmd => 'foo', :github? => true, :gemcutter? => true, :blacklisted? => false),
|
86
|
+
mock(:install_cmd => 'bar', :github? => true, :gemcutter? => true, :blacklisted? => false),
|
87
|
+
mock(:github? => true, :gemcutter? => true, :blacklisted? => true),
|
89
88
|
mock(:github? => true, :gemcutter? => false),
|
90
89
|
mock(:github? => false)
|
91
90
|
]
|
@@ -93,16 +92,15 @@ class TestHubless < Test::Unit::TestCase
|
|
93
92
|
@io.expects(:puts).with{|s| s =~ /To reinstall these gems from Gemcutter run:/ }
|
94
93
|
@io.expects(:puts).once.with{|s| s =~ /foo/ }
|
95
94
|
@io.expects(:puts).once.with{|s| s =~ /bar/ }
|
96
|
-
@io.expects(:puts).once.with{|s| s =~ /abc/ }
|
97
95
|
hubless = Hubless.new
|
98
96
|
hubless.install_instructions
|
99
97
|
end
|
100
98
|
|
101
99
|
def test_install_gems
|
102
100
|
local_gems = [
|
103
|
-
mock(:install_cmd => 'foo', :github? => true, :gemcutter? => true),
|
104
|
-
mock(:install_cmd => 'bar', :github? => true, :gemcutter? => true),
|
105
|
-
mock(:
|
101
|
+
mock(:install_cmd => 'foo', :github? => true, :gemcutter? => true, :blacklisted? => false),
|
102
|
+
mock(:install_cmd => 'bar', :github? => true, :gemcutter? => true, :blacklisted? => false),
|
103
|
+
mock(:github? => true, :gemcutter? => true, :blacklisted? => true),
|
106
104
|
mock(:github? => true, :gemcutter? => false),
|
107
105
|
mock(:github? => false)
|
108
106
|
]
|
@@ -110,15 +108,13 @@ class TestHubless < Test::Unit::TestCase
|
|
110
108
|
@io.expects(:puts).with{|s| s =~ /Installing gems:/ }
|
111
109
|
@io.expects(:puts).once.with{|s| s =~ /foo/ }
|
112
110
|
@io.expects(:puts).once.with{|s| s =~ /bar/ }
|
113
|
-
@io.expects(:puts).once.with{|s| s =~ /abc/ }
|
114
111
|
Kernel.expects(:system).once.with{|s| s =~ /foo/ }.returns(true)
|
115
112
|
Kernel.expects(:system).once.with{|s| s =~ /bar/ }.returns(true)
|
116
|
-
Kernel.expects(:system).once.with{|s| s =~ /abc/ }.returns(true)
|
117
113
|
hubless = Hubless.new
|
118
114
|
hubless.install_gems
|
119
115
|
|
120
116
|
local_gems = [
|
121
|
-
mock(:install_cmd => 'foo', :github? => true, :gemcutter? => true)
|
117
|
+
mock(:install_cmd => 'foo', :github? => true, :gemcutter? => true, :blacklisted? => false)
|
122
118
|
]
|
123
119
|
Hubless::GemDescription.expects(:local_gems).once.returns(local_gems)
|
124
120
|
@io.expects(:puts).with{|s| s =~ /Installing gems:/ }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hubless
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Sterndale
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-19 00:00:00 -05:00
|
13
13
|
default_executable: hubless
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -34,6 +34,7 @@ extra_rdoc_files:
|
|
34
34
|
files:
|
35
35
|
- .document
|
36
36
|
- .gitignore
|
37
|
+
- BLACKLIST.yml
|
37
38
|
- LICENSE
|
38
39
|
- README.markdown
|
39
40
|
- Rakefile
|