Skip to content

Commit

Permalink
Merge pull request #7 from Cogmasters/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
lcsmuller authored Jan 7, 2022
2 parents f590a24 + 4aa2b41 commit d1dac45
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 12,331 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ Doxyfile
*.swp
cog-utils
src/specs-code
include/one-specs.h
46 changes: 25 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ SRC_DIR := src
INCLUDE_DIR := include
OBJDIR := obj
LIBDIR := lib

DOCS_DIR := docs
SPECS_DIR := specs
SPECSCODE_DIR := $(SRC_DIR)/specs-code
C_SPECS_DIR := $(SRC_DIR)/specs-code
H_SPECS_DIR := $(DOCS_DIR)/specs-headers
COGUTILS_DIR := cog-utils
COMMON_DIR := common
THIRDP_DIR := $(COMMON_DIR)/third-party
EXAMPLES_DIR := examples
TEST_DIR := test
DOCS_DIR := concord-docs
CCORDDOCS_DIR := concord-docs

COGUTILS_SRC := $(COGUTILS_DIR)/cog-utils.c \
$(COGUTILS_DIR)/json-actor.c \
Expand All @@ -32,7 +33,7 @@ THIRDP_SRC := $(THIRDP_DIR)/sha1.c \
$(THIRDP_DIR)/curl-websocket.c \
$(THIRDP_DIR)/threadpool.c

