spine-module/project.luxe
2021-07-10 19:43:40 +02:00

34 lines
No EOL
1.2 KiB
Text

import "luxe: project" for Entry, Parcels, ProjectPaths
import "luxe: io" for IO
import "luxe: regex" for Regex
import "luxe: lx" for LX
class Project is Entry {
construct entry(target) {
name = "spine module"
version = "0.0.0"
renderer = "outline/renderer"
settings = "outline/settings"
} //new
entry() {
import "spine" for Spine
//todo: only update files with changes (check file timestamp)
var spine_files = IO.list_recursive(".", [], [ProjectPaths.dev], [".","..",ProjectPaths.dev, ProjectPaths.deploy])
.where{|file| file.path.endsWith(".spine.lx") }
var directory_regex = Regex.new("^[\\w\\s./]*[\\|/]", Regex.gim)
var name_regex = Regex.new("[^\\|/]*$", Regex.gim)
for(file in spine_files){
var base_file_path = file.path[0..-10]
var name = name_regex.exec(base_file_path)[0].string
var directory = directory_regex.exec(base_file_path)[0].string[0..-1]
var data_directory = "%(directory)/%(name)_data"
IO.make_directory(data_directory)
var spine = Spine.parse(base_file_path)
LX.stringify_to_file({"prototype":spine.prototype_skeleton()}, "%(data_directory)/%(name)_skeleton.prototype.lx")
}
} //entry
} //Project