bracecomp 0.1.0 → 0.1.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/lib/bracecomp.tab.rb CHANGED
@@ -13,7 +13,7 @@ require 'strscan'
13
13
 
14
14
  class BraceComp < Racc::Parser
15
15
 
16
- module_eval <<'..end bracecomp.y modeval..idad4372d656', 'bracecomp.y', 50
16
+ module_eval <<'..end bracecomp.y modeval..idf2d157fb92', 'bracecomp.y', 50
17
17
 
18
18
  attr_reader :tree
19
19
 
@@ -54,6 +54,7 @@ end
54
54
 
55
55
  def permutation(stack, ary = [], &block)
56
56
  list = stack.shift
57
+ return unless list
57
58
 
58
59
  list.each do |i|
59
60
  if stack.empty?
@@ -128,13 +129,17 @@ def expand
128
129
 
129
130
  expandeds = []
130
131
 
131
- permutation(sets) do |seq|
132
- expandeds << src % seq
132
+ if sets.empty?
133
+ expandeds << src
134
+ else
135
+ permutation(sets) do |seq|
136
+ expandeds << src % seq
137
+ end
133
138
  end
134
139
 
135
140
  expandeds
136
141
  end
137
- ..end bracecomp.y modeval..idad4372d656
142
+ ..end bracecomp.y modeval..idf2d157fb92
138
143
 
139
144
  ##### racc 1.4.5 generates ###
140
145
 
data/lib/bracecomp.y CHANGED
@@ -87,6 +87,7 @@ end
87
87
 
88
88
  def permutation(stack, ary = [], &block)
89
89
  list = stack.shift
90
+ return unless list
90
91
 
91
92
  list.each do |i|
92
93
  if stack.empty?
@@ -161,8 +162,12 @@ def expand
161
162
 
162
163
  expandeds = []
163
164
 
164
- permutation(sets) do |seq|
165
- expandeds << src % seq
165
+ if sets.empty?
166
+ expandeds << src
167
+ else
168
+ permutation(sets) do |seq|
169
+ expandeds << src % seq
170
+ end
166
171
  end
167
172
 
168
173
  expandeds
@@ -0,0 +1,11 @@
1
+ require 'bracecomp'
2
+
3
+ class BraceComp::Capistrano
4
+ def self.expand_env(name)
5
+ return unless ENV[name]
6
+ ENV[name] = ENV[name].expand.map {|i| i.split(',') }.flatten.uniq.join(',')
7
+ end
8
+ end
9
+
10
+ BraceComp::Capistrano.expand_env('ROLES')
11
+ BraceComp::Capistrano.expand_env('HOSTS')
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bracecomp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - winebarrel
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-05 00:00:00 Z
18
+ date: 2011-09-06 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description:
@@ -28,6 +28,7 @@ extra_rdoc_files: []
28
28
 
29
29
  files:
30
30
  - README
31
+ - lib/bracecomp/capistrano.rb
31
32
  - lib/bracecomp.rb
32
33
  - lib/bracecomp.tab.rb
33
34
  - lib/bracecomp.y