batali 0.1.10 → 0.1.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 583f2ea83e2fb2813e041d122c3578f4816b84cc
4
- data.tar.gz: 2aebd3e383e3b91e58c22f11452779603c0fd923
3
+ metadata.gz: cc7940adb3a1a14d55eb855b5f4e1e23d05777bb
4
+ data.tar.gz: 50bface2e8d95e696b7d5d403885b9b1b08dc085
5
5
  SHA512:
6
- metadata.gz: e5e0d6735a93edba1c9d58db7d2078e0b5a79afe5c4947124ca6b04626e48618276055bf5cafed3f946721c4dc571b4d5e1765d97371118fc15484cc9644b978
7
- data.tar.gz: ac5e8c16532a66e3b7e706e3db2cf6a2e07bea66c69feeaae0269635a72878fa3138cd6259303839ce17461b564af2cf1deeeba4579d5a6209977ad9209990c7
6
+ metadata.gz: 763cedeab275662414f90a01938fc7d42879cf57b0507a917fcf0723c5ad2a9b291bba6938a88b877f1b8823d38fe8417d7e92ddf3b1c6aaaba6cde14039e8a1
7
+ data.tar.gz: 795b924481089ad62bb8bb6b5dc83dd2a7f7bab66b108a2ebfc9787fcdae83a1c04bf6a8b7f100e618e8f0cb8819eb175f1a29b36b38990dcb969652c62626ac
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # v0.1.12
2
+ * Bug fix for multiple constraint arguments
3
+ * Provide consistent type for values that can be multiples within Batali file
4
+ * Get started on spec coverage
5
+
1
6
  # v0.1.10
2
7
  * Bug fix for Batali file parsing to provide expected format on processing
3
8
 
data/lib/batali/b_file.rb CHANGED
@@ -8,7 +8,25 @@ module Batali
8
8
  unless(self[:cookbook])
9
9
  set!(:cookbook, ::AttributeStruct::CollapseArray.new.push(args))
10
10
  else
11
- set!(:cookbook, args)
11
+ self[:cookbook].push(args)
12
+ end
13
+ self
14
+ end
15
+
16
+ def source(*args)
17
+ unless(self[:source])
18
+ set!(:source, ::AttributeStruct::CollapseArray.new.push(args))
19
+ else
20
+ self[:source].push(args)
21
+ end
22
+ self
23
+ end
24
+
25
+ def restrict(*args)
26
+ unless(self[:restrict])
27
+ set!(:restrict, ::AttributeStruct::CollapseArray.new.push(args))
28
+ else
29
+ self[:restrict].push(args)
12
30
  end
13
31
  self
14
32
  end
@@ -31,8 +49,16 @@ module Batali
31
49
  # @return [Proc] cookbook convert
32
50
  def self.cookbook_coerce
33
51
  proc do |v|
34
- name, args = v
35
- Cookbook.new(Smash.new(:name => name).merge(args || {}))
52
+ v = [v].flatten.compact
53
+ name, args = v.first, v.slice(1, v.size)
54
+ if(args.empty?)
55
+ args = Smash.new
56
+ elsif(args.size == 1 && args.first.is_a?(Hash))
57
+ args = args.first
58
+ else
59
+ args = Smash.new(:constraint => args.map(&:to_s))
60
+ end
61
+ Cookbook.new(Smash.new(:name => name).merge(args))
36
62
  end
37
63
  end
38
64
 
@@ -54,8 +80,16 @@ module Batali
54
80
  attribute :cookbook, Cookbook, :multiple => true, :required => true, :coerce => BFile.cookbook_coerce
55
81
  end
56
82
 
57
- attribute :restrict, Restriction, :multiple => true, :coerce => lambda{|v| Restriction.new(:cookbook => v.first, :source => v.last)}
58
- attribute :source, Origin::RemoteSite, :multiple => true, :coerce => lambda{|v| Origin::RemoteSite.new(:endpoint => v)}
83
+ attribute :restrict, Restriction, :multiple => true, :coerce => lambda{|v|
84
+ Restriction.new(:cookbook => v.first, :source => v.last.to_smash[:to])
85
+ }
86
+ attribute :source, Origin::RemoteSite, :multiple => true, :coerce => lambda{|v|
87
+ args = Smash.new(:endpoint => v.first)
88
+ if(v.last.is_a?(Hash))
89
+ args.merge!(v.last)
90
+ end
91
+ Origin::RemoteSite.new(args)
92
+ }
59
93
  attribute :group, Group, :multiple => true, :coerce => lambda{|v| Group.new()}
60
94
  attribute :cookbook, Cookbook, :multiple => true, :coerce => BFile.cookbook_coerce
61
95
 
@@ -21,7 +21,7 @@ module Batali
21
21
  requirements = Grimoire::RequirementList.new(
22
22
  :name => :batali_resolv,
23
23
  :requirements => batali_file.cookbook.map{ |ckbk|
24
- [ckbk.name, *(ckbk.constraint.nil? || ckbk.constraint.empty? ? ['> 0'] : ckbk.constraint)]
24
+ [ckbk.name, (ckbk.constraint.nil? || ckbk.constraint.empty? ? ['> 0'] : ckbk.constraint)]
25
25
  }
26
26
  )
27
27
  solv = Grimoire::Solver.new(
@@ -63,7 +63,7 @@ module Batali
63
63
  nil
64
64
  end
65
65
  end
66
- ui.info "Number of solutions collected for defined requirements: #{results.size + 1}"
66
+ # ui.info "Number of solutions collected for defined requirements: #{results.size + 1}"
67
67
  ui.info 'Ideal solution:'
68
68
  ideal_solution.units.sort_by(&:name).map do |unit|
69
69
  output_args = ["#{unit.name} <#{unit.version}>"]
@@ -1,4 +1,4 @@
1
1
  module Batali
2
2
  # Current version
3
- VERSION = Gem::Version.new('0.1.10')
3
+ VERSION = Gem::Version.new('0.1.12')
4
4
  end
data/lib/batali.rb CHANGED
@@ -4,6 +4,7 @@ require 'batali/monkey'
4
4
 
5
5
  module Batali
6
6
 
7
+ autoload :BFile, 'batali/b_file'
7
8
  autoload :Command, 'batali/command'
8
9
  autoload :Config, 'batali/config'
9
10
  autoload :Git, 'batali/git'
@@ -12,6 +13,7 @@ module Batali
12
13
  autoload :RequirementList, 'batali/requirement_list'
13
14
  autoload :ScoreKeeper, 'batali/score_keeper'
14
15
  autoload :Source, 'batali/source'
16
+ autoload :Struct, 'batali/b_file'
15
17
  autoload :Unit, 'batali/unit'
16
18
  autoload :UnitLoader, 'batali/unit_loader'
17
19
  autoload :Utility, 'batali/utility'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: batali
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-13 00:00:00.000000000 Z
11
+ date: 2015-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: attribute_struct