AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [batch] sm plugins ftp (sftp) uploader (https://forums.alliedmods.net/showthread.php?t=311576)

Dragokas 10-24-2018 04:27

[batch] sm plugins ftp (sftp) uploader
 
3 Attachment(s)
This CMD (batch) file allows you save a time if:
  • you are developing plugins
  • you need upload the same plugin on server again and again (after each local modification)

Purpose:
It automatically compile and upload smx file to FTP (using CURL or Putty) as soon as its timestamp is changed.
When you edit your .sp file press Ctrl + S and it will be compiled (in background) and uploaded in a second.
Alternatively, you can set to track only smx (compiled files).

Versions:
There are 2 version of uploader:
  • 1.2 (for ftp only, using curl.exe)
  • 1.3 (for both sftp and ftp, using pscp.exe (putty command line tool)).

Preparation:
1) (optional) Using Plugin-autoreload is highly recommended. See attached autoreload.zip (it is an optimized fork of original).
Compile it and place in server .../addons/sourcemod/plugins/ folder.

2) Download one of attached sm_upload_*.zip archive. Unpack.

3) Dependency:
- (for v.1.2 only) Download and place CURL.exe in the same folder.
- (for v.1.3 only) Install Putty
- Download local compiler: from here. Unzip it.

4) Edit "sm_upload.cmd" file (open in notepad: right mouse click => Edit).
Set correct path and settings here:
Code:

:: path to spcomp.exe of local compiler
set compiler=d:\dev\SourceMod\addons\sourcemod\scripting\spcomp.exe

:: server settings (in v.1.3)
set server=5.x.x.x
set port=22
set user=l4dserver
set pass=xxx
set servpath=/home/l4dserver/serverfiles/left4dead/

:: or this line (in v.1.2)
set ftp=ftp://user:[email protected]/left4dead/

:: Specify true if you want to upload source files (.sp) as well
set upload_source=false

Save.


How to use:
1) Edit "plugins.txt" file: add full paths to plugins (smx or sp) you want to track.
2) Run "sm_upload.cmd" file and minimize its window to tray every time you need uploader to work.

Alternatively:
You can add files for tracking by context menu (Right Button Mouse Click on any.sp or any.smx file => SendTo => "SM - Track for upload").
To install such menu:
  • create shortcut to "SM - Track for upload.cmd" file.
  • place that shortcut in SendTo folder. To find that folder: press Win + R and enter Shell:SendTo than press OK and paste shortcut there.

You are ready.
Good luck.

Compatibility: Windows Vista+.

Update
Now *.phrases.txt files are also supported.

Dragokas 10-25-2018 01:05

Re: [batch] sm plugins ftp uploader
 
Updated to v1.1
- Added opportunity to set mask * like c:\path\*.sp (though, it's not recursive, subfolders are not included).
- Added opportunity to add files for tracking by context menu => SendTo (see above for instruction how to add).
- Improved error displaying
- curl: removed -v switch. Add it yourself if you want verbose info.

Dragokas 10-28-2018 06:02

Re: [batch] sm plugins ftp uploader
 
Updated to v1.2
- Fixed cases with infinite uploading when plugin name begins with number.
- Fixed infinite errors in console when file is no longer exists.
- Improved console log formatting.
- Added ability to track and upload translation files (*.phrases.txt).
- Added ability to upload source files (it's require you change "upload_source" variable to 'true'). Disabled by default.
- Added ability to track and upload any kind of files (files that not meet criteria *.sp, *.smx, *.phrases.txt will be uploaded to addons/sourcemod/data/ folder, defined by "data" variable).
- Added variable "scripting" - location of source files subfolder on ftp ('addons/sourcemod/scripting/' by default).
- Added variable "plugins" - location of plugins subfolder on ftp ('addons/sourcemod/plugins/' by default).
- Added variable "translations" - location of translations subfolder on ftp ('addons/sourcemod/translations/' by default).
- Added variable "data" - location of data subfolder on ftp ('addons/sourcemod/data/' by default).
- BE ATTENTIVE !!! Format of "ftp" variable is changed!!! Now it include only ftp authorization, ip and root folder name only (without full path to 'plugins').

Dragokas 01-26-2020 11:02

Re: [batch] sm plugins ftp uploader
 
Added FTP (SFTP) Uploader v.1.3:

Quote:

- Now supported SFTP protocol
New requirement:

Quote:

- Installed Putty.
Added plugin-autoreload fork:

Quote:

1.2 (22-Nov-2019)
- Converted to a new syntax and methodmaps
- Added ConVar "sm_autoreload_delay"
- Some code optimizations

1.1
- Added command "sm plugins load" in case plugin is not loaded last time due to startup error

// TODO:
- check smx integrity before trying to load it.


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

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