Raised This Month: $51 Target: $400
 12% 

[Github] Adding .inc file from another repository


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-28-2018 , 15:37   [Github] Adding .inc file from another repository
Reply With Quote #1

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.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 02-28-2018 , 18:06   Re: [Github] Adding .inc file from another repository
Reply With Quote #2

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.
__________________

Last edited by klippy; 02-28-2018 at 18:10.
klippy is offline
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 03-01-2018 , 06:39   Re: [Github] Adding .inc file from another repository
Reply With Quote #3

Quote:
Originally Posted by KliPPy View Post
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?

?
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].
DarkDeviL is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 03-01-2018 , 08:25   Re: [Github] Adding .inc file from another repository
Reply With Quote #4

Quote:
Originally Posted by arne1288 View Post
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.
__________________
klippy is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-01-2018 , 08:29   Re: [Github] Adding .inc file from another repository
Reply With Quote #5

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?
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 03-01-2018 , 09:04   Re: [Github] Adding .inc file from another repository
Reply With Quote #6

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.
__________________
klippy is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-01-2018 , 10:05   Re: [Github] Adding .inc file from another repository
Reply With Quote #7

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.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 03-13-2018 , 19:05   Re: [Github] Adding .inc file from another repository
Reply With Quote #8

When will we see OciXCrom making a RGB chat? c:
redivcram is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 03-13-2018 , 19:24   Re: [Github] Adding .inc file from another repository
Reply With Quote #9

Quote:
Originally Posted by redivcram View Post
When will we see OciXCrom making a RGB chat? c:
Ask Razer, they excel at RGB.
__________________
klippy is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-13-2018 , 20:00   Re: [Github] Adding .inc file from another repository
Reply With Quote #10

Quote:
Originally Posted by redivcram View Post
When will we see OciXCrom making a RGB chat? c:
When CS 1.7 comes out.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:09.


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