DISCORD_SRC := $(wildcard $(SRC_DIR)/*.c $(SPECSCODE_DIR)/*.c)
DISCORD_SRC := $(wildcard $(SRC_DIR)/*.c $(C_SPECS_DIR)/*.c)

SRC := $(COGUTILS_SRC) $(COMMON_SRC) $(THIRDP_SRC) $(DISCORD_SRC)
OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
Expand All @@ -53,15 +54,15 @@ $(OBJDIR)/$(THIRDP_DIR)/%.o : $(THIRDP_DIR)/%.c
$(OBJDIR)/%.o : %.c
$(CC) $(CFLAGS) $(WFLAGS) -c -o $@ $<

all: | $(SPECSCODE_DIR)
all: | $(C_SPECS_DIR)
$(MAKE) discord

specs_gen: | $(COGUTILS_DIR)
@ $(MAKE) -C $(SPECS_DIR) clean
@ $(MAKE) -C $(SPECS_DIR) gen_source gen_headers_amalgamation
@ mkdir -p $(SPECSCODE_DIR)
mv $(SPECS_DIR)/specs-code/discord/*.c $(SPECSCODE_DIR)
mv $(SPECS_DIR)/specs-code/discord/*.h $(INCLUDE_DIR)
@ mkdir -p $(C_SPECS_DIR)
mv $(SPECS_DIR)/specs-code/discord/*.c $(C_SPECS_DIR)
mv $(SPECS_DIR)/specs-code/discord/one-specs.h $(INCLUDE_DIR)

cog_utils:
git clone https://github.com/cogmasters/cog-utils $(COGUTILS_DIR)
Expand All @@ -72,25 +73,25 @@ test: all
examples: all
@ $(MAKE) -C $(EXAMPLES_DIR)

discord: $(LIB) | $(SPECSCODE_DIR)
discord: $(LIB) | $(C_SPECS_DIR)

# API libraries compilation
$(LIB): $(OBJS) | $(LIBDIR)
$(AR) -cqsv $@ $?

$(LIBDIR):
@ mkdir -p $(LIBDIR)
$(SPECSCODE_DIR):
@ mkdir -p $@
$(C_SPECS_DIR):
@ $(MAKE) specs_gen
$(COGUTILS_DIR):
@ $(MAKE) cog_utils

$(OBJS): | $(OBJDIR)

$(OBJDIR):
@ mkdir -p $(OBJDIR)/$(THIRDP_DIR) \
$(OBJDIR)/$(COGUTILS_DIR) \
$(addprefix $(OBJDIR)/, $(wildcard $(SPECSCODE_DIR)/*))
@ mkdir -p $@/$(THIRDP_DIR) \
$@/$(COGUTILS_DIR) \
$(addprefix $@/, $(wildcard $(C_SPECS_DIR)/*))

install:
@ mkdir -p $(PREFIX)/lib/
Expand All @@ -106,7 +107,7 @@ echo:
@ echo -e 'PREFIX: $(PREFIX)\n'
@ echo -e 'CFLAGS: $(CFLAGS)\n'
@ echo -e 'OBJS: $(OBJS)\n'
@ echo -e 'SPECS DIRS: $(wildcard $(SPECSCODE_DIR)/*)\n'
@ echo -e 'SPECS DIRS: $(wildcard $(C_SPECS_DIR)/*)\n'
@ echo -e 'COGUTILS_SRC: $(COGUTILS_SRC)\n'
@ echo -e 'COMMON_SRC: $(COMMON_SRC)\n'
@ echo -e 'DISCORD_SRC: $(DISCORD_SRC)\n'
Expand All @@ -120,16 +121,19 @@ clean:
purge: clean
rm -rf $(LIBDIR)
rm -rf $(COGUTILS_DIR)
rm -rf $(SPECSCODE_DIR)
rm -rf $(C_SPECS_DIR)

# prepare files for generating documentation at .github/workflows/gh_pages.yml
docs: $(COGUTILS_DIR) | $(DOCS_DIR)
docs: $(COGUTILS_DIR) | $(H_SPECS_DIR)
@ $(MAKE) -C $(SPECS_DIR) clean
@ $(MAKE) -C $(SPECS_DIR) gen_headers
@ mv $(SPECS_DIR)/specs-code $(SPECSCODE_DIR)
@ mv $(SPECS_DIR)/specs-code/discord/*.h $(H_SPECS_DIR)

$(H_SPECS_DIR): | $(C_SPECS_DIR)
@ mkdir -p $@

$(DOCS_DIR):
git clone https://github.com/cogmasters/concord-docs $(DOCS_DIR)
cp $(DOCS_DIR)/Doxyfile Doxyfile
$(CCORDDOCS_DIR):
git clone https://github.com/cogmasters/concord-docs $@
cp $@/Doxyfile Doxyfile

.PHONY: all test examples install echo clean purge docs
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
specs-headers
49 changes: 1 addition & 48 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Please try to get the latest available sources to make your patches against. It

### Documentation

Writing docs is dead boring and one of the big problems with many open source projects. But someone's gotta do it! Please get yourself familiarized with [Doxygen syntax](https://www.doxygen.nl/manual/docblocks.html) and use the surrounding code as a guide when documenting your patch. Once the patch is approved a automated [workflow](.github/workflows/gh_pages.yml) will automatically updated our documentation with your changes. If you wish to patch how the documentation is generated and rendered, please head to [concord-docs](https://github.com/cee-studio/concord-docs) and submit your changes there.
Writing docs is dead boring and one of the big problems with many open source projects. But someone's gotta do it! Please get yourself familiarized with [Doxygen syntax](https://www.doxygen.nl/manual/docblocks.html) and use the surrounding code as a guide when documenting your patch. Once the patch is approved a automated [workflow](.github/workflows/gh_pages.yml) will automatically updated our documentation with your changes. If you wish to patch how the documentation is generated and rendered, please head to [concord-docs](https://github.com/Cogmasters/concord-docs) and submit your changes there.

### Test Cases

Expand Down Expand Up @@ -81,50 +81,3 @@ References:
- https://www.conventionalcommits.org/
- https://seesparkbox.com/foundry/semantic_commit_messages
- http://karma-runner.github.io/1.0/dev/git-commit-msg.html

### Easy Pull Request

If you have problems to submit clean pull requests without introducing merge commits,
you can use this method, otherwise please use your git commands.

This section explains how to submit changes and pull requests the easy
and cleanest way without causing any merge conflicts.

#### Setup .cee-contributor
1. fork this repo to your personal account. Please DO NOT submit any changes to
this fork from your git command line

2. run the following command
```
git clone https://github.com/cee-studio/concord.git
cd concord
cp config.json .cee-contributor
```
It is important that you clone from this repo, NOT from your fork.


3. add replace "YOUR-GITHUB-USERNAME" and "YOUR-PERSONAL-ACCESS-TOKEN"
with your github username and your personal access token (which can
be obtained thru this
[link](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token))

#### Build test-git2.exe
1. run
```
cd concord
make test
```
Copy test-git2 to your bin folder and make that folder searchable in PATH


#### Usage
Run the following command that will automatically do the following
1. sync up your personal fork
2. create a branch in your fork
3. submit a commit to the branch
4. create a pull request

Assume your changes are in the concord folder, you can run the following commands:
```
./test/test-git2 -m "you commit comments" files
```
8 changes: 4 additions & 4 deletions docs/PROJECT_OUTLINE.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Project Outline

An explanation of important folders for developers who would like to contribute to Concord.

| directory | meaning |
|----------------------|-------------------------------------------------------------------------|
| examples/ | Example bots for new users |
| common/ | The backbone to wrap APIs using Concord |
| src/ | The Discord API wrapping source code |
| include/ | The Discord API wrapping header files |
| docs/ | Guidelines, roadmap, and other important information regarding Concord |
| licenses/ | License for Concord, and some other libraries used by Concord |
| mujs/ | An embedded JavaScript engine. Unused at the moment. |
| scripts/ | Cee-Studio specific scripts |
| specs/ | Data used to generate types and structures used by Concord |
| specs-code/ | Where files generated from ``specs/`` are dumped to |
| specs/ | JSON Specs used to generate types and structures used by Concord |
| test/ | Tests to make sure Concord is running smoothly are put here |

19 changes: 5 additions & 14 deletions examples/bot-embed.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,16 @@ char JSON_STRING[] =
" \"author\": {\n"
" \"name\": \"Cogmasters\",\n"
" \"url\": \"https://github.com/Cogmasters\",\n"
" \"icon_url\": \"https://cee.dev/static/images/cee.png\"\n"
" },\n"
" \"fields\": [\n"
" {\n"
" \"name\":\"Want to learn more?\", \n"
" \"value\":\"Read our "
"[documentation](https://Cogmasters.github.io/concord/"
"discord_api.html#c.discord_embed)!\"\n"
" },\n"
" {\n"
" \"name\":\"Need help troubleshooting?\", \n"
" \"value\":\"Debug with [Saiph-C](https://www.cee.studio/)\"\n"
"[documentation](https://cogmasters.github.io/concord/)!\"\n"
" },\n"
" {\n"
" \"name\":\"Looking for support?\", \n"
" \"value\":\"Join our server [here](https://discord.gg/nBUqrWf)!\"\n"
" \"value\":\"Join our server [here](https://discord.gg/Y7Xa6MA82v)!\"\n"
" }\n"
" ]\n"
"}";
Expand Down Expand Up @@ -94,15 +88,13 @@ void on_static(struct discord *client, const struct discord_message *msg)
&(struct discord_embed_author){
.name = "Cogmasters",
.url = "https://github.com/Cogmasters",
.icon_url = "https://cee.dev/static/images/cee.png",
},
.fields =
(struct discord_embed_field *[]){
&(struct discord_embed_field){
.name = "Want to learn more?",
.value = "Read our "
"[documentation](https://Cogmasters.github.io/concord/apis/"
"discord.html#c.discord_embed)!",
"[documentation](https://cogmasters.github.io/concord/)!",
},
&(struct discord_embed_field){
.name = "Looking for support?",
Expand Down Expand Up @@ -136,11 +128,10 @@ void on_builder(struct discord *client, const struct discord_message *msg)
NULL, 0, 0);
discord_embed_set_author(&embed, "Cogmasters",
"https://github.com/Cogmasters",
"https://cee.dev/static/images/cee.png", NULL);
NULL, NULL);
discord_embed_add_field(&embed, "Want to learn more?",
"Read our "
"[documentation](https://Cogmasters.github.io/concord/"
"apis/discord.html#c.discord_embed)!",
"[documentation](https://cogmasters.github.io/concord/)!",
false);
discord_embed_add_field(
&embed, "Looking for support?",
Expand Down
Loading

0 comments on commit d1dac45

Please sign in to comment.