fig18 0.1.39 → 0.1.40
Sign up to get free protection for your applications and to get access to all the features.
- data/Changes +41 -0
- data/LICENSE +2 -2
- data/README.md +154 -100
- data/VERSION +1 -0
- data/bin/fig +4 -182
- data/lib/fig/applicationconfiguration.rb +52 -0
- data/lib/fig/backtrace.rb +6 -6
- data/lib/fig/configfileerror.rb +15 -0
- data/lib/fig/environment.rb +46 -26
- data/lib/fig/figrc.rb +105 -0
- data/lib/fig/grammar.treetop +1 -1
- data/lib/fig/log4rconfigerror.rb +14 -0
- data/lib/fig/logging.rb +131 -0
- data/lib/fig/networkerror.rb +7 -0
- data/lib/fig/notfounderror.rb +4 -0
- data/lib/fig/options.rb +191 -54
- data/lib/fig/os.rb +73 -74
- data/lib/fig/package.rb +30 -30
- data/lib/fig/packageerror.rb +7 -0
- data/lib/fig/parser.rb +5 -8
- data/lib/fig/repository.rb +44 -28
- data/lib/fig/repositoryerror.rb +7 -0
- data/lib/fig/retriever.rb +26 -17
- data/lib/fig/urlaccesserror.rb +9 -0
- data/lib/fig/userinputerror.rb +4 -0
- data/lib/fig/windows.rb +3 -3
- data/lib/fig.rb +222 -0
- metadata +221 -47
data/lib/fig/package.rb
CHANGED
@@ -1,22 +1,25 @@
|
|
1
|
+
require 'fig/logging'
|
2
|
+
require 'fig/packageerror'
|
3
|
+
|
1
4
|
module Fig
|
2
5
|
class Package
|
3
6
|
attr_reader :package_name, :version_name, :directory, :statements
|
4
7
|
attr_accessor :backtrace
|
5
|
-
|
6
|
-
def initialize(package_name, version_name, directory, statements)
|
8
|
+
|
9
|
+
def initialize(package_name, version_name, directory, statements)
|
7
10
|
@package_name = package_name
|
8
11
|
@version_name = version_name
|
9
12
|
@directory = directory
|
10
13
|
@statements = statements
|
11
14
|
@backtrace = nil
|
12
15
|
end
|
13
|
-
|
16
|
+
|
14
17
|
def [](config_name)
|
15
18
|
@statements.each do |stmt|
|
16
19
|
return stmt if stmt.is_a?(Configuration) && stmt.name == config_name
|
17
20
|
end
|
18
|
-
|
19
|
-
|
21
|
+
Fig::Logging.fatal "Configuration not found: #{@package_name}/#{@version_name}:#{config_name}"
|
22
|
+
raise PackageError.new
|
20
23
|
end
|
21
24
|
|
22
25
|
def configs
|
@@ -32,11 +35,11 @@ module Fig
|
|
32
35
|
def archive_urls
|
33
36
|
@statements.select{|s| s.is_a?(Archive)}.map{|s|s.url}
|
34
37
|
end
|
35
|
-
|
38
|
+
|
36
39
|
def resource_urls
|
37
40
|
@statements.select{|s| s.is_a?(Resource)}.map{|s|s.url}
|
38
41
|
end
|
39
|
-
|
42
|
+
|
40
43
|
def unparse
|
41
44
|
@statements.map { |statement| statement.unparse('') }.join("\n")
|
42
45
|
end
|
@@ -46,34 +49,34 @@ module Fig
|
|
46
49
|
end
|
47
50
|
|
48
51
|
def to_s
|
49
|
-
@package_name +
|
52
|
+
@package_name + '/' + @version_name
|
50
53
|
end
|
51
54
|
end
|
52
|
-
|
55
|
+
|
53
56
|
class Archive
|
54
57
|
attr_reader :url
|
55
|
-
|
58
|
+
|
56
59
|
def initialize(url)
|
57
60
|
@url = url
|
58
61
|
end
|
59
|
-
|
62
|
+
|
60
63
|
def unparse(indent)
|
61
|
-
|
64
|
+
%Q<#{indent}archive "#{url}">
|
62
65
|
end
|
63
66
|
end
|
64
|
-
|
67
|
+
|
65
68
|
class Resource
|
66
69
|
attr_reader :url
|
67
|
-
|
70
|
+
|
68
71
|
def initialize(url)
|
69
72
|
@url = url
|
70
73
|
end
|
71
|
-
|
74
|
+
|
72
75
|
def unparse(indent)
|
73
76
|
"#{indent}resource #{url}"
|
74
77
|
end
|
75
78
|
end
|
76
|
-
|
79
|
+
|
77
80
|
class Retrieve
|
78
81
|
attr_reader :var, :path
|
79
82
|
|
@@ -94,7 +97,7 @@ module Fig
|
|
94
97
|
@local_name = local_name
|
95
98
|
@remote_name = remote_name
|
96
99
|
end
|
97
|
-
|
100
|
+
|
98
101
|
def unparse(indent)
|
99
102
|
"#{indent}publish #{@local_name}->#{@remote_name}"
|
100
103
|
end
|
@@ -110,9 +113,9 @@ module Fig
|
|
110
113
|
body = @statements.map { |statement| statement.unparse(indent+' ') }.join("\n")
|
111
114
|
suffix = "#{indent}end"
|
112
115
|
return [prefix, body, suffix].join("\n")
|
113
|
-
end
|
116
|
+
end
|
114
117
|
end
|
115
|
-
|
118
|
+
|
116
119
|
class Configuration
|
117
120
|
attr_reader :name, :statements
|
118
121
|
|
@@ -127,14 +130,11 @@ module Fig
|
|
127
130
|
|
128
131
|
def commands
|
129
132
|
result = statements.select { |statement| statement.is_a?(Command) }
|
130
|
-
# if result.empty?
|
131
|
-
# raise "No commands found for config: #{@name}"
|
132
|
-
# end
|
133
133
|
result
|
134
134
|
end
|
135
135
|
|
136
136
|
def unparse(indent)
|
137
|
-
unparse_statements(indent, "config #{@name}", @statements,
|
137
|
+
unparse_statements(indent, "config #{@name}", @statements, 'end')
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
@@ -145,7 +145,7 @@ module Fig
|
|
145
145
|
@name = name
|
146
146
|
@value = value
|
147
147
|
end
|
148
|
-
|
148
|
+
|
149
149
|
def unparse(indent)
|
150
150
|
"#{indent}append #{name}=#{value}"
|
151
151
|
end
|
@@ -158,7 +158,7 @@ module Fig
|
|
158
158
|
@name = name
|
159
159
|
@value = value
|
160
160
|
end
|
161
|
-
|
161
|
+
|
162
162
|
def unparse(indent)
|
163
163
|
"#{indent}set #{name}=#{value}"
|
164
164
|
end
|
@@ -175,7 +175,7 @@ module Fig
|
|
175
175
|
end
|
176
176
|
|
177
177
|
def unparse(indent)
|
178
|
-
descriptor =
|
178
|
+
descriptor = ''
|
179
179
|
descriptor += @package_name if @package_name
|
180
180
|
descriptor += "/#{@version_name}" if @version_name
|
181
181
|
descriptor += ":#{@config_name}" if @config_name
|
@@ -188,14 +188,14 @@ module Fig
|
|
188
188
|
|
189
189
|
class Override
|
190
190
|
attr_reader :package_name, :version_name
|
191
|
-
|
191
|
+
|
192
192
|
def initialize(package_name, version_name)
|
193
193
|
@package_name = package_name
|
194
194
|
@version_name = version_name
|
195
195
|
end
|
196
196
|
|
197
197
|
def unparse()
|
198
|
-
return
|
198
|
+
return ' override ' + @package_name + '/' + @version_name
|
199
199
|
end
|
200
200
|
end
|
201
201
|
|
@@ -207,7 +207,7 @@ module Fig
|
|
207
207
|
end
|
208
208
|
|
209
209
|
def unparse(indent)
|
210
|
-
|
210
|
+
%Q<#{indent}command "#{@command}">
|
211
211
|
end
|
212
212
|
end
|
213
213
|
|
@@ -216,5 +216,5 @@ end
|
|
216
216
|
def unparse_statements(indent, prefix, statements, suffix)
|
217
217
|
body = @statements.map { |statement| statement.unparse(indent+' ') }.join("\n")
|
218
218
|
return ["\n#{indent}#{prefix}", body, "#{indent}#{suffix}"].join("\n")
|
219
|
-
end
|
219
|
+
end
|
220
220
|
|
data/lib/fig/parser.rb
CHANGED
@@ -2,6 +2,8 @@ require 'polyglot'
|
|
2
2
|
require 'treetop'
|
3
3
|
|
4
4
|
require 'fig/grammar'
|
5
|
+
require 'fig/logging'
|
6
|
+
require 'fig/packageerror'
|
5
7
|
|
6
8
|
module Fig
|
7
9
|
class Parser
|
@@ -12,16 +14,11 @@ module Fig
|
|
12
14
|
def parse_package(package_name, version_name, directory, input)
|
13
15
|
input = input.gsub(/#.*$/, '')
|
14
16
|
result = @parser.parse(" #{input} ")
|
15
|
-
if result.nil?
|
16
|
-
|
17
|
-
|
17
|
+
if result.nil?
|
18
|
+
Fig::Logging.fatal "#{directory}: #{@parser.failure_reason}"
|
19
|
+
raise PackageError.new
|
18
20
|
end
|
19
21
|
result.to_package(package_name, version_name, directory)
|
20
22
|
end
|
21
|
-
|
22
|
-
# def parse_descriptor(descriptor)
|
23
|
-
# puts @parser.methods.sort
|
24
|
-
# end
|
25
23
|
end
|
26
|
-
|
27
24
|
end
|
data/lib/fig/repository.rb
CHANGED
@@ -1,12 +1,17 @@
|
|
1
|
+
require 'fig/logging'
|
2
|
+
require 'fig/notfounderror'
|
1
3
|
require 'fig/parser'
|
4
|
+
require 'fig/repositoryerror'
|
5
|
+
require 'fig/urlaccesserror'
|
2
6
|
|
3
7
|
module Fig
|
4
8
|
class Repository
|
5
|
-
def initialize(os, local_repository_dir, remote_repository_url, remote_repository_user=nil, update=false, update_if_missing=true)
|
9
|
+
def initialize(os, local_repository_dir, remote_repository_url, application_config, remote_repository_user=nil, update=false, update_if_missing=true)
|
6
10
|
@os = os
|
7
11
|
@local_repository_dir = local_repository_dir
|
8
12
|
@remote_repository_url = remote_repository_url
|
9
13
|
@remote_repository_user = remote_repository_user
|
14
|
+
@application_config = application_config
|
10
15
|
@update = update
|
11
16
|
@update_if_missing = update_if_missing
|
12
17
|
@parser = Parser.new
|
@@ -20,7 +25,7 @@ module Fig
|
|
20
25
|
end
|
21
26
|
end
|
22
27
|
|
23
|
-
def clean(package_name, version_name)
|
28
|
+
def clean(package_name, version_name)
|
24
29
|
dir = File.join(@local_repository_dir, package_name)
|
25
30
|
dir = File.join(dir, version_name) if version_name
|
26
31
|
FileUtils.rm_rf(dir)
|
@@ -42,13 +47,13 @@ module Fig
|
|
42
47
|
@os.download_list(@remote_repository_url)
|
43
48
|
end
|
44
49
|
|
45
|
-
def publish_package(package_statements, package_name, version_name, local_only)
|
50
|
+
def publish_package(package_statements, package_name, version_name, local_only)
|
46
51
|
temp_dir = temp_dir_for_package(package_name, version_name)
|
47
52
|
@os.clear_directory(temp_dir)
|
48
53
|
local_dir = local_dir_for_package(package_name, version_name)
|
49
54
|
@os.clear_directory(local_dir)
|
50
|
-
fig_file = File.join(temp_dir,
|
51
|
-
content = bundle_resources(package_statements).map do |statement|
|
55
|
+
fig_file = File.join(temp_dir, '.fig')
|
56
|
+
content = bundle_resources(package_statements).map do |statement|
|
52
57
|
if statement.is_a?(Publish)
|
53
58
|
nil
|
54
59
|
elsif statement.is_a?(Archive) || statement.is_a?(Resource)
|
@@ -56,17 +61,17 @@ module Fig
|
|
56
61
|
archive_name = statement.url
|
57
62
|
archive_remote = "#{remote_dir_for_package(package_name, version_name)}/#{statement.url}"
|
58
63
|
else
|
59
|
-
archive_name = statement.url.split(
|
64
|
+
archive_name = statement.url.split('/').last
|
60
65
|
archive_remote = "#{remote_dir_for_package(package_name, version_name)}/#{archive_name}"
|
61
66
|
end
|
62
|
-
if
|
67
|
+
if is_url_with_access?(statement.url)
|
63
68
|
archive_local = File.join(temp_dir, archive_name)
|
64
69
|
@os.download(statement.url, archive_local)
|
65
70
|
else
|
66
71
|
archive_local = statement.url
|
67
72
|
end
|
68
73
|
@os.upload(archive_local, archive_remote, @remote_repository_user) unless local_only
|
69
|
-
@os.copy(archive_local, local_dir +
|
74
|
+
@os.copy(archive_local, local_dir + '/' + archive_name)
|
70
75
|
if statement.is_a?(Archive)
|
71
76
|
@os.unpack_archive(local_dir, archive_name)
|
72
77
|
end
|
@@ -92,7 +97,7 @@ module Fig
|
|
92
97
|
end
|
93
98
|
if resources.size > 0
|
94
99
|
resources = expand_globs_from(resources)
|
95
|
-
file =
|
100
|
+
file = 'resources.tar.gz'
|
96
101
|
@os.create_archive(file, resources)
|
97
102
|
new_package_statements.unshift(Archive.new(file))
|
98
103
|
at_exit { File.delete(file) }
|
@@ -101,12 +106,17 @@ module Fig
|
|
101
106
|
end
|
102
107
|
|
103
108
|
def load_package(package_name, version_name)
|
109
|
+
Logging.debug "Considering #{package_name}/#{version_name}."
|
104
110
|
if @update || (@update_if_missing && package_missing?(package_name, version_name))
|
105
111
|
update_package(package_name, version_name)
|
106
112
|
end
|
107
113
|
read_local_package(package_name, version_name)
|
108
114
|
end
|
109
115
|
|
116
|
+
def updating?
|
117
|
+
return @update || @update_if_missing
|
118
|
+
end
|
119
|
+
|
110
120
|
def update_package(package_name, version_name)
|
111
121
|
remote_fig_file = remote_fig_file_for_package(package_name, version_name)
|
112
122
|
local_fig_file = local_fig_file_for_package(package_name, version_name)
|
@@ -114,17 +124,17 @@ module Fig
|
|
114
124
|
if @os.download(remote_fig_file, local_fig_file)
|
115
125
|
install_package(package_name, version_name)
|
116
126
|
end
|
117
|
-
rescue
|
118
|
-
|
127
|
+
rescue NotFoundError
|
128
|
+
Logging.fatal "Package not found in remote repository: #{package_name}/#{version_name}"
|
119
129
|
delete_local_package(package_name, version_name)
|
120
|
-
|
130
|
+
raise RepositoryError.new
|
121
131
|
end
|
122
132
|
end
|
123
133
|
|
124
134
|
def read_local_package(package_name, version_name)
|
125
135
|
dir = local_dir_for_package(package_name, version_name)
|
126
136
|
read_package_from_directory(dir, package_name, version_name)
|
127
|
-
end
|
137
|
+
end
|
128
138
|
|
129
139
|
def read_remote_package(package_name, version_name)
|
130
140
|
url = remote_fig_file_for_package(package_name, version_name)
|
@@ -133,21 +143,21 @@ module Fig
|
|
133
143
|
end
|
134
144
|
|
135
145
|
def read_package_from_directory(dir, package_name, version_name)
|
136
|
-
file = File.join(dir,
|
146
|
+
file = File.join(dir, '.fig')
|
137
147
|
if not File.exist?(file)
|
138
|
-
file = File.join(dir,
|
148
|
+
file = File.join(dir, 'package.fig')
|
139
149
|
end
|
140
150
|
if not File.exist?(file)
|
141
|
-
|
142
|
-
|
151
|
+
Logging.fatal "Fig file not found for package: #{file}"
|
152
|
+
raise RepositoryError.new
|
143
153
|
end
|
144
154
|
read_package_from_file(file, package_name, version_name)
|
145
155
|
end
|
146
156
|
|
147
157
|
def read_package_from_file(file_name, package_name, version_name)
|
148
158
|
if not @os.exist?(file_name)
|
149
|
-
|
150
|
-
|
159
|
+
Logging.fatal "Package not found: #{package_name}/#{version_name}"
|
160
|
+
raise RepositoryError.new
|
151
161
|
end
|
152
162
|
modified_time = @os.mtime(file_name)
|
153
163
|
content = @os.read(file_name)
|
@@ -158,7 +168,7 @@ module Fig
|
|
158
168
|
descriptor = "#{package_name}/#{version_name}"
|
159
169
|
dir = @overrides[descriptor]
|
160
170
|
if dir
|
161
|
-
|
171
|
+
Logging.info "override: #{descriptor}=#{dir}"
|
162
172
|
else
|
163
173
|
dir = File.join(@local_repository_dir, package_name, version_name)
|
164
174
|
end
|
@@ -174,13 +184,13 @@ module Fig
|
|
174
184
|
@os.clear_directory(temp_dir)
|
175
185
|
package.archive_urls.each do |archive_url|
|
176
186
|
if not is_url?(archive_url)
|
177
|
-
archive_url = remote_dir_for_package(package_name, version_name) +
|
187
|
+
archive_url = remote_dir_for_package(package_name, version_name) + '/' + archive_url
|
178
188
|
end
|
179
189
|
@os.download_archive(archive_url, File.join(temp_dir))
|
180
190
|
end
|
181
191
|
package.resource_urls.each do |resource_url|
|
182
192
|
if not is_url?(resource_url)
|
183
|
-
resource_url = remote_dir_for_package(package_name, version_name) +
|
193
|
+
resource_url = remote_dir_for_package(package_name, version_name) + '/' + resource_url
|
184
194
|
end
|
185
195
|
@os.download_resource(resource_url, File.join(temp_dir))
|
186
196
|
end
|
@@ -188,13 +198,13 @@ module Fig
|
|
188
198
|
@os.clear_directory(local_dir)
|
189
199
|
# some packages contain no files, only a fig file.
|
190
200
|
if not (package.archive_urls.empty? && package.resource_urls.empty?)
|
191
|
-
FileUtils.mv(Dir.glob(File.join(temp_dir,
|
201
|
+
FileUtils.mv(Dir.glob(File.join(temp_dir, '*')), local_dir)
|
192
202
|
end
|
193
203
|
write_local_package(package_name, version_name, package)
|
194
204
|
rescue
|
195
|
-
|
205
|
+
Logging.fatal 'Install failed, cleaning up.'
|
196
206
|
delete_local_package(package_name, version_name)
|
197
|
-
|
207
|
+
raise RepositoryError.new
|
198
208
|
end
|
199
209
|
end
|
200
210
|
|
@@ -209,6 +219,12 @@ module Fig
|
|
209
219
|
not (/ftp:\/\/|http:\/\/|file:\/\/|ssh:\/\// =~ url).nil?
|
210
220
|
end
|
211
221
|
|
222
|
+
def is_url_with_access?(url)
|
223
|
+
return false if not is_url?(url)
|
224
|
+
raise URLAccessError.new(url) if not @application_config.url_access_allowed?(url)
|
225
|
+
return true
|
226
|
+
end
|
227
|
+
|
212
228
|
def delete_local_package(package_name, version_name)
|
213
229
|
FileUtils.rm_rf(local_dir_for_package(package_name, version_name))
|
214
230
|
end
|
@@ -220,10 +236,10 @@ module Fig
|
|
220
236
|
|
221
237
|
def remote_fig_file_for_package(package_name, version_name)
|
222
238
|
"#{@remote_repository_url}/#{package_name}/#{version_name}/.fig"
|
223
|
-
end
|
239
|
+
end
|
224
240
|
|
225
241
|
def local_fig_file_for_package(package_name, version_name)
|
226
|
-
File.join(local_dir_for_package(package_name, version_name),
|
242
|
+
File.join(local_dir_for_package(package_name, version_name), '.fig')
|
227
243
|
end
|
228
244
|
|
229
245
|
def remote_dir_for_package(package_name, version_name)
|
@@ -231,7 +247,7 @@ module Fig
|
|
231
247
|
end
|
232
248
|
|
233
249
|
def temp_dir_for_package(package_name, version_name)
|
234
|
-
File.join(@local_repository_dir,
|
250
|
+
File.join(@local_repository_dir, 'tmp')
|
235
251
|
end
|
236
252
|
|
237
253
|
def package_missing?(package_name, version_name)
|
data/lib/fig/retriever.rb
CHANGED
@@ -1,35 +1,37 @@
|
|
1
1
|
require 'ostruct'
|
2
2
|
require 'set'
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
require 'fig/logging'
|
5
|
+
|
6
|
+
# This class copies files from the project directories in ~/.fighome to the
|
7
|
+
# user's working directory. It keeps track of which files have already been copied, and which
|
6
8
|
# package/versions they came from, and deletes files as necessary to ensure that
|
7
|
-
# we never have files from two different versions of the same package in the user's
|
8
|
-
# working directory.
|
9
|
+
# we never have files from two different versions of the same package in the user's
|
10
|
+
# working directory.
|
9
11
|
class Retriever
|
10
12
|
def initialize(base_dir)
|
11
13
|
@base_dir = base_dir
|
12
14
|
@configs = {}
|
13
|
-
@fig_dir = File.join(@base_dir,
|
15
|
+
@fig_dir = File.join(@base_dir, '.fig')
|
14
16
|
|
15
|
-
file = File.join(@fig_dir,
|
17
|
+
file = File.join(@fig_dir, 'retrieve')
|
16
18
|
if File.exist?(file)
|
17
19
|
load(file)
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
21
|
-
def
|
23
|
+
def with_package_config(name, version)
|
22
24
|
if name and version
|
23
25
|
@config = @configs[name]
|
24
26
|
if @config && @config.version != version
|
25
27
|
@config.files.each do |relpath|
|
26
|
-
|
28
|
+
Fig::Logging.info "- [#{@config.name}/#{@config.version}] #{relpath}"
|
27
29
|
FileUtils.rm_f(File.join(@base_dir, relpath))
|
28
30
|
end
|
29
31
|
@config = nil
|
30
32
|
end
|
31
33
|
if not @config
|
32
|
-
@config =
|
34
|
+
@config = new_package_config(name, version)
|
33
35
|
@configs[name] = @config
|
34
36
|
end
|
35
37
|
else
|
@@ -44,10 +46,10 @@ class Retriever
|
|
44
46
|
|
45
47
|
def save
|
46
48
|
FileUtils.mkdir_p(@fig_dir)
|
47
|
-
File.open(File.join(@fig_dir,
|
49
|
+
File.open(File.join(@fig_dir, 'retrieve'), 'w') do |f|
|
48
50
|
@configs.each do |name,config|
|
49
51
|
config.files.each do |target|
|
50
|
-
f << target <<
|
52
|
+
f << target << '=' << config.name << '/' << config.version << "\n"
|
51
53
|
end
|
52
54
|
end
|
53
55
|
end
|
@@ -65,10 +67,10 @@ private
|
|
65
67
|
config = @configs[config_name]
|
66
68
|
if config
|
67
69
|
if config.version != config_version
|
68
|
-
raise
|
70
|
+
raise 'version mismatch in .figretrieve'
|
69
71
|
end
|
70
72
|
else
|
71
|
-
config =
|
73
|
+
config = new_package_config(config_name, config_version)
|
72
74
|
@configs[config_name] = config
|
73
75
|
end
|
74
76
|
config.files << target
|
@@ -78,7 +80,7 @@ private
|
|
78
80
|
end
|
79
81
|
end
|
80
82
|
|
81
|
-
def
|
83
|
+
def new_package_config(name, version)
|
82
84
|
config = OpenStruct.new
|
83
85
|
config.name = name
|
84
86
|
config.version = version
|
@@ -91,13 +93,20 @@ private
|
|
91
93
|
if File.directory?(source)
|
92
94
|
FileUtils.mkdir_p(target)
|
93
95
|
Dir.foreach(source) do |child|
|
94
|
-
if child !=
|
95
|
-
|
96
|
+
if child != '.' and child != '..'
|
97
|
+
source_file = File.join(source, child)
|
98
|
+
target_file = File.join(relpath, child)
|
99
|
+
Fig::Logging.debug "Copying #{source_file} to #{target_file}."
|
100
|
+
copy(source_file, target_file)
|
96
101
|
end
|
97
102
|
end
|
98
103
|
else
|
99
104
|
if !File.exist?(target) || File.mtime(source) > File.mtime(target)
|
100
|
-
|
105
|
+
if Fig::Logging.debug?
|
106
|
+
Fig::Logging.debug "Copying package [#{@config.name}/#{@config.version}] from #{source} to #{target}."
|
107
|
+
else
|
108
|
+
Fig::Logging.info "+ [#{@config.name}/#{@config.version}] #{relpath}"
|
109
|
+
end
|
101
110
|
FileUtils.mkdir_p(File.dirname(target))
|
102
111
|
FileUtils.cp(source, target, :preserve => true)
|
103
112
|
end
|
data/lib/fig/windows.rb
CHANGED
@@ -22,12 +22,12 @@ EOF
|
|
22
22
|
|
23
23
|
def self.with_generated_batch_script(cmd)
|
24
24
|
command = cmd.join(' ')
|
25
|
-
template = ERB.new(BATCH_SCRIPT_TEMPLATE, 0,
|
25
|
+
template = ERB.new(BATCH_SCRIPT_TEMPLATE, 0, '%')
|
26
26
|
output = template.result(binding)
|
27
27
|
begin
|
28
|
-
tf = File.new(
|
28
|
+
tf = File.new('C:/tmp/fig_command.bat', 'w')
|
29
29
|
FileUtils.chmod(0755, tf.path)
|
30
|
-
File.open(tf.path,
|
30
|
+
File.open(tf.path, 'w') do |fh|
|
31
31
|
fh.puts output
|
32
32
|
end
|
33
33
|
tf.close
|