Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
FossilOrigin-Name: c0acbe64015e6199855500a46efe36e6cd7fb042678580c2e9d877613c9007ec
  • Loading branch information
thindil committed Jan 10, 2019
0 parents commit 43a615e
Show file tree
Hide file tree
Showing 6 changed files with 869 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bin
obj
674 changes: 674 additions & 0 deletions COPYING

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
YASS - Yet Another Static Site (Generator)

As name says, it is static site generator written in Ada. At this moment
project is under organization, don't expect too much here.

## Build from sources

To build you need:

* compiler - GCC with enabled Ada support or (best option) GNAT from:

https://www.adacore.com/download/

* gprbuild - it is included in GNAT and should be available in most Linux
distributions too.

Navigate to the main directory(where this file is) to compile:

* Easiest way to compile game is use Gnat Programming Studio included in GNAT.
Just run GPS, select *yass.gpr* as a project file and select option
`Build All`.

* If you prefer using console: in main source code directory type `gprbuild`
for debug mode build or for release mode: `gprbuild -XMode=release`.

## Running program

### Linux

To see all available options, type in console `./yass help` in directory where
binary file is.

Bartek thindil Jasicki
2 changes: 2 additions & 0 deletions gnat.adc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pragma Restrictions (No_Obsolescent_Features);
pragma Assertion_Policy (Pre => Check);
87 changes: 87 additions & 0 deletions src/yass.adb
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
-- Copyright 2019 Bartek thindil Jasicki
--
-- This file is part of YASS.
--
-- YASS is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- YASS is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with YASS. If not, see <http://www.gnu.org/licenses/>.

with Ada.Command_Line; use Ada.Command_Line;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Directories; use Ada.Directories;
with Ada.Calendar; use Ada.Calendar;
with Ada.Calendar.Formatting;
with Ada.Characters.Latin_1; use Ada.Characters.Latin_1;
with Ada.Exceptions; use Ada.Exceptions;
with GNAT.Traceback.Symbolic; use GNAT.Traceback.Symbolic;

procedure YASS is
Version: constant String := "0.1";
begin
if Argument_Count < 1 then
Put_Line
("Please specify what you want to do. To see possible actions, type ""yass help""");
return;
end if;
if Argument(1) = "help" then
Put_Line("Possible actions:");
Put_Line("help - show this screen and exit");
Put_Line("version - show program version and exit");
Put_Line("create [name] - create new page in name directory");
elsif Argument(1) = "version" then
Put_Line("Version: " & Version);
elsif Argument(1) = "create" then
if Argument_Count < 2 then
Put_Line
("Please specify directory name where new page will be created.");
return;
end if;
if Exists(Argument(2)) then
Put_Line("Directory with that name exists, please specify another.");
return;
end if;
Create_Path(Argument(2) & "/_layouts");
Put_Line("New page in directory """ & Argument(2) & """ was created.");
end if;
exception
when An_Exception : others =>
declare
ErrorFile: File_Type;
ErrorText: Unbounded_String;
begin
if Exists("error.log") then
Open(ErrorFile, Append_File, "error.log");
else
Create(ErrorFile, Append_File, "error.log");
end if;
Append(ErrorText, Ada.Calendar.Formatting.Image(Clock));
Append(ErrorText, LF);
Append(ErrorText, Version);
Append(ErrorText, LF);
Append(ErrorText, "Exception: " & Exception_Name(An_Exception));
Append(ErrorText, LF);
Append(ErrorText, "Message: " & Exception_Message(An_Exception));
Append(ErrorText, LF);
Append
(ErrorText, "-------------------------------------------------");
Append(ErrorText, LF);
Append(ErrorText, Symbolic_Traceback(An_Exception));
Append(ErrorText, LF);
Append
(ErrorText, "-------------------------------------------------");
Put_Line(ErrorFile, To_String(ErrorText));
Close(ErrorFile);
Put_Line
("Oops, something bad happen and program crashed. Please, remember what you done before crash and report this problem at https://github.com/thindil/yass/issues (or if you prefer, on mail [email protected]) and attach (if possible) file 'error.log' (should be in this same directory where this file is).");
end;
end YASS;
71 changes: 71 additions & 0 deletions yass.gpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
project yass is

for Main use ("yass.adb");
for Source_Dirs use ("src");
for Object_Dir use "obj";
for Exec_Dir use "bin";

for Create_Missing_Dirs use "True";

type Mode_Type is ("debug", "release", "analyze");
Mode : Mode_Type := external ("Mode", "debug");

package Builder is
for Default_Switches("ada") use ("-j0", "-gnat2012", "-g");
for Global_Configuration_Pragmas use "gnat.adc";
end Builder;

package Binder is
case Mode is
when "debug" | "analyze" =>
for Default_Switches("ada") use ("-E", "-shared");
when "release" =>
for Default_Switches("ada") use ("-E");
end case;
end Binder;

package Compiler is
case Mode is
when "debug" =>
for Default_Switches ("ada") use ("-gnatwa",
"-fstack-check",
"-gnatVa",
"-gnatU",
"-gnatf",
"-gnateE");
when "release" =>
for Default_Switches ("ada") use ("-O2",
"-gnatn2");
when "analyze" =>
for Default_Switches ("ada") use ("-pg",
"-fprofile-arcs",
"-ftest-coverage");
end case;
end Compiler;

package Linker is
case Mode is
when "debug" =>
for Default_Switches ("ada") use ("-no-pie");
when "release" =>
for Default_Switches ("ada") use ("-Wl,--gc-sections");
when "analyze" =>
for Default_Switches ("ada") use ("-no-pie", "-pg", "-fprofile-arcs");
end case;
end Linker;

package Pretty_Printer is
for Default_Switches("ada") use ("--RM-style-spacing",
"--no-separate-loop-then",
"--no-separate-is",
"-rnb",
"-j0");
end Pretty_Printer;

package GnatTest is
for Tests_Dir use "../tests";
for Harness_Dir use "../tests/driver";
for Skeletons_Default use "pass";
end GnatTest;

end yass;

0 comments on commit 43a615e

Please sign in to comment.