fig 0.1.76 → 0.1.77

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,6 +3,7 @@ require 'set'
3
3
  require 'fig/logging'
4
4
  require 'fig/logging/colorizable'
5
5
  require 'fig/package_descriptor'
6
+ require 'fig/repository_error'
6
7
  require 'fig/working_directory_metadata'
7
8
 
8
9
  module Fig; end
@@ -37,8 +38,33 @@ class Fig::WorkingDirectoryMaintainer
37
38
  return
38
39
  end
39
40
 
41
+ SYMLOOP_MAX = 20 # https://duckduckgo.com/html?q=posix_symloop_max
42
+
40
43
  def retrieve(source, relpath)
41
- copy(source, relpath)
44
+ resolved_source = source
45
+
46
+ # When recursing through a retrieve, if we encounter a symlink that doesn't
47
+ # point to a directory, we copy it as a symlink. However, if the retrieve
48
+ # path itself is a symlink, we copy the target of the symlink, not the
49
+ # symlink itself.
50
+ if File.exist? resolved_source
51
+ # Ruby v1.8 does not have File.realdirpath().
52
+ traversal_count = 0
53
+ while File.symlink? resolved_source
54
+ resolved_source = File.join(
55
+ File.dirname(resolved_source), File.readlink(resolved_source)
56
+ )
57
+ traversal_count += 1
58
+
59
+ if traversal_count > SYMLOOP_MAX
60
+ raise Fig::RepositoryError.new(
61
+ %Q<Could not resolve symlink "#{source}"; symlink chain exceeded #{SYMLOOP_MAX}.>
62
+ )
63
+ end
64
+ end
65
+ end
66
+
67
+ copy(resolved_source, relpath)
42
68
 
43
69
  return
44
70
  end
@@ -174,6 +200,10 @@ class Fig::WorkingDirectoryMaintainer
174
200
 
175
201
  def should_copy_file?(source, target)
176
202
  if File.symlink?(target)
203
+ if File.symlink?(source) && File.readlink(source) == File.readlink(target)
204
+ return false
205
+ end
206
+
177
207
  FileUtils.rm(target)
178
208
  return true
179
209
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.76
4
+ version: 0.1.77
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-07 00:00:00.000000000 Z
12
+ date: 2012-08-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: colorize
16
- requirement: &18129660 !ruby/object:Gem::Requirement
16
+ requirement: &15864160 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.5.8
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *18129660
24
+ version_requirements: *15864160
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: highline
27
- requirement: &18129120 !ruby/object:Gem::Requirement
27
+ requirement: &15863620 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.6.2
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *18129120
35
+ version_requirements: *15863620
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: json
38
- requirement: &18128560 !ruby/object:Gem::Requirement
38
+ requirement: &15862940 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.6.5
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *18128560
46
+ version_requirements: *15862940
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: libarchive-static
49
- requirement: &18128000 !ruby/object:Gem::Requirement
49
+ requirement: &15862100 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.0.0
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *18128000
57
+ version_requirements: *15862100
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: log4r
60
- requirement: &18127400 !ruby/object:Gem::Requirement
60
+ requirement: &15861200 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.1.5
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *18127400
68
+ version_requirements: *15861200
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: net-netrc
71
- requirement: &18126620 !ruby/object:Gem::Requirement
71
+ requirement: &15860680 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 0.2.2
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *18126620
79
+ version_requirements: *15860680
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: net-sftp
82
- requirement: &18125720 !ruby/object:Gem::Requirement
82
+ requirement: &15773760 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 2.0.4
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *18125720
90
+ version_requirements: *15773760
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: net-ssh
93
- requirement: &18040400 !ruby/object:Gem::Requirement
93
+ requirement: &15773240 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: 2.0.15
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *18040400
101
+ version_requirements: *15773240
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: rdoc
104
- requirement: &18039900 !ruby/object:Gem::Requirement
104
+ requirement: &15772400 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '3.12'
110
110
  type: :runtime
111
111
  prerelease: false
112
- version_requirements: *18039900
112
+ version_requirements: *15772400
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: sys-admin
115
- requirement: &18039420 !ruby/object:Gem::Requirement
115
+ requirement: &15771860 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: 1.5.6
121
121
  type: :runtime
122
122
  prerelease: false
123
- version_requirements: *18039420
123
+ version_requirements: *15771860
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: treetop
126
- requirement: &18038680 !ruby/object:Gem::Requirement
126
+ requirement: &15771340 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ! '>='
@@ -131,10 +131,10 @@ dependencies:
131
131
  version: 1.4.2
132
132
  type: :runtime
133
133
  prerelease: false
134
- version_requirements: *18038680
134
+ version_requirements: *15771340
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: open4
137
- requirement: &18038020 !ruby/object:Gem::Requirement
137
+ requirement: &15770600 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ! '>='
@@ -142,10 +142,10 @@ dependencies:
142
142
  version: 1.0.1
143
143
  type: :development
144
144
  prerelease: false
145
- version_requirements: *18038020
145
+ version_requirements: *15770600
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: bundler
148
- requirement: &18036920 !ruby/object:Gem::Requirement
148
+ requirement: &15769420 !ruby/object:Gem::Requirement
149
149
  none: false
150
150
  requirements:
151
151
  - - ! '>='
@@ -153,10 +153,10 @@ dependencies:
153
153
  version: 1.0.15
154
154
  type: :development
155
155
  prerelease: false
156
- version_requirements: *18036920
156
+ version_requirements: *15769420
157
157
  - !ruby/object:Gem::Dependency
