inventory 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README +211 -4
- data/Rakefile +8 -2
- data/lib/inventory-1.0.rb +139 -12
- data/lib/inventory-1.0/dependencies.rb +102 -0
- data/lib/inventory-1.0/dependencies/development.rb +22 -0
- data/lib/inventory-1.0/dependencies/optional.rb +14 -0
- data/lib/inventory-1.0/dependencies/runtime.rb +8 -0
- data/lib/inventory-1.0/dependency.rb +85 -0
- data/lib/inventory-1.0/extension.rb +82 -0
- data/lib/inventory-1.0/version.rb +23 -0
- data/test/unit/inventory-1.0.rb +8 -0
- data/test/unit/{inventory → inventory-1.0}/dependencies.rb +0 -0
- data/test/unit/{inventory → inventory-1.0}/dependencies/development.rb +0 -0
- data/test/unit/{inventory → inventory-1.0}/dependencies/optional.rb +0 -0
- data/test/unit/{inventory → inventory-1.0}/dependencies/runtime.rb +0 -0
- data/test/unit/{inventory → inventory-1.0}/dependency.rb +0 -0
- data/test/unit/{inventory/version.rb → inventory-1.0/extension.rb} +0 -0
- data/test/unit/inventory-1.0/version.rb +4 -0
- metadata +262 -40
- data/lib/inventory/dependencies.rb +0 -54
- data/lib/inventory/dependencies/development.rb +0 -14
- data/lib/inventory/dependencies/optional.rb +0 -9
- data/lib/inventory/dependencies/runtime.rb +0 -5
- data/lib/inventory/dependency.rb +0 -30
- data/lib/inventory/version.rb +0 -24
@@ -1,54 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
class Inventory::Dependencies
|
4
|
-
include Enumerable
|
5
|
-
|
6
|
-
def initialize(*dependencies)
|
7
|
-
@dependencies = dependencies
|
8
|
-
instance_exec(&Proc.new) if block_given?
|
9
|
-
end
|
10
|
-
|
11
|
-
def +(other)
|
12
|
-
self.class.new(*(dependencies + other.dependencies))
|
13
|
-
end
|
14
|
-
|
15
|
-
def each
|
16
|
-
return enum_for(__method__) unless block_given?
|
17
|
-
dependencies.each do |dependency|
|
18
|
-
yield dependency
|
19
|
-
end
|
20
|
-
self
|
21
|
-
end
|
22
|
-
|
23
|
-
def require
|
24
|
-
map{ |dependency| dependency.require }
|
25
|
-
end
|
26
|
-
|
27
|
-
def add_to_gem_specification(specification)
|
28
|
-
each do |dependency|
|
29
|
-
dependency.add_to_gem_specification specification
|
30
|
-
end
|
31
|
-
self
|
32
|
-
end
|
33
|
-
|
34
|
-
protected
|
35
|
-
|
36
|
-
attr_reader :dependencies
|
37
|
-
|
38
|
-
private
|
39
|
-
|
40
|
-
def development(name, major, minor, patch, options = {})
|
41
|
-
dependencies << Development.new(name, major, minor, patch, options)
|
42
|
-
self
|
43
|
-
end
|
44
|
-
|
45
|
-
def runtime(name, major, minor, patch, options = {})
|
46
|
-
dependencies << Runtime.new(name, major, minor, patch, options)
|
47
|
-
self
|
48
|
-
end
|
49
|
-
|
50
|
-
def optional(name, major, minor, patch, options = {})
|
51
|
-
dependencies << Optional.new(name, major, minor, patch, options)
|
52
|
-
self
|
53
|
-
end
|
54
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
class Inventory::Dependencies::Development
|
4
|
-
include Inventory::Dependency
|
5
|
-
|
6
|
-
def require
|
7
|
-
nil
|
8
|
-
end
|
9
|
-
|
10
|
-
def add_to_gem_specification(specification)
|
11
|
-
specification.add_development_dependency name, gem_requirement
|
12
|
-
self
|
13
|
-
end
|
14
|
-
end
|
data/lib/inventory/dependency.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
module Inventory::Dependency
|
4
|
-
def initialize(name, major, minor, patch, options = {})
|
5
|
-
@name, @major, @minor, @patch = name, major, minor, patch
|
6
|
-
@feature = options.fetch(:feature, '%s-%d.0' % [name.gsub('-', '/'), major])
|
7
|
-
instance_exec(&Proc.new) if block_given?
|
8
|
-
end
|
9
|
-
|
10
|
-
def to_s
|
11
|
-
[major, minor, patch].join('.')
|
12
|
-
end
|
13
|
-
|
14
|
-
def require
|
15
|
-
super feature
|
16
|
-
end
|
17
|
-
|
18
|
-
def add_to_gem_specification(specification)
|
19
|
-
specification.add_runtime_dependency name, gem_requirement
|
20
|
-
self
|
21
|
-
end
|
22
|
-
|
23
|
-
attr_reader :name, :major, :minor, :patch, :feature
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
def gem_requirement
|
28
|
-
'~> %s' % (major > 0 ? '%d.%d' % [major, minor] : to_s)
|
29
|
-
end
|
30
|
-
end
|
data/lib/inventory/version.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
class Inventory
|
4
|
-
Version = Inventory.new(1, 3, 0){
|
5
|
-
def dependencies
|
6
|
-
Dependencies.new{
|
7
|
-
development 'inventory-rake', 1, 3, 0
|
8
|
-
development 'lookout', 3, 0, 0
|
9
|
-
development 'lookout-rake', 3, 0, 0
|
10
|
-
development 'yard', 0, 8, 0
|
11
|
-
}
|
12
|
-
end
|
13
|
-
|
14
|
-
def libs
|
15
|
-
%w'
|
16
|
-
inventory/dependency.rb
|
17
|
-
inventory/dependencies.rb
|
18
|
-
inventory/dependencies/development.rb
|
19
|
-
inventory/dependencies/optional.rb
|
20
|
-
inventory/dependencies/runtime.rb
|
21
|
-
'
|
22
|
-
end
|
23
|
-
}
|
24
|
-
end
|