-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added script to automatically upload histwin
- Loading branch information
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/perl | ||
use strict; | ||
use warnings; | ||
|
||
use WWW::Mechanize; | ||
|
||
sub GetPassword() { | ||
my $i=0; | ||
my @pass; | ||
my $passfile="./vim_passfile"; # line1: username, line2: password | ||
open(PASS, '<',$passfile) or die "Can't open passwordfile: $passfile\n"; | ||
while(<PASS>){ | ||
chomp; | ||
$pass[$i++] = $_; | ||
} | ||
close(PASS); | ||
return @pass; | ||
} | ||
|
||
my $sid=2932; | ||
my $file; | ||
my @files=glob('*.vba'); | ||
#my $scriptversion=shift @ARGV; | ||
my $scriptversion = 0; | ||
my $versioncomment=shift @ARGV; | ||
|
||
|
||
my @userpasswordpair = GetPassword(); | ||
for (@files) { | ||
my $f = $_ if [ -f $_ ] && $_ =~ /\w+-[^.]+\.(\d+)\.vba/; | ||
if ($1 > $scriptversion) { | ||
$scriptversion=$1; | ||
$file = $f; | ||
} | ||
} | ||
|
||
my $mech=WWW::Mechanize->new(autocheck => 1); | ||
$mech->get("http://www.vim.org/login.php"); | ||
$mech->submit_form( | ||
form_name => "login", | ||
with_fields => { | ||
userName => $userpasswordpair[0], | ||
password => $userpasswordpair[1], | ||
}, | ||
); | ||
$mech->get("http://www.vim.org/scripts/script.php?script_id=$sid"); | ||
$mech->follow_link(text => 'upload new version'); | ||
$mech->form_name("script"); | ||
$mech->field(script_file => $file); | ||
$mech->field(vim_version => 7.3); | ||
$mech->field(script_version => $scriptversion); | ||
$mech->field(version_comment => $versioncomment); | ||
$mech->click_button(value => "upload"); |