inventory 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -1,9 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- class Inventory::Dependencies::Optional
4
- include Inventory::Dependency
5
-
6
- def require
7
- nil
8
- end
9
- end
@@ -1,5 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- class Inventory::Dependencies::Runtime
4
- include Inventory::Dependency
5
- end
@@ -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
@@ -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