Updating website.
This commit is contained in:
parent
6bde7f2412
commit
339195f5a5
8
Rakefile
Normal file
8
Rakefile
Normal file
|
@ -0,0 +1,8 @@
|
|||
|
||||
$:.push "lib"
|
||||
require "gemsmith.rb"
|
||||
|
||||
|
||||
site :odin_lab do
|
||||
|
||||
end
|
46
lib/gemsmith.rb
Normal file
46
lib/gemsmith.rb
Normal file
|
@ -0,0 +1,46 @@
|
|||
|
||||
$gemsmith = {
|
||||
active: nil,
|
||||
stages: [],
|
||||
}
|
||||
|
||||
def load_site(in_path, out_path)
|
||||
Dir["#{in_path}/*"].map do |f|
|
||||
out_f = "#{out_path}/#{File.basename f}"
|
||||
if File.symlink? f then
|
||||
$stderr.puts "Warning: Skipping symlink #{f}"
|
||||
nil
|
||||
elsif File.directory? f then
|
||||
[File.basename(f), [:directory, load_site(f, out_f)]]
|
||||
else
|
||||
[File.basename(f), [:file, {
|
||||
created: File.birthtime(f),
|
||||
modified: File.mtime(f),
|
||||
source_path: f,
|
||||
dependencies: f,
|
||||
out_path: out_f,
|
||||
stages: [ proc { File.open(f) {|io| io.readlines} } ]
|
||||
}]]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def site(site_name, params = {})
|
||||
|
||||
in_path = params.fetch(:src, "src")
|
||||
out_path = params.fetch(:out, "build/#{site_name}")
|
||||
|
||||
$gemsmith[:active] = {
|
||||
in_path: in_path,
|
||||
out_path: out_path,
|
||||
files: load_site(in_path)
|
||||
}
|
||||
|
||||
directory $gemsmith[:active][:in_path]
|
||||
directory $gemsmith[:active][:out_path]
|
||||
|
||||
yield
|
||||
|
||||
$gemsmith[:active] = nil
|
||||
end
|
Loading…
Reference in a new issue