squish.lua

changeset 87
f39aceada1ad
parent 86
2322f7932064
child 88
60e10cf9b20c
equal deleted inserted replaced
86:2322f7932064 87:f39aceada1ad
147 return false, "HTTP status code: "..tostring(status); 147 return false, "HTTP status code: "..tostring(status);
148 end 148 end
149 else 149 else
150 function fetch.http(url) 150 function fetch.http(url)
151 return false, "Module not found. Re-squish with --use-http option to fetch it from "..url; 151 return false, "Module not found. Re-squish with --use-http option to fetch it from "..url;
152 end
153 end
154
155 print_info("Writing "..out_fn.."...");
156 local f, err = io.open(out_fn, "w+");
157 if not f then
158 print_err("Couldn't open output file: "..tostring(err));
159 os.exit(1);
160 end
161
162 if opts.executable then
163 if opts.executable == true then
164 f:write("#!/usr/bin/env lua\n");
165 else
166 f:write(opts.executable, "\n");
167 end 152 end
168 end 153 end
169 154
170 print_verbose("Resolving modules..."); 155 print_verbose("Resolving modules...");
171 do 156 do
209 end 194 end
210 end 195 end
211 end 196 end
212 end 197 end
213 198
199 print_info("Writing "..out_fn.."...");
200 local f, err = io.open(out_fn, "w+");
201 if not f then
202 print_err("Couldn't open output file: "..tostring(err));
203 os.exit(1);
204 end
205
206 if opts.executable then
207 if opts.executable == true then
208 f:write("#!/usr/bin/env lua\n");
209 else
210 f:write(opts.executable, "\n");
211 end
212 end
214 213
215 print_verbose("Packing modules..."); 214 print_verbose("Packing modules...");
216 for _, module in ipairs(modules) do 215 for _, module in ipairs(modules) do
217 local modulename, path = module.name, module.path; 216 local modulename, path = module.name, module.path;
218 if module.path:sub(1,1) ~= "/" then 217 if module.path:sub(1,1) ~= "/" then

mercurial