Skip to content

Commit e6b8cf2

Browse files
committed
Updating README file with instructions
modified: FTP.py modified: README.md
1 parent d1819bf commit e6b8cf2

File tree

2 files changed

+43
-2
lines changed

2 files changed

+43
-2
lines changed

FTP.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
DELETED = "D "
1313
UPDATED = "U "
1414
OFFSET = len(ADDED) + len(TRUNK)
15+
SETTINGS_FILE = "E:\website.txt"
1516

1617
def upload(ftp, local_root, files):
1718
for file_name in files:
@@ -81,7 +82,7 @@ def delete(ftp, files):
8182
if repo == "" or rev == "":
8283
raise Exception("Empty repo or rev")
8384

84-
with open("E:\website.txt", "r") as settings:
85+
with open(SETTINGS_FILE, "r") as settings:
8586
local = settings.readline().rstrip()
8687
ftp_server = settings.readline().rstrip()
8788
user = settings.readline().rstrip()

README.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,44 @@
11
svn2ftp
22
=======
3+
## Purpose
4+
### Short Story
5+
This Python script automatically uploads SVN commits to a specified FTP location.
36

4-
Python script to automatically upload svn repo to ftp location
7+
### Long Story
8+
When converting my website to SVN, I wanted a tool to allow me to avoid manually
9+
uploading changes to my FTP server. I found some solutions online, but most of
10+
them weren't exactly what I was looking for, and many were too complicated.
11+
12+
I ended up making something from scratch using the changelist provided by SVN.
13+
I had to figure out how to pass it the sensitive user information. I decided
14+
to use a local file which the script would use to extract what it needed.
15+
While it's not the most secure solution, it was good enough for my needs.
16+
Feel free to fork this project and implement your own way of passing the ftp information.
17+
An example solution could be to prompt the user each time a commit is pushed.
18+
19+
## Installation
20+
This script is very simple to install.
21+
22+
1. Copy post-commit.bat and FTP.py to your svn\hooks\ folder.
23+
2. Create a file that will contain the necessary FTP server information (each item should be on its own line, in the following order):
24+
- The full path location to the local SVN repo
25+
- The full URL to the FTP server
26+
- The username for the FTP server
27+
- The password for the FTP server
28+
- The root directory to upload the repo to (default should be './')
29+
3. Modify FTP.py's SETTINGS_FILE variable to the full location of this file
30+
4. Make a commit and see the script run.
31+
32+
### Example settings file
33+
<pre>
34+
E:\mysite
35+
robbie.ftpserver.org
36+
robbie
37+
thepassword
38+
public_html/
39+
</pre>
40+
41+
## TODO
42+
- Modify post-commit.bat so the command prompt closes automatically
43+
- Add a debug variable to make this easily configurable
44+
- Fix bug when "adding" a file that already exists on the server

0 commit comments

Comments
 (0)