rubygems-find 0.0.1
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/bin/rubygems-find.rb +13 -0
- data/lib/rubygems-find/find.rb +21 -0
- data/spec/find_spec.rb +27 -0
- metadata +51 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
|
|
3
|
+
module Gem
|
|
4
|
+
def self.find(dir)
|
|
5
|
+
gemspecs = {}
|
|
6
|
+
spec_files = Dir.glob(File.join(dir, "**/*.gemspec"))
|
|
7
|
+
spec_files.each do |spec_file|
|
|
8
|
+
spec = Gem::Specification.load(spec_file)
|
|
9
|
+
if spec
|
|
10
|
+
spec.normalize
|
|
11
|
+
o = {}
|
|
12
|
+
spec.class.attribute_names.find_all do |name|
|
|
13
|
+
v = spec.instance_variable_get("@#{name}")
|
|
14
|
+
o[name] = v if v
|
|
15
|
+
end
|
|
16
|
+
gemspecs[spec_file] = o
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
gemspecs
|
|
20
|
+
end
|
|
21
|
+
end
|
data/spec/find_spec.rb
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require "rubygems-find/find"
|
|
2
|
+
|
|
3
|
+
def simplify(gemspecs)
|
|
4
|
+
s = {}
|
|
5
|
+
gemspecs.each do |file,spec|
|
|
6
|
+
s[file] = spec[:name]
|
|
7
|
+
end
|
|
8
|
+
s
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
describe Gem do
|
|
12
|
+
context "find" do
|
|
13
|
+
it "finds a single gemspec" do
|
|
14
|
+
gemspecs = Gem.find("spec/testdata/single")
|
|
15
|
+
expect(simplify(gemspecs)).to eq({"spec/testdata/single/single.gemspec" => "single"})
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it "finds nested gemspecs" do
|
|
19
|
+
gemspecs = Gem.find("spec/testdata/nested")
|
|
20
|
+
expect(simplify(gemspecs)).to eq({
|
|
21
|
+
"spec/testdata/nested/toplevel.gemspec" => "toplevel",
|
|
22
|
+
"spec/testdata/nested/a/a.gemspec" => "a",
|
|
23
|
+
"spec/testdata/nested/b/b.gemspec" => "b",
|
|
24
|
+
})
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: rubygems-find
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
prerelease:
|
|
6
|
+
platform: ruby
|
|
7
|
+
authors:
|
|
8
|
+
- Quinn Slack
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 2014-07-04 00:00:00.000000000 Z
|
|
13
|
+
dependencies: []
|
|
14
|
+
description: Library and program for finding all RubyGems gemspecs in a directory
|
|
15
|
+
tree
|
|
16
|
+
email:
|
|
17
|
+
- sqs@sourcegraph.com
|
|
18
|
+
executables:
|
|
19
|
+
- rubygems-find.rb
|
|
20
|
+
extensions: []
|
|
21
|
+
extra_rdoc_files: []
|
|
22
|
+
files:
|
|
23
|
+
- bin/rubygems-find.rb
|
|
24
|
+
- lib/rubygems-find/find.rb
|
|
25
|
+
- spec/find_spec.rb
|
|
26
|
+
homepage: https://sourcegraph.com/github.com/sourcegraph/rubygems-find
|
|
27
|
+
licenses:
|
|
28
|
+
- MIT
|
|
29
|
+
post_install_message:
|
|
30
|
+
rdoc_options: []
|
|
31
|
+
require_paths:
|
|
32
|
+
- lib
|
|
33
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
34
|
+
none: false
|
|
35
|
+
requirements:
|
|
36
|
+
- - ! '>='
|
|
37
|
+
- !ruby/object:Gem::Version
|
|
38
|
+
version: 1.9.2
|
|
39
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
40
|
+
none: false
|
|
41
|
+
requirements:
|
|
42
|
+
- - ! '>='
|
|
43
|
+
- !ruby/object:Gem::Version
|
|
44
|
+
version: 1.3.5
|
|
45
|
+
requirements: []
|
|
46
|
+
rubyforge_project:
|
|
47
|
+
rubygems_version: 1.8.23
|
|
48
|
+
signing_key:
|
|
49
|
+
specification_version: 3
|
|
50
|
+
summary: Find all RubyGems gemspecs in a directory tree
|
|
51
|
+
test_files: []
|