Skip to content

Commit

Permalink
Rename the project to Amps
Browse files Browse the repository at this point in the history
Signed-off-by: Jose Ricardo Ziviani <[email protected]>
  • Loading branch information
jrziviani committed Jan 20, 2019
1 parent e71ba31 commit a0d114e
Show file tree
Hide file tree
Showing 24 changed files with 84 additions and 84 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# CMake setup
#-----------------------------------------
cmake_minimum_required (VERSION 3.10)
project (volt VERSION 0.0
project (amps VERSION 0.0
DESCRIPTION "Text Template Engine"
LANGUAGES CXX)

Expand Down
14 changes: 7 additions & 7 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Volt - Simple Template Engine for C++
Amps - Simple Template Engine for C++
=====================================

Index
Expand All @@ -14,12 +14,12 @@ Introduction

**IMPORTANT**: It's not even finished yet, so don't use it for anything important.

Volt offers a simple and small text-based template language for general purposes. It's inspired by [Jinja2](http://jinja.pocoo.org) - but light-years away from the quality achieved by Jinja2.
Amps offers a simple and small text-based template language for general purposes. It's inspired by [Jinja2](http://jinja.pocoo.org) - but light-years away from the quality achieved by Jinja2.

What it does
------------

Given a template file and an user data, Volt will use that user data to create a result file based on the template file.
Given a template file and an user data, Amps will use that user data to create a result file based on the template file.

A basic template looks like:

Expand Down Expand Up @@ -84,7 +84,7 @@ A basic template looks like:

The C++ code is:
```cpp
volt::user_map ht {
amps::user_map ht {
{"name", "Jose"},
{"cities", vector<string>{
"Sao Paulo",
Expand Down Expand Up @@ -171,13 +171,13 @@ Will create a folder called bin/release with:

```shell
% ls bin/release
include.tpl libvolt.so template.tpl volt_sample
include.tpl libamps.so template.tpl amps_sample
```

The file **libvolt.so** is the important thing here, **volt_sample** is an example on how to use that lib. The sample will run with:
The file **libamps.so** is the important thing here, **amps_sample** is an example on how to use that lib. The sample will run with:

```shell
% ./volt_sample template.tpl
% ./amps_sample template.tpl
```

It's also possible to create the same objects with debug symbols included:
Expand Down
2 changes: 1 addition & 1 deletion include/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <functional>
#include <unordered_map>

namespace volt
namespace amps
{
class parser_iterator;

Expand Down
2 changes: 1 addition & 1 deletion include/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "stack.h"
#include "types.h"

namespace volt
namespace amps
{
class context
{
Expand Down
2 changes: 1 addition & 1 deletion include/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <string>

namespace volt
namespace amps
{
class engine
{
Expand Down
2 changes: 1 addition & 1 deletion include/error.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <sstream>
#include <functional>

namespace volt
namespace amps
{
class error
{
Expand Down
2 changes: 1 addition & 1 deletion include/fileops.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <sys/stat.h>
#endif

namespace volt
namespace amps
{

bool dir_exist(const std::string &path);
Expand Down
2 changes: 1 addition & 1 deletion include/metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "token.h"

namespace volt
namespace amps
{
enum class metatype : uint8_t
{
Expand Down
2 changes: 1 addition & 1 deletion include/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <variant>
#include <iostream>

namespace volt
namespace amps
{
using number_t = uint64_t;
using var_t = std::variant<bool,
Expand Down
2 changes: 1 addition & 1 deletion include/scan.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <unordered_map>
#include <string>

namespace volt
namespace amps
{
class scan_iterator;

Expand Down
2 changes: 1 addition & 1 deletion include/stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "types.h"

namespace volt
namespace amps
{
class gstack
{
Expand Down
2 changes: 1 addition & 1 deletion include/token.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
X("size", SIZE) \
X("insert", INSERT)

namespace volt
namespace amps
{
enum class token_types : uint8_t
{
Expand Down
2 changes: 1 addition & 1 deletion include/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <string>
#include <unordered_map>

namespace volt
namespace amps
{
using tokens = std::vector<token_t>;

Expand Down
12 changes: 6 additions & 6 deletions sample/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

include_directories(../include)

add_executable(volt_sample
add_executable(amps_sample
main.cpp)

if (enable-static)
target_link_libraries(volt_sample LINK_PUBLIC
${CMAKE_DL_LIBS} volt-static)
target_link_libraries(amps_sample LINK_PUBLIC
${CMAKE_DL_LIBS} amps-static)
else(enable-static)
target_link_libraries(volt_sample LINK_PUBLIC
${CMAKE_DL_LIBS} volt)
target_link_libraries(amps_sample LINK_PUBLIC
${CMAKE_DL_LIBS} amps)
endif(enable-static)

add_custom_command(TARGET volt_sample POST_BUILD
add_custom_command(TARGET amps_sample POST_BUILD
COMMAND cp ${CMAKE_SOURCE_DIR}/sample/*.tpl ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
)
6 changes: 3 additions & 3 deletions sample/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ int main(int argc, char *argv[])
return 1;
}

volt::user_map ht {
amps::user_map ht {
{"name", "Jose"},
{"cities", vector<string>{
"Sao Paulo",
Expand All @@ -24,8 +24,8 @@ int main(int argc, char *argv[])
{"pink floyd", "high hopes"}}},
};

volt::error err;
volt::engine engine(err);
amps::error err;
amps::engine engine(err);
engine.set_template_directory("/tmp");
engine.prepare_template(argv[1]);
engine.compile(ht);
Expand Down
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ include_directories(../include)

option(enable-static "enable-static" OFF)
if (enable-static)
add_library(volt-static STATIC
add_library(amps-static STATIC
scan.cpp
engine.cpp
token.cpp
compiler.cpp
context.cpp)
else(enable-static)
add_library(volt SHARED
add_library(amps SHARED
scan.cpp
engine.cpp
token.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

using namespace std;

namespace volt
namespace amps
{
compiler::compiler(error &err) :
error_(err),
Expand Down
2 changes: 1 addition & 1 deletion src/context.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "context.h"

namespace volt
namespace amps
{
using v_number = std::vector<number_t>;
using v_string = std::vector<std::string>;
Expand Down
2 changes: 1 addition & 1 deletion src/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

using namespace std;

namespace volt
namespace amps
{
engine::engine(error &err) :
path_("."),
Expand Down
2 changes: 1 addition & 1 deletion src/scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using namespace std;

namespace volt
namespace amps
{
scan::scan(error &err)
: error_(err)
Expand Down
2 changes: 1 addition & 1 deletion src/token.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "token.h"

namespace volt
namespace amps
{
token_t::token_t()
{
Expand Down
10 changes: 5 additions & 5 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/test)

include_directories(../include)

add_executable(volt_test
add_executable(amps_test
main.cpp
../src/compiler.cpp
../src/context.cpp
../src/scan.cpp
../src/token.cpp)

target_link_libraries(volt_test LINK_PUBLIC ${CMAKE_DL_LIBS} gmock_main)
target_link_libraries(amps_test LINK_PUBLIC ${CMAKE_DL_LIBS} gmock_main)

add_custom_target(coverage
COMMAND ${CMAKE_MAKE_PROGRAM} test
Expand All @@ -31,10 +31,10 @@ add_custom_command(TARGET coverage
COMMAND ${CMAKE_COMMAND} -E echo '---------------------------------------------------------'
)

add_dependencies(coverage volt_test)
add_test(NAME test COMMAND volt_test WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin/test)
add_dependencies(coverage amps_test)
add_test(NAME test COMMAND amps_test WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin/test)

add_custom_command(TARGET volt_test POST_BUILD
add_custom_command(TARGET amps_test POST_BUILD
COMMAND cp ${CMAKE_SOURCE_DIR}/test/block.* ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
COMMAND cp ${CMAKE_SOURCE_DIR}/test/code.* ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
)
Expand Down
Loading

0 comments on commit a0d114e

Please sign in to comment.