gem-orphan 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require 'rake/gempackagetask'
2
+ require 'rake/clean'
3
+
4
+ spec = Gem::Specification.load('gem-orphan.gemspec')
5
+
6
+ Rake::GemPackageTask.new(spec) do |t|
7
+ t.need_zip = true
8
+ t.need_tar = true
9
+ end
@@ -0,0 +1,19 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'gem-orphan'
3
+ s.author = 'OZAWA Sakuro'
4
+ s.author = 'sakuro@2238club.org'
5
+ s.rubyforge_project = ''
6
+ s.homepage = nil
7
+ s.platform = Gem::Platform::RUBY
8
+ s.summary = 'A RubyGems plugin to show orphaned gems.'
9
+ s.description = <<-EOF
10
+ A RubyGems plugin to show orphaned gems.
11
+ EOF
12
+ s.version = '0.0.1'
13
+ s.files = <<-FILES.split
14
+ lib/rubygems/commands/orphan_command.rb
15
+ lib/rubygems_plugin.rb
16
+ Rakefile
17
+ gem-orphan.gemspec
18
+ FILES
19
+ end
@@ -0,0 +1,24 @@
1
+ require 'rubygems/command'
2
+ require 'rubygems/source_index'
3
+
4
+ class Gem::Commands::OrphanCommand < Gem::Command
5
+
6
+ def initialize
7
+ super 'orphan', 'Show gems which are required from nothing.'
8
+ end
9
+
10
+ def execute
11
+ index = Gem::SourceIndex.from_installed_gems
12
+ specs = index.map {|name, spec| spec }
13
+ dependencies = specs.map(&:dependencies).flatten.uniq
14
+ runtime_dependencies = dependencies.select {|dep| dep.type == :runtime }
15
+
16
+ specs.delete_if {|spec| runtime_dependencies.any? {|dep| dep.name == spec.name} }
17
+
18
+ specs.each do |spec|
19
+ say "#{spec.name} (#{spec.version})"
20
+ end
21
+ end
22
+
23
+ end
24
+
@@ -0,0 +1,3 @@
1
+ require 'rubygems/command_manager'
2
+
3
+ Gem::CommandManager.instance.register_command :orphan
metadata ADDED
@@ -0,0 +1,67 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gem-orphan
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - sakuro@2238club.org
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-11-18 00:00:00 +09:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: " A RubyGems plugin to show orphaned gems.\n"
22
+ email:
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files: []
28
+
29
+ files:
30
+ - lib/rubygems/commands/orphan_command.rb
31
+ - lib/rubygems_plugin.rb
32
+ - Rakefile
33
+ - gem-orphan.gemspec
34
+ has_rdoc: true
35
+ homepage:
36
+ licenses: []
37
+
38
+ post_install_message:
39
+ rdoc_options: []
40
+
41
+ require_paths:
42
+ - lib
43
+ required_ruby_version: !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ segments:
49
+ - 0
50
+ version: "0"
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ segments:
57
+ - 0
58
+ version: "0"
59
+ requirements: []
60
+
61
+ rubyforge_project: ""
62
+ rubygems_version: 1.3.7
63
+ signing_key:
64
+ specification_version: 3
65
+ summary: A RubyGems plugin to show orphaned gems.
66
+ test_files: []
67
+