Skip to content

Commit 91359df

Browse files
author
Coal
committed
Initial commit
0 parents  commit 91359df

19 files changed

+16603
-0
lines changed

.gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Compiled
2+
lpm
3+
*.a
4+
*.o
5+
build/*
6+
7+
# CMake
8+
CMakeFiles
9+
CMakeCache.txt
10+
cmake_install.cmake
11+
Makefile
12+
13+
# Other
14+
.vscode
15+
!build/*.sh

CMakeLists.txt

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
cmake_minimum_required(VERSION 3.9)
2+
set(CMAKE_C_COMPILER "gcc")
3+
set(CMAKE_CXX_COMPILER "/usr/bin/g++")
4+
5+
project(lpm-cli)
6+
7+
set(CMAKE_CXX_FLAGS "-std=c++2a")
8+
9+
include_directories(./src/library/include)
10+
11+
add_executable(lpm-cli src/main.cpp)
12+
set_target_properties(lpm-cli PROPERTIES LINKER_LANGUAGE CXX OUTPUT_NAME lpm)
13+
14+
# Include the framework
15+
add_subdirectory(src/library)
16+
17+
target_link_libraries(lpm-cli PRIVATE lpm-lib)

build/build.sh

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
cmake ../
2+
make

build/static.sh

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
rm -rf ../src/static/messages.h
2+
xxd -i ../src/static/MESSAGES_HELP >> ../src/static/messages.h

dev/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## dev
2+
3+
This folder contains files, sources and scripts used for development.
4+
5+
There's also an example project (sampleproject/), which contains a few sources and a packages.toml file, to get you started with using lpm for the first time.
6+
7+
More information is available in the README.md file within the project folder.

dev/sampleproject/README.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## sampleproject
2+
3+
The LPM sample project.
4+
5+
This project uses the module `hamming` to calculate the Hamming distance between two strings.
6+
7+
## Getting started
8+
9+
Run the following command to install dependencies:
10+
11+
lpm install
12+
13+
Once you're done, you can run the following command to start the project:
14+
15+
lpm start
16+
17+
Very simple!
18+
19+
## Getting rid of the project
20+
21+
Run the following command to uninstall the project:
22+
23+
lpm purge
24+
25+
All the files and folders created by lpm will be deleted. Only the packages.toml file will remain.

dev/sampleproject/main.lua

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
local hamming = require("hamming:latest")
2+
3+
print("'hello', 'world' =", hamming("hello", "world"))
4+
print("'amazing', 'amazing' =", hamming("amazing", "amazing"))

dev/sampleproject/packages.toml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[project]
2+
name = "sampleproject"
3+
version = "0.1"
4+
author = "Coal"
5+
description = "Sample project. Uses the hamming distance to calculate the similarity between two strings."
6+
license = "GPL v3"
7+
homepage = "tabe.me"
8+
repository = "https://github.com/coalio/lpm"
9+
10+
# Main entry point (when lpm start is called)
11+
main = "main.lua"
12+
# Valid lua versions: PUC-Lua/LuaJIT/Lua <version>
13+
lua_version = "PUC-Lua 5.2"
14+
15+
[dependencies]
16+
hamming = "latest"

docs/lpm_project_structure.drawio

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<mxfile host="Electron" modified="2022-02-15T04:26:22.318Z" agent="5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/16.5.1 Chrome/96.0.4664.110 Electron/16.0.7 Safari/537.36" etag="iHoZBGkrsNagCnLxiYqu" version="16.5.1" type="device"><diagram id="mH10CcK8kwQEcqgbL3z_" name="Page-1">7Vpdj5s4FP01kXYfZhQgn49tMm1XmpVGykrtPlUu3IA7BrPGTML++r025ismM9NtmqA2T8GHi33vucfXNmHkreL9e0HS6E8eABu542A/8tYj13UmzhJ/FFJUiGeQUNDAYA2wof+CAccGzWkAWcdQcs4kTbugz5MEfNnBiBB81zXbctYdNSUhWMDGJ8xGP9JARiW6mI4b/APQMKpGdsbmTkwqYwNkEQn4rgV5dyNvJTiX5VW8XwFT7FW8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VlTLFBPmRHl37HwADqbTW+funpWA1oJ8LnRl8iovHUqcBFegNF8WrZHkkbOOhNbgeWftnolYwjpeLjD4BU2n/rbSCPYlTBlVskJRsJKWTW8Hjepbpr3fcMd82nDbkPNTjtJgvWfj9CMc5aUVwI14gekt1LSij6iM7q+tFnRP0Oz4MfFUKFfvgOkR9jYaKE58jF4WpRnXcsE8xMgiscVul5mQFgjAa4vxeM9iqHtT8pT5hbwwc4/zXb8T66sTJa8KiWxKcWU9F6Fu/lt9eELDZfB1WvqlvPrLz7v4D</diagram></mxfile>

docs/lpm_project_structure.png

49.3 KB
Loading

src/library/CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# The LPM lib includes abstract functions with all of LPM features.
2+
# You can compile this lib independently and use it in your own projects.
3+
include_directories(./include)
4+
add_library(lpm-lib
5+
packages.cpp
6+
)

src/library/include/macros.h

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#pragma once
2+
#include <iostream>
3+
4+
#ifndef LPM_SHOULD_PRINT_ERRORS
5+
#define LPM_SHOULD_PRINT_ERRORS 1
6+
#endif
7+
8+
#if LPM_SHOULD_PRINT_ERRORS
9+
#define LPM_PRINT_ERROR(msg) std::cerr << msg << std::endl
10+
#else
11+
#define LPM_PRINT_ERROR(msg)
12+
#endif

src/library/include/packages.h

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#pragma once
2+
#include <string>
3+
#include <vector>
4+
#include "toml_lib.h"
5+
6+
namespace LPM {
7+
class PackagesData {
8+
public:
9+
PackagesData(const std::string& path) {
10+
this->path = path;
11+
this->load();
12+
}
13+
14+
std::string path;
15+
16+
std::string name;
17+
std::string version;
18+
std::string description;
19+
std::string author;
20+
std::string license;
21+
std::string homepage;
22+
std::string repository;
23+
std::string main;
24+
std::string lua_version;
25+
26+
std::vector<std::string> dependencies;
27+
28+
void load();
29+
};
30+
}

0 commit comments

Comments
 (0)