Skip to content

Instantly share code, notes, and snippets.

@Daniel-Worrall
Created June 13, 2017 23:17
Show Gist options
  • Save Daniel-Worrall/f26b271021b885180c534c4ab6849910 to your computer and use it in GitHub Desktop.
Save Daniel-Worrall/f26b271021b885180c534c4ab6849910 to your computer and use it in GitHub Desktop.
Crystal Project of a lot of mini projects from a list, from Ruby
require 'fileutils'
file = File.open('list.txt', 'r')
File.open('shard.yml', 'w') do |f1|
f1.puts "name: 100projects\nversion: 0.1.0\n\nauthors:\n - <>\n\ntargets:\n"
while line = file.gets
filename = line.strip.gsub(/[^\w\.]/, '_').downcase
f1.puts " #{filename}:\n main: src/#{filename}/main.cr"
FileUtils::mkdir_p "src/#{filename}"
File.new "src/#{filename}/main.cr", 'w'
end
f1.puts "\ncrystal: 0.22.0\n\nlicense: MIT\n"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment