mattn (owner)

Forks

Revisions

gist: 36989 Download_button fork
public
Public Clone URL: git://gist.github.com/36989.git
Embed All Files: show embed
release.pl #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!perl
use strict;
use warnings;
use Config::Pit;
use Getopt::Long;
use WWW::Mechanize;
use Perl6::Say;
 
my $conf = pit_get("vim.com", require => {
  "username" => "your username on vim.org", # NOTE: do not edit this line
  "password" => "your password on vim.org", # NOTE: do not edit this line
});
 
my %args = ( id => '', sv => '', vv => '7.0', msg => '' );
die "invalid args"
  unless GetOptions(\%args, 'id=i', 'sv=s', 'vv=f', 'msg=s');
unless ($args{msg}) {
  print "message: ";
  $args{msg} = <STDIN>;
}
 
my $file = shift;
die "script version not specified" unless $args{id};
die "message not specified" unless $args{msg};
die "file not specified" unless $file;
 
my $mech = WWW::Mechanize->new;
$mech->get('http://www.vim.org/login.php');
$mech->submit_form(
form_name => 'login',
fields => {
userName => $conf->{username},
password => $conf->{password},
},
);
 
$mech->get("http://www.vim.org/scripts/add_script_version.php?script_id=$args{id}");
$mech->form_name('script');
$mech->field(script_file => $file);
$mech->select('vim_version', $args{vv});
$mech->field(script_version => $args{sv});
$mech->field(version_comment => $args{msg});
my $res = $mech->click('add_script');
say $res->is_success ? "uploaded" : $res->status_line;