natives-catalog 0.3.0 → 0.3.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.
- checksums.yaml +8 -8
- data/VERSION +1 -1
- data/lib/natives/catalog.rb +20 -8
- data/natives-catalog.gemspec +4 -4
- data/spec/natives/catalog_spec.rb +34 -15
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
!binary "U0hBMQ==":
|
|
3
3
|
metadata.gz: !binary |-
|
|
4
|
-
|
|
4
|
+
N2ZkYTA1YWNkOTNkMjdhMWFmM2VmNmFmODc2ODk3MzJiN2Y5MGJkYg==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
NTljZDE2ZTkzYjg2YWUyNzYyZGFiOGNjYzZkZDQ0ZDlhMDg4YzU4Nw==
|
|
7
7
|
SHA512:
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
ZmRiYjVhNDYxNTZiNTZkNWI2Y2Y0NmVhMzFhMDdiMjcxZjc2NmFmZmNjMTZh
|
|
10
|
+
OTk2YzY0MjY4MDlkMTg5MzQ0NTU1OTE1MzBiMDI1ZDgyOGFlN2VlNDdkOGUy
|
|
11
|
+
NzVhZGFlOTM4YzY2N2FkYzU3Y2Q1YzViMjdhMzViODE4ODY3ODQ=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
ZThlYjM1ODEzMTZlMmNkYmQyNTAwMTJlNTc3NTQyYjM2OGM1M2JiMmQ3NGIz
|
|
14
|
+
YWY1ZjI5MWZmY2JiNjNkYmE4NTQ5ZTFiNDUyYmM5NGU2NGYyOTFjMGJmNmI1
|
|
15
|
+
YzlkNzU3YWRkYzJkOGUzZmQxZDYwZTZkNmE3M2NlMzA4MDk4MGM=
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.3.
|
|
1
|
+
0.3.1
|
data/lib/natives/catalog.rb
CHANGED
|
@@ -6,26 +6,29 @@ module Natives
|
|
|
6
6
|
|
|
7
7
|
CATALOG_PATH_IN_GEM = File.absolute_path(File.join(
|
|
8
8
|
File.dirname(__FILE__), '..', '..', 'catalogs'))
|
|
9
|
-
CATALOG_PATH_IN_WORKING_DIR = File.absolute_path(File.join('.', 'natives-catalogs'))
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
CATALOG_PATH_IN_GEM,
|
|
13
|
-
CATALOG_PATH_IN_WORKING_DIR
|
|
14
|
-
].freeze
|
|
10
|
+
WORKING_DIR_CATALOG_DIRNAME = 'natives-catalogs'
|
|
15
11
|
|
|
16
12
|
attr_reader :platform, :platform_version, :package_provider, :name
|
|
17
13
|
|
|
18
|
-
def initialize(catalog_name,
|
|
19
|
-
|
|
14
|
+
def initialize(catalog_name,
|
|
15
|
+
platform, platform_version,
|
|
16
|
+
package_provider,
|
|
17
|
+
opts={})
|
|
20
18
|
|
|
21
19
|
@name = catalog_name.to_s
|
|
22
20
|
@platform = platform.to_s
|
|
23
21
|
@platform_version = platform_version.to_s
|
|
24
22
|
@package_provider = package_provider.to_s
|
|
23
|
+
|
|
24
|
+
@loader = opts.fetch(:loader, Loader.new)
|
|
25
|
+
@working_dir = opts.fetch(:working_dir, Dir.pwd)
|
|
26
|
+
|
|
27
|
+
reload
|
|
25
28
|
end
|
|
26
29
|
|
|
27
30
|
def reload
|
|
28
|
-
@catalogs =
|
|
31
|
+
@catalogs = @loader.load_from_paths(catalog_paths)
|
|
29
32
|
end
|
|
30
33
|
|
|
31
34
|
def to_hash
|
|
@@ -40,5 +43,14 @@ module Natives
|
|
|
40
43
|
packages.flatten.compact
|
|
41
44
|
end
|
|
42
45
|
|
|
46
|
+
protected
|
|
47
|
+
|
|
48
|
+
def catalog_paths
|
|
49
|
+
[
|
|
50
|
+
CATALOG_PATH_IN_GEM,
|
|
51
|
+
File.absolute_path(File.join(@working_dir, WORKING_DIR_CATALOG_DIRNAME))
|
|
52
|
+
]
|
|
53
|
+
end
|
|
54
|
+
|
|
43
55
|
end
|
|
44
56
|
end
|
data/natives-catalog.gemspec
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
|
5
|
-
# stub: natives-catalog 0.3.
|
|
5
|
+
# stub: natives-catalog 0.3.1 ruby lib
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |s|
|
|
8
8
|
s.name = "natives-catalog"
|
|
9
|
-
s.version = "0.3.
|
|
9
|
+
s.version = "0.3.1"
|
|
10
10
|
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
12
12
|
s.authors = ["Huiming Teo"]
|
|
13
|
-
s.date = "2013-
|
|
13
|
+
s.date = "2013-11-04"
|
|
14
14
|
s.description = "A catalog of native packages in different platforms required by ruby gems."
|
|
15
15
|
s.email = "teohuiming@gmail.com"
|
|
16
16
|
s.extra_rdoc_files = [
|
|
@@ -49,7 +49,7 @@ Gem::Specification.new do |s|
|
|
|
49
49
|
s.homepage = "http://github.com/teohm/natives-catalog"
|
|
50
50
|
s.licenses = ["MIT"]
|
|
51
51
|
s.require_paths = ["lib"]
|
|
52
|
-
s.rubygems_version = "2.1.
|
|
52
|
+
s.rubygems_version = "2.1.10"
|
|
53
53
|
s.summary = "A catalog of native packages for ruby gems."
|
|
54
54
|
|
|
55
55
|
if s.respond_to? :specification_version then
|
|
@@ -10,7 +10,10 @@ describe Natives::Catalog do
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
it "requires caller to provide platform and package provider details" do
|
|
13
|
-
catalog = Natives::Catalog.new('rubygems',
|
|
13
|
+
catalog = Natives::Catalog.new('rubygems',
|
|
14
|
+
'mac_os_x', '10.7.5',
|
|
15
|
+
'homebrew')
|
|
16
|
+
|
|
14
17
|
expect(catalog.name).to eq('rubygems')
|
|
15
18
|
expect(catalog.platform).to eq('mac_os_x')
|
|
16
19
|
expect(catalog.platform_version).to eq('10.7.5')
|
|
@@ -20,18 +23,45 @@ describe Natives::Catalog do
|
|
|
20
23
|
|
|
21
24
|
describe "#reload" do
|
|
22
25
|
it "reloads catalogs from default catalog paths" do
|
|
23
|
-
|
|
26
|
+
loader = double()
|
|
27
|
+
loader.
|
|
28
|
+
should_receive(:load_from_paths).
|
|
29
|
+
with([
|
|
30
|
+
Natives::Catalog::CATALOG_PATH_IN_GEM,
|
|
31
|
+
File.absolute_path(File.join(Dir.pwd, 'natives-catalogs'))
|
|
32
|
+
]).
|
|
33
|
+
and_return({
|
|
34
|
+
'rubygems' => {'foo' => {'key' => 'value'}},
|
|
35
|
+
'npm' => {'bar' => {'key' => 'value'}}
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
catalog = Natives::Catalog.new('rubygems',
|
|
39
|
+
'mac_os_x', '10.7.5', 'homebrew',
|
|
40
|
+
loader: loader)
|
|
41
|
+
|
|
42
|
+
expect(catalog.to_hash).to eq({'foo' => {'key' => 'value'}})
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it "reloads catalogs from given working directory" do
|
|
46
|
+
loader = double()
|
|
47
|
+
loader.
|
|
24
48
|
should_receive(:load_from_paths).
|
|
25
|
-
with(
|
|
49
|
+
with([
|
|
50
|
+
Natives::Catalog::CATALOG_PATH_IN_GEM,
|
|
51
|
+
'/path/to/working_dir/natives-catalogs'
|
|
52
|
+
]).
|
|
26
53
|
and_return({
|
|
27
54
|
'rubygems' => {'foo' => {'key' => 'value'}},
|
|
28
55
|
'npm' => {'bar' => {'key' => 'value'}}
|
|
29
56
|
})
|
|
30
57
|
|
|
31
58
|
catalog = Natives::Catalog.new('rubygems',
|
|
32
|
-
'mac_os_x', '10.7.5', 'homebrew'
|
|
59
|
+
'mac_os_x', '10.7.5', 'homebrew',
|
|
60
|
+
loader: loader,
|
|
61
|
+
working_dir: '/path/to/working_dir')
|
|
33
62
|
|
|
34
63
|
expect(catalog.to_hash).to eq({'foo' => {'key' => 'value'}})
|
|
64
|
+
|
|
35
65
|
end
|
|
36
66
|
end
|
|
37
67
|
|
|
@@ -39,7 +69,6 @@ describe Natives::Catalog do
|
|
|
39
69
|
before do
|
|
40
70
|
Natives::Catalog::Loader.any_instance.
|
|
41
71
|
stub(:load_from_paths).
|
|
42
|
-
with(Natives::Catalog::CATALOG_PATHS).
|
|
43
72
|
and_return({
|
|
44
73
|
'rubygems' => {'foo' => {'key' => 'value'}},
|
|
45
74
|
'npm' => {'bar' => {'key' => 'value'}}
|
|
@@ -61,7 +90,6 @@ describe Natives::Catalog do
|
|
|
61
90
|
before do
|
|
62
91
|
Natives::Catalog::Loader.any_instance.
|
|
63
92
|
stub(:load_from_paths).
|
|
64
|
-
with(Natives::Catalog::CATALOG_PATHS).
|
|
65
93
|
and_return({
|
|
66
94
|
'rubygems' => {
|
|
67
95
|
'nokogiri' => {
|
|
@@ -102,13 +130,4 @@ describe Natives::Catalog do
|
|
|
102
130
|
end
|
|
103
131
|
end
|
|
104
132
|
|
|
105
|
-
describe "::CATALOG_PATHS" do
|
|
106
|
-
it "contains the default catalog paths" do
|
|
107
|
-
expect(Natives::Catalog::CATALOG_PATHS).to eq([
|
|
108
|
-
Natives::Catalog::CATALOG_PATH_IN_GEM,
|
|
109
|
-
Natives::Catalog::CATALOG_PATH_IN_WORKING_DIR
|
|
110
|
-
])
|
|
111
|
-
end
|
|
112
|
-
end
|
|
113
|
-
|
|
114
133
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: natives-catalog
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: !binary |-
|
|
5
|
+
MC4zLjE=
|
|
5
6
|
platform: ruby
|
|
6
7
|
authors:
|
|
7
8
|
- Huiming Teo
|
|
8
9
|
autorequire:
|
|
9
10
|
bindir: bin
|
|
10
11
|
cert_chain: []
|
|
11
|
-
date: 2013-
|
|
12
|
+
date: 2013-11-04 00:00:00.000000000 Z
|
|
12
13
|
dependencies:
|
|
13
14
|
- !ruby/object:Gem::Dependency
|
|
14
15
|
name: rspec
|
|
@@ -164,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
164
165
|
version: '0'
|
|
165
166
|
requirements: []
|
|
166
167
|
rubyforge_project:
|
|
167
|
-
rubygems_version: 2.1.
|
|
168
|
+
rubygems_version: 2.1.10
|
|
168
169
|
signing_key:
|
|
169
170
|
specification_version: 4
|
|
170
171
|
summary: A catalog of native packages for ruby gems.
|