158
158
  name: rake
159
- requirement: &18036100 !ruby/object:Gem::Requirement
159
+ requirement: &15768880 !ruby/object:Gem::Requirement
160
160
  none: false
161
161
  requirements:
162
162
  - - ! '>='
@@ -164,10 +164,10 @@ dependencies:
164
164
  version: 0.8.7
165
165
  type: :development
166
166
  prerelease: false
167
- version_requirements: *18036100
167
+ version_requirements: *15768880
168
168
  - !ruby/object:Gem::Dependency
169
169
  name: rspec
170
- requirement: &18035560 !ruby/object:Gem::Requirement
170
+ requirement: &15768340 !ruby/object:Gem::Requirement
171
171
  none: false
172
172
  requirements:
173
173
  - - ~>
@@ -175,10 +175,10 @@ dependencies:
175
175
  version: '2'
176
176
  type: :development
177
177
  prerelease: false
178
- version_requirements: *18035560
178
+ version_requirements: *15768340
179
179
  - !ruby/object:Gem::Dependency
180
180
  name: rspec-core
181
- requirement: &18035080 !ruby/object:Gem::Requirement
181
+ requirement: &15767880 !ruby/object:Gem::Requirement
182
182
  none: false
183
183
  requirements:
184
184
  - - ! '>='
@@ -186,10 +186,10 @@ dependencies:
186
186
  version: 2.7.1
187
187
  type: :development
188
188
  prerelease: false
189
- version_requirements: *18035080
189
+ version_requirements: *15767880
190
190
  - !ruby/object:Gem::Dependency
191
191
  name: rspec-expectations
192
- requirement: &18034600 !ruby/object:Gem::Requirement
192
+ requirement: &15767420 !ruby/object:Gem::Requirement
193
193
  none: false
194
194
  requirements:
195
195
  - - ! '>='
@@ -197,10 +197,10 @@ dependencies:
197
197
  version: 2.7.0
198
198
  type: :development
199
199
  prerelease: false
200
- version_requirements: *18034600
200
+ version_requirements: *15767420
201
201
  - !ruby/object:Gem::Dependency
202
202
  name: rspec-mocks
203
- requirement: &18034100 !ruby/object:Gem::Requirement
203
+ requirement: &15766900 !ruby/object:Gem::Requirement
204
204
  none: false
205
205
  requirements:
206
206
  - - ! '>='
@@ -208,10 +208,10 @@ dependencies:
208
208
  version: 2.7.0
209
209
  type: :development
210
210
  prerelease: false
211
- version_requirements: *18034100
211
+ version_requirements: *15766900
212
212
  - !ruby/object:Gem::Dependency
213
213
  name: simplecov
214
- requirement: &18033600 !ruby/object:Gem::Requirement
214
+ requirement: &15766040 !ruby/object:Gem::Requirement
215
215
  none: false
216
216
  requirements:
217
217
  - - ! '>='
@@ -219,10 +219,10 @@ dependencies:
219
219
  version: 0.6.2
220
220
  type: :development
221
221
  prerelease: false
222
- version_requirements: *18033600
222
+ version_requirements: *15766040
223
223
  - !ruby/object:Gem::Dependency
224
224
  name: simplecov-html
225
- requirement: &18033140 !ruby/object:Gem::Requirement
225
+ requirement: &15747020 !ruby/object:Gem::Requirement
226
226
  none: false
227
227
  requirements:
228
228
  - - ! '>='
@@ -230,7 +230,7 @@ dependencies:
230
230
  version: 0.5.3
231
231
  type: :development
232
232
  prerelease: false
233
- version_requirements: *18033140
233
+ version_requirements: *15747020
234
234
  description: Fig is a utility for configuring environments and managing dependencies
235
235
  across a team of developers. Given a list of packages and a command to run, Fig
236
236
  builds environment variables named in those packages (e.g., CLASSPATH), then executes
@@ -270,16 +270,15 @@ files:
270
270
  - lib/fig/package_descriptor.rb
271
271
  - lib/fig/not_found_error.rb
272
272
  - lib/fig/application_configuration.rb
273
- - lib/fig/grammar/version.rb
273
+ - lib/fig/grammar/v1_asset_location.rb
274
274
  - lib/fig/grammar/base.treetop
275
+ - lib/fig/grammar/v2.rb
275
276
  - lib/fig/grammar/version.treetop
276
277
  - lib/fig/grammar/v0.treetop
277
278
  - lib/fig/grammar/version_identification.treetop
278
- - lib/fig/grammar/v1.rb
279
- - lib/fig/grammar/base.rb
280
- - lib/fig/grammar/v0.rb
279
+ - lib/fig/grammar/v0_ish.rb
281
280
  - lib/fig/grammar/v1.treetop
282
- - lib/fig/grammar/version_identification.rb
281
+ - lib/fig/grammar/v0_asset_location.rb
283
282
  - lib/fig/statement/path.rb
284
283
  - lib/fig/statement/set.rb
285
284
  - lib/fig/statement/grammar_version.rb
@@ -355,6 +354,11 @@ files:
355
354
  - lib/fig/statement.rb
356
355
  - LICENSE
357
356
  - README.md
357
+ - lib/fig/grammar/base.rb
358
+ - lib/fig/grammar/version.rb
359
+ - lib/fig/grammar/v0.rb
360
+ - lib/fig/grammar/version_identification.rb
361
+ - lib/fig/grammar/v1.rb
358
362
  homepage: http://github.com/mfoemmel/fig
359
363
  licenses: []
360
364
  post_install_message: