Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 59 lines (52 sloc) 1.366 kb
0e499f5 @chrisbra Added script to automatically upload histwin
authored
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4
5 use WWW::Mechanize;
6
7 sub GetPassword() {
8 my $i=0;
9 my @pass;
10 my $passfile="./vim_passfile"; # line1: username, line2: password
11 open(PASS, '<',$passfile) or die "Can't open passwordfile: $passfile\n";
12 while(<PASS>){
13 chomp;
14 $pass[$i++] = $_;
15 }
16 close(PASS);
17 return @pass;
18 }
19
20 my $sid=2932;
21 my $file;
22 my @files=glob('*.vba');
23 #my $scriptversion=shift @ARGV;
24 my $scriptversion = 0;
25 my $versioncomment=shift @ARGV;
5a98870 @chrisbra Force entering a comment before uploading
authored
26 unless ($versioncomment){
27 print "Please enter comment!\n";
28 exit;
29 }
30 $versioncomment.="\n(automatically uploaded)";
0e499f5 @chrisbra Added script to automatically upload histwin
authored
31
32
33 my @userpasswordpair = GetPassword();
34 for (@files) {
35 my $f = $_ if [ -f $_ ] && $_ =~ /\w+-[^.]+\.(\d+)\.vba/;
36 if ($1 > $scriptversion) {
37 $scriptversion=$1;
38 $file = $f;
39 }
40 }
41
42 my $mech=WWW::Mechanize->new(autocheck => 1);
43 $mech->get("http://www.vim.org/login.php");
44 $mech->submit_form(
45 form_name => "login",
46 with_fields => {
47 userName => $userpasswordpair[0],
48 password => $userpasswordpair[1],
49 },
50 );
51 $mech->get("http://www.vim.org/scripts/script.php?script_id=$sid");
52 $mech->follow_link(text => 'upload new version');
53 $mech->form_name("script");
54 $mech->field(script_file => $file);
55 $mech->field(vim_version => 7.3);
56 $mech->field(script_version => $scriptversion);
57 $mech->field(version_comment => $versioncomment);
58 $mech->click_button(value => "upload");
Something went wrong with that request. Please try again.