Browse Source

Working on moving the bootstrapper to moonscript

environments/development/deployments/31
Drew Short 7 years ago
parent
commit
f82d352d66
  1. 4
      gruntfile.js
  2. 29
      src/bootstrap.lua

4
gruntfile.js

@ -24,10 +24,10 @@ module.exports = function (grunt) {
grunt.registerTask("compile-moonscript", "compiles moonscript files to lua", function() { grunt.registerTask("compile-moonscript", "compiles moonscript files to lua", function() {
grunt.file.expand({filter: 'isDirectory'}, "src/**").forEach(function (dir) { grunt.file.expand({filter: 'isDirectory'}, "src/**").forEach(function (dir) {
grunt.file.expand({filter: 'isFile'}, dir + "/*.moon").forEach(function (file) { grunt.file.expand({filter: 'isFile'}, dir + "/*.moon").forEach(function (file) {
const directory = file.substr(0, file.lastIndexOf('/')).replace("src/","");
const directory = file.substr(0, file.lastIndexOf('/') + 1).replace("src/","");
const file_name = file.substr(file.lastIndexOf('/') + 1); const file_name = file.substr(file.lastIndexOf('/') + 1);
const file_name_sans_ext = file_name.substr(0, file_name.lastIndexOf('.')); const file_name_sans_ext = file_name.substr(0, file_name.lastIndexOf('.'));
const output_path = "dist/" + directory + '/' + file_name_sans_ext + '.lua';
const output_path = "dist/" + directory + file_name_sans_ext + '.lua';
const exec_task = grunt.config.get('exec') || {}; const exec_task = grunt.config.get('exec') || {};
exec_task[file] = { exec_task[file] = {

29
src/bootstrap.lua

@ -1,29 +0,0 @@
--[[
SPM Bootstrap Installer
Minimal functionality to install pull SPM and install itself.
]]
local component = require("component")
local fs = require("filesystem")
local wget = loadfile("/bin/wget.lua")
if not component.isAvailable("internet") then
io.stderr:write("This program requires an internet card to run.")
return
end
local downloadSrc = "{URL_BASE}/spm/spm.min.lua"
local saveLocation = "/tmp/spm.lua"
print("Downloading Temporary SPM")
wget("-qf", downloadSrc, saveLocation)
local spm = loadfile(saveLocation)
print("Installing SPM Locally")
spm("install", "-f", "spm")
print("Removing Temporary SPM")
fs.remove(saveLocation)
print("Removing bootstrap.lua")
fs.remove(debug.getinfo(2, "S").source:sub(2))
print("Done")
Loading…
Cancel
Save