AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Off-Topic (https://forums.alliedmods.net/forumdisplay.php?f=15)
-   -   [Github] Adding .inc file from another repository (https://forums.alliedmods.net/showthread.php?t=305692)

OciXCrom 02-28-2018 15:37

[Github] Adding .inc file from another repository
 
So, I have a .inc file in one repository and I want to include it in some of my plugins without having to manually update it every time in every repo.

For example, I want to add the file cromchat.inc from here - https://github.com/OciXCrom/cromchat

In the scripting/include folder here - https://github.com/OciXCrom/ChatManager

I tried using git submodule add, but I can't figure out how to put it in the correct folder.

klippy 02-28-2018 18:06

Re: [Github] Adding .inc file from another repository
 
In git submodule --help you can find
Code:

git submodule [--quiet] add [<options>] [--] <repository> [<path>]
The optional path argument lets you set where you want it to reside in your project, but by default it will reside in /submodule-name (or /cromchat in your case), but I guess for your case you'd want this:
Code:

git submodule add https://github.com/OciXCrom/cromchat scripting/cromchat
and in your crx_chatmanager.sma you can
PHP Code:

#include "cromchat/cromchat.inc" 

The real problem is that people don't really use git here, and even less server owners that only know how to compile a plugin using simple steps. This makes it much harder for them if you want to release a plugin.

It would be s e x y if we had something along the lines of NPM.

DarkDeviL 03-01-2018 06:39

Re: [Github] Adding .inc file from another repository
 
Quote:

Originally Posted by KliPPy (Post 2580713)
The optional path argument lets you set where you want it to reside in your project, but by default it will reside in /submodule-name (or /cromchat in your case), but I guess for your case you'd want this:
Code:

git submodule add https://github.com/OciXCrom/cromchat scripting/cromchat
and in your crx_chatmanager.sma you can
PHP Code:

#include "cromchat/cromchat.inc" 


I must admit that I haven't been playing around much with submodules, but didn't you mean:

Code:

git submodule add https://github.com/OciXCrom/cromchat scripting/include/cromchat
Otherwise I believe the path to the cromchat.inc file @ #include will be a little bit incorrect?

? :)

klippy 03-01-2018 08:25

Re: [Github] Adding .inc file from another repository
 
Quote:

Originally Posted by arne1288 (Post 2580789)
I must admit that I haven't been playing around much with submodules, but didn't you mean:

Code:

git submodule add https://github.com/OciXCrom/cromchat scripting/include/cromchat
Otherwise I believe the path to the cromchat.inc file @ #include will be a little bit incorrect?

? :)

Then he'd have to do
PHP Code:

#include "include/cromchat/cromchat.inc" 

The path you set will be the base path for that submodule, i.e. the directory in which all of submodules contents will be copied. I didn't purposely set it to "scripting/include/cromchat" because, as you see, including it gets ridiculous.
Also confusion may arrive because that "/include" path is not automatically added to included paths, you have to do it yourself when compiling or just reference it using a relative path (like I did).
I mean it's up to the OP what he wants to do with it, I just posted what I would've done.

OciXCrom 03-01-2018 08:29

Re: [Github] Adding .inc file from another repository
 
Thanks, but I want to put the .inc file directly in the include folder and avoid changing the #include line. I tried tricking the system by creating a new repository called "include" that contains only cromchat.inc and adding it in the scripting folder, but it said "scripting already exists in the index". Can I somehow force git to "overwrite" the folder?

klippy 03-01-2018 09:04

Re: [Github] Adding .inc file from another repository
 
In that case you won't be able to have other files under "/include". It's either a normal directory containing files or a submodule.

OciXCrom 03-01-2018 10:05

Re: [Github] Adding .inc file from another repository
 
I see. I'll stick to adding it manually for now since I don't really like the idea of manipulating the #include path. Too many people are using the .inc file and my plugins, so this will probably cause a mess.

redivcram 03-13-2018 19:05

Re: [Github] Adding .inc file from another repository
 
When will we see OciXCrom making a RGB chat? c:

klippy 03-13-2018 19:24

Re: [Github] Adding .inc file from another repository
 
Quote:

Originally Posted by redivcram (Post 2582919)
When will we see OciXCrom making a RGB chat? c:

Ask Razer, they excel at RGB.

OciXCrom 03-13-2018 20:00

Re: [Github] Adding .inc file from another repository
 
Quote:

Originally Posted by redivcram (Post 2582919)
When will we see OciXCrom making a RGB chat? c:

When CS 1.7 comes out.


All times are GMT -4. The time now is 01:13.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.