Skip to content

Commit

Permalink
feat: add action edit/view configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
easbarba committed Aug 14, 2024
1 parent ab26aa1 commit 43954cb
Show file tree
Hide file tree
Showing 25 changed files with 620 additions and 103 deletions.
64 changes: 60 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
build_debug/
build_release/

# MESON

/build
/subprojects/*
!/subprojects/*.wrap
/.cache

# CMAKE

# Generated and user files
**/CMakeCache.txt
**/CMakeUserPresets.json
Expand All @@ -11,8 +20,55 @@ build_release/
**/install_manifest.txt
**/compile_commands.json

# Build directories
build/
out/
cmake-build-*/

/build
/subprojects/*
!/subprojects/*.wrap
/.cache
# CMake files
CMakeCache.txt
CMakeFiles/
CMakeScripts/
Testing/
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# IDE-specific files (example for Visual Studio Code)
.vscode/

# OS-specific files
.DS_Store
Thumbs.db
19 changes: 17 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
image: registry.gitlab.com/easbarba/onur-cpp:0.2.0

stages:
- build
- test

workflow:
Expand All @@ -9,7 +10,21 @@ workflow:
when: never
- if: $CI_COMMIT_BRANCH == 'main'

Integration Tests:
.build_template: &build_definition
stage: build
script:
- cmake -B build -S .
- cmake --build build

build:linux:
<<: *build_definition
artifacts:
paths:
- build/

test:
stage: test
script:
- meson test -C /home/easbarba/app/build
- ./build/tests/onur_tests
dependencies:
- build:linux
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ along with Onur. If not, see <https://www.gnu.org/licenses/>.

# CHANGELOG

## 0.3.0

- feat: add action edit/view configurations

## 0.2.0

- feat: refactor, more tests and improve cli ui
Expand Down
24 changes: 22 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
# Onur 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.
#
# Onur 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 Onur. If not, see <https://www.gnu.org/licenses/>.

cmake_minimum_required(VERSION 3.20.0)
project(Onur)
add_executable(onur src/main.cpp)
project(onur)

# Set C++ standard
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED True)

# Add subdirectories
add_subdirectory(src)
add_subdirectory(tests)
15 changes: 8 additions & 7 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ LABEL version=${ONUR_VERSION}
LABEL description="Easily manage multiple FLOSS repositories."

RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential git meson cmake ca-certificates && \
apt-get install -y --no-install-recommends build-essential git meson cmake ca-certificates pkg-config && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

ENV NEWUSER easbarba
ENV APP_HOME /home/$USER_NAME/app
ENV PATH "/home/$NEWUSER/.local/bin:$PATH"
RUN useradd -ms /bin/bash $NEWUSER && mkdir $APP_HOME && chown -R $USER_NAME:$USER_NAME $APP_HOME
USER $NEWUSER
ENV USERNAME easbarba
ENV APP_HOME /home/$USERNAME/app
WORKDIR $APP_HOME

RUN groupadd -r $USERNAME && useradd -r -g $USERNAME -d /home/$USERNAME -m -s /bin/bash $USERNAME
RUN chown -R $USERNAME:$USERNAME /home/$USERNAME

COPY examples examples
COPY ./prepare.bash .
RUN ./prepare.bash

Expand All @@ -24,4 +25,4 @@ COPY . .
RUN CC=g++ meson setup $APP_HOME/build --wipe --backend ninja
RUN CC=g++ meson compile -C $APP_HOME/build

CMD [ "meson", "test", "-C", $APP_HOME/build ]
CMD [ "meson", "test", "-C", "/home/easbarba/app/build" ]
24 changes: 18 additions & 6 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,30 @@ CONTAINER_IMAGE := registry.gitlab.com/${USER}/${NAME}:${VERSION}
# ------------------------------------ TASKS

.PHONY: all
all:
all: cmake.all

.PHONY: dev
dev: cmake.dev

.PHONY: meson.all
meson.all:
CC=g++ meson setup $(BUILDDIR) --wipe
CC=g++ meson compile -C $(BUILDDIR)

.PHONY: dev
dev:

.PHONY: meson.dev
meson.dev:
CC=g++ meson setup $(BUILDDIR)
CC=g++ meson compile -C $(BUILDDIR)

.PHONY: cmake
cmake:
cmake -B ${BUILDDIR} -S .
.PHONY: cmake.all
cmake.all: clean
cmake -S . -B ${BUILDDIR} -D CMAKE_BUILD_TYPE=Release
cmake --build ${BUILDDIR}

.PHONY: cmake.dev
cmake.dev:
cmake -S . -B ${BUILDDIR} -D CMAKE_BUILD_TYPE=Debug
cmake --build ${BUILDDIR}

.PHONY: clean
Expand Down
26 changes: 22 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,30 @@ Easily manage multiple FLOSS repositories.
| [ruby](https://gitlab.com/easbarba/onur-ruby)



## Usage

```shell
onur grab
onur backup nuxt awesomewm gitignore
# grab all projects
onur grab

# grab only the c projects
onur grab c

# list the cpp configuration file
onur config cpp

# list topics of haskell
onur config haskell.

# list only the projects on misc topic of lisp
onur config lisp.misc

# add a new configuration with theses entries in the topic misc of c
onur config c.misc cli11 https://github.com/cliutils/cli11 main

# back up these projects as tar.gz
onur backup ecmascript.nuxt lua.awesomewm misc.gitignore

onur --help
```

Expand Down Expand Up @@ -90,7 +108,7 @@ depth = 1

## Installation

`onur` requires a c++ 20 compiler and `meson` to install, locally at `$HOME/.local/bin`, easily with : `make all install`.
`onur` requires a c++ 23 compiler and `meson` or `cmake`: `make all`.

## Development

Expand Down
7 changes: 5 additions & 2 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@ along with Onur. If not, see <https://www.gnu.org/licenses/>.

### High

- verbose
- flag: --verbose
- validation of repository links
- actions: --filter rust
- actions: --filter rust:misc
- actions: --only rust,haskel,commonlisp
- actions: --exclude rust,haskel,commonlisp

### Mid
- actions: onur config c.misc foo https://git@gmasd main

### Low

- config: move on these to a syntax check class
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ project(
'cpp',
license: 'GNU GPL version 3',
version: '0.2.0',
default_options: [ 'cpp_std=c++20', 'warning_level=3' ],
default_options: [ 'cpp_std=c++23', 'warning_level=3' ],
meson_version: '>=1.4.0',
)

Expand Down
39 changes: 39 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Onur 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.
#
# Onur 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 Onur. If not, see <https://www.gnu.org/licenses/>.

include(FetchContent)

FetchContent_Declare(
cli11
GIT_REPOSITORY https://github.com/CLIUtils/CLI11.git
GIT_TAG v2.4.1
)
FetchContent_MakeAvailable(cli11)

FetchContent_Declare(
json
GIT_REPOSITORY https://github.com/nlohmann/json.git
GIT_TAG v3.11.2
)
FetchContent_MakeAvailable(json)

add_executable(onur main.cpp
common/globals.cpp
database/parse.cpp
database/repository.cpp
domain/konfig.cpp
handlers/actions.cpp
handlers/commands.cpp
handlers/helpers.cpp)
target_link_libraries(onur PRIVATE CLI11::CLI11 nlohmann_json::nlohmann_json)
target_include_directories(onur PRIVATE ${PROJECT_SOURCE_DIR}/src/include)
Loading

0 comments on commit 43954cb

Please sign in to comment.