From kawas at dev.open-bio.org Thu May 1 13:42:47 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 1 May 2008 13:42:47 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805011742.m41Hgk04016495@dev.open-bio.org> kawas Thu May 1 13:42:46 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/share/db/schema In directory dev.open-bio.org:/tmp/cvs-serv16460/Perl/MOBY-Server/share/db/schema Modified Files: mobycentral.mysql Log Message: missing description field in the schema moby-live/Perl/MOBY-Server/share/db/schema mobycentral.mysql,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/share/db/schema/mobycentral.mysql,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/share/db/schema/mobycentral.mysql 2008/02/21 00:21:28 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/share/db/schema/mobycentral.mysql 2008/05/01 17:42:46 1.2 @@ -50,6 +50,7 @@ enum_value text, datatype enum('String','Integer','DateTime','Float','Boolean') default NULL, article_name varchar(255) default NULL, + description text, service_instance_id int(10) unsigned NOT NULL default '0', PRIMARY KEY (secondary_input_id) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; @@ -59,7 +60,7 @@ -- CREATE TABLE service_instance ( - category enum('moby','soap','wsdl','cgi','moby-async') default NULL, + category enum('moby','soap','wsdl','rest','moby-async') default NULL, servicename varchar(255) NOT NULL default '', service_type_uri varchar(255) NOT NULL default '', authority_id int(10) unsigned NOT NULL default '0', From kawas at dev.open-bio.org Thu May 1 14:56:43 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 1 May 2008 14:56:43 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805011856.m41Iuh6b016609@dev.open-bio.org> kawas Thu May 1 14:56:43 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts In directory dev.open-bio.org:/tmp/cvs-serv16574/Perl/MOSES-MOBY/bin/scripts Modified Files: moses-testing-service.pl Log Message: fixed the code to get rid of the warning message moby-live/Perl/MOSES-MOBY/bin/scripts moses-testing-service.pl,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts/moses-testing-service.pl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts/moses-testing-service.pl 2008/04/29 19:58:37 1.4 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts/moses-testing-service.pl 2008/05/01 18:56:43 1.5 @@ -66,7 +66,7 @@ } elsif ($opt_c) { # calling a real service, using cgi - eval "use HTTP::Request::Common qw(POST); 1;" + eval "use HTTP::Request; 1;" or die "$@\n"; eval "use LWP::UserAgent; 1;" or die "$@\n"; @@ -145,7 +145,9 @@ $input = _empty_input; } - my $req = POST $opt_c, [ data => $input]; + my $req = HTTP::Request->new(POST => $opt_c); + $req->content_type('application/x-www-form-urlencoded'); + $req->content('data=$input'); print "\n" . $ua->request($req)->as_string . "\n"; } else { From kawas at dev.open-bio.org Thu May 1 17:44:47 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 1 May 2008 17:44:47 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805012144.m41LilXS016802@dev.open-bio.org> kawas Thu May 1 17:44:46 EDT 2008 Update of /home/repository/moby/moby-live/Docs/MOBY-S_API/Perl In directory dev.open-bio.org:/tmp/cvs-serv16771/Docs/MOBY-S_API/Perl Added Files: construct_moses_soap_service.html Log Message: tutorial on implementing a soap based perl moses service. moby-live/Docs/MOBY-S_API/Perl construct_moses_soap_service.html,NONE,1.1 From kawas at dev.open-bio.org Thu May 1 17:48:30 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 1 May 2008 17:48:30 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805012148.m41LmUGt016860@dev.open-bio.org> kawas Thu May 1 17:48:30 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server In directory dev.open-bio.org:/tmp/cvs-serv16825/Perl/MOBY-Server Modified Files: Changes Log Message: moby-live/Perl/MOBY-Server Changes,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/Changes,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOBY-Server/Changes 2008/04/30 17:02:54 1.3 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/Changes 2008/05/01 21:48:30 1.4 @@ -3,7 +3,7 @@ 1.04 - fixed bug that allowed service types to be registered - with empty ISA relationships. + with empty ISA relationships. - MOBY::Config now only reads the config file once instead of numerous times. @@ -20,6 +20,9 @@ - Added checks for those cases where RDF is wanted for a particular ontology that is empty. Instead of dying, we now return an empty document (as should be expected). + + - Fixed a bug in the schema for secondary inputs. The schema + was missing the column 'description' 1.00 - CVS version of MOBY released to the world via CPAN! From kawas at dev.open-bio.org Tue May 6 12:52:49 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 6 May 2008 12:52:49 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805061652.m46GqnhI031664@dev.open-bio.org> kawas Tue May 6 12:52:48 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts In directory dev.open-bio.org:/tmp/cvs-serv31628/Perl/MOSES-MOBY/bin/scripts Modified Files: moses-testing-service.pl Log Message: moby-live/Perl/MOSES-MOBY/bin/scripts moses-testing-service.pl,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts/moses-testing-service.pl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts/moses-testing-service.pl 2008/05/01 18:56:43 1.5 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts/moses-testing-service.pl 2008/05/06 16:52:48 1.6 @@ -96,7 +96,7 @@ } # --- what service to call -my $module = shift; # eg. Service::Mabuhay, or just Mabuhay +my $module = shift unless $opt_c; # eg. Service::Mabuhay, or just Mabuhay my $service; ($service = $module) =~ s/.*::// unless $opt_c; @@ -147,7 +147,7 @@ my $req = HTTP::Request->new(POST => $opt_c); $req->content_type('application/x-www-form-urlencoded'); - $req->content('data=$input'); + $req->content("data=$input"); print "\n" . $ua->request($req)->as_string . "\n"; } else { From kawas at dev.open-bio.org Tue May 6 13:15:00 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 6 May 2008 13:15:00 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805061715.m46HF0DC031742@dev.open-bio.org> kawas Tue May 6 13:15:00 EDT 2008 Update of /home/repository/moby/moby-live/Docs/MOBY-S_API/Perl In directory dev.open-bio.org:/tmp/cvs-serv31711/Docs/MOBY-S_API/Perl Added Files: construct_moses_cgi_service.html Log Message: tutorial on implementing a cgi based perl moses service. moby-live/Docs/MOBY-S_API/Perl construct_moses_cgi_service.html,NONE,1.1 From kawas at dev.open-bio.org Wed May 7 13:21:29 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 May 2008 13:21:29 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805071721.m47HLTf1009071@dev.open-bio.org> kawas Wed May 7 13:21:29 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module In directory dev.open-bio.org:/tmp/cvs-serv9036/Perl/MOSES-MOBY/inc/Module Modified Files: Install.pm Log Message: updated the Module::Install libraries to version 0.72 moby-live/Perl/MOSES-MOBY/inc/Module Install.pm,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install.pm 2008/02/21 00:12:56 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install.pm 2008/05/07 17:21:28 1.4 @@ -17,20 +17,30 @@ # 3. The ./inc/ version of Module::Install loads # } -use 5.004; +BEGIN { + require 5.004; +} use strict 'vars'; use vars qw{$VERSION}; BEGIN { - # All Module::Install core packages now require synchronised versions. - # This will be used to ensure we don't accidentally load old or - # different versions of modules. - # This is not enforced yet, but will be some time in the next few - # releases once we can make sure it won't clash with custom - # Module::Install extensions. - $VERSION = '0.67'; + # All Module::Install core packages now require synchronised versions. + # This will be used to ensure we don't accidentally load old or + # different versions of modules. + # This is not enforced yet, but will be some time in the next few + # releases once we can make sure it won't clash with custom + # Module::Install extensions. + $VERSION = '0.72'; + + *inc::Module::Install::VERSION = *VERSION; + @inc::Module::Install::ISA = __PACKAGE__; + } + + + + # Whether or not inc::Module::Install is actually loaded, the # $INC{inc/Module/Install.pm} is what will still get set as long as # the caller loaded module this in the documented manner. @@ -38,26 +48,29 @@ # they may not have a MI version that works with the Makefile.PL. This would # result in false errors or unexpected behaviour. And we don't want that. my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm'; -unless ( $INC{$file} ) { - die <<"END_DIE"; +unless ( $INC{$file} ) { die <<"END_DIE" } + Please invoke ${\__PACKAGE__} with: - use inc::${\__PACKAGE__}; + use inc::${\__PACKAGE__}; not: - use ${\__PACKAGE__}; + use ${\__PACKAGE__}; END_DIE -} + + + + # If the script that is loading Module::Install is from the future, # then make will detect this and cause it to re-run over and over # again. This is bad. Rather than taking action to touch it (which # is unreliable on some platforms and requires write permissions) # for now we should catch this and refuse to run. -if ( -f $0 and (stat($0))[9] > time ) { - die << "END_DIE"; +if ( -f $0 and (stat($0))[9] > time ) { die <<"END_DIE" } + Your installer $0 has a modification time in the future. This is known to create infinite loops in make. @@ -65,115 +78,142 @@ Please correct this, then run $0 again. END_DIE -} + + + + + +# Build.PL was formerly supported, but no longer is due to excessive +# difficulty in implementing every single feature twice. +if ( $0 =~ /Build.PL$/i or -f 'Build.PL' ) { die <<"END_DIE" } + +Module::Install no longer supports Build.PL. + +It was impossible to maintain duel backends, and has been deprecated. + +Please remove all Build.PL files and only use the Makefile.PL installer. + +END_DIE + + + + + +# To save some more typing in Module::Install installers, every... +# use inc::Module::Install +# ...also acts as an implicit use strict. +$^H |= strict::bits(qw(refs subs vars)); + + + + use Cwd (); use File::Find (); use File::Path (); use FindBin; -*inc::Module::Install::VERSION = *VERSION; - at inc::Module::Install::ISA = __PACKAGE__; - sub autoload { - my $self = shift; - my $who = $self->_caller; - my $cwd = Cwd::cwd(); - my $sym = "${who}::AUTOLOAD"; - $sym->{$cwd} = sub { - my $pwd = Cwd::cwd(); - if ( my $code = $sym->{$pwd} ) { - # delegate back to parent dirs - goto &$code unless $cwd eq $pwd; - } - $$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym"; - unshift @_, ($self, $1); - goto &{$self->can('call')} unless uc($1) eq $1; - }; + my $self = shift; + my $who = $self->_caller; + my $cwd = Cwd::cwd(); + my $sym = "${who}::AUTOLOAD"; + $sym->{$cwd} = sub { + my $pwd = Cwd::cwd(); + if ( my $code = $sym->{$pwd} ) { + # delegate back to parent dirs + goto &$code unless $cwd eq $pwd; + } + $$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym"; + unshift @_, ( $self, $1 ); + goto &{$self->can('call')} unless uc($1) eq $1; + }; } sub import { - my $class = shift; - my $self = $class->new(@_); - my $who = $self->_caller; - - unless ( -f $self->{file} ) { - require "$self->{path}/$self->{dispatch}.pm"; - File::Path::mkpath("$self->{prefix}/$self->{author}"); - $self->{admin} = "$self->{name}::$self->{dispatch}"->new( _top => $self ); - $self->{admin}->init; - @_ = ($class, _self => $self); - goto &{"$self->{name}::import"}; - } - - *{"${who}::AUTOLOAD"} = $self->autoload; - $self->preload; - - # Unregister loader and worker packages so subdirs can use them again - delete $INC{"$self->{file}"}; - delete $INC{"$self->{path}.pm"}; + my $class = shift; + my $self = $class->new(@_); + my $who = $self->_caller; + + unless ( -f $self->{file} ) { + require "$self->{path}/$self->{dispatch}.pm"; + File::Path::mkpath("$self->{prefix}/$self->{author}"); + $self->{admin} = "$self->{name}::$self->{dispatch}"->new( _top => $self ); + $self->{admin}->init; + @_ = ($class, _self => $self); + goto &{"$self->{name}::import"}; + } + + *{"${who}::AUTOLOAD"} = $self->autoload; + $self->preload; + + # Unregister loader and worker packages so subdirs can use them again + delete $INC{"$self->{file}"}; + delete $INC{"$self->{path}.pm"}; + + return 1; } sub preload { - my ($self) = @_; - - unless ( $self->{extensions} ) { - $self->load_extensions( - "$self->{prefix}/$self->{path}", $self - ); - } - - my @exts = @{$self->{extensions}}; - unless ( @exts ) { - my $admin = $self->{admin}; - @exts = $admin->load_all_extensions; - } - - my %seen; - foreach my $obj ( @exts ) { - while (my ($method, $glob) = each %{ref($obj) . '::'}) { - next unless $obj->can($method); - next if $method =~ /^_/; - next if $method eq uc($method); - $seen{$method}++; - } - } - - my $who = $self->_caller; - foreach my $name ( sort keys %seen ) { - *{"${who}::$name"} = sub { - ${"${who}::AUTOLOAD"} = "${who}::$name"; - goto &{"${who}::AUTOLOAD"}; - }; - } + my $self = shift; + unless ( $self->{extensions} ) { + $self->load_extensions( + "$self->{prefix}/$self->{path}", $self + ); + } + + my @exts = @{$self->{extensions}}; + unless ( @exts ) { + my $admin = $self->{admin}; + @exts = $admin->load_all_extensions; + } + + my %seen; + foreach my $obj ( @exts ) { + while (my ($method, $glob) = each %{ref($obj) . '::'}) { + next unless $obj->can($method); + next if $method =~ /^_/; + next if $method eq uc($method); + $seen{$method}++; + } + } + + my $who = $self->_caller; + foreach my $name ( sort keys %seen ) { + *{"${who}::$name"} = sub { + ${"${who}::AUTOLOAD"} = "${who}::$name"; + goto &{"${who}::AUTOLOAD"}; + }; + } } sub new { - my ($class, %args) = @_; + my ($class, %args) = @_; - # ignore the prefix on extension modules built from top level. - my $base_path = Cwd::abs_path($FindBin::Bin); - unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) { - delete $args{prefix}; - } - - return $args{_self} if $args{_self}; - - $args{dispatch} ||= 'Admin'; - $args{prefix} ||= 'inc'; - $args{author} ||= ($^O eq 'VMS' ? '_author' : '.author'); - $args{bundle} ||= 'inc/BUNDLES'; - $args{base} ||= $base_path; - $class =~ s/^\Q$args{prefix}\E:://; - $args{name} ||= $class; - $args{version} ||= $class->VERSION; - unless ( $args{path} ) { - $args{path} = $args{name}; - $args{path} =~ s!::!/!g; - } - $args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm"; + # ignore the prefix on extension modules built from top level. + my $base_path = Cwd::abs_path($FindBin::Bin); + unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) { + delete $args{prefix}; + } + + return $args{_self} if $args{_self}; + + $args{dispatch} ||= 'Admin'; + $args{prefix} ||= 'inc'; + $args{author} ||= ($^O eq 'VMS' ? '_author' : '.author'); + $args{bundle} ||= 'inc/BUNDLES'; + $args{base} ||= $base_path; + $class =~ s/^\Q$args{prefix}\E:://; + $args{name} ||= $class; + $args{version} ||= $class->VERSION; + unless ( $args{path} ) { + $args{path} = $args{name}; + $args{path} =~ s!::!/!g; + } + $args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm"; + $args{wrote} = 0; - bless( \%args, $class ); + bless( \%args, $class ); } sub call { @@ -184,98 +224,130 @@ } sub load { - my ($self, $method) = @_; - - $self->load_extensions( - "$self->{prefix}/$self->{path}", $self - ) unless $self->{extensions}; + my ($self, $method) = @_; - foreach my $obj (@{$self->{extensions}}) { - return $obj if $obj->can($method); - } + $self->load_extensions( + "$self->{prefix}/$self->{path}", $self + ) unless $self->{extensions}; + + foreach my $obj (@{$self->{extensions}}) { + return $obj if $obj->can($method); + } - my $admin = $self->{admin} or die <<"END_DIE"; + my $admin = $self->{admin} or die <<"END_DIE"; The '$method' method does not exist in the '$self->{prefix}' path! Please remove the '$self->{prefix}' directory and run $0 again to load it. END_DIE - my $obj = $admin->load($method, 1); - push @{$self->{extensions}}, $obj; + my $obj = $admin->load($method, 1); + push @{$self->{extensions}}, $obj; - $obj; + $obj; } sub load_extensions { - my ($self, $path, $top) = @_; + my ($self, $path, $top) = @_; - unless ( grep { lc $_ eq lc $self->{prefix} } @INC ) { - unshift @INC, $self->{prefix}; - } - - foreach my $rv ( $self->find_extensions($path) ) { - my ($file, $pkg) = @{$rv}; - next if $self->{pathnames}{$pkg}; - - local $@; - my $new = eval { require $file; $pkg->can('new') }; - unless ( $new ) { - warn $@ if $@; - next; - } - $self->{pathnames}{$pkg} = delete $INC{$file}; - push @{$self->{extensions}}, &{$new}($pkg, _top => $top ); - } + unless ( grep { lc $_ eq lc $self->{prefix} } @INC ) { + unshift @INC, $self->{prefix}; + } + + foreach my $rv ( $self->find_extensions($path) ) { + my ($file, $pkg) = @{$rv}; + next if $self->{pathnames}{$pkg}; + + local $@; + my $new = eval { require $file; $pkg->can('new') }; + unless ( $new ) { + warn $@ if $@; + next; + } + $self->{pathnames}{$pkg} = delete $INC{$file}; + push @{$self->{extensions}}, &{$new}($pkg, _top => $top ); + } - $self->{extensions} ||= []; + $self->{extensions} ||= []; } sub find_extensions { - my ($self, $path) = @_; + my ($self, $path) = @_; + + my @found; + File::Find::find( sub { + my $file = $File::Find::name; + return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is; + my $subpath = $1; + return if lc($subpath) eq lc($self->{dispatch}); + + $file = "$self->{path}/$subpath.pm"; + my $pkg = "$self->{name}::$subpath"; + $pkg =~ s!/!::!g; - my @found; - File::Find::find( sub { - my $file = $File::Find::name; - return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is; - my $subpath = $1; - return if lc($subpath) eq lc($self->{dispatch}); - - $file = "$self->{path}/$subpath.pm"; - my $pkg = "$self->{name}::$subpath"; - $pkg =~ s!/!::!g; - - # If we have a mixed-case package name, assume case has been preserved - # correctly. Otherwise, root through the file to locate the case-preserved - # version of the package name. - if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) { - open PKGFILE, "<$subpath.pm" or die "find_extensions: Can't open $subpath.pm: $!"; - my $in_pod = 0; - while ( ) { - $in_pod = 1 if /^=\w/; - $in_pod = 0 if /^=cut/; - next if ($in_pod || /^=cut/); # skip pod text - next if /^\s*#/; # and comments - if ( m/^\s*package\s+($pkg)\s*;/i ) { - $pkg = $1; - last; - } - } - close PKGFILE; - } + # If we have a mixed-case package name, assume case has been preserved + # correctly. Otherwise, root through the file to locate the case-preserved + # version of the package name. + if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) { + my $content = Module::Install::_read($subpath . '.pm'); + my $in_pod = 0; + foreach ( split //, $content ) { + $in_pod = 1 if /^=\w/; + $in_pod = 0 if /^=cut/; + next if ($in_pod || /^=cut/); # skip pod text + next if /^\s*#/; # and comments + if ( m/^\s*package\s+($pkg)\s*;/i ) { + $pkg = $1; + last; + } + } + } - push @found, [ $file, $pkg ]; - }, $path ) if -d $path; + push @found, [ $file, $pkg ]; + }, $path ) if -d $path; - @found; + @found; } + + + + +##################################################################### +# Utility Functions + sub _caller { - my $depth = 0; - my $call = caller($depth); - while ( $call eq __PACKAGE__ ) { - $depth++; - $call = caller($depth); - } - return $call; + my $depth = 0; + my $call = caller($depth); + while ( $call eq __PACKAGE__ ) { + $depth++; + $call = caller($depth); + } + return $call; +} + +sub _read { + local *FH; + open FH, "< $_[0]" or die "open($_[0]): $!"; + my $str = do { local $/; }; + close FH or die "close($_[0]): $!"; + return $str; +} + +sub _write { + local *FH; + open FH, "> $_[0]" or die "open($_[0]): $!"; + foreach ( 1 .. $#_ ) { print FH $_[$_] or die "print($_[0]): $!" } + close FH or die "close($_[0]): $!"; +} + +sub _version { + my $s = shift || 0; + $s =~ s/^(\d+)\.?//; + my $l = $1 || 0; + my @v = map { $_ . '0' x (3 - length $_) } $s =~ /(\d{1,3})\D?/g; + $l = $l . '.' . join '', @v if @v; + return $l + 0; } 1; + +# Copyright 2008 Adam Kennedy. From kawas at dev.open-bio.org Wed May 7 13:21:29 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 May 2008 13:21:29 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805071721.m47HLTnF009126@dev.open-bio.org> kawas Wed May 7 13:21:29 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install In directory dev.open-bio.org:/tmp/cvs-serv9036/Perl/MOSES-MOBY/inc/Module/Install Modified Files: Include.pm AutoInstall.pm Base.pm Makefile.pm Fetch.pm WriteAll.pm Can.pm Share.pm Win32.pm Metadata.pm Removed Files: Scripts.pm Log Message: updated the Module::Install libraries to version 0.72 moby-live/Perl/MOSES-MOBY/inc/Module/Install Include.pm,1.3,1.4 AutoInstall.pm,1.3,1.4 Base.pm,1.3,1.4 Makefile.pm,1.3,1.4 Fetch.pm,1.3,1.4 WriteAll.pm,1.3,1.4 Can.pm,1.3,1.4 Share.pm,1.3,1.4 Win32.pm,1.3,1.4 Metadata.pm,1.3,1.4 Scripts.pm,1.3,NONE =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Include.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Include.pm 2008/02/21 00:12:55 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Include.pm 2008/05/07 17:21:29 1.4 @@ -6,7 +6,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/AutoInstall.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/AutoInstall.pm 2008/02/21 00:12:55 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/AutoInstall.pm 2008/05/07 17:21:29 1.4 @@ -6,7 +6,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Base.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Base.pm 2008/02/21 00:12:55 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Base.pm 2008/05/07 17:21:29 1.4 @@ -1,7 +1,7 @@ #line 1 package Module::Install::Base; -$VERSION = '0.67'; +$VERSION = '0.72'; # Suspend handler for "redefined" warnings BEGIN { =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Makefile.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Makefile.pm 2008/02/21 00:12:55 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Makefile.pm 2008/05/07 17:21:29 1.4 @@ -7,7 +7,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } @@ -37,7 +37,7 @@ sub makemaker_args { my $self = shift; my $args = ($self->{makemaker_args} ||= {}); - %$args = ( %$args, @_ ) if @_; + %$args = ( %$args, @_ ) if @_; $args; } @@ -63,18 +63,18 @@ sub clean_files { my $self = shift; my $clean = $self->makemaker_args->{clean} ||= {}; - %$clean = ( + %$clean = ( %$clean, - FILES => join(' ', grep length, $clean->{FILES}, @_), + FILES => join ' ', grep { length $_ } ($clean->{FILES} || (), @_), ); } sub realclean_files { - my $self = shift; + my $self = shift; my $realclean = $self->makemaker_args->{realclean} ||= {}; - %$realclean = ( + %$realclean = ( %$realclean, - FILES => join(' ', grep length, $realclean->{FILES}, @_), + FILES => join ' ', grep { length $_ } ($realclean->{FILES} || (), @_), ); } @@ -104,8 +104,8 @@ unless ( -d $dir ) { die "tests_recursive dir '$dir' does not exist"; } - require File::Find; %test_dir = (); + require File::Find; File::Find::find( \&_wanted_t, $dir ); $self->tests( join ' ', map { "$_/*.t" } sort keys %test_dir ); } @@ -114,10 +114,15 @@ my $self = shift; die "&Makefile->write() takes no arguments\n" if @_; + # Make sure we have a new enough + require ExtUtils::MakeMaker; + $self->configure_requires( 'ExtUtils::MakeMaker' => $ExtUtils::MakeMaker::VERSION ); + + # Generate the my $args = $self->makemaker_args; $args->{DISTNAME} = $self->name; - $args->{NAME} = $self->module_name || $self->name || $self->determine_NAME($args); - $args->{VERSION} = $self->version || $self->determine_VERSION($args); + $args->{NAME} = $self->module_name || $self->name; + $args->{VERSION} = $self->version; $args->{NAME} =~ s/-/::/g; if ( $self->tests ) { $args->{test} = { TESTS => $self->tests }; @@ -142,9 +147,12 @@ map { @$_ } map { @$_ } grep $_, - ($self->build_requires, $self->requires) + ($self->configure_requires, $self->build_requires, $self->requires) ); + # Remove any reference to perl, PREREQ_PM doesn't support it + delete $args->{PREREQ_PM}->{perl}; + # merge both kinds of requires into prereq_pm my $subdirs = ($args->{DIR} ||= []); if ($self->bundles) { @@ -205,7 +213,7 @@ #$makefile =~ s/^PERL_ARCHLIB = .+/PERL_ARCHLIB =/m; # Perl 5.005 mentions PERL_LIB explicitly, so we have to remove that as well. - $makefile =~ s/("?)-I\$\(PERL_LIB\)\1//g; + $makefile =~ s/(\"?)-I\$\(PERL_LIB\)\1//g; # XXX - This is currently unused; not sure if it breaks other MM-users # $makefile =~ s/^pm_to_blib\s+:\s+/pm_to_blib :: /mg; @@ -234,4 +242,4 @@ __END__ -#line 363 +#line 371 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Fetch.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Fetch.pm 2008/02/21 00:12:55 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Fetch.pm 2008/05/07 17:21:29 1.4 @@ -6,7 +6,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/WriteAll.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/WriteAll.pm 2008/02/21 00:12:55 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/WriteAll.pm 2008/05/07 17:21:29 1.4 @@ -4,40 +4,37 @@ use strict; use Module::Install::Base; -use vars qw{$VERSION $ISCORE @ISA}; +use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '0.67'; - $ISCORE = 1; + $VERSION = '0.72'; @ISA = qw{Module::Install::Base}; + $ISCORE = 1; } sub WriteAll { - my $self = shift; - my %args = ( - meta => 1, - sign => 0, - inline => 0, - check_nmake => 1, - @_ - ); - - $self->sign(1) if $args{sign}; - $self->Meta->write if $args{meta}; - $self->admin->WriteAll(%args) if $self->is_admin; - - if ( $0 =~ /Build.PL$/i ) { - $self->Build->write; - } else { - $self->check_nmake if $args{check_nmake}; - unless ( $self->makemaker_args->{'PL_FILES'} ) { - $self->makemaker_args( PL_FILES => {} ); - } - if ($args{inline}) { - $self->Inline->write; - } else { - $self->Makefile->write; - } - } + my $self = shift; + my %args = ( + meta => 1, + sign => 0, + inline => 0, + check_nmake => 1, + @_, + ); + + $self->sign(1) if $args{sign}; + $self->Meta->write if $args{meta}; + $self->admin->WriteAll(%args) if $self->is_admin; + + $self->check_nmake if $args{check_nmake}; + unless ( $self->makemaker_args->{PL_FILES} ) { + $self->makemaker_args( PL_FILES => {} ); + } + + if ( $args{inline} ) { + $self->Inline->write; + } else { + $self->Makefile->write; + } } 1; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Can.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Can.pm 2008/02/21 00:12:55 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Can.pm 2008/05/07 17:21:29 1.4 @@ -11,7 +11,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Share.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Share.pm 2008/02/21 00:12:55 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Share.pm 2008/05/07 17:21:29 1.4 @@ -6,7 +6,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } @@ -31,10 +31,13 @@ # So when we need to install a share directory, make sure we add a # dependency on a moderately new version of ExtUtils::MakeMaker. $self->build_requires( 'ExtUtils::MakeMaker' => '6.11' ); + + # 99% of the time we don't want to index a shared dir + $self->no_index( directory => $dir ); } 1; __END__ -#line 98 +#line 101 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Win32.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Win32.pm 2008/02/21 00:12:55 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Win32.pm 2008/05/07 17:21:29 1.4 @@ -4,11 +4,11 @@ use strict; use Module::Install::Base; -use vars qw{$VERSION $ISCORE @ISA}; +use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '0.67'; - $ISCORE = 1; + $VERSION = '0.72'; @ISA = qw{Module::Install::Base}; + $ISCORE = 1; } # determine if the user needs nmake, and download it if needed @@ -16,7 +16,7 @@ my $self = shift; $self->load('can_run'); $self->load('get_file'); - + require Config; return unless ( $^O eq 'MSWin32' and @@ -38,8 +38,7 @@ remove => 1, ); - if (!$rv) { - die <<'END_MESSAGE'; + die <<'END_MESSAGE' unless $rv; ------------------------------------------------------------------------------- @@ -59,7 +58,7 @@ ------------------------------------------------------------------------------- END_MESSAGE - } + } 1; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Metadata.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Metadata.pm 2008/02/21 00:12:55 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Metadata.pm 2008/05/07 17:21:29 1.4 @@ -6,18 +6,30 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } my @scalar_keys = qw{ - name module_name abstract author version license - distribution_type perl_version tests installdirs + name + module_name + abstract + author + version + license + distribution_type + perl_version + tests + installdirs }; my @tuple_keys = qw{ - build_requires requires recommends bundles + configure_requires + build_requires + requires + recommends + bundles }; sub Meta { shift } @@ -25,44 +37,68 @@ sub Meta_TupleKeys { @tuple_keys } foreach my $key (@scalar_keys) { - *$key = sub { - my $self = shift; - return $self->{values}{$key} if defined wantarray and !@_; - $self->{values}{$key} = shift; - return $self; - }; -} - -foreach my $key (@tuple_keys) { - *$key = sub { - my $self = shift; - return $self->{values}{$key} unless @_; - - my @rv; - while (@_) { - my $module = shift or last; - my $version = shift || 0; - if ( $module eq 'perl' ) { - $version =~ s{^(\d+)\.(\d+)\.(\d+)} - {$1 + $2/1_000 + $3/1_000_000}e; - $self->perl_version($version); - next; - } - my $rv = [ $module, $version ]; - push @rv, $rv; - } - push @{ $self->{values}{$key} }, @rv; - @rv; - }; + *$key = sub { + my $self = shift; + return $self->{values}{$key} if defined wantarray and !@_; + $self->{values}{$key} = shift; + return $self; + }; +} + +sub requires { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{requires} }, [ $module, $version ]; + } + $self->{values}{requires}; +} + +sub build_requires { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{build_requires} }, [ $module, $version ]; + } + $self->{values}{build_requires}; +} + +sub configure_requires { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{configure_requires} }, [ $module, $version ]; + } + $self->{values}{configure_requires}; +} + +sub recommends { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{recommends} }, [ $module, $version ]; + } + $self->{values}{recommends}; } -# configure_requires is currently a null-op -sub configure_requires { 1 } +sub bundles { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{bundles} }, [ $module, $version ]; + } + $self->{values}{bundles}; +} # Aliases for build_requires that will have alternative # meanings in some future version of META.yml. -sub test_requires { shift->build_requires(@_) } -sub install_requires { shift->build_requires(@_) } +sub test_requires { shift->build_requires(@_) } +sub install_requires { shift->build_requires(@_) } # Aliases for installdirs options sub install_as_core { $_[0]->installdirs('perl') } @@ -71,10 +107,10 @@ sub install_as_vendor { $_[0]->installdirs('vendor') } sub sign { - my $self = shift; - return $self->{'values'}{'sign'} if defined wantarray and ! @_; - $self->{'values'}{'sign'} = ( @_ ? $_[0] : 1 ); - return $self; + my $self = shift; + return $self->{'values'}{'sign'} if defined wantarray and ! @_; + $self->{'values'}{'sign'} = ( @_ ? $_[0] : 1 ); + return $self; } sub dynamic_config { @@ -83,254 +119,268 @@ warn "You MUST provide an explicit true/false value to dynamic_config, skipping\n"; return $self; } - $self->{'values'}{'dynamic_config'} = $_[0] ? 1 : 0; + $self->{values}{dynamic_config} = $_[0] ? 1 : 0; return $self; } sub all_from { - my ( $self, $file ) = @_; + my ( $self, $file ) = @_; + + unless ( defined($file) ) { + my $name = $self->name + or die "all_from called with no args without setting name() first"; + $file = join('/', 'lib', split(/-/, $name)) . '.pm'; + $file =~ s{.*/}{} unless -e $file; + die "all_from: cannot find $file from $name" unless -e $file; + } + + # Some methods pull from POD instead of code. + # If there is a matching .pod, use that instead + my $pod = $file; + $pod =~ s/\.pm$/.pod/i; + $pod = $file unless -e $pod; + + # Pull the different values + $self->name_from($file) unless $self->name; + $self->version_from($file) unless $self->version; + $self->perl_version_from($file) unless $self->perl_version; + $self->author_from($pod) unless $self->author; + $self->license_from($pod) unless $self->license; + $self->abstract_from($pod) unless $self->abstract; - unless ( defined($file) ) { - my $name = $self->name - or die "all_from called with no args without setting name() first"; - $file = join('/', 'lib', split(/-/, $name)) . '.pm'; - $file =~ s{.*/}{} unless -e $file; - die "all_from: cannot find $file from $name" unless -e $file; - } - - $self->version_from($file) unless $self->version; - $self->perl_version_from($file) unless $self->perl_version; - - # The remaining probes read from POD sections; if the file - # has an accompanying .pod, use that instead - my $pod = $file; - if ( $pod =~ s/\.pm$/.pod/i and -e $pod ) { - $file = $pod; - } - - $self->author_from($file) unless $self->author; - $self->license_from($file) unless $self->license; - $self->abstract_from($file) unless $self->abstract; + return 1; } sub provides { - my $self = shift; - my $provides = ( $self->{values}{provides} ||= {} ); - %$provides = (%$provides, @_) if @_; - return $provides; + my $self = shift; + my $provides = ( $self->{values}{provides} ||= {} ); + %$provides = (%$provides, @_) if @_; + return $provides; } sub auto_provides { - my $self = shift; - return $self unless $self->is_admin; - - unless (-e 'MANIFEST') { - warn "Cannot deduce auto_provides without a MANIFEST, skipping\n"; - return $self; - } - - # Avoid spurious warnings as we are not checking manifest here. - - local $SIG{__WARN__} = sub {1}; - require ExtUtils::Manifest; - local *ExtUtils::Manifest::manicheck = sub { return }; - - require Module::Build; - my $build = Module::Build->new( - dist_name => $self->name, - dist_version => $self->version, - license => $self->license, - ); - $self->provides(%{ $build->find_dist_packages || {} }); + my $self = shift; + return $self unless $self->is_admin; + unless (-e 'MANIFEST') { + warn "Cannot deduce auto_provides without a MANIFEST, skipping\n"; + return $self; + } + # Avoid spurious warnings as we are not checking manifest here. + local $SIG{__WARN__} = sub {1}; + require ExtUtils::Manifest; + local *ExtUtils::Manifest::manicheck = sub { return }; + + require Module::Build; + my $build = Module::Build->new( + dist_name => $self->name, + dist_version => $self->version, + license => $self->license, + ); + $self->provides( %{ $build->find_dist_packages || {} } ); } sub feature { - my $self = shift; - my $name = shift; - my $features = ( $self->{values}{features} ||= [] ); - - my $mods; - - if ( @_ == 1 and ref( $_[0] ) ) { - # The user used ->feature like ->features by passing in the second - # argument as a reference. Accomodate for that. - $mods = $_[0]; - } else { - $mods = \@_; - } - - my $count = 0; - push @$features, ( - $name => [ - map { - ref($_) ? ( ref($_) eq 'HASH' ) ? %$_ - : @$_ - : $_ - } @$mods - ] - ); + my $self = shift; + my $name = shift; + my $features = ( $self->{values}{features} ||= [] ); + my $mods; + + if ( @_ == 1 and ref( $_[0] ) ) { + # The user used ->feature like ->features by passing in the second + # argument as a reference. Accomodate for that. + $mods = $_[0]; + } else { + $mods = \@_; + } - return @$features; + my $count = 0; + push @$features, ( + $name => [ + map { + ref($_) ? ( ref($_) eq 'HASH' ) ? %$_ : @$_ : $_ + } @$mods + ] + ); + + return @$features; } sub features { - my $self = shift; - while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) { - $self->feature( $name, @$mods ); - } - return $self->{values}->{features} - ? @{ $self->{values}->{features} } - : (); + my $self = shift; + while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) { + $self->feature( $name, @$mods ); + } + return $self->{values}->{features} + ? @{ $self->{values}->{features} } + : (); } sub no_index { - my $self = shift; - my $type = shift; - push @{ $self->{values}{no_index}{$type} }, @_ if $type; - return $self->{values}{no_index}; + my $self = shift; + my $type = shift; + push @{ $self->{values}{no_index}{$type} }, @_ if $type; + return $self->{values}{no_index}; } sub read { - my $self = shift; - $self->include_deps( 'YAML', 0 ); + my $self = shift; + $self->include_deps( 'YAML::Tiny', 0 ); - require YAML; - my $data = YAML::LoadFile('META.yml'); + require YAML::Tiny; + my $data = YAML::Tiny::LoadFile('META.yml'); - # Call methods explicitly in case user has already set some values. - while ( my ( $key, $value ) = each %$data ) { - next unless $self->can($key); - if ( ref $value eq 'HASH' ) { - while ( my ( $module, $version ) = each %$value ) { - $self->can($key)->($self, $module => $version ); - } - } - else { - $self->can($key)->($self, $value); - } - } - return $self; + # Call methods explicitly in case user has already set some values. + while ( my ( $key, $value ) = each %$data ) { + next unless $self->can($key); + if ( ref $value eq 'HASH' ) { + while ( my ( $module, $version ) = each %$value ) { + $self->can($key)->($self, $module => $version ); + } + } else { + $self->can($key)->($self, $value); + } + } + return $self; } sub write { - my $self = shift; - return $self unless $self->is_admin; - $self->admin->write_meta; - return $self; + my $self = shift; + return $self unless $self->is_admin; + $self->admin->write_meta; + return $self; } sub version_from { - my ( $self, $file ) = @_; - require ExtUtils::MM_Unix; - $self->version( ExtUtils::MM_Unix->parse_version($file) ); + require ExtUtils::MM_Unix; + my ( $self, $file ) = @_; + $self->version( ExtUtils::MM_Unix->parse_version($file) ); } sub abstract_from { - my ( $self, $file ) = @_; - require ExtUtils::MM_Unix; - $self->abstract( - bless( - { DISTNAME => $self->name }, - 'ExtUtils::MM_Unix' - )->parse_abstract($file) - ); -} - -sub _slurp { - my ( $self, $file ) = @_; - - local *FH; - open FH, "< $file" or die "Cannot open $file.pod: $!"; - do { local $/; }; + require ExtUtils::MM_Unix; + my ( $self, $file ) = @_; + $self->abstract( + bless( + { DISTNAME => $self->name }, + 'ExtUtils::MM_Unix' + )->parse_abstract($file) + ); } -sub perl_version_from { - my ( $self, $file ) = @_; +sub name_from { + my $self = shift; + if ( + Module::Install::_read($_[0]) =~ m/ + ^ \s* + package \s* + ([\w:]+) + \s* ; + /ixms + ) { + my $name = $1; + $name =~ s{::}{-}g; + $self->name($name); + } else { + die "Cannot determine name from $_[0]\n"; + return; + } +} - if ( - $self->_slurp($file) =~ m/ - ^ - use \s* - v? - ([\d_\.]+) - \s* ; - /ixms - ) - { - my $v = $1; - $v =~ s{_}{}g; - $self->perl_version($1); - } - else { - warn "Cannot determine perl version info from $file\n"; - return; - } +sub perl_version_from { + my $self = shift; + if ( + Module::Install::_read($_[0]) =~ m/ + ^ + use \s* + v? + ([\d_\.]+) + \s* ; + /ixms + ) { + my $perl_version = $1; + $perl_version =~ s{_}{}g; + $self->perl_version($perl_version); + } else { + warn "Cannot determine perl version info from $_[0]\n"; + return; + } } sub author_from { - my ( $self, $file ) = @_; - my $content = $self->_slurp($file); - if ($content =~ m/ - =head \d \s+ (?:authors?)\b \s* - ([^\n]*) - | - =head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b \s* - .*? copyright .*? \d\d\d[\d.]+ \s* (?:\bby\b)? \s* - ([^\n]*) - /ixms) { - my $author = $1 || $2; - $author =~ s{E}{<}g; - $author =~ s{E}{>}g; - $self->author($author); - } - else { - warn "Cannot determine author info from $file\n"; - } + my $self = shift; + my $content = Module::Install::_read($_[0]); + if ($content =~ m/ + =head \d \s+ (?:authors?)\b \s* + ([^\n]*) + | + =head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b \s* + .*? copyright .*? \d\d\d[\d.]+ \s* (?:\bby\b)? \s* + ([^\n]*) + /ixms) { + my $author = $1 || $2; + $author =~ s{E}{<}g; + $author =~ s{E}{>}g; + $self->author($author); + } else { + warn "Cannot determine author info from $_[0]\n"; + } } sub license_from { - my ( $self, $file ) = @_; - - if ( - $self->_slurp($file) =~ m/ - ( - =head \d \s+ - (?:licen[cs]e|licensing|copyright|legal)\b - .*? - ) - (=head\\d.*|=cut.*|) - \z - /ixms - ) - { - my $license_text = $1; - my @phrases = ( - 'under the same (?:terms|license) as perl itself' => 'perl', 1, - 'GNU public license' => 'gpl', 1, - 'GNU lesser public license' => 'gpl', 1, - 'BSD license' => 'bsd', 1, - 'Artistic license' => 'artistic', 1, - 'GPL' => 'gpl', 1, - 'LGPL' => 'lgpl', 1, - 'BSD' => 'bsd', 1, - 'Artistic' => 'artistic', 1, - 'MIT' => 'mit', 1, - 'proprietary' => 'proprietary', 0, - ); - while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) { - $pattern =~ s{\s+}{\\s+}g; - if ( $license_text =~ /\b$pattern\b/i ) { - if ( $osi and $license_text =~ /All rights reserved/i ) { - warn "LEGAL WARNING: 'All rights reserved' may invalidate Open Source licenses. Consider removing it."; + my $self = shift; + if ( + Module::Install::_read($_[0]) =~ m/ + ( + =head \d \s+ + (?:licen[cs]e|licensing|copyright|legal)\b + .*? + ) + (=head\\d.*|=cut.*|) + \z + /ixms ) { + my $license_text = $1; + my @phrases = ( + 'under the same (?:terms|license) as perl itself' => 'perl', 1, + 'GNU public license' => 'gpl', 1, + 'GNU lesser public license' => 'lgpl', 1, + 'BSD license' => 'bsd', 1, + 'Artistic license' => 'artistic', 1, + 'GPL' => 'gpl', 1, + 'LGPL' => 'lgpl', 1, + 'BSD' => 'bsd', 1, + 'Artistic' => 'artistic', 1, + 'MIT' => 'mit', 1, + 'proprietary' => 'proprietary', 0, + ); + while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) { + $pattern =~ s{\s+}{\\s+}g; + if ( $license_text =~ /\b$pattern\b/i ) { + if ( $osi and $license_text =~ /All rights reserved/i ) { + warn "LEGAL WARNING: 'All rights reserved' may invalidate Open Source licenses. Consider removing it."; + } + $self->license($license); + return 1; + } } - $self->license($license); - return 1; - } - } - } + } + + warn "Cannot determine license info from $_[0]\n"; + return 'unknown'; +} - warn "Cannot determine license info from $file\n"; - return 'unknown'; +sub install_script { + my $self = shift; + my $args = $self->makemaker_args; + my $exe = $args->{EXE_FILES} ||= []; + foreach ( @_ ) { + if ( -f $_ ) { + push @$exe, $_; + } elsif ( -d 'script' and -f "script/$_" ) { + push @$exe, "script/$_"; + } else { + die "Cannot find script '$_'"; + } + } } 1; rcsdiff: /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/RCS/Scripts.pm,v: No such file or directory From kawas at dev.open-bio.org Wed May 7 13:22:12 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 May 2008 13:22:12 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805071722.m47HMCZi009188@dev.open-bio.org> kawas Wed May 7 13:22:12 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY In directory dev.open-bio.org:/tmp/cvs-serv9153/Perl/MOSES-MOBY Modified Files: Makefile.PL Log Message: updated the makefile to require the exact version of IO::Prompt necessary. moby-live/Perl/MOSES-MOBY Makefile.PL,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/Makefile.PL,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/Makefile.PL 2008/02/21 00:12:55 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/Makefile.PL 2008/05/07 17:22:12 1.4 @@ -3,7 +3,7 @@ # Define metadata name 'MOSES-MOBY'; - version '0.84'; + version '0.85'; license 'perl'; abstract 'This distribution aids in the creation of BioMOBY perl based web services.'; @@ -11,6 +11,7 @@ # Specific dependencies requires 'Carp' => 0; + requires 'CGI' => 0; requires 'File::Spec' => 0.80; requires 'SOAP::Lite' => 0.69; requires 'XML::LibXML' => 1.62; @@ -25,8 +26,9 @@ requires 'Params::Util' => 0.28; # requires 'Want' => 0; - requires 'IO::Prompt' => 0.99; - + if ( not( $^O =~ /MSWin32|Windows_NT/i ) ) { + requires 'IO::Prompt' => '0.99.2'; + } build_requires 'Test::More' => '0.42'; no_index 'directory' => 'bin/scripts'; From kawas at dev.open-bio.org Wed May 7 13:26:15 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 May 2008 13:26:15 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805071726.m47HQFWP009282@dev.open-bio.org> kawas Wed May 7 13:26:15 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY In directory dev.open-bio.org:/tmp/cvs-serv9247/Perl/MOSES-MOBY Modified Files: META.yml Log Message: moby-live/Perl/MOSES-MOBY META.yml,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/META.yml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/META.yml 2008/04/29 20:10:06 1.4 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/META.yml 2008/05/07 17:26:15 1.5 @@ -1,10 +1,12 @@ --- abstract: 'This distribution aids in the creation of BioMOBY perl based web services.' +author: + - 'Edward Kawas (edward.kawas [at] gmail [dot] com)' build_requires: ExtUtils::MakeMaker: 6.11 Test::More: 0.42 distribution_type: module -generated_by: 'Module::Install version 0.67' +generated_by: 'Module::Install version 0.72' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.3.html @@ -13,21 +15,24 @@ no_index: directory: - bin/scripts + - share + - share - inc - t requires: Carp: 0 + Class::Inspector: 1.17 Config::Simple: 4.58 File::HomeDir: 0.65 File::ShareDir: 0.05 - File::Spec: 0.80 + File::Spec: 0.8 + IO::Prompt: 0.99.2 IO::Stringy: 2.11 Log::Log4perl: 1.12 + Params::Util: 0.28 SOAP::Lite: 0.69 Template: 1.11 Unicode::String: 2.09 XML::LibXML: 1.62 - IO::Prompt: 0.99 - Want: 0 - version: 0 version: 0.85 + From kawas at dev.open-bio.org Wed May 7 13:33:30 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 May 2008 13:33:30 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805071733.m47HXUcU009322@dev.open-bio.org> kawas Wed May 7 13:33:30 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY In directory dev.open-bio.org:/tmp/cvs-serv9287/Perl/MOSES-MOBY Modified Files: MANIFEST Log Message: moby-live/Perl/MOSES-MOBY MANIFEST,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/MANIFEST,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/MANIFEST 2008/04/29 20:07:50 1.4 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/MANIFEST 2008/05/07 17:33:30 1.5 @@ -1,6 +1,3 @@ -share/samples/Service/HelloBiomobyWorld.pm -share/samples/Service/Mabuhay.pm -share/samples/SERVICES_TABLE bin/scripts/moses-cache-tester.pl bin/scripts/moses-config-status.pl bin/scripts/moses-generate-datatypes.pl @@ -22,7 +19,6 @@ inc/Module/Install/Include.pm inc/Module/Install/Makefile.pm inc/Module/Install/Metadata.pm -inc/Module/Install/Scripts.pm inc/Module/Install/Share.pm inc/Module/Install/Win32.pm inc/Module/Install/WriteAll.pm @@ -58,14 +54,18 @@ lib/MOSES/MOBY/ServiceException.pm lib/MOSES/MOBY/Tags.pm Makefile.PL -MANIFEST This list of files +MANIFEST This list of files META.yml README share/log4perl.properties.template +share/mabuhay.file share/moby-services.cfg.template share/MobyServer.cgi.template -share/mabuhay.file -share/USER_REGISTRIES share/notes -t/MOSES-MOBY.t +share/samples/Service/HelloBiomobyWorld.pm +share/samples/Service/Mabuhay.pm +share/samples/SERVICES_TABLE +share/USER_REGISTRIES t/MOSES-MOBY-Cache.t +t/MOSES-MOBY-Registry.t +t/MOSES-MOBY.t \ No newline at end of file From kawas at dev.open-bio.org Wed May 7 13:50:57 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 May 2008 13:50:57 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805071750.m47Hovl7009383@dev.open-bio.org> kawas Wed May 7 13:50:57 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY In directory dev.open-bio.org:/tmp/cvs-serv9348/Perl/MOSES-MOBY Modified Files: Makefile.PL Log Message: moby-live/Perl/MOSES-MOBY Makefile.PL,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/Makefile.PL,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/Makefile.PL 2008/05/07 17:22:12 1.4 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/Makefile.PL 2008/05/07 17:50:57 1.5 @@ -27,6 +27,7 @@ # requires 'Want' => 0; if ( not( $^O =~ /MSWin32|Windows_NT/i ) ) { + requires 'Want' => '0.18'; requires 'IO::Prompt' => '0.99.2'; } build_requires 'Test::More' => '0.42'; From kawas at dev.open-bio.org Wed May 7 14:15:19 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 May 2008 14:15:19 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805071815.m47IFJ3m009598@dev.open-bio.org> kawas Wed May 7 14:15:19 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install In directory dev.open-bio.org:/tmp/cvs-serv9526/Perl/MOBY-Client/inc/Module/Install Modified Files: Metadata.pm AutoInstall.pm Share.pm Win32.pm Include.pm Base.pm WriteAll.pm Fetch.pm Can.pm Makefile.pm Removed Files: Scripts.pm Log Message: updated the Module::Install libraries to version 0.72 moby-live/Perl/MOBY-Client/inc/Module/Install Metadata.pm,1.1,1.2 AutoInstall.pm,1.1,1.2 Share.pm,1.1,1.2 Win32.pm,1.1,1.2 Include.pm,1.1,1.2 Base.pm,1.1,1.2 WriteAll.pm,1.1,1.2 Fetch.pm,1.1,1.2 Can.pm,1.1,1.2 Makefile.pm,1.1,1.2 Scripts.pm,1.1,NONE =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Metadata.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Metadata.pm 2008/02/21 00:14:33 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Metadata.pm 2008/05/07 18:15:19 1.2 @@ -6,18 +6,30 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.68'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } my @scalar_keys = qw{ - name module_name abstract author version license - distribution_type perl_version tests installdirs + name + module_name + abstract + author + version + license + distribution_type + perl_version + tests + installdirs }; my @tuple_keys = qw{ - build_requires requires recommends bundles + configure_requires + build_requires + requires + recommends + bundles }; sub Meta { shift } @@ -25,44 +37,68 @@ sub Meta_TupleKeys { @tuple_keys } foreach my $key (@scalar_keys) { - *$key = sub { - my $self = shift; - return $self->{values}{$key} if defined wantarray and !@_; - $self->{values}{$key} = shift; - return $self; - }; -} - -foreach my $key (@tuple_keys) { - *$key = sub { - my $self = shift; - return $self->{values}{$key} unless @_; - - my @rv; - while (@_) { - my $module = shift or last; - my $version = shift || 0; - if ( $module eq 'perl' ) { - $version =~ s{^(\d+)\.(\d+)\.(\d+)} - {$1 + $2/1_000 + $3/1_000_000}e; - $self->perl_version($version); - next; - } - my $rv = [ $module, $version ]; - push @rv, $rv; - } - push @{ $self->{values}{$key} }, @rv; - @rv; - }; + *$key = sub { + my $self = shift; + return $self->{values}{$key} if defined wantarray and !@_; + $self->{values}{$key} = shift; + return $self; + }; +} + +sub requires { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{requires} }, [ $module, $version ]; + } + $self->{values}{requires}; +} + +sub build_requires { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{build_requires} }, [ $module, $version ]; + } + $self->{values}{build_requires}; +} + +sub configure_requires { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{configure_requires} }, [ $module, $version ]; + } + $self->{values}{configure_requires}; +} + +sub recommends { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{recommends} }, [ $module, $version ]; + } + $self->{values}{recommends}; } -# configure_requires is currently a null-op -sub configure_requires { 1 } +sub bundles { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{bundles} }, [ $module, $version ]; + } + $self->{values}{bundles}; +} # Aliases for build_requires that will have alternative # meanings in some future version of META.yml. -sub test_requires { shift->build_requires(@_) } -sub install_requires { shift->build_requires(@_) } +sub test_requires { shift->build_requires(@_) } +sub install_requires { shift->build_requires(@_) } # Aliases for installdirs options sub install_as_core { $_[0]->installdirs('perl') } @@ -71,10 +107,10 @@ sub install_as_vendor { $_[0]->installdirs('vendor') } sub sign { - my $self = shift; - return $self->{'values'}{'sign'} if defined wantarray and ! @_; - $self->{'values'}{'sign'} = ( @_ ? $_[0] : 1 ); - return $self; + my $self = shift; + return $self->{'values'}{'sign'} if defined wantarray and ! @_; + $self->{'values'}{'sign'} = ( @_ ? $_[0] : 1 ); + return $self; } sub dynamic_config { @@ -83,254 +119,268 @@ warn "You MUST provide an explicit true/false value to dynamic_config, skipping\n"; return $self; } - $self->{'values'}{'dynamic_config'} = $_[0] ? 1 : 0; + $self->{values}{dynamic_config} = $_[0] ? 1 : 0; return $self; } sub all_from { - my ( $self, $file ) = @_; + my ( $self, $file ) = @_; + + unless ( defined($file) ) { + my $name = $self->name + or die "all_from called with no args without setting name() first"; + $file = join('/', 'lib', split(/-/, $name)) . '.pm'; + $file =~ s{.*/}{} unless -e $file; + die "all_from: cannot find $file from $name" unless -e $file; + } + + # Some methods pull from POD instead of code. + # If there is a matching .pod, use that instead + my $pod = $file; + $pod =~ s/\.pm$/.pod/i; + $pod = $file unless -e $pod; + + # Pull the different values + $self->name_from($file) unless $self->name; + $self->version_from($file) unless $self->version; + $self->perl_version_from($file) unless $self->perl_version; + $self->author_from($pod) unless $self->author; + $self->license_from($pod) unless $self->license; + $self->abstract_from($pod) unless $self->abstract; - unless ( defined($file) ) { - my $name = $self->name - or die "all_from called with no args without setting name() first"; - $file = join('/', 'lib', split(/-/, $name)) . '.pm'; - $file =~ s{.*/}{} unless -e $file; - die "all_from: cannot find $file from $name" unless -e $file; - } - - $self->version_from($file) unless $self->version; - $self->perl_version_from($file) unless $self->perl_version; - - # The remaining probes read from POD sections; if the file - # has an accompanying .pod, use that instead - my $pod = $file; - if ( $pod =~ s/\.pm$/.pod/i and -e $pod ) { - $file = $pod; - } - - $self->author_from($file) unless $self->author; - $self->license_from($file) unless $self->license; - $self->abstract_from($file) unless $self->abstract; + return 1; } sub provides { - my $self = shift; - my $provides = ( $self->{values}{provides} ||= {} ); - %$provides = (%$provides, @_) if @_; - return $provides; + my $self = shift; + my $provides = ( $self->{values}{provides} ||= {} ); + %$provides = (%$provides, @_) if @_; + return $provides; } sub auto_provides { - my $self = shift; - return $self unless $self->is_admin; - - unless (-e 'MANIFEST') { - warn "Cannot deduce auto_provides without a MANIFEST, skipping\n"; - return $self; - } - - # Avoid spurious warnings as we are not checking manifest here. - - local $SIG{__WARN__} = sub {1}; - require ExtUtils::Manifest; - local *ExtUtils::Manifest::manicheck = sub { return }; - - require Module::Build; - my $build = Module::Build->new( - dist_name => $self->name, - dist_version => $self->version, - license => $self->license, - ); - $self->provides(%{ $build->find_dist_packages || {} }); + my $self = shift; + return $self unless $self->is_admin; + unless (-e 'MANIFEST') { + warn "Cannot deduce auto_provides without a MANIFEST, skipping\n"; + return $self; + } + # Avoid spurious warnings as we are not checking manifest here. + local $SIG{__WARN__} = sub {1}; + require ExtUtils::Manifest; + local *ExtUtils::Manifest::manicheck = sub { return }; + + require Module::Build; + my $build = Module::Build->new( + dist_name => $self->name, + dist_version => $self->version, + license => $self->license, + ); + $self->provides( %{ $build->find_dist_packages || {} } ); } sub feature { - my $self = shift; - my $name = shift; - my $features = ( $self->{values}{features} ||= [] ); - - my $mods; - - if ( @_ == 1 and ref( $_[0] ) ) { - # The user used ->feature like ->features by passing in the second - # argument as a reference. Accomodate for that. - $mods = $_[0]; - } else { - $mods = \@_; - } - - my $count = 0; - push @$features, ( - $name => [ - map { - ref($_) ? ( ref($_) eq 'HASH' ) ? %$_ - : @$_ - : $_ - } @$mods - ] - ); + my $self = shift; + my $name = shift; + my $features = ( $self->{values}{features} ||= [] ); + my $mods; + + if ( @_ == 1 and ref( $_[0] ) ) { + # The user used ->feature like ->features by passing in the second + # argument as a reference. Accomodate for that. + $mods = $_[0]; + } else { + $mods = \@_; + } - return @$features; + my $count = 0; + push @$features, ( + $name => [ + map { + ref($_) ? ( ref($_) eq 'HASH' ) ? %$_ : @$_ : $_ + } @$mods + ] + ); + + return @$features; } sub features { - my $self = shift; - while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) { - $self->feature( $name, @$mods ); - } - return $self->{values}->{features} - ? @{ $self->{values}->{features} } - : (); + my $self = shift; + while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) { + $self->feature( $name, @$mods ); + } + return $self->{values}->{features} + ? @{ $self->{values}->{features} } + : (); } sub no_index { - my $self = shift; - my $type = shift; - push @{ $self->{values}{no_index}{$type} }, @_ if $type; - return $self->{values}{no_index}; + my $self = shift; + my $type = shift; + push @{ $self->{values}{no_index}{$type} }, @_ if $type; + return $self->{values}{no_index}; } sub read { - my $self = shift; - $self->include_deps( 'YAML', 0 ); + my $self = shift; + $self->include_deps( 'YAML::Tiny', 0 ); - require YAML; - my $data = YAML::LoadFile('META.yml'); + require YAML::Tiny; + my $data = YAML::Tiny::LoadFile('META.yml'); - # Call methods explicitly in case user has already set some values. - while ( my ( $key, $value ) = each %$data ) { - next unless $self->can($key); - if ( ref $value eq 'HASH' ) { - while ( my ( $module, $version ) = each %$value ) { - $self->can($key)->($self, $module => $version ); - } - } - else { - $self->can($key)->($self, $value); - } - } - return $self; + # Call methods explicitly in case user has already set some values. + while ( my ( $key, $value ) = each %$data ) { + next unless $self->can($key); + if ( ref $value eq 'HASH' ) { + while ( my ( $module, $version ) = each %$value ) { + $self->can($key)->($self, $module => $version ); + } + } else { + $self->can($key)->($self, $value); + } + } + return $self; } sub write { - my $self = shift; - return $self unless $self->is_admin; - $self->admin->write_meta; - return $self; + my $self = shift; + return $self unless $self->is_admin; + $self->admin->write_meta; + return $self; } sub version_from { - my ( $self, $file ) = @_; - require ExtUtils::MM_Unix; - $self->version( ExtUtils::MM_Unix->parse_version($file) ); + require ExtUtils::MM_Unix; + my ( $self, $file ) = @_; + $self->version( ExtUtils::MM_Unix->parse_version($file) ); } sub abstract_from { - my ( $self, $file ) = @_; - require ExtUtils::MM_Unix; - $self->abstract( - bless( - { DISTNAME => $self->name }, - 'ExtUtils::MM_Unix' - )->parse_abstract($file) - ); -} - -sub _slurp { - my ( $self, $file ) = @_; - - local *FH; - open FH, "< $file" or die "Cannot open $file.pod: $!"; - do { local $/; }; + require ExtUtils::MM_Unix; + my ( $self, $file ) = @_; + $self->abstract( + bless( + { DISTNAME => $self->name }, + 'ExtUtils::MM_Unix' + )->parse_abstract($file) + ); } -sub perl_version_from { - my ( $self, $file ) = @_; +sub name_from { + my $self = shift; + if ( + Module::Install::_read($_[0]) =~ m/ + ^ \s* + package \s* + ([\w:]+) + \s* ; + /ixms + ) { + my $name = $1; + $name =~ s{::}{-}g; + $self->name($name); + } else { + die "Cannot determine name from $_[0]\n"; + return; + } +} - if ( - $self->_slurp($file) =~ m/ - ^ - use \s* - v? - ([\d_\.]+) - \s* ; - /ixms - ) - { - my $v = $1; - $v =~ s{_}{}g; - $self->perl_version($1); - } - else { - warn "Cannot determine perl version info from $file\n"; - return; - } +sub perl_version_from { + my $self = shift; + if ( + Module::Install::_read($_[0]) =~ m/ + ^ + use \s* + v? + ([\d_\.]+) + \s* ; + /ixms + ) { + my $perl_version = $1; + $perl_version =~ s{_}{}g; + $self->perl_version($perl_version); + } else { + warn "Cannot determine perl version info from $_[0]\n"; + return; + } } sub author_from { - my ( $self, $file ) = @_; - my $content = $self->_slurp($file); - if ($content =~ m/ - =head \d \s+ (?:authors?)\b \s* - ([^\n]*) - | - =head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b \s* - .*? copyright .*? \d\d\d[\d.]+ \s* (?:\bby\b)? \s* - ([^\n]*) - /ixms) { - my $author = $1 || $2; - $author =~ s{E}{<}g; - $author =~ s{E}{>}g; - $self->author($author); - } - else { - warn "Cannot determine author info from $file\n"; - } + my $self = shift; + my $content = Module::Install::_read($_[0]); + if ($content =~ m/ + =head \d \s+ (?:authors?)\b \s* + ([^\n]*) + | + =head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b \s* + .*? copyright .*? \d\d\d[\d.]+ \s* (?:\bby\b)? \s* + ([^\n]*) + /ixms) { + my $author = $1 || $2; + $author =~ s{E}{<}g; + $author =~ s{E}{>}g; + $self->author($author); + } else { + warn "Cannot determine author info from $_[0]\n"; + } } sub license_from { - my ( $self, $file ) = @_; - - if ( - $self->_slurp($file) =~ m/ - ( - =head \d \s+ - (?:licen[cs]e|licensing|copyright|legal)\b - .*? - ) - (=head\\d.*|=cut.*|) - \z - /ixms - ) - { - my $license_text = $1; - my @phrases = ( - 'under the same (?:terms|license) as perl itself' => 'perl', 1, - 'GNU public license' => 'gpl', 1, - 'GNU lesser public license' => 'gpl', 1, - 'BSD license' => 'bsd', 1, - 'Artistic license' => 'artistic', 1, - 'GPL' => 'gpl', 1, - 'LGPL' => 'lgpl', 1, - 'BSD' => 'bsd', 1, - 'Artistic' => 'artistic', 1, - 'MIT' => 'mit', 1, - 'proprietary' => 'proprietary', 0, - ); - while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) { - $pattern =~ s{\s+}{\\s+}g; - if ( $license_text =~ /\b$pattern\b/i ) { - if ( $osi and $license_text =~ /All rights reserved/i ) { - warn "LEGAL WARNING: 'All rights reserved' may invalidate Open Source licenses. Consider removing it."; + my $self = shift; + if ( + Module::Install::_read($_[0]) =~ m/ + ( + =head \d \s+ + (?:licen[cs]e|licensing|copyright|legal)\b + .*? + ) + (=head\\d.*|=cut.*|) + \z + /ixms ) { + my $license_text = $1; + my @phrases = ( + 'under the same (?:terms|license) as perl itself' => 'perl', 1, + 'GNU public license' => 'gpl', 1, + 'GNU lesser public license' => 'lgpl', 1, + 'BSD license' => 'bsd', 1, + 'Artistic license' => 'artistic', 1, + 'GPL' => 'gpl', 1, + 'LGPL' => 'lgpl', 1, + 'BSD' => 'bsd', 1, + 'Artistic' => 'artistic', 1, + 'MIT' => 'mit', 1, + 'proprietary' => 'proprietary', 0, + ); + while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) { + $pattern =~ s{\s+}{\\s+}g; + if ( $license_text =~ /\b$pattern\b/i ) { + if ( $osi and $license_text =~ /All rights reserved/i ) { + warn "LEGAL WARNING: 'All rights reserved' may invalidate Open Source licenses. Consider removing it."; + } + $self->license($license); + return 1; + } } - $self->license($license); - return 1; - } - } - } + } + + warn "Cannot determine license info from $_[0]\n"; + return 'unknown'; +} - warn "Cannot determine license info from $file\n"; - return 'unknown'; +sub install_script { + my $self = shift; + my $args = $self->makemaker_args; + my $exe = $args->{EXE_FILES} ||= []; + foreach ( @_ ) { + if ( -f $_ ) { + push @$exe, $_; + } elsif ( -d 'script' and -f "script/$_" ) { + push @$exe, "script/$_"; + } else { + die "Cannot find script '$_'"; + } + } } 1; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/AutoInstall.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/AutoInstall.pm 2008/02/21 00:14:33 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/AutoInstall.pm 2008/05/07 18:15:19 1.2 @@ -6,7 +6,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.68'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Share.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Share.pm 2008/02/22 16:40:30 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Share.pm 2008/05/07 18:15:19 1.2 @@ -6,7 +6,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } @@ -31,10 +31,13 @@ # So when we need to install a share directory, make sure we add a # dependency on a moderately new version of ExtUtils::MakeMaker. $self->build_requires( 'ExtUtils::MakeMaker' => '6.11' ); + + # 99% of the time we don't want to index a shared dir + $self->no_index( directory => $dir ); } 1; __END__ -#line 98 +#line 101 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Win32.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Win32.pm 2008/02/21 00:14:33 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Win32.pm 2008/05/07 18:15:19 1.2 @@ -4,11 +4,11 @@ use strict; use Module::Install::Base; -use vars qw{$VERSION $ISCORE @ISA}; +use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '0.68'; - $ISCORE = 1; + $VERSION = '0.72'; @ISA = qw{Module::Install::Base}; + $ISCORE = 1; } # determine if the user needs nmake, and download it if needed @@ -16,7 +16,7 @@ my $self = shift; $self->load('can_run'); $self->load('get_file'); - + require Config; return unless ( $^O eq 'MSWin32' and @@ -38,8 +38,7 @@ remove => 1, ); - if (!$rv) { - die <<'END_MESSAGE'; + die <<'END_MESSAGE' unless $rv; ------------------------------------------------------------------------------- @@ -59,7 +58,7 @@ ------------------------------------------------------------------------------- END_MESSAGE - } + } 1; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Include.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Include.pm 2008/02/21 00:14:33 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Include.pm 2008/05/07 18:15:19 1.2 @@ -6,7 +6,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.68'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Base.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Base.pm 2008/02/21 00:14:33 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Base.pm 2008/05/07 18:15:19 1.2 @@ -1,7 +1,7 @@ #line 1 package Module::Install::Base; -$VERSION = '0.68'; +$VERSION = '0.72'; # Suspend handler for "redefined" warnings BEGIN { =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/WriteAll.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/WriteAll.pm 2008/02/21 00:14:33 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/WriteAll.pm 2008/05/07 18:15:19 1.2 @@ -4,40 +4,37 @@ use strict; use Module::Install::Base; -use vars qw{$VERSION $ISCORE @ISA}; +use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '0.68'; - $ISCORE = 1; + $VERSION = '0.72'; @ISA = qw{Module::Install::Base}; + $ISCORE = 1; } sub WriteAll { - my $self = shift; - my %args = ( - meta => 1, - sign => 0, - inline => 0, - check_nmake => 1, - @_ - ); - - $self->sign(1) if $args{sign}; - $self->Meta->write if $args{meta}; - $self->admin->WriteAll(%args) if $self->is_admin; - - if ( $0 =~ /Build.PL$/i ) { - $self->Build->write; - } else { - $self->check_nmake if $args{check_nmake}; - unless ( $self->makemaker_args->{'PL_FILES'} ) { - $self->makemaker_args( PL_FILES => {} ); - } - if ($args{inline}) { - $self->Inline->write; - } else { - $self->Makefile->write; - } - } + my $self = shift; + my %args = ( + meta => 1, + sign => 0, + inline => 0, + check_nmake => 1, + @_, + ); + + $self->sign(1) if $args{sign}; + $self->Meta->write if $args{meta}; + $self->admin->WriteAll(%args) if $self->is_admin; + + $self->check_nmake if $args{check_nmake}; + unless ( $self->makemaker_args->{PL_FILES} ) { + $self->makemaker_args( PL_FILES => {} ); + } + + if ( $args{inline} ) { + $self->Inline->write; + } else { + $self->Makefile->write; + } } 1; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Fetch.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Fetch.pm 2008/02/21 00:14:33 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Fetch.pm 2008/05/07 18:15:19 1.2 @@ -6,7 +6,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.68'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Can.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Can.pm 2008/02/21 00:14:33 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Can.pm 2008/05/07 18:15:19 1.2 @@ -11,7 +11,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.68'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Makefile.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Makefile.pm 2008/02/21 00:14:33 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Makefile.pm 2008/05/07 18:15:19 1.2 @@ -7,7 +7,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.68'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } @@ -37,7 +37,7 @@ sub makemaker_args { my $self = shift; my $args = ($self->{makemaker_args} ||= {}); - %$args = ( %$args, @_ ) if @_; + %$args = ( %$args, @_ ) if @_; $args; } @@ -63,18 +63,18 @@ sub clean_files { my $self = shift; my $clean = $self->makemaker_args->{clean} ||= {}; - %$clean = ( + %$clean = ( %$clean, - FILES => join(' ', grep length, $clean->{FILES}, @_), + FILES => join ' ', grep { length $_ } ($clean->{FILES} || (), @_), ); } sub realclean_files { - my $self = shift; + my $self = shift; my $realclean = $self->makemaker_args->{realclean} ||= {}; - %$realclean = ( + %$realclean = ( %$realclean, - FILES => join(' ', grep length, $realclean->{FILES}, @_), + FILES => join ' ', grep { length $_ } ($realclean->{FILES} || (), @_), ); } @@ -104,8 +104,8 @@ unless ( -d $dir ) { die "tests_recursive dir '$dir' does not exist"; } - require File::Find; %test_dir = (); + require File::Find; File::Find::find( \&_wanted_t, $dir ); $self->tests( join ' ', map { "$_/*.t" } sort keys %test_dir ); } @@ -114,10 +114,15 @@ my $self = shift; die "&Makefile->write() takes no arguments\n" if @_; + # Make sure we have a new enough + require ExtUtils::MakeMaker; + $self->configure_requires( 'ExtUtils::MakeMaker' => $ExtUtils::MakeMaker::VERSION ); + + # Generate the my $args = $self->makemaker_args; $args->{DISTNAME} = $self->name; - $args->{NAME} = $self->module_name || $self->name || $self->determine_NAME($args); - $args->{VERSION} = $self->version || $self->determine_VERSION($args); + $args->{NAME} = $self->module_name || $self->name; + $args->{VERSION} = $self->version; $args->{NAME} =~ s/-/::/g; if ( $self->tests ) { $args->{test} = { TESTS => $self->tests }; @@ -142,9 +147,12 @@ map { @$_ } map { @$_ } grep $_, - ($self->build_requires, $self->requires) + ($self->configure_requires, $self->build_requires, $self->requires) ); + # Remove any reference to perl, PREREQ_PM doesn't support it + delete $args->{PREREQ_PM}->{perl}; + # merge both kinds of requires into prereq_pm my $subdirs = ($args->{DIR} ||= []); if ($self->bundles) { @@ -205,7 +213,7 @@ #$makefile =~ s/^PERL_ARCHLIB = .+/PERL_ARCHLIB =/m; # Perl 5.005 mentions PERL_LIB explicitly, so we have to remove that as well. - $makefile =~ s/("?)-I\$\(PERL_LIB\)\1//g; + $makefile =~ s/(\"?)-I\$\(PERL_LIB\)\1//g; # XXX - This is currently unused; not sure if it breaks other MM-users # $makefile =~ s/^pm_to_blib\s+:\s+/pm_to_blib :: /mg; @@ -234,4 +242,4 @@ __END__ -#line 363 +#line 371 rcsdiff: /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/RCS/Scripts.pm,v: No such file or directory From kawas at dev.open-bio.org Wed May 7 14:15:19 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 May 2008 14:15:19 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805071815.m47IFJ7J009618@dev.open-bio.org> kawas Wed May 7 14:15:19 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module In directory dev.open-bio.org:/tmp/cvs-serv9526/Perl/MOBY-Client/inc/Module Modified Files: Install.pm Log Message: updated the Module::Install libraries to version 0.72 moby-live/Perl/MOBY-Client/inc/Module Install.pm,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install.pm 2008/02/21 00:14:33 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install.pm 2008/05/07 18:15:19 1.2 @@ -17,20 +17,30 @@ # 3. The ./inc/ version of Module::Install loads # } -use 5.004; +BEGIN { + require 5.004; +} use strict 'vars'; use vars qw{$VERSION}; BEGIN { - # All Module::Install core packages now require synchronised versions. - # This will be used to ensure we don't accidentally load old or - # different versions of modules. - # This is not enforced yet, but will be some time in the next few - # releases once we can make sure it won't clash with custom - # Module::Install extensions. - $VERSION = '0.68'; + # All Module::Install core packages now require synchronised versions. + # This will be used to ensure we don't accidentally load old or + # different versions of modules. + # This is not enforced yet, but will be some time in the next few + # releases once we can make sure it won't clash with custom + # Module::Install extensions. + $VERSION = '0.72'; + + *inc::Module::Install::VERSION = *VERSION; + @inc::Module::Install::ISA = __PACKAGE__; + } + + + + # Whether or not inc::Module::Install is actually loaded, the # $INC{inc/Module/Install.pm} is what will still get set as long as # the caller loaded module this in the documented manner. @@ -38,26 +48,29 @@ # they may not have a MI version that works with the Makefile.PL. This would # result in false errors or unexpected behaviour. And we don't want that. my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm'; -unless ( $INC{$file} ) { - die <<"END_DIE"; +unless ( $INC{$file} ) { die <<"END_DIE" } + Please invoke ${\__PACKAGE__} with: - use inc::${\__PACKAGE__}; + use inc::${\__PACKAGE__}; not: - use ${\__PACKAGE__}; + use ${\__PACKAGE__}; END_DIE -} + + + + # If the script that is loading Module::Install is from the future, # then make will detect this and cause it to re-run over and over # again. This is bad. Rather than taking action to touch it (which # is unreliable on some platforms and requires write permissions) # for now we should catch this and refuse to run. -if ( -f $0 and (stat($0))[9] > time ) { - die << "END_DIE"; +if ( -f $0 and (stat($0))[9] > time ) { die <<"END_DIE" } + Your installer $0 has a modification time in the future. This is known to create infinite loops in make. @@ -65,115 +78,142 @@ Please correct this, then run $0 again. END_DIE -} + + + + + +# Build.PL was formerly supported, but no longer is due to excessive +# difficulty in implementing every single feature twice. +if ( $0 =~ /Build.PL$/i or -f 'Build.PL' ) { die <<"END_DIE" } + +Module::Install no longer supports Build.PL. + +It was impossible to maintain duel backends, and has been deprecated. + +Please remove all Build.PL files and only use the Makefile.PL installer. + +END_DIE + + + + + +# To save some more typing in Module::Install installers, every... +# use inc::Module::Install +# ...also acts as an implicit use strict. +$^H |= strict::bits(qw(refs subs vars)); + + + + use Cwd (); use File::Find (); use File::Path (); use FindBin; -*inc::Module::Install::VERSION = *VERSION; - at inc::Module::Install::ISA = __PACKAGE__; - sub autoload { - my $self = shift; - my $who = $self->_caller; - my $cwd = Cwd::cwd(); - my $sym = "${who}::AUTOLOAD"; - $sym->{$cwd} = sub { - my $pwd = Cwd::cwd(); - if ( my $code = $sym->{$pwd} ) { - # delegate back to parent dirs - goto &$code unless $cwd eq $pwd; - } - $$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym"; - unshift @_, ($self, $1); - goto &{$self->can('call')} unless uc($1) eq $1; - }; + my $self = shift; + my $who = $self->_caller; + my $cwd = Cwd::cwd(); + my $sym = "${who}::AUTOLOAD"; + $sym->{$cwd} = sub { + my $pwd = Cwd::cwd(); + if ( my $code = $sym->{$pwd} ) { + # delegate back to parent dirs + goto &$code unless $cwd eq $pwd; + } + $$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym"; + unshift @_, ( $self, $1 ); + goto &{$self->can('call')} unless uc($1) eq $1; + }; } sub import { - my $class = shift; - my $self = $class->new(@_); - my $who = $self->_caller; - - unless ( -f $self->{file} ) { - require "$self->{path}/$self->{dispatch}.pm"; - File::Path::mkpath("$self->{prefix}/$self->{author}"); - $self->{admin} = "$self->{name}::$self->{dispatch}"->new( _top => $self ); - $self->{admin}->init; - @_ = ($class, _self => $self); - goto &{"$self->{name}::import"}; - } - - *{"${who}::AUTOLOAD"} = $self->autoload; - $self->preload; - - # Unregister loader and worker packages so subdirs can use them again - delete $INC{"$self->{file}"}; - delete $INC{"$self->{path}.pm"}; + my $class = shift; + my $self = $class->new(@_); + my $who = $self->_caller; + + unless ( -f $self->{file} ) { + require "$self->{path}/$self->{dispatch}.pm"; + File::Path::mkpath("$self->{prefix}/$self->{author}"); + $self->{admin} = "$self->{name}::$self->{dispatch}"->new( _top => $self ); + $self->{admin}->init; + @_ = ($class, _self => $self); + goto &{"$self->{name}::import"}; + } + + *{"${who}::AUTOLOAD"} = $self->autoload; + $self->preload; + + # Unregister loader and worker packages so subdirs can use them again + delete $INC{"$self->{file}"}; + delete $INC{"$self->{path}.pm"}; + + return 1; } sub preload { - my ($self) = @_; - - unless ( $self->{extensions} ) { - $self->load_extensions( - "$self->{prefix}/$self->{path}", $self - ); - } - - my @exts = @{$self->{extensions}}; - unless ( @exts ) { - my $admin = $self->{admin}; - @exts = $admin->load_all_extensions; - } - - my %seen; - foreach my $obj ( @exts ) { - while (my ($method, $glob) = each %{ref($obj) . '::'}) { - next unless $obj->can($method); - next if $method =~ /^_/; - next if $method eq uc($method); - $seen{$method}++; - } - } - - my $who = $self->_caller; - foreach my $name ( sort keys %seen ) { - *{"${who}::$name"} = sub { - ${"${who}::AUTOLOAD"} = "${who}::$name"; - goto &{"${who}::AUTOLOAD"}; - }; - } + my $self = shift; + unless ( $self->{extensions} ) { + $self->load_extensions( + "$self->{prefix}/$self->{path}", $self + ); + } + + my @exts = @{$self->{extensions}}; + unless ( @exts ) { + my $admin = $self->{admin}; + @exts = $admin->load_all_extensions; + } + + my %seen; + foreach my $obj ( @exts ) { + while (my ($method, $glob) = each %{ref($obj) . '::'}) { + next unless $obj->can($method); + next if $method =~ /^_/; + next if $method eq uc($method); + $seen{$method}++; + } + } + + my $who = $self->_caller; + foreach my $name ( sort keys %seen ) { + *{"${who}::$name"} = sub { + ${"${who}::AUTOLOAD"} = "${who}::$name"; + goto &{"${who}::AUTOLOAD"}; + }; + } } sub new { - my ($class, %args) = @_; + my ($class, %args) = @_; - # ignore the prefix on extension modules built from top level. - my $base_path = Cwd::abs_path($FindBin::Bin); - unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) { - delete $args{prefix}; - } - - return $args{_self} if $args{_self}; - - $args{dispatch} ||= 'Admin'; - $args{prefix} ||= 'inc'; - $args{author} ||= ($^O eq 'VMS' ? '_author' : '.author'); - $args{bundle} ||= 'inc/BUNDLES'; - $args{base} ||= $base_path; - $class =~ s/^\Q$args{prefix}\E:://; - $args{name} ||= $class; - $args{version} ||= $class->VERSION; - unless ( $args{path} ) { - $args{path} = $args{name}; - $args{path} =~ s!::!/!g; - } - $args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm"; + # ignore the prefix on extension modules built from top level. + my $base_path = Cwd::abs_path($FindBin::Bin); + unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) { + delete $args{prefix}; + } + + return $args{_self} if $args{_self}; + + $args{dispatch} ||= 'Admin'; + $args{prefix} ||= 'inc'; + $args{author} ||= ($^O eq 'VMS' ? '_author' : '.author'); + $args{bundle} ||= 'inc/BUNDLES'; + $args{base} ||= $base_path; + $class =~ s/^\Q$args{prefix}\E:://; + $args{name} ||= $class; + $args{version} ||= $class->VERSION; + unless ( $args{path} ) { + $args{path} = $args{name}; + $args{path} =~ s!::!/!g; + } + $args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm"; + $args{wrote} = 0; - bless( \%args, $class ); + bless( \%args, $class ); } sub call { @@ -184,98 +224,130 @@ } sub load { - my ($self, $method) = @_; - - $self->load_extensions( - "$self->{prefix}/$self->{path}", $self - ) unless $self->{extensions}; + my ($self, $method) = @_; - foreach my $obj (@{$self->{extensions}}) { - return $obj if $obj->can($method); - } + $self->load_extensions( + "$self->{prefix}/$self->{path}", $self + ) unless $self->{extensions}; + + foreach my $obj (@{$self->{extensions}}) { + return $obj if $obj->can($method); + } - my $admin = $self->{admin} or die <<"END_DIE"; + my $admin = $self->{admin} or die <<"END_DIE"; The '$method' method does not exist in the '$self->{prefix}' path! Please remove the '$self->{prefix}' directory and run $0 again to load it. END_DIE - my $obj = $admin->load($method, 1); - push @{$self->{extensions}}, $obj; + my $obj = $admin->load($method, 1); + push @{$self->{extensions}}, $obj; - $obj; + $obj; } sub load_extensions { - my ($self, $path, $top) = @_; + my ($self, $path, $top) = @_; - unless ( grep { lc $_ eq lc $self->{prefix} } @INC ) { - unshift @INC, $self->{prefix}; - } - - foreach my $rv ( $self->find_extensions($path) ) { - my ($file, $pkg) = @{$rv}; - next if $self->{pathnames}{$pkg}; - - local $@; - my $new = eval { require $file; $pkg->can('new') }; - unless ( $new ) { - warn $@ if $@; - next; - } - $self->{pathnames}{$pkg} = delete $INC{$file}; - push @{$self->{extensions}}, &{$new}($pkg, _top => $top ); - } + unless ( grep { lc $_ eq lc $self->{prefix} } @INC ) { + unshift @INC, $self->{prefix}; + } + + foreach my $rv ( $self->find_extensions($path) ) { + my ($file, $pkg) = @{$rv}; + next if $self->{pathnames}{$pkg}; + + local $@; + my $new = eval { require $file; $pkg->can('new') }; + unless ( $new ) { + warn $@ if $@; + next; + } + $self->{pathnames}{$pkg} = delete $INC{$file}; + push @{$self->{extensions}}, &{$new}($pkg, _top => $top ); + } - $self->{extensions} ||= []; + $self->{extensions} ||= []; } sub find_extensions { - my ($self, $path) = @_; + my ($self, $path) = @_; + + my @found; + File::Find::find( sub { + my $file = $File::Find::name; + return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is; + my $subpath = $1; + return if lc($subpath) eq lc($self->{dispatch}); + + $file = "$self->{path}/$subpath.pm"; + my $pkg = "$self->{name}::$subpath"; + $pkg =~ s!/!::!g; - my @found; - File::Find::find( sub { - my $file = $File::Find::name; - return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is; - my $subpath = $1; - return if lc($subpath) eq lc($self->{dispatch}); - - $file = "$self->{path}/$subpath.pm"; - my $pkg = "$self->{name}::$subpath"; - $pkg =~ s!/!::!g; - - # If we have a mixed-case package name, assume case has been preserved - # correctly. Otherwise, root through the file to locate the case-preserved - # version of the package name. - if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) { - open PKGFILE, "<$subpath.pm" or die "find_extensions: Can't open $subpath.pm: $!"; - my $in_pod = 0; - while ( ) { - $in_pod = 1 if /^=\w/; - $in_pod = 0 if /^=cut/; - next if ($in_pod || /^=cut/); # skip pod text - next if /^\s*#/; # and comments - if ( m/^\s*package\s+($pkg)\s*;/i ) { - $pkg = $1; - last; - } - } - close PKGFILE; - } + # If we have a mixed-case package name, assume case has been preserved + # correctly. Otherwise, root through the file to locate the case-preserved + # version of the package name. + if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) { + my $content = Module::Install::_read($subpath . '.pm'); + my $in_pod = 0; + foreach ( split //, $content ) { + $in_pod = 1 if /^=\w/; + $in_pod = 0 if /^=cut/; + next if ($in_pod || /^=cut/); # skip pod text + next if /^\s*#/; # and comments + if ( m/^\s*package\s+($pkg)\s*;/i ) { + $pkg = $1; + last; + } + } + } - push @found, [ $file, $pkg ]; - }, $path ) if -d $path; + push @found, [ $file, $pkg ]; + }, $path ) if -d $path; - @found; + @found; } + + + + +##################################################################### +# Utility Functions + sub _caller { - my $depth = 0; - my $call = caller($depth); - while ( $call eq __PACKAGE__ ) { - $depth++; - $call = caller($depth); - } - return $call; + my $depth = 0; + my $call = caller($depth); + while ( $call eq __PACKAGE__ ) { + $depth++; + $call = caller($depth); + } + return $call; +} + +sub _read { + local *FH; + open FH, "< $_[0]" or die "open($_[0]): $!"; + my $str = do { local $/; }; + close FH or die "close($_[0]): $!"; + return $str; +} + +sub _write { + local *FH; + open FH, "> $_[0]" or die "open($_[0]): $!"; + foreach ( 1 .. $#_ ) { print FH $_[$_] or die "print($_[0]): $!" } + close FH or die "close($_[0]): $!"; +} + +sub _version { + my $s = shift || 0; + $s =~ s/^(\d+)\.?//; + my $l = $1 || 0; + my @v = map { $_ . '0' x (3 - length $_) } $s =~ /(\d{1,3})\D?/g; + $l = $l . '.' . join '', @v if @v; + return $l + 0; } 1; + +# Copyright 2008 Adam Kennedy. From kawas at dev.open-bio.org Wed May 7 14:16:52 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 May 2008 14:16:52 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805071816.m47IGqir009696@dev.open-bio.org> kawas Wed May 7 14:16:52 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module In directory dev.open-bio.org:/tmp/cvs-serv9661/Perl/MOBY-Server/inc/Module Modified Files: Install.pm Log Message: updated the Module::Install libraries to version 0.72 moby-live/Perl/MOBY-Server/inc/Module Install.pm,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install.pm 2008/02/21 00:21:28 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install.pm 2008/05/07 18:16:52 1.2 @@ -17,20 +17,30 @@ # 3. The ./inc/ version of Module::Install loads # } -use 5.004; +BEGIN { + require 5.004; +} use strict 'vars'; use vars qw{$VERSION}; BEGIN { - # All Module::Install core packages now require synchronised versions. - # This will be used to ensure we don't accidentally load old or - # different versions of modules. - # This is not enforced yet, but will be some time in the next few - # releases once we can make sure it won't clash with custom - # Module::Install extensions. - $VERSION = '0.67'; + # All Module::Install core packages now require synchronised versions. + # This will be used to ensure we don't accidentally load old or + # different versions of modules. + # This is not enforced yet, but will be some time in the next few + # releases once we can make sure it won't clash with custom + # Module::Install extensions. + $VERSION = '0.72'; + + *inc::Module::Install::VERSION = *VERSION; + @inc::Module::Install::ISA = __PACKAGE__; + } + + + + # Whether or not inc::Module::Install is actually loaded, the # $INC{inc/Module/Install.pm} is what will still get set as long as # the caller loaded module this in the documented manner. @@ -38,26 +48,29 @@ # they may not have a MI version that works with the Makefile.PL. This would # result in false errors or unexpected behaviour. And we don't want that. my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm'; -unless ( $INC{$file} ) { - die <<"END_DIE"; +unless ( $INC{$file} ) { die <<"END_DIE" } + Please invoke ${\__PACKAGE__} with: - use inc::${\__PACKAGE__}; + use inc::${\__PACKAGE__}; not: - use ${\__PACKAGE__}; + use ${\__PACKAGE__}; END_DIE -} + + + + # If the script that is loading Module::Install is from the future, # then make will detect this and cause it to re-run over and over # again. This is bad. Rather than taking action to touch it (which # is unreliable on some platforms and requires write permissions) # for now we should catch this and refuse to run. -if ( -f $0 and (stat($0))[9] > time ) { - die << "END_DIE"; +if ( -f $0 and (stat($0))[9] > time ) { die <<"END_DIE" } + Your installer $0 has a modification time in the future. This is known to create infinite loops in make. @@ -65,115 +78,142 @@ Please correct this, then run $0 again. END_DIE -} + + + + + +# Build.PL was formerly supported, but no longer is due to excessive +# difficulty in implementing every single feature twice. +if ( $0 =~ /Build.PL$/i or -f 'Build.PL' ) { die <<"END_DIE" } + +Module::Install no longer supports Build.PL. + +It was impossible to maintain duel backends, and has been deprecated. + +Please remove all Build.PL files and only use the Makefile.PL installer. + +END_DIE + + + + + +# To save some more typing in Module::Install installers, every... +# use inc::Module::Install +# ...also acts as an implicit use strict. +$^H |= strict::bits(qw(refs subs vars)); + + + + use Cwd (); use File::Find (); use File::Path (); use FindBin; -*inc::Module::Install::VERSION = *VERSION; - at inc::Module::Install::ISA = __PACKAGE__; - sub autoload { - my $self = shift; - my $who = $self->_caller; - my $cwd = Cwd::cwd(); - my $sym = "${who}::AUTOLOAD"; - $sym->{$cwd} = sub { - my $pwd = Cwd::cwd(); - if ( my $code = $sym->{$pwd} ) { - # delegate back to parent dirs - goto &$code unless $cwd eq $pwd; - } - $$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym"; - unshift @_, ($self, $1); - goto &{$self->can('call')} unless uc($1) eq $1; - }; + my $self = shift; + my $who = $self->_caller; + my $cwd = Cwd::cwd(); + my $sym = "${who}::AUTOLOAD"; + $sym->{$cwd} = sub { + my $pwd = Cwd::cwd(); + if ( my $code = $sym->{$pwd} ) { + # delegate back to parent dirs + goto &$code unless $cwd eq $pwd; + } + $$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym"; + unshift @_, ( $self, $1 ); + goto &{$self->can('call')} unless uc($1) eq $1; + }; } sub import { - my $class = shift; - my $self = $class->new(@_); - my $who = $self->_caller; - - unless ( -f $self->{file} ) { - require "$self->{path}/$self->{dispatch}.pm"; - File::Path::mkpath("$self->{prefix}/$self->{author}"); - $self->{admin} = "$self->{name}::$self->{dispatch}"->new( _top => $self ); - $self->{admin}->init; - @_ = ($class, _self => $self); - goto &{"$self->{name}::import"}; - } - - *{"${who}::AUTOLOAD"} = $self->autoload; - $self->preload; - - # Unregister loader and worker packages so subdirs can use them again - delete $INC{"$self->{file}"}; - delete $INC{"$self->{path}.pm"}; + my $class = shift; + my $self = $class->new(@_); + my $who = $self->_caller; + + unless ( -f $self->{file} ) { + require "$self->{path}/$self->{dispatch}.pm"; + File::Path::mkpath("$self->{prefix}/$self->{author}"); + $self->{admin} = "$self->{name}::$self->{dispatch}"->new( _top => $self ); + $self->{admin}->init; + @_ = ($class, _self => $self); + goto &{"$self->{name}::import"}; + } + + *{"${who}::AUTOLOAD"} = $self->autoload; + $self->preload; + + # Unregister loader and worker packages so subdirs can use them again + delete $INC{"$self->{file}"}; + delete $INC{"$self->{path}.pm"}; + + return 1; } sub preload { - my ($self) = @_; - - unless ( $self->{extensions} ) { - $self->load_extensions( - "$self->{prefix}/$self->{path}", $self - ); - } - - my @exts = @{$self->{extensions}}; - unless ( @exts ) { - my $admin = $self->{admin}; - @exts = $admin->load_all_extensions; - } - - my %seen; - foreach my $obj ( @exts ) { - while (my ($method, $glob) = each %{ref($obj) . '::'}) { - next unless $obj->can($method); - next if $method =~ /^_/; - next if $method eq uc($method); - $seen{$method}++; - } - } - - my $who = $self->_caller; - foreach my $name ( sort keys %seen ) { - *{"${who}::$name"} = sub { - ${"${who}::AUTOLOAD"} = "${who}::$name"; - goto &{"${who}::AUTOLOAD"}; - }; - } + my $self = shift; + unless ( $self->{extensions} ) { + $self->load_extensions( + "$self->{prefix}/$self->{path}", $self + ); + } + + my @exts = @{$self->{extensions}}; + unless ( @exts ) { + my $admin = $self->{admin}; + @exts = $admin->load_all_extensions; + } + + my %seen; + foreach my $obj ( @exts ) { + while (my ($method, $glob) = each %{ref($obj) . '::'}) { + next unless $obj->can($method); + next if $method =~ /^_/; + next if $method eq uc($method); + $seen{$method}++; + } + } + + my $who = $self->_caller; + foreach my $name ( sort keys %seen ) { + *{"${who}::$name"} = sub { + ${"${who}::AUTOLOAD"} = "${who}::$name"; + goto &{"${who}::AUTOLOAD"}; + }; + } } sub new { - my ($class, %args) = @_; + my ($class, %args) = @_; - # ignore the prefix on extension modules built from top level. - my $base_path = Cwd::abs_path($FindBin::Bin); - unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) { - delete $args{prefix}; - } - - return $args{_self} if $args{_self}; - - $args{dispatch} ||= 'Admin'; - $args{prefix} ||= 'inc'; - $args{author} ||= ($^O eq 'VMS' ? '_author' : '.author'); - $args{bundle} ||= 'inc/BUNDLES'; - $args{base} ||= $base_path; - $class =~ s/^\Q$args{prefix}\E:://; - $args{name} ||= $class; - $args{version} ||= $class->VERSION; - unless ( $args{path} ) { - $args{path} = $args{name}; - $args{path} =~ s!::!/!g; - } - $args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm"; + # ignore the prefix on extension modules built from top level. + my $base_path = Cwd::abs_path($FindBin::Bin); + unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) { + delete $args{prefix}; + } + + return $args{_self} if $args{_self}; + + $args{dispatch} ||= 'Admin'; + $args{prefix} ||= 'inc'; + $args{author} ||= ($^O eq 'VMS' ? '_author' : '.author'); + $args{bundle} ||= 'inc/BUNDLES'; + $args{base} ||= $base_path; + $class =~ s/^\Q$args{prefix}\E:://; + $args{name} ||= $class; + $args{version} ||= $class->VERSION; + unless ( $args{path} ) { + $args{path} = $args{name}; + $args{path} =~ s!::!/!g; + } + $args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm"; + $args{wrote} = 0; - bless( \%args, $class ); + bless( \%args, $class ); } sub call { @@ -184,98 +224,130 @@ } sub load { - my ($self, $method) = @_; - - $self->load_extensions( - "$self->{prefix}/$self->{path}", $self - ) unless $self->{extensions}; + my ($self, $method) = @_; - foreach my $obj (@{$self->{extensions}}) { - return $obj if $obj->can($method); - } + $self->load_extensions( + "$self->{prefix}/$self->{path}", $self + ) unless $self->{extensions}; + + foreach my $obj (@{$self->{extensions}}) { + return $obj if $obj->can($method); + } - my $admin = $self->{admin} or die <<"END_DIE"; + my $admin = $self->{admin} or die <<"END_DIE"; The '$method' method does not exist in the '$self->{prefix}' path! Please remove the '$self->{prefix}' directory and run $0 again to load it. END_DIE - my $obj = $admin->load($method, 1); - push @{$self->{extensions}}, $obj; + my $obj = $admin->load($method, 1); + push @{$self->{extensions}}, $obj; - $obj; + $obj; } sub load_extensions { - my ($self, $path, $top) = @_; + my ($self, $path, $top) = @_; - unless ( grep { lc $_ eq lc $self->{prefix} } @INC ) { - unshift @INC, $self->{prefix}; - } - - foreach my $rv ( $self->find_extensions($path) ) { - my ($file, $pkg) = @{$rv}; - next if $self->{pathnames}{$pkg}; - - local $@; - my $new = eval { require $file; $pkg->can('new') }; - unless ( $new ) { - warn $@ if $@; - next; - } - $self->{pathnames}{$pkg} = delete $INC{$file}; - push @{$self->{extensions}}, &{$new}($pkg, _top => $top ); - } + unless ( grep { lc $_ eq lc $self->{prefix} } @INC ) { + unshift @INC, $self->{prefix}; + } + + foreach my $rv ( $self->find_extensions($path) ) { + my ($file, $pkg) = @{$rv}; + next if $self->{pathnames}{$pkg}; + + local $@; + my $new = eval { require $file; $pkg->can('new') }; + unless ( $new ) { + warn $@ if $@; + next; + } + $self->{pathnames}{$pkg} = delete $INC{$file}; + push @{$self->{extensions}}, &{$new}($pkg, _top => $top ); + } - $self->{extensions} ||= []; + $self->{extensions} ||= []; } sub find_extensions { - my ($self, $path) = @_; + my ($self, $path) = @_; + + my @found; + File::Find::find( sub { + my $file = $File::Find::name; + return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is; + my $subpath = $1; + return if lc($subpath) eq lc($self->{dispatch}); + + $file = "$self->{path}/$subpath.pm"; + my $pkg = "$self->{name}::$subpath"; + $pkg =~ s!/!::!g; - my @found; - File::Find::find( sub { - my $file = $File::Find::name; - return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is; - my $subpath = $1; - return if lc($subpath) eq lc($self->{dispatch}); - - $file = "$self->{path}/$subpath.pm"; - my $pkg = "$self->{name}::$subpath"; - $pkg =~ s!/!::!g; - - # If we have a mixed-case package name, assume case has been preserved - # correctly. Otherwise, root through the file to locate the case-preserved - # version of the package name. - if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) { - open PKGFILE, "<$subpath.pm" or die "find_extensions: Can't open $subpath.pm: $!"; - my $in_pod = 0; - while ( ) { - $in_pod = 1 if /^=\w/; - $in_pod = 0 if /^=cut/; - next if ($in_pod || /^=cut/); # skip pod text - next if /^\s*#/; # and comments - if ( m/^\s*package\s+($pkg)\s*;/i ) { - $pkg = $1; - last; - } - } - close PKGFILE; - } + # If we have a mixed-case package name, assume case has been preserved + # correctly. Otherwise, root through the file to locate the case-preserved + # version of the package name. + if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) { + my $content = Module::Install::_read($subpath . '.pm'); + my $in_pod = 0; + foreach ( split //, $content ) { + $in_pod = 1 if /^=\w/; + $in_pod = 0 if /^=cut/; + next if ($in_pod || /^=cut/); # skip pod text + next if /^\s*#/; # and comments + if ( m/^\s*package\s+($pkg)\s*;/i ) { + $pkg = $1; + last; + } + } + } - push @found, [ $file, $pkg ]; - }, $path ) if -d $path; + push @found, [ $file, $pkg ]; + }, $path ) if -d $path; - @found; + @found; } + + + + +##################################################################### +# Utility Functions + sub _caller { - my $depth = 0; - my $call = caller($depth); - while ( $call eq __PACKAGE__ ) { - $depth++; - $call = caller($depth); - } - return $call; + my $depth = 0; + my $call = caller($depth); + while ( $call eq __PACKAGE__ ) { + $depth++; + $call = caller($depth); + } + return $call; +} + +sub _read { + local *FH; + open FH, "< $_[0]" or die "open($_[0]): $!"; + my $str = do { local $/; }; + close FH or die "close($_[0]): $!"; + return $str; +} + +sub _write { + local *FH; + open FH, "> $_[0]" or die "open($_[0]): $!"; + foreach ( 1 .. $#_ ) { print FH $_[$_] or die "print($_[0]): $!" } + close FH or die "close($_[0]): $!"; +} + +sub _version { + my $s = shift || 0; + $s =~ s/^(\d+)\.?//; + my $l = $1 || 0; + my @v = map { $_ . '0' x (3 - length $_) } $s =~ /(\d{1,3})\D?/g; + $l = $l . '.' . join '', @v if @v; + return $l + 0; } 1; + +# Copyright 2008 Adam Kennedy. From kawas at dev.open-bio.org Wed May 7 14:16:53 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 May 2008 14:16:53 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805071816.m47IGrGf009753@dev.open-bio.org> kawas Wed May 7 14:16:52 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install In directory dev.open-bio.org:/tmp/cvs-serv9661/Perl/MOBY-Server/inc/Module/Install Modified Files: Include.pm Share.pm Base.pm Makefile.pm AutoInstall.pm Metadata.pm WriteAll.pm Win32.pm Can.pm Fetch.pm Removed Files: Scripts.pm Log Message: updated the Module::Install libraries to version 0.72 moby-live/Perl/MOBY-Server/inc/Module/Install Include.pm,1.1,1.2 Share.pm,1.1,1.2 Base.pm,1.1,1.2 Makefile.pm,1.1,1.2 AutoInstall.pm,1.1,1.2 Metadata.pm,1.1,1.2 WriteAll.pm,1.1,1.2 Win32.pm,1.1,1.2 Can.pm,1.1,1.2 Fetch.pm,1.1,1.2 Scripts.pm,1.1,NONE =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Include.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Include.pm 2008/02/21 00:21:28 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Include.pm 2008/05/07 18:16:52 1.2 @@ -6,7 +6,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Share.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Share.pm 2008/02/21 00:21:28 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Share.pm 2008/05/07 18:16:52 1.2 @@ -6,7 +6,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } @@ -31,10 +31,13 @@ # So when we need to install a share directory, make sure we add a # dependency on a moderately new version of ExtUtils::MakeMaker. $self->build_requires( 'ExtUtils::MakeMaker' => '6.11' ); + + # 99% of the time we don't want to index a shared dir + $self->no_index( directory => $dir ); } 1; __END__ -#line 98 +#line 101 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Base.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Base.pm 2008/02/21 00:21:28 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Base.pm 2008/05/07 18:16:52 1.2 @@ -1,7 +1,7 @@ #line 1 package Module::Install::Base; -$VERSION = '0.67'; +$VERSION = '0.72'; # Suspend handler for "redefined" warnings BEGIN { =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Makefile.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Makefile.pm 2008/02/21 00:21:28 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Makefile.pm 2008/05/07 18:16:52 1.2 @@ -7,7 +7,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } @@ -37,7 +37,7 @@ sub makemaker_args { my $self = shift; my $args = ($self->{makemaker_args} ||= {}); - %$args = ( %$args, @_ ) if @_; + %$args = ( %$args, @_ ) if @_; $args; } @@ -63,18 +63,18 @@ sub clean_files { my $self = shift; my $clean = $self->makemaker_args->{clean} ||= {}; - %$clean = ( + %$clean = ( %$clean, - FILES => join(' ', grep length, $clean->{FILES}, @_), + FILES => join ' ', grep { length $_ } ($clean->{FILES} || (), @_), ); } sub realclean_files { - my $self = shift; + my $self = shift; my $realclean = $self->makemaker_args->{realclean} ||= {}; - %$realclean = ( + %$realclean = ( %$realclean, - FILES => join(' ', grep length, $realclean->{FILES}, @_), + FILES => join ' ', grep { length $_ } ($realclean->{FILES} || (), @_), ); } @@ -104,8 +104,8 @@ unless ( -d $dir ) { die "tests_recursive dir '$dir' does not exist"; } - require File::Find; %test_dir = (); + require File::Find; File::Find::find( \&_wanted_t, $dir ); $self->tests( join ' ', map { "$_/*.t" } sort keys %test_dir ); } @@ -114,10 +114,15 @@ my $self = shift; die "&Makefile->write() takes no arguments\n" if @_; + # Make sure we have a new enough + require ExtUtils::MakeMaker; + $self->configure_requires( 'ExtUtils::MakeMaker' => $ExtUtils::MakeMaker::VERSION ); + + # Generate the my $args = $self->makemaker_args; $args->{DISTNAME} = $self->name; - $args->{NAME} = $self->module_name || $self->name || $self->determine_NAME($args); - $args->{VERSION} = $self->version || $self->determine_VERSION($args); + $args->{NAME} = $self->module_name || $self->name; + $args->{VERSION} = $self->version; $args->{NAME} =~ s/-/::/g; if ( $self->tests ) { $args->{test} = { TESTS => $self->tests }; @@ -142,9 +147,12 @@ map { @$_ } map { @$_ } grep $_, - ($self->build_requires, $self->requires) + ($self->configure_requires, $self->build_requires, $self->requires) ); + # Remove any reference to perl, PREREQ_PM doesn't support it + delete $args->{PREREQ_PM}->{perl}; + # merge both kinds of requires into prereq_pm my $subdirs = ($args->{DIR} ||= []); if ($self->bundles) { @@ -205,7 +213,7 @@ #$makefile =~ s/^PERL_ARCHLIB = .+/PERL_ARCHLIB =/m; # Perl 5.005 mentions PERL_LIB explicitly, so we have to remove that as well. - $makefile =~ s/("?)-I\$\(PERL_LIB\)\1//g; + $makefile =~ s/(\"?)-I\$\(PERL_LIB\)\1//g; # XXX - This is currently unused; not sure if it breaks other MM-users # $makefile =~ s/^pm_to_blib\s+:\s+/pm_to_blib :: /mg; @@ -234,4 +242,4 @@ __END__ -#line 363 +#line 371 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/AutoInstall.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/AutoInstall.pm 2008/02/21 00:21:28 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/AutoInstall.pm 2008/05/07 18:16:52 1.2 @@ -6,7 +6,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Metadata.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Metadata.pm 2008/02/21 00:21:28 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Metadata.pm 2008/05/07 18:16:52 1.2 @@ -6,18 +6,30 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } my @scalar_keys = qw{ - name module_name abstract author version license - distribution_type perl_version tests installdirs + name + module_name + abstract + author + version + license + distribution_type + perl_version + tests + installdirs }; my @tuple_keys = qw{ - build_requires requires recommends bundles + configure_requires + build_requires + requires + recommends + bundles }; sub Meta { shift } @@ -25,44 +37,68 @@ sub Meta_TupleKeys { @tuple_keys } foreach my $key (@scalar_keys) { - *$key = sub { - my $self = shift; - return $self->{values}{$key} if defined wantarray and !@_; - $self->{values}{$key} = shift; - return $self; - }; -} - -foreach my $key (@tuple_keys) { - *$key = sub { - my $self = shift; - return $self->{values}{$key} unless @_; - - my @rv; - while (@_) { - my $module = shift or last; - my $version = shift || 0; - if ( $module eq 'perl' ) { - $version =~ s{^(\d+)\.(\d+)\.(\d+)} - {$1 + $2/1_000 + $3/1_000_000}e; - $self->perl_version($version); - next; - } - my $rv = [ $module, $version ]; - push @rv, $rv; - } - push @{ $self->{values}{$key} }, @rv; - @rv; - }; + *$key = sub { + my $self = shift; + return $self->{values}{$key} if defined wantarray and !@_; + $self->{values}{$key} = shift; + return $self; + }; +} + +sub requires { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{requires} }, [ $module, $version ]; + } + $self->{values}{requires}; +} + +sub build_requires { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{build_requires} }, [ $module, $version ]; + } + $self->{values}{build_requires}; +} + +sub configure_requires { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{configure_requires} }, [ $module, $version ]; + } + $self->{values}{configure_requires}; +} + +sub recommends { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{recommends} }, [ $module, $version ]; + } + $self->{values}{recommends}; } -# configure_requires is currently a null-op -sub configure_requires { 1 } +sub bundles { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{bundles} }, [ $module, $version ]; + } + $self->{values}{bundles}; +} # Aliases for build_requires that will have alternative # meanings in some future version of META.yml. -sub test_requires { shift->build_requires(@_) } -sub install_requires { shift->build_requires(@_) } +sub test_requires { shift->build_requires(@_) } +sub install_requires { shift->build_requires(@_) } # Aliases for installdirs options sub install_as_core { $_[0]->installdirs('perl') } @@ -71,10 +107,10 @@ sub install_as_vendor { $_[0]->installdirs('vendor') } sub sign { - my $self = shift; - return $self->{'values'}{'sign'} if defined wantarray and ! @_; - $self->{'values'}{'sign'} = ( @_ ? $_[0] : 1 ); - return $self; + my $self = shift; + return $self->{'values'}{'sign'} if defined wantarray and ! @_; + $self->{'values'}{'sign'} = ( @_ ? $_[0] : 1 ); + return $self; } sub dynamic_config { @@ -83,254 +119,268 @@ warn "You MUST provide an explicit true/false value to dynamic_config, skipping\n"; return $self; } - $self->{'values'}{'dynamic_config'} = $_[0] ? 1 : 0; + $self->{values}{dynamic_config} = $_[0] ? 1 : 0; return $self; } sub all_from { - my ( $self, $file ) = @_; + my ( $self, $file ) = @_; + + unless ( defined($file) ) { + my $name = $self->name + or die "all_from called with no args without setting name() first"; + $file = join('/', 'lib', split(/-/, $name)) . '.pm'; + $file =~ s{.*/}{} unless -e $file; + die "all_from: cannot find $file from $name" unless -e $file; + } + + # Some methods pull from POD instead of code. + # If there is a matching .pod, use that instead + my $pod = $file; + $pod =~ s/\.pm$/.pod/i; + $pod = $file unless -e $pod; + + # Pull the different values + $self->name_from($file) unless $self->name; + $self->version_from($file) unless $self->version; + $self->perl_version_from($file) unless $self->perl_version; + $self->author_from($pod) unless $self->author; + $self->license_from($pod) unless $self->license; + $self->abstract_from($pod) unless $self->abstract; - unless ( defined($file) ) { - my $name = $self->name - or die "all_from called with no args without setting name() first"; - $file = join('/', 'lib', split(/-/, $name)) . '.pm'; - $file =~ s{.*/}{} unless -e $file; - die "all_from: cannot find $file from $name" unless -e $file; - } - - $self->version_from($file) unless $self->version; - $self->perl_version_from($file) unless $self->perl_version; - - # The remaining probes read from POD sections; if the file - # has an accompanying .pod, use that instead - my $pod = $file; - if ( $pod =~ s/\.pm$/.pod/i and -e $pod ) { - $file = $pod; - } - - $self->author_from($file) unless $self->author; - $self->license_from($file) unless $self->license; - $self->abstract_from($file) unless $self->abstract; + return 1; } sub provides { - my $self = shift; - my $provides = ( $self->{values}{provides} ||= {} ); - %$provides = (%$provides, @_) if @_; - return $provides; + my $self = shift; + my $provides = ( $self->{values}{provides} ||= {} ); + %$provides = (%$provides, @_) if @_; + return $provides; } sub auto_provides { - my $self = shift; - return $self unless $self->is_admin; - - unless (-e 'MANIFEST') { - warn "Cannot deduce auto_provides without a MANIFEST, skipping\n"; - return $self; - } - - # Avoid spurious warnings as we are not checking manifest here. - - local $SIG{__WARN__} = sub {1}; - require ExtUtils::Manifest; - local *ExtUtils::Manifest::manicheck = sub { return }; - - require Module::Build; - my $build = Module::Build->new( - dist_name => $self->name, - dist_version => $self->version, - license => $self->license, - ); - $self->provides(%{ $build->find_dist_packages || {} }); + my $self = shift; + return $self unless $self->is_admin; + unless (-e 'MANIFEST') { + warn "Cannot deduce auto_provides without a MANIFEST, skipping\n"; + return $self; + } + # Avoid spurious warnings as we are not checking manifest here. + local $SIG{__WARN__} = sub {1}; + require ExtUtils::Manifest; + local *ExtUtils::Manifest::manicheck = sub { return }; + + require Module::Build; + my $build = Module::Build->new( + dist_name => $self->name, + dist_version => $self->version, + license => $self->license, + ); + $self->provides( %{ $build->find_dist_packages || {} } ); } sub feature { - my $self = shift; - my $name = shift; - my $features = ( $self->{values}{features} ||= [] ); - - my $mods; - - if ( @_ == 1 and ref( $_[0] ) ) { - # The user used ->feature like ->features by passing in the second - # argument as a reference. Accomodate for that. - $mods = $_[0]; - } else { - $mods = \@_; - } - - my $count = 0; - push @$features, ( - $name => [ - map { - ref($_) ? ( ref($_) eq 'HASH' ) ? %$_ - : @$_ - : $_ - } @$mods - ] - ); + my $self = shift; + my $name = shift; + my $features = ( $self->{values}{features} ||= [] ); + my $mods; + + if ( @_ == 1 and ref( $_[0] ) ) { + # The user used ->feature like ->features by passing in the second + # argument as a reference. Accomodate for that. + $mods = $_[0]; + } else { + $mods = \@_; + } - return @$features; + my $count = 0; + push @$features, ( + $name => [ + map { + ref($_) ? ( ref($_) eq 'HASH' ) ? %$_ : @$_ : $_ + } @$mods + ] + ); + + return @$features; } sub features { - my $self = shift; - while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) { - $self->feature( $name, @$mods ); - } - return $self->{values}->{features} - ? @{ $self->{values}->{features} } - : (); + my $self = shift; + while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) { + $self->feature( $name, @$mods ); + } + return $self->{values}->{features} + ? @{ $self->{values}->{features} } + : (); } sub no_index { - my $self = shift; - my $type = shift; - push @{ $self->{values}{no_index}{$type} }, @_ if $type; - return $self->{values}{no_index}; + my $self = shift; + my $type = shift; + push @{ $self->{values}{no_index}{$type} }, @_ if $type; + return $self->{values}{no_index}; } sub read { - my $self = shift; - $self->include_deps( 'YAML', 0 ); + my $self = shift; + $self->include_deps( 'YAML::Tiny', 0 ); - require YAML; - my $data = YAML::LoadFile('META.yml'); + require YAML::Tiny; + my $data = YAML::Tiny::LoadFile('META.yml'); - # Call methods explicitly in case user has already set some values. - while ( my ( $key, $value ) = each %$data ) { - next unless $self->can($key); - if ( ref $value eq 'HASH' ) { - while ( my ( $module, $version ) = each %$value ) { - $self->can($key)->($self, $module => $version ); - } - } - else { - $self->can($key)->($self, $value); - } - } - return $self; + # Call methods explicitly in case user has already set some values. + while ( my ( $key, $value ) = each %$data ) { + next unless $self->can($key); + if ( ref $value eq 'HASH' ) { + while ( my ( $module, $version ) = each %$value ) { + $self->can($key)->($self, $module => $version ); + } + } else { + $self->can($key)->($self, $value); + } + } + return $self; } sub write { - my $self = shift; - return $self unless $self->is_admin; - $self->admin->write_meta; - return $self; + my $self = shift; + return $self unless $self->is_admin; + $self->admin->write_meta; + return $self; } sub version_from { - my ( $self, $file ) = @_; - require ExtUtils::MM_Unix; - $self->version( ExtUtils::MM_Unix->parse_version($file) ); + require ExtUtils::MM_Unix; + my ( $self, $file ) = @_; + $self->version( ExtUtils::MM_Unix->parse_version($file) ); } sub abstract_from { - my ( $self, $file ) = @_; - require ExtUtils::MM_Unix; - $self->abstract( - bless( - { DISTNAME => $self->name }, - 'ExtUtils::MM_Unix' - )->parse_abstract($file) - ); -} - -sub _slurp { - my ( $self, $file ) = @_; - - local *FH; - open FH, "< $file" or die "Cannot open $file.pod: $!"; - do { local $/; }; + require ExtUtils::MM_Unix; + my ( $self, $file ) = @_; + $self->abstract( + bless( + { DISTNAME => $self->name }, + 'ExtUtils::MM_Unix' + )->parse_abstract($file) + ); } -sub perl_version_from { - my ( $self, $file ) = @_; +sub name_from { + my $self = shift; + if ( + Module::Install::_read($_[0]) =~ m/ + ^ \s* + package \s* + ([\w:]+) + \s* ; + /ixms + ) { + my $name = $1; + $name =~ s{::}{-}g; + $self->name($name); + } else { + die "Cannot determine name from $_[0]\n"; + return; + } +} - if ( - $self->_slurp($file) =~ m/ - ^ - use \s* - v? - ([\d_\.]+) - \s* ; - /ixms - ) - { - my $v = $1; - $v =~ s{_}{}g; - $self->perl_version($1); - } - else { - warn "Cannot determine perl version info from $file\n"; - return; - } +sub perl_version_from { + my $self = shift; + if ( + Module::Install::_read($_[0]) =~ m/ + ^ + use \s* + v? + ([\d_\.]+) + \s* ; + /ixms + ) { + my $perl_version = $1; + $perl_version =~ s{_}{}g; + $self->perl_version($perl_version); + } else { + warn "Cannot determine perl version info from $_[0]\n"; + return; + } } sub author_from { - my ( $self, $file ) = @_; - my $content = $self->_slurp($file); - if ($content =~ m/ - =head \d \s+ (?:authors?)\b \s* - ([^\n]*) - | - =head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b \s* - .*? copyright .*? \d\d\d[\d.]+ \s* (?:\bby\b)? \s* - ([^\n]*) - /ixms) { - my $author = $1 || $2; - $author =~ s{E}{<}g; - $author =~ s{E}{>}g; - $self->author($author); - } - else { - warn "Cannot determine author info from $file\n"; - } + my $self = shift; + my $content = Module::Install::_read($_[0]); + if ($content =~ m/ + =head \d \s+ (?:authors?)\b \s* + ([^\n]*) + | + =head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b \s* + .*? copyright .*? \d\d\d[\d.]+ \s* (?:\bby\b)? \s* + ([^\n]*) + /ixms) { + my $author = $1 || $2; + $author =~ s{E}{<}g; + $author =~ s{E}{>}g; + $self->author($author); + } else { + warn "Cannot determine author info from $_[0]\n"; + } } sub license_from { - my ( $self, $file ) = @_; - - if ( - $self->_slurp($file) =~ m/ - ( - =head \d \s+ - (?:licen[cs]e|licensing|copyright|legal)\b - .*? - ) - (=head\\d.*|=cut.*|) - \z - /ixms - ) - { - my $license_text = $1; - my @phrases = ( - 'under the same (?:terms|license) as perl itself' => 'perl', 1, - 'GNU public license' => 'gpl', 1, - 'GNU lesser public license' => 'gpl', 1, - 'BSD license' => 'bsd', 1, - 'Artistic license' => 'artistic', 1, - 'GPL' => 'gpl', 1, - 'LGPL' => 'lgpl', 1, - 'BSD' => 'bsd', 1, - 'Artistic' => 'artistic', 1, - 'MIT' => 'mit', 1, - 'proprietary' => 'proprietary', 0, - ); - while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) { - $pattern =~ s{\s+}{\\s+}g; - if ( $license_text =~ /\b$pattern\b/i ) { - if ( $osi and $license_text =~ /All rights reserved/i ) { - warn "LEGAL WARNING: 'All rights reserved' may invalidate Open Source licenses. Consider removing it."; + my $self = shift; + if ( + Module::Install::_read($_[0]) =~ m/ + ( + =head \d \s+ + (?:licen[cs]e|licensing|copyright|legal)\b + .*? + ) + (=head\\d.*|=cut.*|) + \z + /ixms ) { + my $license_text = $1; + my @phrases = ( + 'under the same (?:terms|license) as perl itself' => 'perl', 1, + 'GNU public license' => 'gpl', 1, + 'GNU lesser public license' => 'lgpl', 1, + 'BSD license' => 'bsd', 1, + 'Artistic license' => 'artistic', 1, + 'GPL' => 'gpl', 1, + 'LGPL' => 'lgpl', 1, + 'BSD' => 'bsd', 1, + 'Artistic' => 'artistic', 1, + 'MIT' => 'mit', 1, + 'proprietary' => 'proprietary', 0, + ); + while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) { + $pattern =~ s{\s+}{\\s+}g; + if ( $license_text =~ /\b$pattern\b/i ) { + if ( $osi and $license_text =~ /All rights reserved/i ) { + warn "LEGAL WARNING: 'All rights reserved' may invalidate Open Source licenses. Consider removing it."; + } + $self->license($license); + return 1; + } } - $self->license($license); - return 1; - } - } - } + } + + warn "Cannot determine license info from $_[0]\n"; + return 'unknown'; +} - warn "Cannot determine license info from $file\n"; - return 'unknown'; +sub install_script { + my $self = shift; + my $args = $self->makemaker_args; + my $exe = $args->{EXE_FILES} ||= []; + foreach ( @_ ) { + if ( -f $_ ) { + push @$exe, $_; + } elsif ( -d 'script' and -f "script/$_" ) { + push @$exe, "script/$_"; + } else { + die "Cannot find script '$_'"; + } + } } 1; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/WriteAll.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/WriteAll.pm 2008/02/21 00:21:28 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/WriteAll.pm 2008/05/07 18:16:52 1.2 @@ -4,40 +4,37 @@ use strict; use Module::Install::Base; -use vars qw{$VERSION $ISCORE @ISA}; +use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '0.67'; - $ISCORE = 1; + $VERSION = '0.72'; @ISA = qw{Module::Install::Base}; + $ISCORE = 1; } sub WriteAll { - my $self = shift; - my %args = ( - meta => 1, - sign => 0, - inline => 0, - check_nmake => 1, - @_ - ); - - $self->sign(1) if $args{sign}; - $self->Meta->write if $args{meta}; - $self->admin->WriteAll(%args) if $self->is_admin; - - if ( $0 =~ /Build.PL$/i ) { - $self->Build->write; - } else { - $self->check_nmake if $args{check_nmake}; - unless ( $self->makemaker_args->{'PL_FILES'} ) { - $self->makemaker_args( PL_FILES => {} ); - } - if ($args{inline}) { - $self->Inline->write; - } else { - $self->Makefile->write; - } - } + my $self = shift; + my %args = ( + meta => 1, + sign => 0, + inline => 0, + check_nmake => 1, + @_, + ); + + $self->sign(1) if $args{sign}; + $self->Meta->write if $args{meta}; + $self->admin->WriteAll(%args) if $self->is_admin; + + $self->check_nmake if $args{check_nmake}; + unless ( $self->makemaker_args->{PL_FILES} ) { + $self->makemaker_args( PL_FILES => {} ); + } + + if ( $args{inline} ) { + $self->Inline->write; + } else { + $self->Makefile->write; + } } 1; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Win32.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Win32.pm 2008/02/21 00:21:28 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Win32.pm 2008/05/07 18:16:52 1.2 @@ -4,11 +4,11 @@ use strict; use Module::Install::Base; -use vars qw{$VERSION $ISCORE @ISA}; +use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '0.67'; - $ISCORE = 1; + $VERSION = '0.72'; @ISA = qw{Module::Install::Base}; + $ISCORE = 1; } # determine if the user needs nmake, and download it if needed @@ -16,7 +16,7 @@ my $self = shift; $self->load('can_run'); $self->load('get_file'); - + require Config; return unless ( $^O eq 'MSWin32' and @@ -38,8 +38,7 @@ remove => 1, ); - if (!$rv) { - die <<'END_MESSAGE'; + die <<'END_MESSAGE' unless $rv; ------------------------------------------------------------------------------- @@ -59,7 +58,7 @@ ------------------------------------------------------------------------------- END_MESSAGE - } + } 1; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Can.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Can.pm 2008/02/21 00:21:28 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Can.pm 2008/05/07 18:16:52 1.2 @@ -11,7 +11,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Fetch.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Fetch.pm 2008/02/21 00:21:28 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Fetch.pm 2008/05/07 18:16:52 1.2 @@ -6,7 +6,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } rcsdiff: /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/RCS/Scripts.pm,v: No such file or directory From kawas at dev.open-bio.org Wed May 7 14:20:29 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 May 2008 14:20:29 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805071820.m47IKTDD009819@dev.open-bio.org> kawas Wed May 7 14:20:29 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server In directory dev.open-bio.org:/tmp/cvs-serv9784 Modified Files: MANIFEST Log Message: updated the manifest to take into account the module install update moby-live/Perl/MOBY-Server MANIFEST,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/MANIFEST,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Perl/MOBY-Server/MANIFEST 2008/03/20 17:36:33 1.5 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/MANIFEST 2008/05/07 18:20:29 1.6 @@ -1,5 +1,6 @@ bin/scripts/moby-s-install.pl Changes +drop_tables.sql inc/Module/AutoInstall.pm inc/Module/Install.pm inc/Module/Install/AutoInstall.pm @@ -9,7 +10,6 @@ inc/Module/Install/Include.pm inc/Module/Install/Makefile.pm inc/Module/Install/Metadata.pm -inc/Module/Install/Scripts.pm inc/Module/Install/Share.pm inc/Module/Install/Win32.pm inc/Module/Install/WriteAll.pm @@ -54,9 +54,6 @@ lib/MOBY/MOBYXSLT.pm lib/MOBY/mysql.pm lib/MOBY/OntologyServer.pm -lib/MOBY/RDF/Parsers/NamespaceParser.pm -lib/MOBY/RDF/Parsers/ServiceTypeParser.pm -lib/MOBY/RDF/Parsers/DatatypeParser.pm lib/MOBY/RDF/Ontologies/Cache/CacheUtils.pm lib/MOBY/RDF/Ontologies/Cache/NamespaceCache.pm lib/MOBY/RDF/Ontologies/Cache/ObjectCache.pm @@ -66,6 +63,9 @@ lib/MOBY/RDF/Ontologies/Objects.pm lib/MOBY/RDF/Ontologies/Services.pm lib/MOBY/RDF/Ontologies/ServiceTypes.pm +lib/MOBY/RDF/Parsers/DatatypeParser.pm +lib/MOBY/RDF/Parsers/NamespaceParser.pm +lib/MOBY/RDF/Parsers/ServiceTypeParser.pm lib/MOBY/RDF/Predicates/DC_PROTEGE.pm lib/MOBY/RDF/Predicates/FETA.pm lib/MOBY/RDF/Predicates/MOBY_PREDICATES.pm @@ -119,5 +119,5 @@ t/Config.t t/CrossReference.t t/MOBY.t +t/mobycentral.config t/Template.t - From kawas at dev.open-bio.org Wed May 7 14:24:29 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 May 2008 14:24:29 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805071824.m47IOTDf009949@dev.open-bio.org> kawas Wed May 7 14:24:29 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Client In directory dev.open-bio.org:/tmp/cvs-serv9914/Perl/MOBY-Client Modified Files: Makefile.PL Log Message: moby-live/Perl/MOBY-Client Makefile.PL,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/Makefile.PL,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Perl/MOBY-Client/Makefile.PL 2008/04/23 13:08:11 1.6 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/Makefile.PL 2008/05/07 18:24:29 1.7 @@ -10,8 +10,6 @@ build_requires 'Test::More' => 0; build_requires 'Test::Pod' => 0; -requires( perl => 5.005 ); - # MOBY::Client::* depends requires 'SOAP::Lite' => '0.60'; requires 'XML::LibXML' => 0; From kawas at dev.open-bio.org Wed May 7 14:27:31 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 May 2008 14:27:31 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805071827.m47IRV5m010013@dev.open-bio.org> kawas Wed May 7 14:27:31 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Client In directory dev.open-bio.org:/tmp/cvs-serv9978 Modified Files: MANIFEST Log Message: updated the manifest to take into account the module install update moby-live/Perl/MOBY-Client MANIFEST,1.8,1.9 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/MANIFEST,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Perl/MOBY-Client/MANIFEST 2008/03/13 19:12:59 1.8 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/MANIFEST 2008/05/07 18:27:31 1.9 @@ -8,17 +8,16 @@ inc/Module/Install/Include.pm inc/Module/Install/Makefile.pm inc/Module/Install/Metadata.pm -inc/Module/Install/Scripts.pm inc/Module/Install/Share.pm inc/Module/Install/Win32.pm inc/Module/Install/WriteAll.pm INSTALL -lib/MOBY/Client/Central.pm -lib/MOBY/Client/CollectionArticle.pm lib/MOBY/Async/LSAE.pm lib/MOBY/Async/Service.pm lib/MOBY/Async/SimpleServer.pm lib/MOBY/Async/WSRF.pm +lib/MOBY/Client/Central.pm +lib/MOBY/Client/CollectionArticle.pm lib/MOBY/Client/Exception/MobyException.pm lib/MOBY/Client/Exception/MobyExceptionCodes.pm lib/MOBY/Client/OntologyServer.pm @@ -28,9 +27,12 @@ lib/MOBY/Client/ServiceInstance.pm lib/MOBY/Client/SimpleArticle.pm lib/MOBY/Client/SimpleInput.pm +lib/MOBY/CommonSubs.pm +lib/MOBY/CrossReference.pm +lib/MOBY/MobyXMLConstants.pm +lib/MOBY/RDF/Parsers/DatatypeParser.pm lib/MOBY/RDF/Parsers/NamespaceParser.pm lib/MOBY/RDF/Parsers/ServiceTypeParser.pm -lib/MOBY/RDF/Parsers/DatatypeParser.pm lib/MOBY/RDF/Predicates/DC_PROTEGE.pm lib/MOBY/RDF/Predicates/FETA.pm lib/MOBY/RDF/Predicates/MOBY_PREDICATES.pm @@ -38,17 +40,13 @@ lib/MOBY/RDF/Predicates/OWL.pm lib/MOBY/RDF/Predicates/RDF.pm lib/MOBY/RDF/Predicates/RDFS.pm -lib/MOBY/CommonSubs.pm -lib/MOBY/CrossReference.pm -lib/MOBY/MobyXMLConstants.pm lib/MOBY/RDF/Utils.pm License Makefile.PL MANIFEST This list of files META.yml +populate_libs.pl README -share/HelloWorldService.pm -share/LocalServices.pm scripts/DebugYourService.pl scripts/FindServices.pl scripts/GetDump.pl @@ -57,6 +55,8 @@ scripts/GetServicesProviders.pl scripts/GetServicesTypes.pl scripts/MOBY-Client05.cgi +share/HelloWorldService.pm +share/LocalServices.pm t/Client-Central.t t/Client-CollectionArticle.t t/Client-OntologyServer.t @@ -65,4 +65,3 @@ t/Client-Service.t t/Client-ServiceInstance.t t/Client-SimpleArticle.t - From kawas at dev.open-bio.org Fri May 9 16:21:49 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 9 May 2008 16:21:49 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805092021.m49KLntG019598@dev.open-bio.org> kawas Fri May 9 16:21:48 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY/Cache In directory dev.open-bio.org:/tmp/cvs-serv19562/Perl/MOSES-MOBY/lib/MOSES/MOBY/Cache Modified Files: Central.pm Log Message: fixed bug that occurs when a registry url is specified. The bug is that the endpoint and namespace end up being the registry url and this causes a failure when the SOAP calls are made. moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY/Cache Central.pm,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY/Cache/Central.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY/Cache/Central.pm 2008/04/29 19:02:37 1.5 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY/Cache/Central.pm 2008/05/09 20:21:48 1.6 @@ -213,7 +213,7 @@ sub _namespace { my ($self, $registry) = @_; $registry ||= $self->registry; - return $registry if $registry =~ m"^http://"; + return "http://localhost/MOBY/Central" if $registry =~ m"^http://"; my $reg = $self->registries->get ($registry); return $reg->{namespace} if $reg; return $self->registries->get ('default')->{namespace}; From kawas at dev.open-bio.org Fri May 9 16:26:04 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 9 May 2008 16:26:04 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805092026.m49KQ4ic019660@dev.open-bio.org> kawas Fri May 9 16:26:04 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts In directory dev.open-bio.org:/tmp/cvs-serv19621/Perl/MOSES-MOBY/bin/scripts Modified Files: moses-generate-datatypes.pl moses-generate-services.pl Log Message: new -R option added. this allows you to specify a registry url on the command line moby-live/Perl/MOSES-MOBY/bin/scripts moses-generate-datatypes.pl,1.3,1.4 moses-generate-services.pl,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts/moses-generate-datatypes.pl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts/moses-generate-datatypes.pl 2008/02/21 00:12:55 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts/moses-generate-datatypes.pl 2008/05/09 20:26:04 1.4 @@ -8,15 +8,15 @@ # some command-line options use Getopt::Std; -use vars qw/ $opt_h $opt_f $opt_u $opt_d $opt_v $opt_s /; -getopt; +use vars qw/ $opt_h $opt_f $opt_R $opt_u $opt_d $opt_v $opt_s /; +getopts('hfudvsR:'); # usage if ($opt_h) { print STDOUT <<'END_OF_USAGE'; Generate datatypes. -Usage: [-vds] [data-type-name] [data-type-name...] - [-uf] +Usage: [-R registry-string] [-vds] [data-type-name] [data-type-name...] + [-R registry-string] [-uf] It also needs to get a location of a local cache (and potentially a BioMoby registry endpoint, and an output directory). It takes @@ -24,6 +24,14 @@ If no data type given it generates all of them. + -R ... a registry string in the form: + registry-url[@registry-uri] + where registry-uri is optional. + For example: + http://localhost/cgi-bin/MOBY-Central.pl + or + http://localhost/cgi-bin/MOBY-Central.pl at http://localhost/MOBY/Central + -s ... show generated code on STDOUT (no file is created, disabled when no data type name given) -f ... fill the cache @@ -46,8 +54,14 @@ sub say { print @_, "\n"; } +if ($opt_R) { + my @r = split(/\@/, $opt_R); + $opt_R = $r[0]; +} my $generator = new MOSES::MOBY::Generators::GenTypes; +$generator->registry($opt_R) if $opt_R; + if ($opt_f) { my $cache = MOSES::MOBY::Cache::Central->new ( cachedir => $generator->cachedir, =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts/moses-generate-services.pl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts/moses-generate-services.pl 2008/04/29 19:58:37 1.4 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts/moses-generate-services.pl 2008/05/09 20:26:04 1.5 @@ -8,17 +8,17 @@ # some command-line options use Getopt::Std; -use vars qw/ $opt_h $opt_d $opt_v $opt_a $opt_s $opt_b $opt_f $opt_u $opt_F $opt_S $opt_t $opt_c /; -getopt; +use vars qw/ $opt_h $opt_d $opt_R $opt_v $opt_a $opt_s $opt_b $opt_f $opt_u $opt_F $opt_S $opt_t $opt_c /; +getopts('hdvasbfuFStcR:'); # usage if (not($opt_u or $opt_f)) { if ($opt_h or (not $opt_a and @ARGV == 0)) { print STDOUT <<'END_OF_USAGE'; Generate Services. -Usage: [-vds] [-b|S|t] authority [service-name] [service-name...] - [-vds] [-b|S|t] authority - [-vd] [-b|S|t]a - [-fu] +Usage: [-vds] [-R registry-string] [-b|S|t] authority [service-name] [service-name...] + [-vds] [-R registry-string] [-b|S|t] authority + [-vd] [-R registry-string] [-b|S|t] -a + [-R registry-string] [-fu] It also needs to get a location of a local cache (and potentially a BioMoby registry endpoint, and an output directory). It takes @@ -27,6 +27,14 @@ -f ... fill the cache -u ... update the cache + -R ... a registry string in the form: + registry-url[@registry-uri] + where registry-uri is optional. + For example: + http://localhost/cgi-bin/MOBY-Central.pl + or + http://localhost/cgi-bin/MOBY-Central.pl at http://localhost/MOBY/Central + -b ... generate base[s] of given service[s] -S ... generate implementation and the base of service[s], the implementation module has enabled option to read the base @@ -66,8 +74,13 @@ sub say { print @_, "\n"; } +if ($opt_R) { + my @r = split(/\@/, $opt_R); + $opt_R = $r[0]; +} my $generator = new MOSES::MOBY::Generators::GenServices; +$generator->registry($opt_R) if $opt_R; if ($opt_f) { my $cache = MOSES::MOBY::Cache::Central->new ( From kawas at dev.open-bio.org Fri May 9 16:37:03 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 9 May 2008 16:37:03 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805092037.m49Kb3m4019720@dev.open-bio.org> kawas Fri May 9 16:37:03 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY In directory dev.open-bio.org:/tmp/cvs-serv19685/Perl/MOSES-MOBY Modified Files: Changes Log Message: changes made for 0.85 release moby-live/Perl/MOSES-MOBY Changes,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/Changes,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/Changes 2008/04/01 16:56:35 1.4 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/Changes 2008/05/09 20:37:03 1.5 @@ -1,13 +1,26 @@ Revision history for Perl extension MOSES::MOBY. -.84 Date here .... +.85 Fri May 9 7:52:35 2008 - fixed a bug in Parser.pm that created xrefs and called non-existent method isSimpleXref. - added namespace checking for inputs. It is inserted into impl code that is generated, but is commented out. + - added $VERSION to every module. As a result, + some of the modules have large increments in + version numbers with little changes to back up + the jump. Sorry. + - added support for 'cgi' category moby services + - updated the makefile to correctly identify the + version of IO::Prompt to use so that users dont + have to downgrade when they accidently install + the wrong version (i.e. 0.99.4) + - added a new -R option to the generate-* scripts. + This option allows you to specify a registry URL + to use when generating moses scripts. + -.83 Tue Dec 11 7:52:35 2007 +.84 Tue Dec 11 7:52:35 2007 - updated the default moby url to be the new ucalgary one because the one hosted at icapture died From kawas at dev.open-bio.org Fri May 9 16:51:37 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 9 May 2008 16:51:37 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805092051.m49Kpavl019761@dev.open-bio.org> kawas Fri May 9 16:51:36 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES In directory dev.open-bio.org:/tmp/cvs-serv19726/Perl/MOSES-MOBY/lib/MOSES Modified Files: MOBY.pm Log Message: added some more brief documentation. more to come moby-live/Perl/MOSES-MOBY/lib/MOSES MOBY.pm,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY.pm 2008/02/21 00:12:56 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY.pm 2008/05/09 20:51:36 1.4 @@ -7,7 +7,7 @@ use vars qw{$VERSION @ISA @EXPORT @EXPORT_OK}; BEGIN { - $VERSION = '0.84'; + $VERSION = sprintf "%d.%02d", q$Revision$ =~ /: (\d+)\.(\d+)/; @ISA = qw{ Exporter }; @EXPORT = qw{}; @EXPORT_OK = qw{}; @@ -318,6 +318,9 @@ =item * FindBin +=item * + IO::Prompt - try to install version 0.99.2 and not 0.99.4 + =back =cut @@ -786,9 +789,11 @@ You can use option I<-s> to get the generated result directly on the screen (in that case no file is created). -You can use the option B<-u> updates the datatype cache. +You can use the option B<-u> to update the datatype cache. + +You can use the option B<-f> to fill the datatype cache. -You can use the option B<-f> fills the datatype cache. +The B<-R> option allows you to specify a registry endpoint. For instance, -R http://moby.ucalgary.ca/moby/MOBY-Central.pl would cause the script to use UCalgary registry. The BioMoby primitive types (String, Integer, Float, Boolean and DateTime) are never generated. They were created manually. @@ -873,6 +878,10 @@ rather than load the base" enabled.

Option -u updates the service cache.

Option -f fills the service cache.

+ Option -R allows you to specify a registry endpoint. + For instance, + -R http://moby.ucalgary.ca/moby/MOBY-Central.pl + would cause the script to use UCalgary registry. =end html @@ -1903,7 +1912,7 @@ ScriptAlias /cgi-bin/

  • Underneath this text, enter something like the following (replace Eddie with your username):
    ScriptAlias /services/ "C:/Documents and Settings/Eddie/Perl-MoSeS/"
  • -
  • Just below this, after the </IfModule> line, add the following text (replace Eddie with your username): +
  • Just below this, after the </IfModule> line, add the following text (replace Eddie with your username and the directory with your directory):
           <Directory "C:/Documents and Settings/Eddie/Perl-MoSeS">
              AllowOverride None
    @@ -1949,7 +1958,7 @@
     
     It is B that you change the name of the file if you anticipate other users B to the cgi-bin directory as well!
     
    -Once the file has been copied, then change the ownership of the file to the web servers' user/group.
    +Once the file has been copied, change the ownership of the file to the web servers' user/group. Also, make sure that the path (and its parents) to all of the directories in the 'use lib ...' are readable by your web server. 
     
     That's all there is to it! Now when you test your services, remember that your file may no longer be called MobyServer.cgi, but something else that you named it!
     
    @@ -1997,21 +2006,26 @@
     
     =cut
     
    -=head2 EXPORT
    +=head1 EXPORT
     
     None by default.
     
     
     =head1 SEE ALSO
     
    -For the most up-to-date documentation, visit the Perl MoSes online documentation:
    +=head2 Tutorials on building services
    +
    +For some tutorials on using Perl MoSeS:
     
     =begin html
     
    -	Perl MoSeS - Online
    +	Tutorial for creating SOAP based Biomoby Services
    + Tutorial for creating CGI based Biomoby Services =end html +=cut + If you have questions or comments, please feel free to message us on the following mailing lists: =over From kawas at dev.open-bio.org Fri May 9 16:54:31 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 9 May 2008 16:54:31 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805092054.m49KsV2v019837@dev.open-bio.org> kawas Fri May 9 16:54:31 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY In directory dev.open-bio.org:/tmp/cvs-serv19802/Perl/MOSES-MOBY Modified Files: README Log Message: moby-live/Perl/MOSES-MOBY README,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/README,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/README 2008/04/29 20:09:35 1.4 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/README 2008/05/09 20:54:31 1.5 @@ -1,17 +1,18 @@ -MOSES-MOBY version .84 +MOSES-MOBY version .85 ====================== OVERVIEW -Perl Moses is a generator of Perl code - but this -code does not need to be always stored in files, -it can be generated on-the-fly every time a -service is called. Also, there are up to four -things to be generated: objects representing -BioMoby data types, classes establishing bases -for services, empty (but working) service -implementation modules, and cgi-bin scripts, -the entry points to BioMoby services. +Perl MoSeS is a generator of Perl based BioMOBY +web services (SOAP & CGI based). This module +will hopefully help all those service providers +that have something to offer, but don't want to +get overwhelmed by the BioMOBY services protocol. + +Perl MoSeS takes care of all data marshalling and +un-marshalling, web service transporting, and much +more, leaving the service provider the sole task +of providing the business logic for their service. INSTALLATION From kawas at dev.open-bio.org Fri May 9 20:23:06 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 9 May 2008 20:23:06 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805100023.m4A0N5uv020332@dev.open-bio.org> kawas Fri May 9 20:23:05 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY/Generators In directory dev.open-bio.org:/tmp/cvs-serv20297/Perl/MOSES-MOBY/lib/MOSES/MOBY/Generators Modified Files: GenServices.pm Log Message: moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY/Generators GenServices.pm,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY/Generators/GenServices.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY/Generators/GenServices.pm 2008/04/29 19:58:37 1.5 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY/Generators/GenServices.pm 2008/05/10 00:23:05 1.6 @@ -332,8 +332,7 @@ # we cannot easily check whether the same file was already # generated - so we don't my $outfile = - File::Spec->catfile ( $outdir, split (/\./, $obj->authority), $obj->name ) - . '.cgi'; + File::Spec->catfile ( $outdir, split (/\./, $obj->authority), $obj->name ) . '.cgi'; $tt->process ( $input, { obj => $obj, @@ -342,7 +341,9 @@ services_dir => $MOBYCFG::GENERATORS_IMPL_OUTDIR, }, $outfile ) || $LOG->logdie ($tt->error()); - chmod 0755, $outfile; + chmod (0755, $outfile); + $LOG->info ("\tCGI service created at '$outfile'\n"); + } } } From kawas at dev.open-bio.org Fri May 9 20:23:44 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 9 May 2008 20:23:44 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805100023.m4A0NiOZ020372@dev.open-bio.org> kawas Fri May 9 20:23:44 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES In directory dev.open-bio.org:/tmp/cvs-serv20337/Perl/MOSES-MOBY/lib/MOSES Modified Files: MOBY.pm Log Message: moby-live/Perl/MOSES-MOBY/lib/MOSES MOBY.pm,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY.pm 2008/05/09 20:51:36 1.4 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY.pm 2008/05/10 00:23:44 1.5 @@ -876,6 +876,8 @@ do it again in the run-time - therefore, the service implementation is generated slightly differently - with an option "use the base, rather than load the base" enabled.

    + Option -c generates both a service base + as well as a CGI dispatcher script.

    Option -u updates the service cache.

    Option -f fills the service cache.

    Option -R allows you to specify a registry endpoint. From kawas at dev.open-bio.org Sun May 11 19:41:48 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Sun, 11 May 2008 19:41:48 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805112341.m4BNfmOh000997@dev.open-bio.org> kawas Sun May 11 19:41:48 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY/t In directory dev.open-bio.org:/tmp/cvs-serv961/Perl/MOSES-MOBY/t Modified Files: MOSES-MOBY-Registry.t Log Message: updated the registry in the test to be the ucalgary one. moby-live/Perl/MOSES-MOBY/t MOSES-MOBY-Registry.t,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/t/MOSES-MOBY-Registry.t,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/t/MOSES-MOBY-Registry.t 2008/02/21 00:12:55 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/t/MOSES-MOBY-Registry.t 2008/05/11 23:41:48 1.4 @@ -21,7 +21,7 @@ can_ok($registry, ("get", "list", "add", "remove", "all")); # get should return default registry details -ok($registry->get->{endpoint} eq 'http://mobycentral.icapture.ubc.ca/cgi-bin/MOBY05/mobycentral.pl', "Check the 'get' method returns the default registry") or diag("'" . $registry->get->{endpoint} . "' was not expected."); +ok($registry->get->{endpoint} eq 'http://moby.ucalgary.ca/moby/MOBY-Central.pl', "Check the 'get' method returns the default registry") or diag("'" . $registry->get->{endpoint} . "' was not expected."); # shouldnt be able to add to persistent store, but should be in memory (0). my $ret = $registry->add( From kawas at dev.open-bio.org Sun May 11 19:44:37 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Sun, 11 May 2008 19:44:37 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805112344.m4BNibGn001157@dev.open-bio.org> kawas Sun May 11 19:44:37 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY In directory dev.open-bio.org:/tmp/cvs-serv1118/Perl/MOSES-MOBY Modified Files: Makefile.PL Changes Log Message: fixed a test case and re-releasing on cpan moby-live/Perl/MOSES-MOBY Makefile.PL,1.5,1.6 Changes,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/Makefile.PL,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/Makefile.PL 2008/05/07 17:50:57 1.5 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/Makefile.PL 2008/05/11 23:44:37 1.6 @@ -3,7 +3,7 @@ # Define metadata name 'MOSES-MOBY'; - version '0.85'; + version '0.86'; license 'perl'; abstract 'This distribution aids in the creation of BioMOBY perl based web services.'; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/Changes,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/Changes 2008/05/09 20:37:03 1.5 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/Changes 2008/05/11 23:44:37 1.6 @@ -1,6 +1,9 @@ Revision history for Perl extension MOSES::MOBY. .85 Fri May 9 7:52:35 2008 + - fixed a bug in one of the test cases. + +.85 Fri May 9 7:52:35 2008 - fixed a bug in Parser.pm that created xrefs and called non-existent method isSimpleXref. - added namespace checking for inputs. It is From kawas at dev.open-bio.org Mon May 12 11:05:29 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 12 May 2008 11:05:29 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805121505.m4CF5T7p005633@dev.open-bio.org> kawas Mon May 12 11:05:28 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv5598/Perl/MOBY-Server/lib/MOBY/Client Modified Files: Central.pm Log Message: Fixed DUMP Not sure when DUMP broke, but our custom serializer (MOBY::SOAP::Serializer) stated that 'this wont work for the DUMP call if and when a SOAP::Data object is passed' and sure enough, in the _call() method in MOBY::Client::Central, a SOAP::Data object was passed to DUMP. This is now fixed thanks to Pieter Neerincx moby-live/Perl/MOBY-Server/lib/MOBY/Client Central.pm,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Client/Central.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Client/Central.pm 2008/03/06 18:04:35 1.3 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Client/Central.pm 2008/05/12 15:05:28 1.4 @@ -1924,10 +1924,16 @@ # return $self->SOAP_connection($reg)->call('DUMP')->paramsall; my ($SQLs) = $self->_call( $reg, 'DUMP_MySQL', "" ); my ( - $mobycentral, $mobyobject, $mobyservice, - $mobynamespace, $mobyrelationship - ) - = @{$SQLs}; + $mobycentral, $mobyobject, $mobyservice, + $mobynamespace, $mobyrelationship + ) = @{$SQLs} unless ref($SQLs) eq 'HASH'; + + # cases where soap message is serialized as a HASH + ( + $mobycentral, $mobyobject, $mobyservice, + $mobynamespace, $mobyrelationship + ) = @{$SQLs->{item}} if ref($SQLs) eq 'HASH'; + return ( $mobycentral, $mobyobject, $mobyservice, $mobynamespace, $mobyrelationship From kawas at dev.open-bio.org Mon May 12 11:08:10 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 12 May 2008 11:08:10 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805121508.m4CF8A0V005673@dev.open-bio.org> kawas Mon May 12 11:08:10 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server In directory dev.open-bio.org:/tmp/cvs-serv5638/Perl/MOBY-Server Modified Files: Changes Log Message: moby-live/Perl/MOBY-Server Changes,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/Changes,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Perl/MOBY-Server/Changes 2008/05/01 21:48:30 1.4 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/Changes 2008/05/12 15:08:10 1.5 @@ -1,7 +1,12 @@ Revision history for Perl extension MOBY. 1.04 - + - fixed bug in MOBY::Client::Central::DUMP that resulted + in an error ('Not an ARRAY reference at + MOBY/Client/Central.pm line 1927') being raised. + Thanks to Pieter Neerincx for finding the bug and a + solution. + - fixed bug that allowed service types to be registered with empty ISA relationships. From kawas at dev.open-bio.org Wed May 14 10:00:05 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 14 May 2008 10:00:05 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805141400.m4EE05jA012182@dev.open-bio.org> kawas Wed May 14 10:00:05 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/share/db/schema In directory dev.open-bio.org:/tmp/cvs-serv12146/Perl/MOBY-Server/share/db/schema Modified Files: mobycentral.mysql Log Message: reverted the schema for service_instance. moby-live/Perl/MOBY-Server/share/db/schema mobycentral.mysql,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/share/db/schema/mobycentral.mysql,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/MOBY-Server/share/db/schema/mobycentral.mysql 2008/05/01 17:42:46 1.2 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/share/db/schema/mobycentral.mysql 2008/05/14 14:00:05 1.3 @@ -60,7 +60,7 @@ -- CREATE TABLE service_instance ( - category enum('moby','soap','wsdl','rest','moby-async') default NULL, + category enum('moby','soap','wsdl','cgi','moby-async') default NULL, servicename varchar(255) NOT NULL default '', service_type_uri varchar(255) NOT NULL default '', authority_id int(10) unsigned NOT NULL default '0', From kawas at dev.open-bio.org Wed May 14 10:01:19 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 14 May 2008 10:01:19 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805141401.m4EE1Je5012242@dev.open-bio.org> kawas Wed May 14 10:01:19 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/share/cgi In directory dev.open-bio.org:/tmp/cvs-serv12207/Perl/MOBY-Server/share/cgi Modified Files: service_tester.pl Log Message: added code for testing category 'cgi' services moby-live/Perl/MOBY-Server/share/cgi service_tester.pl,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/share/cgi/service_tester.pl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/MOBY-Server/share/cgi/service_tester.pl 2008/04/16 13:52:03 1.2 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/share/cgi/service_tester.pl 2008/05/14 14:01:19 1.3 @@ -35,6 +35,8 @@ use MOBY::Client::Central; use SOAP::Lite; use XML::LibXML; +use HTTP::Request::Common qw(POST); +use LWP::UserAgent; # Because of this library, cannot run on windows use IPC::Shareable; @@ -116,28 +118,40 @@ } if $url =~ /localhost/; # child - stuff to do goes here + my $out = undef; + my $input = _empty_input(); + #print "Calling: " . $auth . "," . $name . "\n"; - my $soap = - SOAP::Lite->uri("http://biomoby.org/") - ->proxy( $url, timeout => $TIMEOUT )->on_fault( - sub { - my $soap = shift; - my $res = shift; - - #TODO add to DEAD hash ... - $alive_handle->shlock(); - $ALIVE{$auth} = () if not exists $ALIVE{$auth}; - push @{ $ALIVE{$auth} }, {name=>$name, alive=>undef}; - $alive_handle->shunlock(); + do { + my $soap = + SOAP::Lite->uri("http://biomoby.org/") + ->proxy( $url, timeout => $TIMEOUT )->on_fault( + sub { + my $soap = shift; + my $res = shift; + + #TODO add to DEAD hash ... + $alive_handle->shlock(); + $ALIVE{$auth} = () if not exists $ALIVE{$auth}; + push @{ $ALIVE{$auth} }, {name=>$name, alive=>undef}; + $alive_handle->shunlock(); + + #print "\t" . $auth . "," . $name . " ~isAlive\n"; + exit(0); + } + ); - #print "\t" . $auth . "," . $name . " ~isAlive\n"; - exit(0); - } - ); + $out = + $soap->$name( SOAP::Data->type( 'string' => "$input" ) )->result; + } unless $cat eq 'cgi'; + # test cgi services + do { + my $ua = LWP::UserAgent->new; + my $req = POST $opt_c, [ data => $input]; + $req = $ua->request($req); + $out = $req->content if $req->is_success; + } if $cat eq 'cgi'; - my $input = _empty_input(); - my $out = - $soap->$name( SOAP::Data->type( 'string' => "$input" ) )->result; do { #TODO add to ALIVE hash ... #print "\t" . $auth . "," . $name . " isAlive\n"; From kawas at dev.open-bio.org Wed May 14 10:04:03 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 14 May 2008 10:04:03 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805141404.m4EE43hF012302@dev.open-bio.org> kawas Wed May 14 10:04:03 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv12267/Perl/MOBY-Server/lib/MOBY/Client Modified Files: Central.pm Log Message: category 'cgi' is what the registry expects. fixed instances in the code that 'post' was used, rather than 'cgi' moby-live/Perl/MOBY-Server/lib/MOBY/Client Central.pm,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Client/Central.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Client/Central.pm 2008/05/12 15:05:28 1.4 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Client/Central.pm 2008/05/14 14:04:03 1.5 @@ -640,7 +640,7 @@ authURI => $authURI, contactEmail => "your at mail.address", description => $human_readable_description, - category => "moby" | "post" | "moby-async" + category => "moby" | "cgi" | "moby-async" URL => $URL_TO_SERVICE (or URL to WSDL document for wsdl-type services) input: listref; (articleName may be undef) @@ -738,13 +738,13 @@ #____________________________________________________________________________________________ return $self->errorRegXML( -"Only 'moby', 'post', 'moby-async', 'doc-literal', 'doc-literal-async' Service Categories are currently allowed - you gave me $Category" +"Only 'moby', 'cgi', 'moby-async', 'doc-literal', 'doc-literal-async' Service Categories are currently allowed - you gave me $Category" ) unless ( ( $Category eq 'moby' ) || ( $Category eq 'moby-async' ) || ( $Category eq 'doc-literal' ) || ( $Category eq 'doc-literal-async' ) - || ( $Category eq 'post' )); + || ( $Category eq 'cgi' )); return $self->errorRegXML( "All Fields Required: serviceName, serviceType, authURI, contactEmail, URL, description, Category, input, output, secondary" ) @@ -971,7 +971,7 @@ serviceType => $serviceType, (optional) authURI => $authURI, (optional) authoritative => 1, (optional) - category => "moby" | "post" | "moby-async" (optional) + category => "moby" | "cgi" | "moby-async" (optional) expandObjects => 1, (optional) expandServices => 1, (optional) URL => $URL_TO_SERVICE (optional) From kawas at dev.open-bio.org Wed May 14 10:06:23 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 14 May 2008 10:06:23 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805141406.m4EE6N2s012416@dev.open-bio.org> kawas Wed May 14 10:06:23 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY In directory dev.open-bio.org:/tmp/cvs-serv12381/Perl/MOBY-Server/lib/MOBY Modified Files: Central.pm Log Message: category 'cgi' is what the registry expects. fixed instances in the code that 'post' was used, rather than 'cgi' moby-live/Perl/MOBY-Server/lib/MOBY Central.pm,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Central.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Central.pm 2008/04/23 13:08:11 1.4 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Central.pm 2008/05/14 14:06:23 1.5 @@ -1102,7 +1102,7 @@ Input XML : - moby + moby YourServiceNameHere TypeOntologyTerm http://path.to/your/signature/RDF.rdf @@ -1330,14 +1330,14 @@ $error .= "missing Category \n" unless defined $Category; return &_error( "malformed payload $error\n\n", "" ) if ($error); return &_error( - "Category may take the (case sensitive) values 'moby', 'moby-async', 'post', 'doc-literal', and 'doc-literal-async', \n", + "Category may take the (case sensitive) values 'moby', 'moby-async', 'cgi', 'doc-literal', and 'doc-literal-async', \n", "" ) unless ( ( $Category eq "wsdl" ) || ( $Category eq "moby" ) || ( $Category eq "moby-async" ) - || ( $Category eq "post" ) + || ( $Category eq "cgi" ) || ( $Category eq "doc-literal" ) || ( $Category eq "doc-literal-async")); @@ -3274,7 +3274,7 @@ # do substitutions my $serviceType = $SI->category; my $wsdl; - if ($serviceType eq "post"){ + if ($serviceType eq "cgi"){ $wsdl = &_doPostWSDLReplacement(@_) } elsif ($serviceType eq "moby"){ $wsdl = &_doMobyWSDLReplacement(@_) @@ -4073,7 +4073,7 @@ END -# MOBY POST service template +# MOBY CGI service template $WSDL_POST_TEMPLATE = < From walexander at dev.open-bio.org Wed May 14 16:37:10 2008 From: walexander at dev.open-bio.org (Wendy Alexander) Date: Wed, 14 May 2008 16:37:10 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805142037.m4EKbAPu013256@dev.open-bio.org> walexander Wed May 14 16:37:10 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard In directory dev.open-bio.org:/tmp/cvs-serv13213 Modified Files: DashboardProperties.java ServiceCallerModel.java SimpleClientPanel.java Log Message: Modified the ping functionality in the Simple Client panel. Ping is now a checkbox option instead of a radio button. Also the 'Call Service' button text changes to reflect whether a ping is used or the data is being sent as bytes. moby-live/Java/src/main/org/biomoby/service/dashboard DashboardProperties.java,1.27,1.28 ServiceCallerModel.java,1.5,1.6 SimpleClientPanel.java,1.10,1.11 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DashboardProperties.java,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DashboardProperties.java 2008/03/19 22:50:46 1.27 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DashboardProperties.java 2008/05/14 20:37:10 1.28 @@ -65,7 +65,6 @@ static final String DP_CS_URL = "service-endpoint"; static final String DP_CS_NEWURL = "service-new-endpoint"; static final String DP_CS_REGISTRY = "as-registered"; - static final String DP_CS_PING = "ping"; static final String DP_ENDPOINT = "serviceEndpoint"; static final String DP_IMPL_CLASS = "serviceImplClass"; @@ -73,6 +72,7 @@ static final String DP_INP_SHOW = "showInput"; static final String DP_INP_SHOWXML = "showInputAsXML"; static final String DP_INP_ASBYTES = "sendInputAsBytes"; + static final String DP_INP_PING = "sendEmptyInputAsPing"; static final String DP_OUT_SHOW = "showOutput"; static final String DP_OUT_SHOWXML = "showOutputAsXML"; =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/ServiceCallerModel.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/ServiceCallerModel.java 2008/03/19 22:50:14 1.5 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/ServiceCallerModel.java 2008/05/14 20:37:10 1.6 @@ -145,7 +145,7 @@ if (! UUtils.isEmpty (sEndpoint)) clonedService.setURL (sEndpoint); - } else if (DP_CS_REGISTRY.equals (howToCall) || DP_CS_PING.equals(howToCall)) { + } else if (DP_CS_REGISTRY.equals (howToCall)) { clonedService.setURL (null); setRegistryEndpoint (propertyChannel.getString (DP_REGISTRY_ENDPOINT)); setRegistryNamespace (propertyChannel.getString (DP_REGISTRY_NAMESPACE)); =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/SimpleClientPanel.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/SimpleClientPanel.java 2008/03/19 22:49:47 1.10 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/SimpleClientPanel.java 2008/05/14 20:37:10 1.11 @@ -248,48 +248,28 @@ className = createText (null, DP_IMPL_CLASS, DP_IMPL_CLASS); ButtonGroup group = new ButtonGroup(); - JRadioButton htNone, htRegistry, htEndpoint, htLocal, htNewURL, htPing; + JRadioButton htNone, htRegistry, htEndpoint, htLocal, htNewURL; group.add (htEndpoint = createHowToButton ("Use service's usual endpoint", DP_CS_URL)); group.add (htNone = createHowToButton ("No real call, just show/echo input", DP_CS_NONE)); group.add (htRegistry = createHowToButton ("Ask registry where service is, and call it", DP_CS_REGISTRY)); group.add (htNewURL = createHowToButton ("Use this endpoint", DP_CS_NEWURL)); group.add (htLocal = createHowToButton ("Use this local class", DP_CS_CLASS)); - group.add (htPing = createHowToButton ("'Ping' this service", DP_CS_PING)); - htPing.setToolTipText("A Moby 'Ping' is used to determine if the service is responsive, " + - "and if it responds in an API-compliant manner"); - - - boolean usingAsBytes = getPrefValue (DP_INP_ASBYTES, false); - JCheckBox asBytes = createCheckBox - ("Send data to service as a byte array", - usingAsBytes, -1, - new ItemListener() { - public void itemStateChanged (ItemEvent e) { - boolean enabled = (e.getStateChange() == ItemEvent.SELECTED); - onAsBytes (enabled); - setPrefValue (DP_INP_ASBYTES, enabled); - propertyChannel.put (DP_INP_ASBYTES, - new Boolean (enabled).toString()); - } - }); - onAsBytes (usingAsBytes); - asBytes.setToolTipText ("It should not have any effect on result; it is for debugging"); - Font font = asBytes.getFont(); - asBytes.setFont (font.deriveFont (Math.max (1, font.getSize2D() - 1))); - - SwingUtils.addComponent (howTo, htEndpoint, 0, 0, 2, 1, HORI, NWEST, 1.0, 0.0); - SwingUtils.addComponent (howTo, htNewURL, 0, 1, 1, 1, NONE, NWEST, 0.0, 0.0); - SwingUtils.addComponent (howTo, endpoint, 1, 1, 1, 1, HORI, NWEST, 1.0, 0.0); - SwingUtils.addComponent (howTo, htRegistry, 0, 2, 2, 1, NONE, NWEST, 0.0, 0.0); - SwingUtils.addComponent (howTo, htLocal, 0, 3, 1, 1, NONE, NWEST, 0.0, 0.0); - SwingUtils.addComponent (howTo, className, 1, 3, 1, 1, HORI, NWEST, 1.0, 0.0); - SwingUtils.addComponent (howTo, htNone, 0, 4, 2, 1, NONE, NWEST, 0.0, 0.0); - SwingUtils.addComponent (howTo, htPing, 0, 5, 2, 1, NONE, NWEST, 0.0, 0.0); - SwingUtils.addComponent (howTo, asBytes, 0, 6, 2, 1, NONE, NWEST, 0.0, 0.0, BREATH_TOP); // run the service + // determine button text from preferences + boolean usingPing = getPrefValue (DP_INP_PING, false); + boolean usingAsBytes = getPrefValue (DP_INP_ASBYTES, false); + String runLabel = " Call Service "; + if (usingPing) { + if (usingAsBytes) runLabel = " Ping and Show Input "; + else runLabel = " Ping Service "; + } + else { + if (usingAsBytes) runLabel = " Show Input "; + } + runButton = - createButton (" Call service ", + createButton (runLabel, "Invoke selected service", KeyEvent.VK_C, new ActionListener() { @@ -324,6 +304,74 @@ JPanel buttonPanel = createButtonPanel (new JButton[] { runButton, stopButton }); + + JCheckBox asPing = createCheckBox + ("'Ping' this service", + usingPing, -1, + new ItemListener() { + public void itemStateChanged (ItemEvent e) { + boolean enabled = (e.getStateChange() == ItemEvent.SELECTED); + setPropertySelect (enabled, DP_INP_PING); + setPrefValue (DP_INP_PING, enabled); + propertyChannel.put (DP_INP_PING, + new Boolean (enabled).toString()); + if (enabled) { + if (propertyChannel.getString(DP_INP_ASBYTES).toLowerCase().equals("true")) + runButton.setText(" Ping and Show Input "); + else runButton.setText(" Ping Service "); + } + else { + if (propertyChannel.getString(DP_INP_ASBYTES).toLowerCase().equals("true")) + runButton.setText(" Show Input "); + else runButton.setText(" Call Service "); + } + } + }); + setPropertySelect (usingPing, DP_INP_PING); + asPing.setToolTipText ("A Moby 'Ping' is used to determine if the service is responsive " + + "and if it responds in an API-compliant manner."); + Font font = asPing.getFont(); + asPing.setFont (font.deriveFont (Math.max (1, font.getSize2D() - 1))); + + JCheckBox asBytes = createCheckBox + ("Send data to service as a byte array", + usingAsBytes, -1, + new ItemListener() { + public void itemStateChanged (ItemEvent e) { + boolean enabled = (e.getStateChange() == ItemEvent.SELECTED); + setPropertySelect (enabled, DP_INP_ASBYTES); + setPrefValue (DP_INP_ASBYTES, enabled); + propertyChannel.put (DP_INP_ASBYTES, + new Boolean (enabled).toString()); + if (enabled) { + if (propertyChannel.getString(DP_INP_PING).toLowerCase().equals("true")) + runButton.setText(" Ping and Show Input "); + else runButton.setText(" Show Input "); + } + else { + if (propertyChannel.getString(DP_INP_PING).toLowerCase().equals("true")) + runButton.setText(" Ping Service "); + else runButton.setText(" Call Service "); + } + + } + }); + setPropertySelect (usingAsBytes, DP_INP_ASBYTES); + asBytes.setToolTipText ("It should not have any effect on result; it is for debugging"); + font = asBytes.getFont(); + asBytes.setFont (font.deriveFont (Math.max (1, font.getSize2D() - 1))); + + + SwingUtils.addComponent (howTo, htEndpoint, 0, 0, 2, 1, HORI, NWEST, 1.0, 0.0); + SwingUtils.addComponent (howTo, htNewURL, 0, 1, 1, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent (howTo, endpoint, 1, 1, 1, 1, HORI, NWEST, 1.0, 0.0); + SwingUtils.addComponent (howTo, htRegistry, 0, 2, 2, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent (howTo, htLocal, 0, 3, 1, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent (howTo, className, 1, 3, 1, 1, HORI, NWEST, 1.0, 0.0); + SwingUtils.addComponent (howTo, htNone, 0, 4, 2, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent (howTo, asPing, 0, 5, 2, 1, NONE, NWEST, 0.0, 0.0, BREATH_TOP); + SwingUtils.addComponent (howTo, asBytes, 0, 6, 2, 1, NONE, NWEST, 0.0, 0.0); + Component glue = Box.createVerticalGlue(); SwingUtils.addComponent (p, selService, 0, 0, 1, 1, NONE, CENTER, 0.0, 0.0); @@ -334,12 +382,11 @@ } /************************************************************************** - * Select/unselect using 'send as bytes'... + * Select/unselect using 'send as bytes' or 'ping'... **************************************************************************/ - protected void onAsBytes (boolean enabled) { - setPrefValue (DP_INP_ASBYTES, enabled); - propertyChannel.put (DP_INP_ASBYTES, - new Boolean (enabled).toString()); + protected void setPropertySelect (boolean enabled, String property) { + setPrefValue (property, enabled); + propertyChannel.put (property, new Boolean (enabled).toString()); } /************************************************************************** @@ -542,7 +589,7 @@ } // If we are only pinging the service, set the data object to an empty message - if (DP_CS_PING.equals(propertyChannel.getString(DP_CALL_SERVICE))) { + if (propertyChannel.getString(DP_INP_PING).toLowerCase().equals("true")) { String emptyMsg = "\n" + "\n" + " \n" + @@ -576,7 +623,7 @@ if (exception == null) { // handle results here (using renderers...) - if (DP_CS_PING.equals(propertyChannel.getString(DP_CALL_SERVICE))) { + if (propertyChannel.getString(DP_INP_PING).toLowerCase().equals("true")) { propertyChannel.fire (DP_STATUS_MSG, service.getName()+" isAlive."); } else { propertyChannel.fire (DP_STATUS_MSG, "Service invocation finished."); @@ -587,7 +634,7 @@ } } else { - if (DP_CS_PING.equals(propertyChannel.getString(DP_CALL_SERVICE))) { + if (propertyChannel.getString(DP_INP_PING).toLowerCase().equals("true")) { propertyChannel.fire (DP_STATUS_MSG, service.getName()+" is dead."); results.removeResults(); } else { From kawas at dev.open-bio.org Thu May 15 14:58:47 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 15 May 2008 14:58:47 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805151858.m4FIwlMp016599@dev.open-bio.org> kawas Thu May 15 14:58:47 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/help In directory dev.open-bio.org:/tmp/cvs-serv16554/src/main/org/biomoby/service/dashboard/help Added Files: PerlMoSeSPanel.html Log Message: initial commit of panel for Perl-MoSeS moby-live/Java/src/main/org/biomoby/service/dashboard/help PerlMoSeSPanel.html,NONE,1.1 From kawas at dev.open-bio.org Thu May 15 14:58:47 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 15 May 2008 14:58:47 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805151858.m4FIwl0T016585@dev.open-bio.org> kawas Thu May 15 14:58:47 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard In directory dev.open-bio.org:/tmp/cvs-serv16554/src/main/org/biomoby/service/dashboard Added Files: PerlMoSeSPanel.java PerlMoSeSSyntaxDocument.java Log Message: initial commit of panel for Perl-MoSeS moby-live/Java/src/main/org/biomoby/service/dashboard PerlMoSeSPanel.java,NONE,1.1 PerlMoSeSSyntaxDocument.java,NONE,1.1 From kawas at dev.open-bio.org Thu May 15 14:59:25 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 15 May 2008 14:59:25 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805151859.m4FIxPM3016661@dev.open-bio.org> kawas Thu May 15 14:59:25 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/config/dashboard/META-INF/services In directory dev.open-bio.org:/tmp/cvs-serv16626/src/config/dashboard/META-INF/services Modified Files: org.biomoby.service.dashboard.DashboardPanel Log Message: added the panel for Perl-MoSeS moby-live/Java/src/config/dashboard/META-INF/services org.biomoby.service.dashboard.DashboardPanel,1.8,1.9 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/config/dashboard/META-INF/services/org.biomoby.service.dashboard.DashboardPanel,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Java/src/config/dashboard/META-INF/services/org.biomoby.service.dashboard.DashboardPanel 2006/02/19 18:42:55 1.8 +++ /home/repository/moby/moby-live/Java/src/config/dashboard/META-INF/services/org.biomoby.service.dashboard.DashboardPanel 2008/05/15 18:59:25 1.9 @@ -5,3 +5,4 @@ org.biomoby.service.dashboard.StatisticsPanel org.biomoby.service.dashboard.DebuggingPanel org.biomoby.service.dashboard.ExamplePanel +org.biomoby.service.dashboard.PerlMoSeSPanel \ No newline at end of file From kawas at dev.open-bio.org Thu May 15 15:03:54 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 15 May 2008 15:03:54 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805151903.m4FJ3sL6016765@dev.open-bio.org> kawas Thu May 15 15:03:54 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/images In directory dev.open-bio.org:/tmp/cvs-serv16734/src/main/org/biomoby/service/dashboard/images Added Files: pMoses.gif Log Message: moby-live/Java/src/main/org/biomoby/service/dashboard/images pMoses.gif,NONE,1.1 From kawas at dev.open-bio.org Fri May 16 10:42:19 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 16 May 2008 10:42:19 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805161442.m4GEgJs2020120@dev.open-bio.org> kawas Fri May 16 10:42:18 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server In directory dev.open-bio.org:/tmp/cvs-serv20081/Perl/MOBY-Server Modified Files: Makefile.PL META.yml Log Message: moby-live/Perl/MOBY-Server Makefile.PL,1.5,1.6 META.yml,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/Makefile.PL,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Perl/MOBY-Server/Makefile.PL 2008/04/23 13:08:11 1.5 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/Makefile.PL 2008/05/16 14:42:18 1.6 @@ -3,7 +3,7 @@ # Define metadata name 'MOBY'; - version '1.03'; + version '1.04'; license 'perl'; abstract 'This distribution is for communicating with or creating your own MOBY Central registry'; @@ -30,6 +30,7 @@ if ( not( $^O =~ /MSWin32|Windows_NT/i ) ) { # non portable requires + requires 'Want' => '0'; requires 'IO::Prompt' => '0.99.2'; requires 'IPC::Shareable' => '0.6'; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/META.yml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/MOBY-Server/META.yml 2008/03/20 17:36:33 1.2 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/META.yml 2008/05/16 14:42:18 1.3 @@ -41,4 +41,4 @@ XML::DOM: 0 XML::LibXML: 1.62 XML::XPath: 1.12 -version: 1.03 +version: 1.04 From kawas at dev.open-bio.org Fri May 16 11:07:55 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 16 May 2008 11:07:55 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805161507.m4GF7tEZ020405@dev.open-bio.org> kawas Fri May 16 11:07:55 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Client In directory dev.open-bio.org:/tmp/cvs-serv20366/Perl/MOBY-Client Modified Files: Makefile.PL Changes Log Message: moby-live/Perl/MOBY-Client Makefile.PL,1.7,1.8 Changes,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/Makefile.PL,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Perl/MOBY-Client/Makefile.PL 2008/05/07 18:24:29 1.7 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/Makefile.PL 2008/05/16 15:07:55 1.8 @@ -4,8 +4,9 @@ # all_from 'lib/MOBY/Client/Central.pm'; author 'Mark Wilkinson '; -version '1.01'; +version '1.02'; license 'perl'; +abstract 'This distribution is for communicating with a MOBY Central registry'; build_requires 'Test::More' => 0; build_requires 'Test::Pod' => 0; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/Changes,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/MOBY-Client/Changes 2008/03/05 18:38:40 1.2 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/Changes 2008/05/16 15:07:55 1.3 @@ -1,4 +1,18 @@ -Revision history for Moby-Client +Revision history for MOBY-Client + +1.02 16 May 2008 + * fixed bug in MOBY::Client::Central::DUMP that resulted + in an error ('Not an ARRAY reference at + MOBY/Client/Central.pm line 1927') being raised. + Thanks to Pieter Neerincx for finding the bug and a + solution. + + * fixed bug that allowed service types to be registered + with empty ISA relationships. + + * MOBY WSRF implementation was not WSRF compliant in some + points, and the same happened with sample code. Both the + libraries and the generated WSDL have been fixed. 1.01 5 March 2008 * removed some failing pod tests From kawas at dev.open-bio.org Sun May 18 08:43:10 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Sun, 18 May 2008 08:43:10 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805181243.m4IChAPJ029618@dev.open-bio.org> kawas Sun May 18 08:43:09 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard In directory dev.open-bio.org:/tmp/cvs-serv29582/src/main/org/biomoby/service/dashboard Modified Files: PerlMoSeSPanel.java Log Message: made the 'generate cgi services' check box a radio button added a pop that occurs when generating services. moby-live/Java/src/main/org/biomoby/service/dashboard PerlMoSeSPanel.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java 2008/05/15 18:58:47 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java 2008/05/18 12:43:09 1.2 @@ -30,6 +30,7 @@ import javax.swing.AbstractButton; import javax.swing.BorderFactory; import javax.swing.Box; +import javax.swing.ButtonGroup; import javax.swing.Icon; import javax.swing.JButton; import javax.swing.JCheckBox; @@ -39,6 +40,7 @@ import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; +import javax.swing.JRadioButton; import javax.swing.JScrollPane; import javax.swing.JSplitPane; import javax.swing.JTabbedPane; @@ -71,6 +73,8 @@ static String PM_OVERWRITE = "perl-moses-overwrite"; static String PM_CGI = "perl-moses-cgi"; + + static String PM_SOAP = "perl-moses-soap"; static String PM_UPDATE_SERVICE_CACHE = "perl-moses-update-service-cache"; @@ -266,8 +270,7 @@ JPanel bPanel = createTitledPanel("Generate"); JCheckBox genOverwrite = createActionBox("Overwrite Existing Code", PM_OVERWRITE); - JCheckBox genCgi = createActionBox("Generate CGI Service", PM_CGI); - + generateBtn = createButton("Generate Skeletons", "Generate skeletons from selected services", KeyEvent.VK_G, new ActionListener() { @@ -305,9 +308,15 @@ } }); + ButtonGroup group = new ButtonGroup(); + JRadioButton genCgi, genSoap; + group.add (genCgi = createHowToButton ("Generate CGI Service", PM_CGI)); + group.add (genSoap = createHowToButton ("Generate SOAP Service", PM_SOAP)); + SwingUtils.addComponent(bPanel, genOverwrite, 0, 0, 1, 1, NONE, NWEST, 0.0, 0.0); SwingUtils.addComponent(bPanel, genCgi, 0, 1, 2, 1, NONE, NWEST, 0.0, 0.0); - SwingUtils.addComponent(bPanel, generateBtn, 0, 2, 2, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent(bPanel, genSoap, 0, 2, 2, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent(bPanel, generateBtn, 0, 3, 2, 1, NONE, NWEST, 0.0, 0.0); JPanel uPanel = createTitledPanel("Utilities"); JCheckBox syncServices = createActionBox("Synchronize Services", @@ -585,6 +594,23 @@ return panel; } + private JRadioButton createHowToButton (String title, String howTo) { + JRadioButton radio = new JRadioButton (title); + radio.setActionCommand (howTo); + radio.addActionListener (howToListener); + if (!howTo.equals(PM_CGI)) { + radio.setSelected (true); + radio.setEnabled (true); + } + propertyChannel.put (PM_CGI, false); + return radio; + } + private ActionListener howToListener = new ActionListener() { + public void actionPerformed (ActionEvent e) { + String howTo = e.getActionCommand(); + propertyChannel.put (PM_CGI, howTo.equals(PM_CGI)); + } + }; private JPanel getServicesSelectionPanel() { JPanel p = new JPanel(new GridBagLayout()); p.setBorder(createFatBorder("Select services to work with", @@ -810,8 +836,9 @@ .add(propertyChannel .getString(DashboardProperties.DP_REGISTRY_ENDPOINT)); if (Boolean.parseBoolean(propertyChannel - .getString(PM_CGI))) + .getString(PM_CGI))){ command.add("-c"); + } command.add(authority); // place command into com String[] com = command.toArray(new String[] {}); @@ -858,6 +885,10 @@ propertyChannel .fire(DP_STATUS_MSG, "Generating Perl-MoSeS service skeletons complete!"); + JOptionPane.showMessageDialog(null, + "Processing of selected service completed!\n" + + "Please check the 'console' to ensure that the service\n" + + "skeletons were generated correctly.", "Completed", JOptionPane.INFORMATION_MESSAGE); if (!(propertyChannel.getBoolean(PM_SYNC_DATATYPES, false) || propertyChannel .getBoolean(PM_SYNC_SERVICES, false))) { syncBtn.setEnabled(true); @@ -900,8 +931,9 @@ .add(propertyChannel .getString(DashboardProperties.DP_REGISTRY_ENDPOINT)); if (Boolean.parseBoolean(propertyChannel - .getString(PM_CGI))) + .getString(PM_CGI))){ command.add("-c"); + } command.add(auth); command.add(name); // place command into com @@ -951,6 +983,10 @@ propertyChannel .fire(DP_STATUS_MSG, "Generating Perl-MoSeS service skeletons complete!"); + JOptionPane.showMessageDialog(null, + "Processing of selected service completed!\n" + + "Please check the 'console' to ensure that the service\n" + + "skeletons were generated correctly.", "Completed", JOptionPane.INFORMATION_MESSAGE); if (!(propertyChannel.getBoolean(PM_SYNC_DATATYPES, false) || propertyChannel .getBoolean(PM_SYNC_SERVICES, false))) { syncBtn.setEnabled(true); From kawas at dev.open-bio.org Tue May 20 11:33:01 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 20 May 2008 11:33:01 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805201533.m4KFX1it007192@dev.open-bio.org> kawas Tue May 20 11:33:00 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard In directory dev.open-bio.org:/tmp/cvs-serv7153/src/main/org/biomoby/service/dashboard Modified Files: PerlMoSeSPanel.java PerlMoSeSSyntaxDocument.java Log Message: added code that moves the cursor around when certain characters are inserted. the way i did it is less than ideal and should be changed once a better method is found. moby-live/Java/src/main/org/biomoby/service/dashboard PerlMoSeSPanel.java,1.2,1.3 PerlMoSeSSyntaxDocument.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java 2008/05/18 12:43:09 1.2 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java 2008/05/20 15:33:00 1.3 @@ -128,7 +128,7 @@ private Icon zoomInIcon, zoomInIconDis; private Icon zoomOutIcon, zoomOutIconDis; - private JTextPane editorTextPane; + private static JTextPane editorTextPane; private JComboBox fonts; @@ -533,6 +533,10 @@ return p; } + protected static void moveCursor(int pos) { + if (editorTextPane != null && editorTextPane.isEnabled() && pos >= 0 && pos < editorTextPane.getText().length()) + editorTextPane.setCaretPosition(pos); + } private JComponent getFontChooser() { JLabel label = new JLabel("Font:"); JPanel panel = new JPanel(new FlowLayout()); =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSSyntaxDocument.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSSyntaxDocument.java 2008/05/15 18:58:47 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSSyntaxDocument.java 2008/05/20 15:33:00 1.2 @@ -14,6 +14,7 @@ import javax.swing.text.SimpleAttributeSet; import javax.swing.text.StyleConstants; + /** * This class implements the functionality needed to create * a Stylized view of perl scripts in the Perl MoSeS editor @@ -152,12 +153,18 @@ @Override public void insertString(int offset, String str, AttributeSet a) throws BadLocationException { + boolean replaced = false; if (str.equals("{") || str.equals("[") || str.equals("(")) { str = addMatchingToken(offset, str); + replaced = true; } super.insertString(offset, str, a); processChangedLines(offset, str.length()); + if (replaced) { + // FIXME bad hack to move the cursor ... + PerlMoSeSPanel.moveCursor(offset+str.length() - 2); + } } @Override @@ -344,6 +351,7 @@ /* * Parse the line for tokens to highlight */ + boolean inQuote = false; private void checkForTokens(String content, int startOffset, int endOffset) { while (startOffset <= endOffset) { // skip the delimiters to find the start of a new token @@ -393,8 +401,7 @@ else endOfQuote = index; - doc.setCharacterAttributes(startOffset, endOfQuote - startOffset + 1, - quote, false); + doc.setCharacterAttributes(startOffset, endOfQuote - startOffset + 1, quote, false); return endOfQuote + 1; } @@ -590,6 +597,6 @@ if (token.equals("{")) return token + "\n" + whiteSpace.toString() + " \n" + whiteSpace.toString() + token_map.get(token); - return token + whiteSpace.toString() + " " + whiteSpace.toString() + token_map.get(token); + return token + " " + token_map.get(token); } } From kawas at dev.open-bio.org Tue May 20 13:20:38 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 20 May 2008 13:20:38 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805201720.m4KHKc3I007403@dev.open-bio.org> kawas Tue May 20 13:20:38 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard In directory dev.open-bio.org:/tmp/cvs-serv7368/src/main/org/biomoby/service/dashboard Modified Files: PerlMoSeSSyntaxDocument.java Log Message: fixed the nesting of curly braces moby-live/Java/src/main/org/biomoby/service/dashboard PerlMoSeSSyntaxDocument.java,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSSyntaxDocument.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSSyntaxDocument.java 2008/05/20 15:33:00 1.2 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSSyntaxDocument.java 2008/05/20 17:20:38 1.3 @@ -156,6 +156,7 @@ boolean replaced = false; if (str.equals("{") || str.equals("[") || str.equals("(")) { str = addMatchingToken(offset, str); + replaced = true; } @@ -163,7 +164,7 @@ processChangedLines(offset, str.length()); if (replaced) { // FIXME bad hack to move the cursor ... - PerlMoSeSPanel.moveCursor(offset+str.length() - 2); + PerlMoSeSPanel.moveCursor(str.lastIndexOf("\n") >= 0 ? offset + str.lastIndexOf("\n") : offset+str.length() - 2); } } From gordonp at dev.open-bio.org Tue May 20 18:59:48 2008 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Tue, 20 May 2008 18:59:48 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805202259.m4KMxmd3007719@dev.open-bio.org> gordonp Tue May 20 18:59:48 EDT 2008 Update of /home/repository/moby/moby-live/Java/docs In directory dev.open-bio.org:/tmp/cvs-serv7679 Modified Files: deployingServices.html deployingServicesBasic.html Log Message: Added note re: registration with non-default Moby Central moby-live/Java/docs deployingServices.html,1.15,1.16 deployingServicesBasic.html,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/deployingServices.html,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- /home/repository/moby/moby-live/Java/docs/deployingServices.html 2007/12/17 17:49:44 1.15 +++ /home/repository/moby/moby-live/Java/docs/deployingServices.html 2008/05/20 22:59:48 1.16 @@ -296,6 +296,12 @@ in the Tomcat manager interface shown previously).

    +

    Using a different MOBY Central: + By default, the annotation assumes that the default public Moby Central will be used (this is determined + automagically by a combination of hardcoding and fetching info from biomoby.org). If you want to + use a different Moby Central, e.g. a test registry, add the centralEndpoint string + to the annotation.

    +

    Moving Your Service: The WAR you've built is completely self-contained, therefore you should be able to move your service simply by copying the WAR to another servlet container. You can e-mail it to your friends, so they can =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/deployingServicesBasic.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/docs/deployingServicesBasic.html 2007/03/12 17:57:51 1.2 +++ /home/repository/moby/moby-live/Java/docs/deployingServicesBasic.html 2008/05/20 22:59:48 1.3 @@ -293,6 +293,12 @@ in the Tomcat manager interface shown previously).

    +

    Using a different MOBY Central: + By default, the annotation assumes that the default public Moby Central will be used (this is determined + automagically by a combination of hardcoding and fetching info from biomoby.org). If you want to + use a different Moby Central, e.g. a test registry, add the centralEndpoint string + to the annotation.

    +

    Moving Your Service: The WAR you've built is completely self-contained, therefore you should be able to move your service simply by copying the WAR to another servlet container. You can e-mail it to your friends, so they can From gordonp at dev.open-bio.org Wed May 21 15:14:10 2008 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 21 May 2008 15:14:10 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805211914.m4LJEAHS010851@dev.open-bio.org> gordonp Wed May 21 15:14:10 EDT 2008 Update of /home/repository/moby/moby-live/Java/docs In directory dev.open-bio.org:/tmp/cvs-serv10819 Added Files: acdServlet.html Log Message: Added preliminary ACDServlet documentation moby-live/Java/docs acdServlet.html,NONE,1.1 From gordonp at dev.open-bio.org Wed May 21 15:14:10 2008 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 21 May 2008 15:14:10 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805211914.m4LJEAPC010865@dev.open-bio.org> gordonp Wed May 21 15:14:10 EDT 2008 Update of /home/repository/moby/moby-live/Java/docs/images In directory dev.open-bio.org:/tmp/cvs-serv10819/images Added Files: acdservlet.png Log Message: Added preliminary ACDServlet documentation moby-live/Java/docs/images acdservlet.png,NONE,1.1 From gordonp at dev.open-bio.org Wed May 21 15:18:23 2008 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 21 May 2008 15:18:23 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805211918.m4LJINKJ010935@dev.open-bio.org> gordonp Wed May 21 15:18:22 EDT 2008 Update of /home/repository/moby/moby-live/Java/docs In directory dev.open-bio.org:/tmp/cvs-serv10899 Modified Files: index.html Log Message: Added preliminary ACDServlet documentation moby-live/Java/docs index.html,1.32,1.33 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/index.html,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- /home/repository/moby/moby-live/Java/docs/index.html 2008/03/08 12:34:07 1.32 +++ /home/repository/moby/moby-live/Java/docs/index.html 2008/05/21 19:18:22 1.33 @@ -170,12 +170,12 @@

  • Using general methods
      -
    • How to develop a BioMoby +
    • How to develop a BioMoby service, an alternate mechanism for the Extremely Lazy, Complete Idiots, Dummies, etc. (a.k.a. "MobyServlet") +
    • A note on using secondary articles with MobyServlet
    • A note on using secondary articles with MobyServlet +border=0/>How to wrap an EMBOSS/ACD program as a Moby service
    • The org.biomoby.shared.data package "In Anger": creating data instances
    • From gordonp at dev.open-bio.org Wed May 21 15:20:56 2008 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 21 May 2008 15:20:56 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805211920.m4LJKuvK010997@dev.open-bio.org> gordonp Wed May 21 15:20:56 EDT 2008 Update of /home/repository/moby/jars-archive/current In directory dev.open-bio.org:/tmp/cvs-serv10965 Added Files: ACDServlet.war ACDServlet.README.txt Log Message: Preliminary commit of EMBOSS wrapping servlet jars-archive/current ACDServlet.war,NONE,1.1 ACDServlet.README.txt,NONE,1.1 From senger at dev.open-bio.org Thu May 22 13:09:31 2008 From: senger at dev.open-bio.org (Martin Senger) Date: Thu, 22 May 2008 13:09:31 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805221709.m4MH9V3q014439@dev.open-bio.org> senger Thu May 22 13:09:31 EDT 2008 Update of /home/repository/moby/moby-live/Java/docs In directory dev.open-bio.org:/tmp/cvs-serv14420 Modified Files: ChangeLog Log Message: fixed registering data type from an XML file, in Dashboard moby-live/Java/docs ChangeLog,1.89,1.90 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/ChangeLog,v retrieving revision 1.89 retrieving revision 1.90 diff -u -r1.89 -r1.90 --- /home/repository/moby/moby-live/Java/docs/ChangeLog 2008/04/19 19:11:17 1.89 +++ /home/repository/moby/moby-live/Java/docs/ChangeLog 2008/05/22 17:09:30 1.90 @@ -1,3 +1,7 @@ +2008-05-23 Martin Senger + + * Fixed: registering data types from an XML file, in Dashboard + 2008-04-20 Martin Senger * Changed CreateMobyInput client - it now requires to use the From senger at dev.open-bio.org Thu May 22 13:09:40 2008 From: senger at dev.open-bio.org (Martin Senger) Date: Thu, 22 May 2008 13:09:40 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805221709.m4MH9eUO014476@dev.open-bio.org> senger Thu May 22 13:09:40 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard In directory dev.open-bio.org:/tmp/cvs-serv14457 Modified Files: RegistrationDataTypeSubPanel.java Log Message: fixed registering data type from an XML file, in Dashboard moby-live/Java/src/main/org/biomoby/service/dashboard RegistrationDataTypeSubPanel.java,1.10,1.11 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationDataTypeSubPanel.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationDataTypeSubPanel.java 2005/12/20 20:00:41 1.10 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationDataTypeSubPanel.java 2008/05/22 17:09:40 1.11 @@ -130,7 +130,7 @@ KeyEvent.VK_X); fromXMLButton = createFromXMLButton ("Register this data type from a raw XML in a file", - "registerDataType", + "registerObjectClass", KeyEvent.VK_F, REG_DT_FROM_XML, createXMLChooser (REG_DT_FROM_XML)); From walexander at dev.open-bio.org Tue May 27 12:06:14 2008 From: walexander at dev.open-bio.org (Wendy Alexander) Date: Tue, 27 May 2008 12:06:14 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805271606.m4RG6EHP011022@dev.open-bio.org> walexander Tue May 27 12:06:14 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard In directory dev.open-bio.org:/tmp/cvs-serv10987 Modified Files: SimpleClientPanel.java Log Message: Changed the way the label on the run button changes when the ping checkbox or the show input radio button is selected. moby-live/Java/src/main/org/biomoby/service/dashboard SimpleClientPanel.java,1.11,1.12 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/SimpleClientPanel.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/SimpleClientPanel.java 2008/05/14 20:37:10 1.11 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/SimpleClientPanel.java 2008/05/27 16:06:14 1.12 @@ -250,7 +250,23 @@ ButtonGroup group = new ButtonGroup(); JRadioButton htNone, htRegistry, htEndpoint, htLocal, htNewURL; group.add (htEndpoint = createHowToButton ("Use service's usual endpoint", DP_CS_URL)); - group.add (htNone = createHowToButton ("No real call, just show/echo input", DP_CS_NONE)); + htNone = createHowToButton ("No real call, just show/echo input", DP_CS_NONE); + htNone.addItemListener( + new ItemListener() { + public void itemStateChanged (ItemEvent e) { + boolean enabled = (e.getStateChange() == ItemEvent.SELECTED); + if (enabled) runButton.setText(" Show Input "); + else { + if (propertyChannel.getBoolean(DP_INP_PING, false)){ + runButton.setText(" Ping Service "); + } + else { + runButton.setText(" Call Service "); + } + } + } + }); + group.add (htNone); group.add (htRegistry = createHowToButton ("Ask registry where service is, and call it", DP_CS_REGISTRY)); group.add (htNewURL = createHowToButton ("Use this endpoint", DP_CS_NEWURL)); group.add (htLocal = createHowToButton ("Use this local class", DP_CS_CLASS)); @@ -260,13 +276,9 @@ boolean usingPing = getPrefValue (DP_INP_PING, false); boolean usingAsBytes = getPrefValue (DP_INP_ASBYTES, false); String runLabel = " Call Service "; - if (usingPing) { - if (usingAsBytes) runLabel = " Ping and Show Input "; - else runLabel = " Ping Service "; - } - else { - if (usingAsBytes) runLabel = " Show Input "; - } + if (propertyChannel.getString(DP_CALL_SERVICE).equals(DP_CS_NONE)) + runLabel = " Show Input "; + else if (usingPing) runLabel = " Ping Service "; runButton = createButton (runLabel, @@ -316,14 +328,16 @@ propertyChannel.put (DP_INP_PING, new Boolean (enabled).toString()); if (enabled) { - if (propertyChannel.getString(DP_INP_ASBYTES).toLowerCase().equals("true")) - runButton.setText(" Ping and Show Input "); - else runButton.setText(" Ping Service "); + if (propertyChannel.getString(DP_CALL_SERVICE).equals(DP_CS_NONE)) + runButton.setText(" Show Input "); + else + runButton.setText(" Ping Service "); } else { - if (propertyChannel.getString(DP_INP_ASBYTES).toLowerCase().equals("true")) + if (propertyChannel.getString(DP_CALL_SERVICE).equals(DP_CS_NONE)) runButton.setText(" Show Input "); - else runButton.setText(" Call Service "); + else + runButton.setText(" Call Service "); } } }); @@ -343,17 +357,6 @@ setPrefValue (DP_INP_ASBYTES, enabled); propertyChannel.put (DP_INP_ASBYTES, new Boolean (enabled).toString()); - if (enabled) { - if (propertyChannel.getString(DP_INP_PING).toLowerCase().equals("true")) - runButton.setText(" Ping and Show Input "); - else runButton.setText(" Show Input "); - } - else { - if (propertyChannel.getString(DP_INP_PING).toLowerCase().equals("true")) - runButton.setText(" Ping Service "); - else runButton.setText(" Call Service "); - } - } }); setPropertySelect (usingAsBytes, DP_INP_ASBYTES); From kawas at dev.open-bio.org Tue May 27 13:23:53 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 27 May 2008 13:23:53 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805271723.m4RHNrbI011135@dev.open-bio.org> kawas Tue May 27 13:23:53 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/help In directory dev.open-bio.org:/tmp/cvs-serv11100/src/main/org/biomoby/service/dashboard/help Modified Files: PerlMoSeSPanel.html Log Message: * new documentation for the 'Local User Config' sub panel * modifed the the 'generator' section to reflect some ui changes moby-live/Java/src/main/org/biomoby/service/dashboard/help PerlMoSeSPanel.html,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/help/PerlMoSeSPanel.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/help/PerlMoSeSPanel.html 2008/05/15 18:58:47 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/help/PerlMoSeSPanel.html 2008/05/27 17:23:53 1.2 @@ -18,11 +18,14 @@

      All activities are done using the command line utilities installed by the Perl-MoSeS module.

      MoSeS Toolkit

      The MoSeS Toolkit sub panel allows you to:

      -
        -
      • Generate - generate perl modules for services that you select,
      • +
        • Generate - generate perl modules for services that you select,
        • Utilities - for synchronizing Perl-MoSeS with the Dashboard, and an
        • Editor - .for easily editing the business logic of services that you create.
        • +
        • Local User Config - for those users without root access when they installed Perl-MoSeS*
        +
        +

        * when the panel is created, it makes a best attempt to determine whether or not the cpan module MOSES-MOBY was installed as root. If it was not, this sub panel is visible.

        +

        Possible caveats:

        • The actions in this panel depend on the availability of certain command line tools (installed by MOSES-MOBY) being available on the system PATH.
        • @@ -31,7 +34,8 @@

          There is one generator in this panel for creating services, with a couple of options.

          • Overwrite Existing Code - use this to overwrite any service code that has already been generated with MoSeS
          • -
          • Generate CGI Service - use this to generate a category 'cgi' BioMOBY web service.
          • +
          • Generate CGI Service - use this to generate a category 'cgi' BioMOBY web service.
          • +
          • Generate SOAP Service - use this to generate a category 'moby' BioMOBY web service.

          Once you have chosen your desired options, you can click on the Generate Skeletons button. This will go through and generate perl modules that represent the services that you selected in the 'Service Browser'.

          All files are generated into your local Perl-MoSeS/ installation. For instance, assuming that your username is moby_user and that your home directory is /home/moby_user/, then you could find your service skeletons in /home/moby_user/Perl-MoSeS/services/Service/ directory.

          @@ -50,6 +54,27 @@
        • Close - used to remove the script from view.

        There are also a two buttons for enlarging or shrinking the text in the editor.

        +

        Local User Config

        +

        The configuration sub panel allows you to specify:

        +
          +
        • Perl Install Path - this is the path to the PERL executable, for instance, /usr/bin/perl [required]
        • +
        • PERL5LIB directory - a directory to add to Perls' @INC [optional]
        • +
        • PERL5LIB directory (2) - another directory to add to Perls' @INC [optional]
        • +
        • MoSeS Scripts Directory - the directory that contains the moses-*.pl scripts [required]
        • +
        +

        Once this information is entered, and the 'Test user config' is clicked, we check whether the required MOSES scripts are accessible. If everything is deemed to be fine, the other sub panels are enabled. Otherwise, you will be prompted to check your values.

        +

        Help on setting your local user configuration

        +

        Some users find this information hard to obtain. One trick that I use is to enter 'perl -V' at the command prompt. Among other things, one of the last things that you will see displayed is something like:

        +
        Built under linux
        Compiled at Nov 27 2007 10:44:36
        @INC:
        /etc/perl
        /usr/local/lib/perl/5.8.8
        /usr/local/share/perl/5.8.8
        /usr/lib/perl5
        /usr/share/perl5
        /usr/lib/perl/5.8
        /usr/share/perl/5.8
        /usr/local/lib/site_perl
        .
        +

        Keeping the above in mind and remembering that when you installed (locally for just you and not system wide!) MOSES-MOBY from the command prompt, you specified a PREFIX=/some/path/, similar to the following:

        +
           perl Makefile.PL PREFIX=/home/ekawas/usr/local
        +

        The values that you would then enter for PERL5LIB are:

        +
          +
        • /home/ekawas/usr/local/lib/perl/5.8.8
        • +
        • /home/ekawas/usr/local/lib/site_perl
        • +
        +

        In other words, you are interested in using the PREFIX/lib/ directories.

        +

        The value that you should set for the MoSeS Scripts Directory are usually located in the PREFIX/bin/ directory.

        Service deployment

        Once you have created your service, you will want to deploy it. Depending on whether you have generated a SOAP service or a CGI based service, the steps to involved to deploy your service.

        Deploying a SOAP Service

        From kawas at dev.open-bio.org Tue May 27 13:25:17 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 27 May 2008 13:25:17 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805271725.m4RHPHhx011193@dev.open-bio.org> kawas Tue May 27 13:25:17 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard In directory dev.open-bio.org:/tmp/cvs-serv11158/src/main/org/biomoby/service/dashboard Modified Files: PerlMoSeSPanel.java Log Message: *the detection for MOSES::MOBY is now silent. *added a subpanel to the perl-moses panel that allows users to use a locally installed version of moses-moby. moby-live/Java/src/main/org/biomoby/service/dashboard PerlMoSeSPanel.java,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java 2008/05/20 15:33:00 1.3 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java 2008/05/27 17:25:17 1.4 @@ -59,46 +59,77 @@ import org.apache.commons.io.FilenameUtils; import org.biomoby.shared.MobyException; +import org.tulsoft.tools.gui.JTextFieldWithHistory; import org.tulsoft.tools.gui.SwingUtils; public class PerlMoSeSPanel extends AbstractPanel { // some properties for the channel + // String: set this to pop up a warning message static String PM_WARNING = "perl-moses-warning"; + // String: set this to pop up an error message static String PM_ERROR = "perl-moses-error"; + // String: set this for an information message static String PM_INFORMATION = "perl-moses-information"; + // boolean - do we over write files static String PM_OVERWRITE = "perl-moses-overwrite"; + // boolean: do we generate cgi services static String PM_CGI = "perl-moses-cgi"; + // boolean do we generate soap services static String PM_SOAP = "perl-moses-soap"; + // boolean: do we update the service cache static String PM_UPDATE_SERVICE_CACHE = "perl-moses-update-service-cache"; + // boolean: do we update the datatype cache static String PM_UPDATE_DATATYPE_CACHE = "perl-moses-update-datatype-cache"; + // boolean: are we currently updating the datatype cache static String PM_SYNC_DATATYPES = "perl-moses-sync-datatypes"; + // boolean: are we currently updating the services cache static String PM_SYNC_SERVICES = "perl-moses-sync-services"; + // boolean: are we generating services by name static String PM_GENERATING_SPECIFIC_SERVICES = "perl-moses-generating-specific-services"; + // boolean: are we generating services by authority static String PM_GENERATING_BY_AUTHORITY = "perl-moses-generating-by-authority"; + // N/A: set this to make the editor save the current file static String PM_FILE_ACTION_SAVE = "perl-moses-file-action-save"; + // N/A: set this to make the editor open a file static String PM_FILE_ACTION_OPEN = "perl-moses-file-action-open"; + // N/A: set this to make the editor close a file static String PM_FILE_ACTION_CLOSE = "perl-moses-file-action-close"; + // String: the full path of the file that we are editing static String PM_FILE_CURRENT = "perl-moses-file-current"; + // String: the checksum of the current open file static String PM_FILE_CURRENT_CHECKSUM = "perl-moses-file-current-checksum"; + // String: the parent directory of the last opened file static String PM_FILE_LAST_DIRECTORY = "perl-moses-file-last-directory"; + + // String: one of the PERL5LIB directories for those that install modules locally + static String PM_PERL_LIB_1 = "perl-moses-perl-lib-1"; + + // String: one of the PERL5LIB directories for those that install modules locally + static String PM_PERL_LIB_2 = "perl-moses-perl-lib-2"; + + // String: the exact path to the locally installed moses scripts + static String PM_SCRIPTS_INSTALL_DIR = "perl-moses-scripts-install-dir"; + + // String: the exact path to the users perl (in case it is not available on the path) + static String PM_PERL_INSTALL_DIR = "perl-moses-perl-install-dir"; // generated serialversionUID private static final long serialVersionUID = 1379466985182986776L; @@ -109,52 +140,95 @@ private JLabel aSelectedCount, sSelectedCount, currentlyEditing; - private JButton generateBtn; - - private JButton syncBtn; - - private JButton editorSaveButton, editorCloseButton, editorOpenButton; + private JButton editorSaveButton, editorCloseButton, editorOpenButton, scriptsBtn, generateBtn, syncBtn; + // are we enabling moses actions private boolean enable_moses_actions = true; + // is the user running windows private boolean is_windows_pc = false; - private Icon openFileIcon, openFileIconDis; - - private Icon closeFileIcon, closeFileIconDis; - - private Icon saveFileIcon, saveFileIconDis; - - private Icon zoomInIcon, zoomInIconDis; - private Icon zoomOutIcon, zoomOutIconDis; + private Icon openFileIcon, openFileIconDis, closeFileIcon, + closeFileIconDis, saveFileIcon, saveFileIconDis, + zoomInIcon, zoomInIconDis, zoomOutIcon, zoomOutIconDis; private static JTextPane editorTextPane; private JComboBox fonts; + /** + * Default constructor: set the image, and determines + * whether or not we are using windows + */ public PerlMoSeSPanel() { super(); panelIconFileName = "images/pMoses.gif"; + if (System.getProperty("os.name").startsWith("Windows")) is_windows_pc = true; // determine if perl & moses are installed - String[] command; + } + + /* + * private method that determines if + * moses is available from the command line. + */ + private void check_install() { + String[] command; + ArrayList prefix = generatePerlPrefix(); + if (is_windows_pc) { - command = new String[] {"moses-cache-tester.bat"}; + prefix.add("moses-cache-tester.bat"); + command = prefix.toArray(new String[]{}); } else { - command = new String[] {"moses-cache-tester.pl"}; + prefix.add((prefix.size() > 0 ? prefix.remove(prefix.size()-1) : "") + "moses-cache-tester.pl"); + command = prefix.toArray(new String[]{}); } - try { Process process; process = Runtime.getRuntime().exec(command); - process.waitFor(); + process.waitFor(); + enable_moses_actions = true; } catch (Exception e) { enable_moses_actions = false; } } /* + * private method that generates the + * + * /path/to/perl -I/some/dir /path/to/scripts + * + * part of the perl call + * + */ + private ArrayList generatePerlPrefix() { + // usually windows installs everything as root + if (is_windows_pc) + return new ArrayList(); + + ArrayList list = new ArrayList(); + String script_path = propertyChannel.getString(PM_SCRIPTS_INSTALL_DIR); + String lib1 = propertyChannel.getString(PM_PERL_LIB_1); + String lib2 = propertyChannel.getString(PM_PERL_LIB_2); + String perl = propertyChannel.getString(PM_PERL_INSTALL_DIR); + + if (perl != null && !perl.trim().equals("") && script_path != null && !script_path.trim().equals("")) { + list.add(perl); + if (lib1 != null && !lib1.trim().equals("")) { + list.add("-I" + lib1.trim()); + } + if (lib2 != null && !lib2.trim().equals("")) { + list.add("-I" + lib2.trim()); + } + if (!script_path.endsWith("/")) + script_path += "/"; + list.add(script_path); + } + return list; + } + + /* * (non-Javadoc) * * @see org.biomoby.service.dashboard.AbstractPanel#getComponent(org.biomoby.service.dashboard.PropertyChannel) @@ -162,18 +236,8 @@ @Override public JComponent getComponent(PropertyChannel propertyChannel) { - if (!enable_moses_actions) { - JOptionPane.showMessageDialog( - null, - "Sorry, Perl-MoSeS is not enabled because we couldn't detect" + - "\nit on your system. Please make sure that it is installed\n" + - "on your machine!", "Perl-MoSeS",JOptionPane.ERROR_MESSAGE); - JPanel p = new JPanel(new BorderLayout(), true); - JLabel l = new JLabel("Please install Perl-MoSes from CPAN before continuing!"); - p.add(l, BorderLayout.PAGE_START); - return p; - } - setPropertyChannel(propertyChannel); + setPropertyChannel(propertyChannel); + determineMoSeSDirectory(); // put some properties in the channel propertyChannel.put(PM_GENERATING_BY_AUTHORITY, new Boolean(false)); @@ -182,7 +246,7 @@ propertyChannel.put(PM_SYNC_DATATYPES, new Boolean(false)); propertyChannel.put(PM_OVERWRITE, new Boolean(false)); propertyChannel.put(PM_CGI, new Boolean(false)); - + propertyChannel.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { if (e.getPropertyName().equals(PM_ERROR)) { @@ -241,20 +305,21 @@ // set up the splitpane JSplitPane vsplit = vSplit(getServicesSelectionPanel(), tabbedPane, 0.8); JSplitPane splitPane = hSplit(vsplit, getEditorPanel(), 0.1); - splitPane.resetToPreferredSizes(); // add the components SwingUtils.addComponent(pComponent, splitPane, 0, 0, 1, 1, BOTH, NWEST, 1.0, 1.0); return pComponent; } + /* + * method for setting what we think is the Perl-MoSeS home + * directory + */ private void determineMoSeSDirectory() { try { // set PM_FILE_LAST_DIRECTORY File f = new File(System.getProperty("user.home"),"Perl-MoSeS"); if (f.exists() && f.isDirectory() && f.canRead() && f.canWrite()) propertyChannel.put(PM_FILE_LAST_DIRECTORY, f.getPath()); - - } catch (Exception e) { } @@ -262,11 +327,70 @@ } private JPanel getMoSeSPanel() { + + check_install(); JPanel p = new JPanel (new GridBagLayout()); p.setBorder (createFatBorder ("Perl-MoSeS", GraphColours.getColour ("cadetblue", Color.blue))); + JPanel sPanel = createTitledPanel("Local User Config"); + if (!enable_moses_actions) { + scriptsBtn = createButton( + "Test user config", + "Check whether or not your local user config is correct", + KeyEvent.VK_R, new ActionListener() { + public void actionPerformed(ActionEvent e) { + if (!enable_moses_actions) { + if (propertyChannel.getString(PM_SCRIPTS_INSTALL_DIR) != null + && !propertyChannel.getString(PM_SCRIPTS_INSTALL_DIR).endsWith("/")) + propertyChannel.put( + PM_SCRIPTS_INSTALL_DIR, + propertyChannel.getString(PM_SCRIPTS_INSTALL_DIR) + "/"); + // check for the scripts + check_install(); + if (enable_moses_actions) { + // we are good to go! enable buttons + syncBtn.setEnabled(enable_moses_actions); + generateBtn.setEnabled(enable_moses_actions); + scriptsBtn.setEnabled(!enable_moses_actions); + propertyChannel.fire(PM_INFORMATION, "Your local configuration was successful!"); + + } else { + // alert them that this directory didnt + // contain anything useful + + propertyChannel.fire(PM_ERROR, + "Sorry, your configuration resulted in error.\n" + + "Please review your values and try again!"); + } + } + } + }); + + JTextFieldWithHistory lib1 = createText (null, PM_PERL_LIB_1, PM_PERL_LIB_1); + JTextFieldWithHistory lib2 = createText (null, PM_PERL_LIB_2, PM_PERL_LIB_2); + JTextFieldWithHistory install_path = createText (null, PM_SCRIPTS_INSTALL_DIR, PM_SCRIPTS_INSTALL_DIR); + JTextFieldWithHistory perl_install_path = createText(null, PM_PERL_INSTALL_DIR, PM_PERL_INSTALL_DIR); + + SwingUtils.addComponent(sPanel, new JLabel("Perl Path: "), 0, 0, 1, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent(sPanel, perl_install_path, 1, 0, 3, 1, HORI, NWEST, 1.0, 0.0); + SwingUtils.addComponent(sPanel, new JLabel("PERL5LIB dir: "), 0, 1, 1, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent(sPanel, lib1, 1, 1, 3, 1, HORI, NWEST, 1.0, 0.0); + SwingUtils.addComponent(sPanel, new JLabel("PERL5LIB dir (2): "), 0, 2, 1, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent(sPanel, lib2, 1, 2, 3, 1, HORI, NWEST, 1.0, 0.0); + SwingUtils.addComponent(sPanel, new JLabel("MoSeS Scripts dir: "),0, 3, 1, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent(sPanel, install_path, 1, 3, 3, 1, HORI, NWEST, 1.0, 0.0); + SwingUtils.addComponent(sPanel, scriptsBtn, 1, 4, 3, 1, REMAINDER, NWEST, 1.0, 0.0); + } else { + // we dont show the config sub panel + // remove the PERL5LIB, ScriptsInstallDir and PerlInstallDir so that they dont cause problems + propertyChannel.put(PM_PERL_INSTALL_DIR, ""); + propertyChannel.put(PM_PERL_LIB_1, ""); + propertyChannel.put(PM_PERL_LIB_2, ""); + propertyChannel.put(PM_SCRIPTS_INSTALL_DIR, ""); + } + JPanel bPanel = createTitledPanel("Generate"); JCheckBox genOverwrite = createActionBox("Overwrite Existing Code", PM_OVERWRITE); @@ -290,7 +414,7 @@ "Processing MoSeS skeletons..."); if (propertyChannel .get(DashboardProperties.DP_SEL_SERVICES) != null) { - propertyChannel.fire( + propertyChannel.put( PM_GENERATING_SPECIFIC_SERVICES, new Boolean(true)); onGenerateSpecificService(); @@ -299,7 +423,7 @@ if (propertyChannel .get(DashboardProperties.DP_SEL_AUTHORITIES) != null) { - propertyChannel.fire(PM_GENERATING_BY_AUTHORITY, + propertyChannel.put(PM_GENERATING_BY_AUTHORITY, new Boolean(true)); onGenerateFromAuthority(); } @@ -307,7 +431,7 @@ "Processing MoSeS skeletons completed"); } }); - + generateBtn.setEnabled(enable_moses_actions); ButtonGroup group = new ButtonGroup(); JRadioButton genCgi, genSoap; group.add (genCgi = createHowToButton ("Generate CGI Service", PM_CGI)); @@ -315,8 +439,8 @@ SwingUtils.addComponent(bPanel, genOverwrite, 0, 0, 1, 1, NONE, NWEST, 0.0, 0.0); SwingUtils.addComponent(bPanel, genCgi, 0, 1, 2, 1, NONE, NWEST, 0.0, 0.0); - SwingUtils.addComponent(bPanel, genSoap, 0, 2, 2, 1, NONE, NWEST, 0.0, 0.0); - SwingUtils.addComponent(bPanel, generateBtn, 0, 3, 2, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent(bPanel, genSoap, 0, 2, 2, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent(bPanel, generateBtn, 0, 3, 2, 1, HORI, NWEST, 0.0, 0.0); JPanel uPanel = createTitledPanel("Utilities"); JCheckBox syncServices = createActionBox("Synchronize Services", @@ -337,21 +461,21 @@ generateBtn.setEnabled(false); syncBtn.setEnabled(false); if (syncData) { - propertyChannel.fire(PM_SYNC_DATATYPES, true); + propertyChannel.put(PM_SYNC_DATATYPES, true); onUpdateDatatypeCache(); } if (syncServices) { - propertyChannel.fire(PM_SYNC_SERVICES, true); + propertyChannel.put(PM_SYNC_SERVICES, true); onUpdateServiceCache(); } } - } }); - + syncBtn.setEnabled(enable_moses_actions); + SwingUtils.addComponent(uPanel, syncServices, 0, 0, 1, 1, NONE, NWEST, 0.0, 0.0); SwingUtils.addComponent(uPanel, syncDatatypes, 0, 1, 1, 1, NONE, NWEST, 0.0, 0.0); - SwingUtils.addComponent(uPanel, syncBtn, 0, 2, 1, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent(uPanel, syncBtn, 0, 2, 1, 1, HORI, NWEST, 0.0, 0.0); JPanel ePanel = createTitledPanel("Editor"); @@ -421,14 +545,18 @@ editorCloseButton.setEnabled(false); editorSaveButton.setEnabled(false); - SwingUtils.addComponent(ePanel, editorOpenButton, 0, 0, 1, 1, NONE, NWEST, 1.0, 0.0); + SwingUtils.addComponent(ePanel, editorOpenButton, 0, 0, 1, 1, NONE, NWEST, 0.0, 0.0); SwingUtils.addComponent(ePanel, editorSaveButton, 1, 0, 1, 1, NONE, NWEST, 0.0, 0.0); SwingUtils.addComponent(ePanel, editorCloseButton, 2, 0, 1, 1, NONE, NWEST, 0.0, 0.0); // add to the main panel - SwingUtils.addComponent(p, bPanel, 0, 0, 1, 1, HORI, NWEST, 0.0, 0.0); - SwingUtils.addComponent(p, uPanel, 0, 1, 1, 1, HORI, NWEST, 0.0, 0.0); - SwingUtils.addComponent(p, ePanel, 0, 2, 1, 1, HORI, NWEST, 0.0, 0.0); + int count = 0; + if (!enable_moses_actions) + SwingUtils.addComponent(p, sPanel, 0, count++, 2, 1, HORI, NWEST, 0.0, 0.0); + SwingUtils.addComponent(p, bPanel, 0, count++, 2, 1, HORI, NWEST, 0.0, 0.0); + SwingUtils.addComponent(p, uPanel, 0, count++, 2, 1, HORI, NWEST, 0.0, 0.0); + SwingUtils.addComponent(p, ePanel, 0, count++, 2, 1, HORI, NWEST, 0.0, 0.0); + return p; } @@ -677,14 +805,17 @@ try { // empty the command list command = new ArrayList(); + command.addAll(generatePerlPrefix()); + String s = (command.size() > 0 ? command.remove(command.size()-1) : "") ; + // construct the command - command.add(is_windows_pc ? "moses-generate-datatypes" - : "moses-generate-datatypes.pl"); + command.add(is_windows_pc ? "moses-generate-datatypes" + : s + "moses-generate-datatypes.pl"); command.add("-R"); command .add(propertyChannel .getString(DashboardProperties.DP_REGISTRY_ENDPOINT)); - command.add("-u"); + command.add("-f"); // place command into com String[] com = command.toArray(new String[] {}); @@ -727,12 +858,14 @@ propertyChannel .fire(DP_STATUS_MSG, "Synchronization of Perl-MoSeS Datatype Cache Complete"); - propertyChannel.fire(PM_SYNC_DATATYPES, new Boolean(false)); + propertyChannel.put(PM_SYNC_DATATYPES, new Boolean(false)); + if (!(propertyChannel.getBoolean(PM_SYNC_DATATYPES, false) || propertyChannel .getBoolean(PM_SYNC_SERVICES, false))) { syncBtn.setEnabled(true); generateBtn.setEnabled(true); } + } }; worker.start(); @@ -752,14 +885,16 @@ try { // empty the command list command = new ArrayList(); + command.addAll(generatePerlPrefix()); + String s = (command.size() > 0 ? command.remove(command.size()-1) : "") ; // construct the command - command.add(is_windows_pc ? "moses-generate-services" - : "moses-generate-services.pl"); + command.add(is_windows_pc ? "moses-generate-services" + : s + "moses-generate-services.pl"); command.add("-R"); command .add(propertyChannel .getString(DashboardProperties.DP_REGISTRY_ENDPOINT)); - command.add("-u"); + command.add("-f"); // place command into com String[] com = command.toArray(new String[] {}); @@ -799,11 +934,13 @@ error("Problem executing 'moses-generate-services.pl'", exception); console.setEnabledAppendMode(true); - propertyChannel.fire(PM_SYNC_SERVICES, new Boolean(false)); + propertyChannel.put(PM_SYNC_SERVICES, new Boolean(false)); propertyChannel.fire(DP_STATUS_MSG, "Synchronization of Perl-MoSeS Service Cache Complete"); - if (!(propertyChannel.getBoolean(PM_SYNC_DATATYPES, false) || propertyChannel - .getBoolean(PM_SYNC_SERVICES, false))) { + if (!( + propertyChannel.getBoolean(PM_SYNC_DATATYPES, false) + || + propertyChannel.getBoolean(PM_SYNC_SERVICES, false))) { syncBtn.setEnabled(true); generateBtn.setEnabled(true); } @@ -827,11 +964,13 @@ ArrayList command = new ArrayList(); // update the moses cache first ... command = new ArrayList(); + command.addAll(generatePerlPrefix()); + String s = (command.size() > 0 ? command.remove(command.size()-1) : "") ; Process p; try { - // construct the command - command.add(is_windows_pc ? "moses-generate-services" - : "moses-generate-services.pl"); + // construct the command + command.add(is_windows_pc ? "moses-generate-services" + : s + "moses-generate-services.pl"); if (Boolean.parseBoolean(propertyChannel .getString(PM_OVERWRITE))) command.add("-F"); @@ -881,7 +1020,7 @@ error("Problem executing 'moses-generate-services.pl'", exception); console.setEnabledAppendMode(true); - propertyChannel.fire(PM_GENERATING_BY_AUTHORITY, new Boolean( + propertyChannel.put(PM_GENERATING_BY_AUTHORITY, new Boolean( false)); if (!(propertyChannel.getBoolean(PM_GENERATING_BY_AUTHORITY, false)|| propertyChannel.getBoolean(PM_GENERATING_SPECIFIC_SERVICES, false))) { @@ -922,11 +1061,13 @@ + name + "' provided by '" + auth + "' ..."); console.setEnabledAppendMode(false); ArrayList command = new ArrayList(); + command.addAll(generatePerlPrefix()); + String s = (command.size() > 0 ? command.remove(command.size()-1) : "") ; Process p; try { // construct the command command.add(is_windows_pc ? "moses-generate-services" - : "moses-generate-services.pl"); + : s + "moses-generate-services.pl"); if (Boolean.parseBoolean(propertyChannel .getString(PM_OVERWRITE))) command.add("-F"); @@ -979,7 +1120,7 @@ error("Problem executing 'moses-generate-services.pl'", exception); console.setEnabledAppendMode(true); - propertyChannel.fire(PM_GENERATING_SPECIFIC_SERVICES, + propertyChannel.put(PM_GENERATING_SPECIFIC_SERVICES, new Boolean(false)); if (!(propertyChannel.getBoolean(PM_GENERATING_BY_AUTHORITY, false)|| propertyChannel.getBoolean(PM_GENERATING_SPECIFIC_SERVICES, false))) { @@ -1153,8 +1294,7 @@ Object uo2 = ((DefaultMutableTreeNode) en .nextElement()).getUserObject(); if (uo2 instanceof CommonNode) - System.out.println(((CommonNode) uo2) - .getValue()); + System.out.println(((CommonNode) uo2).getValue()); } } else if (nodeType == CommonNode.NODE_SERVICE) { From kawas at dev.open-bio.org Tue May 27 16:08:38 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 27 May 2008 16:08:38 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805272008.m4RK8cPe011600@dev.open-bio.org> kawas Tue May 27 16:08:37 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard In directory dev.open-bio.org:/tmp/cvs-serv11565/src/main/org/biomoby/service/dashboard Modified Files: PerlMoSeSPanel.java Log Message: *made commands that run on windows end in .bat *added reading of input stream -- windows hung when it was ignored. moby-live/Java/src/main/org/biomoby/service/dashboard PerlMoSeSPanel.java,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java 2008/05/27 17:25:17 1.4 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java 2008/05/27 20:08:37 1.5 @@ -176,7 +176,6 @@ private void check_install() { String[] command; ArrayList prefix = generatePerlPrefix(); - if (is_windows_pc) { prefix.add("moses-cache-tester.bat"); command = prefix.toArray(new String[]{}); @@ -187,6 +186,12 @@ try { Process process; process = Runtime.getRuntime().exec(command); + BufferedReader br = new BufferedReader( + new InputStreamReader(process.getInputStream())); + String line = null; + while ((line = br.readLine()) != null) { + //System.out.println(line + System.getProperty("line.separator")); + } process.waitFor(); enable_moses_actions = true; } catch (Exception e) { @@ -809,7 +814,7 @@ String s = (command.size() > 0 ? command.remove(command.size()-1) : "") ; // construct the command - command.add(is_windows_pc ? "moses-generate-datatypes" + command.add(is_windows_pc ? "moses-generate-datatypes.bat" : s + "moses-generate-datatypes.pl"); command.add("-R"); command @@ -839,11 +844,11 @@ } catch (IOException ioe) { exception = new MobyException( - "There was a problem synchronizing the datatype cache(x001):", + "There was a problem synchronizing the datatype cache(x001):\n" + ioe.getMessage(), ioe); } catch (InterruptedException ie) { exception = new MobyException( - "There was a problem synchronizing the datatype cache(x002):", + "There was a problem synchronizing the datatype cache(x002)\n: + ie.getMessage()", ie); } return null; // not used here @@ -888,7 +893,7 @@ command.addAll(generatePerlPrefix()); String s = (command.size() > 0 ? command.remove(command.size()-1) : "") ; // construct the command - command.add(is_windows_pc ? "moses-generate-services" + command.add(is_windows_pc ? "moses-generate-services.bat" : s + "moses-generate-services.pl"); command.add("-R"); command @@ -918,11 +923,11 @@ } catch (IOException ioe) { exception = new MobyException( - "There was a problem synchronizing the service cache(x001):", + "There was a problem synchronizing the service cache(x001):\n" + ioe.getMessage(), ioe); } catch (InterruptedException ie) { exception = new MobyException( - "There was a problem synchronizing the service cache(x002):", + "There was a problem synchronizing the service cache(x002):\n" + ie.getMessage(), ie); } return null; // not used here @@ -969,7 +974,7 @@ Process p; try { // construct the command - command.add(is_windows_pc ? "moses-generate-services" + command.add(is_windows_pc ? "moses-generate-services.bat" : s + "moses-generate-services.pl"); if (Boolean.parseBoolean(propertyChannel .getString(PM_OVERWRITE))) @@ -1004,11 +1009,11 @@ } catch (IOException ioe) { exception = new MobyException( "There was a problem generating MoSeS skeletons for '" - + authority + "'(x001):", ioe); + + authority + "'(x001):\n" + ioe.getMessage(), ioe); } catch (InterruptedException ie) { exception = new MobyException( "There was a problem generating MoSeS skeletons for '" - + authority + "'(x002):", ie); + + authority + "'(x002):\n" + ie.getMessage(), ie); } } return null; // not used here @@ -1066,7 +1071,7 @@ Process p; try { // construct the command - command.add(is_windows_pc ? "moses-generate-services" + command.add(is_windows_pc ? "moses-generate-services.bat" : s + "moses-generate-services.pl"); if (Boolean.parseBoolean(propertyChannel .getString(PM_OVERWRITE))) @@ -1103,12 +1108,12 @@ exception = new MobyException( "There was a problem generating service skeleton for service '" + name + "' provided by '" + auth - + "' (x001):", ioe); + + "' (x001):\n" + ioe.getMessage(), ioe); } catch (InterruptedException ie) { exception = new MobyException( "There was a problem generating service skeleton for service '" + name + "' provided by '" + auth - + "' (x002):", ie); + + "' (x002):\n" + ie.getMessage(), ie); } } return null; // not used here From kawas at dev.open-bio.org Tue May 27 19:10:55 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 27 May 2008 19:10:55 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805272310.m4RNAtM3011812@dev.open-bio.org> kawas Tue May 27 19:10:54 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard In directory dev.open-bio.org:/tmp/cvs-serv11777/src/main/org/biomoby/service/dashboard Modified Files: PerlMoSeSPanel.java Log Message: *last font selected is saved moby-live/Java/src/main/org/biomoby/service/dashboard PerlMoSeSPanel.java,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java 2008/05/27 20:08:37 1.5 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java 2008/05/27 23:10:54 1.6 @@ -130,6 +130,9 @@ // String: the exact path to the users perl (in case it is not available on the path) static String PM_PERL_INSTALL_DIR = "perl-moses-perl-install-dir"; + + // String: the font that the editor uses + static String PM_EDITOR_FONT = "perl-moses-editor-font"; // generated serialversionUID private static final long serialVersionUID = 1379466985182986776L; @@ -678,14 +681,30 @@ GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); String[] fontFamilies = env.getAvailableFontFamilyNames(); + int index = 0; + String saved_font = getPrefValue(PM_EDITOR_FONT, ""); + if (saved_font != null && !saved_font.trim().equals("")) { + index = 0; + for (String f:fontFamilies) { + if (f.equals(saved_font)) + break; + else + index++; + } + Font oldFont = editorTextPane.getFont(); + Font font = new Font(saved_font, oldFont.getStyle(), oldFont.getSize()); + editorTextPane.setFont(font); + } + // set up the combobox fonts = new JComboBox(fontFamilies); - fonts.setSelectedIndex(0); + fonts.setSelectedIndex(index >= fontFamilies.length -1 ? 0 : index); // add a listener fonts.addItemListener(new ItemListener(){ public void itemStateChanged(ItemEvent e) { String newFont = (String)e.getItem(); Font oldFont = editorTextPane.getFont(); + setPrefValue(PM_EDITOR_FONT, newFont); Font font = new Font(newFont, oldFont.getStyle(), oldFont.getSize()); editorTextPane.setFont(font); } From kawas at dev.open-bio.org Thu May 29 09:32:23 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 29 May 2008 09:32:23 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805291332.m4TDWNIR015385@dev.open-bio.org> kawas Thu May 29 09:32:23 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/share/cgi In directory dev.open-bio.org:/tmp/cvs-serv15350/Perl/MOBY-Server/share/cgi Modified Files: service_tester.pl Log Message: $opt_c was supposed to read $url ... Thanks Jason for pointing this out moby-live/Perl/MOBY-Server/share/cgi service_tester.pl,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/share/cgi/service_tester.pl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOBY-Server/share/cgi/service_tester.pl 2008/05/14 14:01:19 1.3 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/share/cgi/service_tester.pl 2008/05/29 13:32:23 1.4 @@ -147,7 +147,7 @@ # test cgi services do { my $ua = LWP::UserAgent->new; - my $req = POST $opt_c, [ data => $input]; + my $req = POST $url, [ data => $input]; $req = $ua->request($req); $out = $req->content if $req->is_success; } if $cat eq 'cgi'; From kawas at dev.open-bio.org Thu May 29 10:19:47 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 29 May 2008 10:19:47 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805291419.m4TEJlI2015779@dev.open-bio.org> kawas Thu May 29 10:19:47 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server In directory dev.open-bio.org:/tmp/cvs-serv15744/Perl/MOBY-Server Modified Files: Changes Log Message: updating the changes to reflect recent commits moby-live/Perl/MOBY-Server Changes,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/Changes,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Perl/MOBY-Server/Changes 2008/05/12 15:08:10 1.5 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/Changes 2008/05/29 14:19:47 1.6 @@ -1,5 +1,37 @@ Revision history for Perl extension MOBY. +1.05 + + - Multiple bug fixes / additions to installer (thanks to Jason Stewart), + as follows: + Additions + * detecting root and giving a warning if not root + * creating apache file in conf.d/ if running apache2 + * added apache defaults for debian/ubuntu systems + * added a couple longer messages to give people a heads up + what is happening. + * changed many/most of the do {...} if pprompt() to + if (prompt()) {...} + * changed the big multi-line messages from multiple + say "..." to say < kawas Thu May 29 10:15:13 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts In directory dev.open-bio.org:/tmp/cvs-serv15629/Perl/MOBY-Server/bin/scripts Modified Files: moby-s-install.pl Log Message: Commiting fixes implemented by Jason Stewart. Thanks! Additions * detecting root and giving a warning if not root * creating apache file in conf.d/ if running apache2 * added apache defaults for debian/ubuntu systems * added a couple longer messages to give people a heads up what is happening. * changed many/most of the do {...} if pprompt() to if (prompt()) {...} * changed the big multi-line messages from multiple say "..." to say <$file" @@ -457,10 +459,44 @@ {} ); + # since the file contains the root DB password + # make it only readable by root + chmod 0600, $file; + die "Couldn't make MOBY config file readable only by root: $!" + if $?; + # finished! return; } +sub check_root { + unless (getpwuid($<) eq 'root') { + print STDOUT <; $tmp =~ s/\s//g; + exit() unless $tmp =~ /y/i; + } else { + print STDOUT < 'n' - ) eq 'y'; - } else { - say " Installing the file '$apache_conf/mobycentral.config' ..."; +EOT - # fill out mobycentral.config - ( - $username, $password, $url, - $port, $m_object, $m_relationship, - $m_service, $m_namespace, $m_central - ) - = prompt_moby_config_info; +$answer = pprompt( "$apache_info\nShall we begin setting up apache? [n] ", + -ynd => 'n' ); + +if ($answer eq 'y') { + + say "Configuring your MOBY/SQL config file ..."; - # TODO - collect the values and do this at the end - fill_out_moby_conf( - "$apache_conf/mobycentral.config", - $username, $password, $url, - $port, $m_object, $m_relationship, - $m_service, $m_namespace, $m_central + # mobycentral.config exists + if ( -e "$apache_conf/mobycentral.config" ) { + do { + + # copy mobycentral.config to conf directory + ( + $username, $password, $url, + $port, $m_object, $m_relationship, + $m_service, $m_namespace, $m_central + ) + = prompt_moby_config_info; + + # TODO - collect the values and do this at the end + # fill out mobycentral.config + fill_out_moby_conf("$apache_conf/mobycentral.config", + $username, $password, $url, + $port, $m_object, $m_relationship, + $m_service, $m_namespace, $m_central ); + } + if pprompt( + "Would you like to overwrite the file '$apache_conf/mobycentral.config'? [n] ", + -ynd => 'n' + ) eq 'y'; + } else { + say " Installing the file '$apache_conf/mobycentral.config' ..."; + + # fill out mobycentral.config + ( $username, $password, $url, + $port, $m_object, $m_relationship, + $m_service, $m_namespace, $m_central + ) = prompt_moby_config_info; - #install MOBY-Central.pl and OntologyServer.cgi - say " Installing the MOBY-Central.pl & OntologyServer.cgi ..."; - file_from_template( - "$apache_cgi/MOBY-Central.pl", - File::ShareDir::dist_file( - 'MOBY', 'cgi/MOBY-Central.pl' - ), - 'MOBY-Central Dispatch file', - { '#!/usr/bin/perl -w' => "#!$perl_exec", } + # TODO - collect the values and do this at the end + fill_out_moby_conf("$apache_conf/mobycentral.config", + $username, $password, $url, + $port, $m_object, $m_relationship, + $m_service, $m_namespace, $m_central + ); + } + + #install MOBY-Central.pl and OntologyServer.cgi + say " Installing the MOBY-Central.pl & OntologyServer.cgi ..."; + file_from_template( + "$apache_cgi/MOBY-Central.pl", + File::ShareDir::dist_file('MOBY', 'cgi/MOBY-Central.pl'), + 'MOBY-Central Dispatch file', + { '#!/usr/bin/perl -w' => "#!$perl_exec", } ); - file_from_template( - "$apache_cgi/OntologyServer.cgi", - File::ShareDir::dist_file( - 'MOBY', 'cgi/OntologyServer.cgi' - ), - 'MOBY-Central Ontology Server file', - { '#!/usr/bin/perl -w' => "#!$perl_exec", } + file_from_template( + "$apache_cgi/OntologyServer.cgi", + File::ShareDir::dist_file('MOBY', 'cgi/OntologyServer.cgi'), + 'MOBY-Central Ontology Server file', + { '#!/usr/bin/perl -w' => "#!$perl_exec", } ); - #install the moby-admin module - file_from_template( - "$apache_cgi/MOBY-Admin.pl", - File::ShareDir::dist_file( - 'MOBY', 'cgi/MOBY-Admin.pl' - ), - 'MOBY-Admin Dispatch file', - { '#!/usr/bin/perl -w' => "#!$perl_exec", } + #install the moby-admin module + file_from_template( + "$apache_cgi/MOBY-Admin.pl", + File::ShareDir::dist_file('MOBY', 'cgi/MOBY-Admin.pl'), + 'MOBY-Admin Dispatch file', + { '#!/usr/bin/perl -w' => "#!$perl_exec", } ); - # configure httpd.conf - if ( -e "$apache_conf/httpd.conf" ) { - say "I would like to add the following lines to your httpd.conf file:\n" - . "\tSetEnv MOBY_CENTRAL_CONFIG \"$apache_conf/mobycentral.config\"\n" - . "\tSetEnv MOBY_URI \"http://localhost/MOBY/Central\"\n" - . "\tSetEnv MOBY_SERVER \"http://localhost/cgi-bin/MOBY/MOBY-Central.pl\"\n" - . "\tSetEnv MOBY_ONTOLOGYSERVER \"http://localhost/cgi-bin/OntologyServer.cgi\"\n" - . "Of course, those lines may not be exactly right, so I will give you a chance to modify them!\n"; - do { + # + # Configure Apache - check for Apache2 first + # + + say < 'y'); + + if ($answer eq 'y') { + open( DAT, ">$conf_file" ) + or die("Could not open $conf_file for reading!"); + + print DAT <; - close(DAT); - - open( DAT, "> $apache_conf/httpd.conf_backup" . time() ) - || die("Trouble creating a backup of httpd.conf!\n$@"); - print DAT @raw_data; - close(DAT); - - my %added = ( - 'DIRTY' => 0, - 'MOBY_CENTRAL_CONFIG' => 0, - 'MOBY_URI' => 0, - 'MOBY_SERVER' => 0, - 'MOBY_ONTOLOGYSERVER' => 0, - ); - tie @raw_data, 'Tie::File', "$apache_conf/httpd.conf" or die "$@"; - for (@raw_data) { - - if ( -/SETENV\s*(MOBY_CENTRAL_CONFIG|MOBY_URI|MOBY_SERVER|MOBY_ONTOLOGYSERVER)\s*.*/gi - ) - { - $added{'DIRTY'}++; - if ( $1 eq "MOBY_CENTRAL_CONFIG" ) { - $_ = "SetEnv MOBY_CENTRAL_CONFIG \"$env1\""; - $added{$1} = 1; - } elsif ( $1 eq "MOBY_URI" ) { - $_ = "SetEnv MOBY_URI \"$env2\""; - $added{$1} = 1; - } elsif ( $1 eq "MOBY_SERVER" ) { - $_ = "SetEnv MOBY_SERVER \"$env3\""; - $added{$1} = 1; - } else { - $_ = "SetEnv MOBY_ONTOLOGYSERVER \"$env4\""; - $added{$1} = 1; - } - } - } - untie @raw_data; + } + } elsif (not -e "$apache_conf/httpd.conf" ) { + die "Could not detect Apache2 setup ($apache_conf/conf.d/) or Apache1.3 ($apache_conf/httpd.conf). Please restart and enter the correct info"; + } else { + + # configure httpd.conf create backup of httpd.conf and append the values + # to the begining of the file + + $answer = pprompt( "May I edit your httpd.conf file? [y] ", + -ynd => 'y' ); + if ($answer eq 'y') { + open( DAT, "< $apache_conf/httpd.conf" ) + || die("Could not open file for reading!"); + my @raw_data = ; + close(DAT); + + open( DAT, "> $apache_conf/httpd.conf_backup" . time() ) + || die("Trouble creating a backup of httpd.conf!\n$@"); + print DAT @raw_data; + close(DAT); + + my %added = ( + 'DIRTY' => 0, + 'MOBY_CENTRAL_CONFIG' => 0, + 'MOBY_URI' => 0, + 'MOBY_SERVER' => 0, + 'MOBY_ONTOLOGYSERVER' => 0, + ); + tie @raw_data, 'Tie::File', "$apache_conf/httpd.conf" or die "$@"; + + for (@raw_data) { + + if ( + /SETENV\s*(MOBY_CENTRAL_CONFIG|MOBY_URI|MOBY_SERVER|MOBY_ONTOLOGYSERVER)\s*.*/gi + ) + { + $added{'DIRTY'}++; + if ( $1 eq "MOBY_CENTRAL_CONFIG" ) { + $_ = "SetEnv MOBY_CENTRAL_CONFIG \"$env1\""; + $added{$1} = 1; + } elsif ( $1 eq "MOBY_URI" ) { + $_ = "SetEnv MOBY_URI \"$env2\""; + $added{$1} = 1; + } elsif ( $1 eq "MOBY_SERVER" ) { + $_ = "SetEnv MOBY_SERVER \"$env3\""; + $added{$1} = 1; + } else { + $_ = "SetEnv MOBY_ONTOLOGYSERVER \"$env4\""; + $added{$1} = 1; + } + } + } + untie @raw_data; + + do { + open( DAT, ">> $apache_conf/httpd.conf" ) + || die("Trouble updating httpd.conf!\n$@"); + print DAT "\n# Values added by moby-s-install.pl\n" + if $added{'DIRTY'} == 0; + print DAT "SetEnv MOBY_CENTRAL_CONFIG \"$env1\"\n" + if $added{'MOBY_CENTRAL_CONFIG'} == 0; + print DAT "SetEnv MOBY_URI \"$env2\"\n" + if $added{'MOBY_URI'} == 0; + print DAT "SetEnv MOBY_SERVER \"$env3\"\n" + if $added{'MOBY_SERVER'} == 0; + print DAT "SetEnv MOBY_ONTOLOGYSERVER \"$env4\"\n" + if $added{'MOBY_ONTOLOGYSERVER'} == 0; + close(DAT); + } unless $added{'DIRTY'} == 4; + + say <> $apache_conf/httpd.conf" ) - || die("Trouble updating httpd.conf!\n$@"); - print DAT "\n# Values added by moby-s-install.pl\n" - if $added{'DIRTY'} == 0; - print DAT "SetEnv MOBY_CENTRAL_CONFIG \"$env1\"\n" - if $added{'MOBY_CENTRAL_CONFIG'} == 0; - print DAT "SetEnv MOBY_URI \"$env2\"\n" - if $added{'MOBY_URI'} == 0; - print DAT "SetEnv MOBY_SERVER \"$env3\"\n" - if $added{'MOBY_SERVER'} == 0; - print DAT "SetEnv MOBY_ONTOLOGYSERVER \"$env4\"\n" - if $added{'MOBY_ONTOLOGYSERVER'} == 0; - close(DAT); - } unless $added{'DIRTY'} == 4; - - say -"\nPlease don't forget to add the following ENV variables to your profile so that they\n" - . "are always available when calling client BioMOBY API methods from scripts!\n" - . "\tMOBY_CENTRAL_CONFIG = \"$env1\"\n" - . "\tMOBY_URI = \"$env2\"\n" - . "\tMOBY_SERVER = \"$env3\"\n" - . "\tMOBY_ONTOLOGYSERVER = \"$env4\"\n"; - - } - if pprompt( "May I edit your httpd.conf file? [y] ", -ynd => 'y' ) eq - 'y'; +EOT } + } +} -} if pprompt( "Would you like to set up apache? [n] ", -ynd => 'n' ) eq 'y'; +$answer = pprompt( "Would you like to set up mySQL? [n] ", -ynd => 'n' ); +if ($answer eq 'y') { -do { my $ready_to_go = 0; my $sql_error = 0; #check to see if we can call mysql ... if not, then die! + my $mysql_installed = (`mysql --version 2>&1` =~ m/^mysql\s+Ver\s+.*$/); + my $mysql_started = (`mysql 2>&1` !~ m/^ERROR 200.*Can't connect to .*$/); print "mysql is installed ...\n" - if `mysql --version 2>&1` =~ m/^mysql\s+Ver\s+.*$/; + if $mysql_installed; print "mysql is started ...\n" - unless `mysql 2>&1` =~ m/^ERROR 200.*Can't connect to .*$/; + if $mysql_started; - unless ( `mysql --version 2>&1` =~ m/^mysql\s+Ver\s+.*$/ - and not( `mysql 2>&1` =~ m/^ERROR .*Can't connect to local MySQL .*$/ ) - ) + unless ($mysql_installed and $mysql_started) { + die < if so, parse it + + if ( -e "$apache_conf/mobycentral.config" + && !( -d "$apache_conf/mobycentral.config" ) + && !$ready_to_go ) { - say -"\nmysql doesn't seem to be accessible ... please ensure that it is on the path, started and try again.\n"; - $sql_error = 1; + open IN, "$apache_conf/mobycentral.config" + or die + "can't open MOBY Configuration file '$apache_conf/mobycentral.config' for unknown reasons: $!\n"; + + my @sections = split /(\[\s*\S+\s*\][^\[]*)/s, join "", ; + my %db_sections = (); + foreach my $section (@sections) { + my $dbConfig = MOBY::dbConfig->new( section => $section ); + next unless $dbConfig; + my $dbname = $dbConfig->section_title; + next unless $dbname; + $db_sections{$dbname} = $dbConfig; + } + + $username = $db_sections{mobycentral}->{username}; + $password = $db_sections{mobycentral}->{password} || ""; + $url = $db_sections{mobycentral}->{url}; + $port = $db_sections{mobycentral}->{port}; + $m_object = $db_sections{mobyobject}->{dbname}; + $m_relationship = $db_sections{mobyrelationship}->{dbname}; + $m_service = $db_sections{mobyservice}->{dbname}; + $m_namespace = $db_sections{mobynamespace}->{dbname}; + $m_central = $db_sections{mobycentral}->{dbname}; + + $ready_to_go = 1; } - # proceed if mysql check was good - do { + # if the values havent been set, then prompt for them + unless ($ready_to_go) { - # have the values been set already? - $ready_to_go = 1 - if $username - and $url - and $port - and $m_object - and $m_relationship - and $m_service - and $m_namespace - and $m_central; - -#check to see if mobycentral.config has been created in the conf directory first -> if so, parse it - if ( -e "$apache_conf/mobycentral.config" - && !( -d "$apache_conf/mobycentral.config" ) - && !$ready_to_go ) - { - my %db_sections = (); - open IN, "$apache_conf/mobycentral.config" - or die -"can't open MOBY Configuration file '$apache_conf/mobycentral.config' for unknown reasons: $!\n"; - my @sections = split /(\[\s*\S+\s*\][^\[]*)/s, join "", ; - foreach my $section (@sections) { - my $dbConfig = MOBY::dbConfig->new( section => $section ); - next unless $dbConfig; - my $dbname = $dbConfig->section_title; - next unless $dbname; - $db_sections{$dbname} = $dbConfig; - } + say " Installing the file '$apache_conf/mobycentral.config' ..."; - $username = $db_sections{mobycentral}->{username}; - $password = $db_sections{mobycentral}->{password} || ""; - $url = $db_sections{mobycentral}->{url}; - $port = $db_sections{mobycentral}->{port}; - $m_object = $db_sections{mobyobject}->{dbname}; - $m_relationship = $db_sections{mobyrelationship}->{dbname}; - $m_service = $db_sections{mobyservice}->{dbname}; - $m_namespace = $db_sections{mobynamespace}->{dbname}; - $m_central = $db_sections{mobycentral}->{dbname}; + # fill out mobycentral.config + ($username, $password, $url, + $port, $m_object, $m_relationship, + $m_service, $m_namespace, $m_central + ) = prompt_moby_config_info; + + fill_out_moby_conf( + "$apache_conf/mobycentral.config", + $username, $password, $url, + $port, $m_object, $m_relationship, + $m_service, $m_namespace, $m_central + ); + } + + # now start creating the tables + say " creating the tables to use for the registry ..."; + my %dbsections = ( + 'mobycentral' => $m_central, + 'mobyobject' => $m_object, + 'mobyservice' => $m_service, + 'mobynamespace' => $m_namespace, + 'mobyrelationship' => $m_relationship + ); + + my $clone = 0; + my $central; + $answer = pprompt( "Would you like to clone a mobycentral registry? [n] ", + -ynd => 'n' ); + if ($answer eq 'y') { + $clone = 1; + my %registries = ( + default => { + url => "http://moby.ucalgary.ca/moby/MOBY-Central.pl", + uri => "http://moby.ucalgary.ca/MOBY/Central" + }, + testing => { + url => "http://bioinfo.icapture.ubc.ca/cgi-bin/mobycentral/MOBY-Central.pl", + uri => "http://bioinfo.icapture.ubc.ca/MOBY/Central" + }, + IRRI => { + url => "http://cropwiki.irri.org/cgi-bin/MOBY-Central.pl", + uri => "http://cropwiki.irri.org/MOBY/Central" + }, + + # localhost => { + # url=>"http://localhost/cgi-bin/MOBY-Central.pl", + # uri=>"http://localhost/MOBY/Central" + # }, + ); + my $registry = pprompt( "What registry to use? [b] ", + -d => 'b', + -m => [ sort keys %registries ], + ); - $ready_to_go = 1; + $central = MOBY::Client::Central->new( + Registries => { + mobycentral => { + URL => $registries{$registry}{url}, + URI => $registries{$registry}{uri} + } } + ); + } + my $error = 0; + if ($clone) { + say "Getting db dumps ..."; + my ($mobycentral, $mobyobject, $mobyservice, + $mobynamespace, $mobyrelationship + ) = $central->MOBY::Client::Central::DUMP(); + my $drh = DBI->install_driver("mysql"); + + my ( $fh, $filename ) = tempfile( UNLINK => 1 ); + say "Processing dump for service instances ..."; + print $fh $mobycentral; + eval { + $drh->func( 'dropdb', $dbsections{mobycentral}, + $url, $username, $password, 'admin' ); + }; + eval { + $drh->func( 'createdb', $dbsections{mobycentral}, + $url, $username, $password, 'admin' ); + }; + system( "mysql -h $url -P $port -u $username --password=$password " + . $dbsections{mobycentral} + . "<$filename" ) == 0 + or ( say "Error populating service instance ontology ...\n$!" + and $error++ ); + + ( $fh, $filename ) = tempfile( UNLINK => 1 ); + say "Processing dump for the objects ontology ..."; + print $fh $mobyobject; + eval { + $drh->func( 'dropdb', $dbsections{mobyobject}, $url, $username, + $password, 'admin' ); + }; + eval { + $drh->func( 'createdb', $dbsections{mobyobject}, $url, + $username, $password, 'admin' ); + }; + system( "mysql -h $url -P $port -u $username --password=$password " + . $dbsections{mobyobject} + . "<$filename" ) == 0 + or + ( say "Error populating objects ontology ...\n$!" and $error++ ); + + ( $fh, $filename ) = tempfile( UNLINK => 1 ); + say "Processing dump for service types ..."; + print $fh $mobyservice; + eval { + $drh->func( 'dropdb', $dbsections{mobyservice}, + $url, $username, $password, 'admin' ); + }; + eval { + $drh->func( 'createdb', $dbsections{mobyservice}, + $url, $username, $password, 'admin' ); + }; + system( "mysql -h $url -P $port -u $username --password=$password " + . $dbsections{mobyservice} + . "<$filename" ) == 0 + or ( say "Error populating service types ontology ...\n$!" + and $error++ ); + + ( $fh, $filename ) = tempfile( UNLINK => 1 ); + say "Processing dump for the namespace ontology ..."; + print $fh $mobynamespace; + eval { + $drh->func( 'dropdb', $dbsections{mobynamespace}, + $url, $username, $password, 'admin' ); + }; + eval { + $drh->func( 'createdb', $dbsections{mobynamespace}, + $url, $username, $password, 'admin' ); + }; + system( "mysql -h $url -P $port -u $username --password=$password " + . $dbsections{mobynamespace} + . "<$filename" ) == 0 + or ( say "Error populating namespace ontology ...\n$!" + and $error++ ); + + ( $fh, $filename ) = tempfile( UNLINK => 1 ); + say "Processing dump for the relationships ontology ..."; + print $fh $mobyrelationship; + eval { + $drh->func( 'dropdb', $dbsections{mobyrelationship}, + $url, $username, $password, 'admin' ); + }; + eval { + $drh->func( 'createdb', $dbsections{mobyrelationship}, + $url, $username, $password, 'admin' ); + }; + system( "mysql -h $url -P $port -u $username --password=$password " + . $dbsections{mobyrelationship} + . "<$filename" ) == 0 + or ( say "Error populating relationships ontology ...\n$!" + and $error++ ); - # if the values havent been set, then prompt for them - do { + } else { - say " Installing the file '$apache_conf/mobycentral.config' ..."; + # no clone, so create minimalist databases + my $drop_db = 0; - # fill out mobycentral.config - ( - $username, $password, $url, - $port, $m_object, $m_relationship, - $m_service, $m_namespace, $m_central - ) - = prompt_moby_config_info; - fill_out_moby_conf( - "$apache_conf/mobycentral.config", - $username, $password, $url, - $port, $m_object, $m_relationship, - $m_service, $m_namespace, $m_central - ); - - } unless $ready_to_go; - - # now start creating the tables - say " creating the tables to use for the registry ..."; - my %dbsections = ( - 'mobycentral' => $m_central, - 'mobyobject' => $m_object, - 'mobyservice' => $m_service, - 'mobynamespace' => $m_namespace, - 'mobyrelationship' => $m_relationship + #ask for permission on dropping data from db ... + $answer = pprompt( + "Shall I drop all pre-existing databases used by BioMOBY? [n] ", + -ynd => 'n' ); + if ($answer eq 'y') { + $drop_db = 1; + } + + #process each db + foreach my $section ( keys %dbsections ) { + my $sqlfilepath = File::ShareDir::dist_file( 'MOBY', + "db/schema/$section.mysql" ); + my $drh = DBI->install_driver("mysql"); + + # drop the db + eval { + $drh->func( 'dropdb', $dbsections{$section}, $url, + $username, $password, 'admin' ); + } if $drop_db; + + # create the db + eval { + $drh->func( 'createdb', $dbsections{$section}, $url, + $username, $password, 'admin' ); + }; - my $clone = 0; - my $central; + #create the tables in the db do { - $clone = 1; - my %registries = ( - default => { - url => "http://moby.ucalgary.ca/moby/MOBY-Central.pl", - uri => "http://moby.ucalgary.ca/MOBY/Central" - }, - testing => { - url => -"http://bioinfo.icapture.ubc.ca/cgi-bin/mobycentral/MOBY-Central.pl", - uri => "http://bioinfo.icapture.ubc.ca/MOBY/Central" - }, - IRRI => { - url => "http://cropwiki.irri.org/cgi-bin/MOBY-Central.pl", - uri => "http://cropwiki.irri.org/MOBY/Central" - }, - - # localhost => { - # url=>"http://localhost/cgi-bin/MOBY-Central.pl", - # uri=>"http://localhost/MOBY/Central" - # }, - ); - my $registry = pprompt( "What registry to use? [b] ", - -m => [ sort keys %registries ] ); - - $central = MOBY::Client::Central->new( - Registries => { - mobycentral => { - URL => $registries{$registry}{url}, - URI => $registries{$registry}{uri} - } - } - ); - } - if pprompt( "Would you like to clone a mobycentral registry? [n] ", - -ynd => 'n' ) eq 'y'; - my $error = 0; - if ($clone) { - say "Getting db dumps ..."; - my ( - $mobycentral, $mobyobject, $mobyservice, - $mobynamespace, $mobyrelationship - ) - = $central->MOBY::Client::Central::DUMP(); - my $drh = DBI->install_driver("mysql"); - - my ( $fh, $filename ) = tempfile( UNLINK => 1 ); - say "Processing dump for service instances ..."; - print $fh $mobycentral; - eval { - $drh->func( 'dropdb', $dbsections{mobycentral}, - $url, $username, $password, 'admin' ); - }; - eval { - $drh->func( 'createdb', $dbsections{mobycentral}, - $url, $username, $password, 'admin' ); - }; - system( "mysql -h $url -P $port -u $username --password=$password " - . $dbsections{mobycentral} - . "<$filename" ) == 0 - or ( say "Error populating service instance ontology ...\n$!" - and $error++ ); - - ( $fh, $filename ) = tempfile( UNLINK => 1 ); - say "Processing dump for the objects ontology ..."; - print $fh $mobyobject; - eval { - $drh->func( 'dropdb', $dbsections{mobyobject}, $url, $username, - $password, 'admin' ); - }; - eval { - $drh->func( 'createdb', $dbsections{mobyobject}, $url, - $username, $password, 'admin' ); - }; - system( "mysql -h $url -P $port -u $username --password=$password " - . $dbsections{mobyobject} - . "<$filename" ) == 0 - or - ( say "Error populating objects ontology ...\n$!" and $error++ ); - - ( $fh, $filename ) = tempfile( UNLINK => 1 ); - say "Processing dump for service types ..."; - print $fh $mobyservice; - eval { - $drh->func( 'dropdb', $dbsections{mobyservice}, - $url, $username, $password, 'admin' ); - }; - eval { - $drh->func( 'createdb', $dbsections{mobyservice}, - $url, $username, $password, 'admin' ); - }; - system( "mysql -h $url -P $port -u $username --password=$password " - . $dbsections{mobyservice} - . "<$filename" ) == 0 - or ( say "Error populating service types ontology ...\n$!" - and $error++ ); - - ( $fh, $filename ) = tempfile( UNLINK => 1 ); - say "Processing dump for the namespace ontology ..."; - print $fh $mobynamespace; - eval { - $drh->func( 'dropdb', $dbsections{mobynamespace}, - $url, $username, $password, 'admin' ); - }; - eval { - $drh->func( 'createdb', $dbsections{mobynamespace}, - $url, $username, $password, 'admin' ); - }; - system( "mysql -h $url -P $port -u $username --password=$password " - . $dbsections{mobynamespace} - . "<$filename" ) == 0 - or ( say "Error populating namespace ontology ...\n$!" - and $error++ ); - - ( $fh, $filename ) = tempfile( UNLINK => 1 ); - say "Processing dump for the relationships ontology ..."; - print $fh $mobyrelationship; - eval { - $drh->func( 'dropdb', $dbsections{mobyrelationship}, - $url, $username, $password, 'admin' ); - }; - eval { - $drh->func( 'createdb', $dbsections{mobyrelationship}, - $url, $username, $password, 'admin' ); - }; - system( "mysql -h $url -P $port -u $username --password=$password " - . $dbsections{mobyrelationship} - . "<$filename" ) == 0 - or ( say "Error populating relationships ontology ...\n$!" - and $error++ ); - - } else { - - # no clone, so create minimalist databases - my $drop_db = 0; - - #ask for permission on dropping data from db ... - do { - $drop_db = 1; - } - if pprompt( - "Shall I drop all pre-existing databases used by BioMOBY? [n] ", - -ynd => 'n' - ) eq 'y'; - - #process each db - foreach my $section ( keys %dbsections ) { - my $sqlfilepath = File::ShareDir::dist_file( 'MOBY', - "db/schema/$section.mysql" ); - my $drh = DBI->install_driver("mysql"); - - # drop the db - eval { - $drh->func( 'dropdb', $dbsections{$section}, $url, - $username, $password, 'admin' ); - } if $drop_db; - - # create the db - eval { - $drh->func( 'createdb', $dbsections{$section}, $url, - $username, $password, 'admin' ); - }; - - #create the tables in the db - do { - say "\n\tProblem creating tables in the db: $section: $!"; - } - unless system( - "mysql -h $url -P $port -u $username --password=$password " - . $dbsections{$section} - . "<$sqlfilepath" ) == 0; - say "\tProcessing of $section completed ... "; - } - say "populating the tables with basic data ..."; - %dbsections = ( - 'mobyobject' => $m_object, - 'mobyservice' => $m_service, - 'mobyrelationship' => $m_relationship - ); - foreach my $section ( keys %dbsections ) { - my $sqlfilepath = - File::ShareDir::dist_file( 'MOBY', "db/data/$section.data" ); - system( - "mysql -h $url -P $port -u $username --password=$password " - . $dbsections{$section} - . "<$sqlfilepath" ) == 0 - or say "\n\tProblem populating the db: $section: $!"; - say "\tPopulation processing for db $section completed ..."; - } + say "\n\tProblem creating tables in the db: $section: $!"; } + unless system( + "mysql -h $url -P $port -u $username --password=$password " + . $dbsections{$section} + . "<$sqlfilepath" ) == 0; + say "\tProcessing of $section completed ... "; + } + say "populating the tables with basic data ..."; + %dbsections = ( + 'mobyobject' => $m_object, + 'mobyservice' => $m_service, + 'mobyrelationship' => $m_relationship + ); + foreach my $section ( keys %dbsections ) { + my $sqlfilepath = + File::ShareDir::dist_file( 'MOBY', "db/data/$section.data" ); + system( + "mysql -h $url -P $port -u $username --password=$password " + . $dbsections{$section} + . "<$sqlfilepath" ) == 0 + or say "\n\tProblem populating the db: $section: $!"; + say "\tPopulation processing for db $section completed ..."; + } + } - say "Set up of mySQL complete!" if $error == 0; - say -"There were some problems encountered. Please correct the errors and re-run this script!" - if $error > 0; - } unless $sql_error; -} if pprompt( "Would you like to set up mySQL? [n] ", -ynd => 'n' ) eq 'y'; - -do { + say "Set up of mySQL complete!" if $error == 0; + say + "There were some problems encountered. Please correct the errors and re-run this script!" + if $error > 0; +} + +$answer = pprompt( "Would you like to install the RESOURCES script? [y] ", + -ynd => 'y' ); +if ($answer eq 'y') { my $exists = 0; # install the script, confirm if it exists - do { - $exists = 1; - do { - $exists = 0; - } - if pprompt( "The RESOURCES script already exists, overwrite? [n] ", - -ynd => 'n' ) eq 'y'; - } if -e "$apache_cgi/RESOURCES"; + if (-e "$apache_cgi/RESOURCES") { + $exists = 1; + $answer = pprompt( "The RESOURCES script already exists, overwrite? [n] ", + -ynd => 'n' ); + if ($answer eq 'y') { + $exists = 0; + } + } my $rdf_cache_location = prompt_for_directory_expand( - "Where would you like to store the RDF cache?", - "$apache_base/moby_cache" ); + "Where would you like to store the RDF cache?", + "$apache_base/moby_cache" ); say "Please make sure that you make that directory read/writable by your web server!\n"; # copy the file - file_from_template( - "$apache_cgi/RESOURCES", - File::ShareDir::dist_file( 'MOBY', 'cgi/RESOURCES' ), - 'RESOURCES script', - { '#!/usr/bin/perl -w' => "#!$perl_exec", } - ) - if $exists == 0; + if ($exists == 0) { + file_from_template( + "$apache_cgi/RESOURCES", + File::ShareDir::dist_file( 'MOBY', 'cgi/RESOURCES' ), + 'RESOURCES script', + { '#!/usr/bin/perl -w' => "#!$perl_exec", } + ) + } # update mobycentral.config file to reflect the location of the script - do { + $answer = pprompt( +"Shall we update mobycentral.config to reflect the installation of this script? [y] ", + -ynd => 'y'); + if ($answer eq 'y') { - # confirm server name, etc then change the values - my $url = "http://localhost/cgi-bin"; - $url = - prompt_user_input( - "Please enter the correct url to your cgi-bin directory: ", - "$url" ); - - # make sure that the key resourceURL exists ... - my $search = search_config_file( - "$apache_conf/mobycentral.config", - { - 'mobycentral' => { - 'resourceURL' => 0, - 'allResources' => 0, - 'rdf_cache' => 0 - }, - 'mobyobject' => { 'resourceURL' => 0 }, - 'mobyservice' => { 'resourceURL' => 0 }, - 'mobynamespace' => { 'resourceURL' => 0 }, - } + # confirm server name, etc then change the values + my $url = "http://localhost/cgi-bin"; + $url = prompt_user_input( + "Please enter the correct url to your cgi-bin directory: ", + "$url" ); + + # make sure that the key resourceURL exists ... + my $search = search_config_file( + "$apache_conf/mobycentral.config", + { + 'mobycentral' => { + 'resourceURL' => 0, + 'allResources' => 0, + 'rdf_cache' => 0, + }, + 'mobyobject' => { 'resourceURL' => 0 }, + 'mobyservice' => { 'resourceURL' => 0 }, + 'mobynamespace' => { 'resourceURL' => 0 }, + } ); - add_missing_keys_to_config_file( "$apache_conf/mobycentral.config", - $search ); + add_missing_keys_to_config_file( "$apache_conf/mobycentral.config", + $search ); - # copy the information - config_file_from_template( - "$apache_conf/mobycentral.config", - "$apache_conf/mobycentral.config", - 'MOBY/SQL Configuration file', + # copy the information + config_file_from_template( + "$apache_conf/mobycentral.config", + "$apache_conf/mobycentral.config", + 'MOBY/SQL Configuration file', - # mysql settings - { 'rdf_cache' => "$rdf_cache_location" }, + # mysql settings + { 'rdf_cache' => "$rdf_cache_location" }, - # db section mappings - {}, + # db section mappings + {}, - # resource urls - { - 'ALL' => "$url/RESOURCES/MOBY-S/FULL", - 'mobycentral' => "$url/RESOURCES/MOBY-S/ServiceInstances", - 'mobyobject' => "$url/RESOURCES/MOBY-S/Objects", - 'mobynamespace' => "$url/RESOURCES/MOBY-S/Namespaces", - 'mobyservice' => "$url/RESOURCES/MOBY-S/Services", - }, + # resource urls + { + 'ALL' => "$url/RESOURCES/MOBY-S/FULL", + 'mobycentral' => "$url/RESOURCES/MOBY-S/ServiceInstances", + 'mobyobject' => "$url/RESOURCES/MOBY-S/Objects", + 'mobynamespace' => "$url/RESOURCES/MOBY-S/Namespaces", + 'mobyservice' => "$url/RESOURCES/MOBY-S/Services", + }, - # lsid info - {} + # lsid info + {} ); } - if pprompt( -"Shall we update mobycentral.config to reflect the installation of this script? [y] ", - -ynd => 'y' - ) eq 'y'; - } - if pprompt( "Would you like to install the RESOURCES script? [y] ", - -ynd => 'y' ) eq 'y'; +} -do { +$answer = pprompt( "Would you like to install the LSID authority script? [y] ", + -ynd => 'y' ); +if ($answer eq 'y') { # install the script, confirm if it exists my $exists = 0; - do { - $exists = 1; - do { - $exists = 0; - } - if pprompt( "The authority script already exists, overwrite? [n] ", - -ynd => 'n' ) eq 'y'; - } if -e "$apache_cgi/authority.pl"; + if (-e "$apache_cgi/authority.pl") { + $exists = 1; + $answer = pprompt( "The authority script already exists, overwrite? [n] ", + -ynd => 'n' ); + if ($answer eq 'y') { + $exists = 0; + } + } file_from_template( "$apache_cgi/authority.pl", @@ -1085,38 +1205,41 @@ if $exists == 0; # update mobycentral.config file to reflect the particulars of the script - do { + $answer = pprompt( +"Shall we update mobycentral.config to reflect the installation of this script? [y] ", + -ynd => 'y'); + if ($answer eq 'y') { - #ask for namespace/authority information + #ask for namespace/authority information - # make sure that the key lsid_namespace & lsid_authority exists ... - my $search = search_config_file( - "$apache_conf/mobycentral.config", - { - 'mobycentral' => { - 'lsid_namespace' => 0, - 'lsid_authority' => 0 - }, - 'mobyobject' => { - 'lsid_namespace' => 0, - 'lsid_authority' => 0 - }, - 'mobyservice' => { - 'lsid_namespace' => 0, - 'lsid_authority' => 0 - }, - 'mobynamespace' => { - 'lsid_namespace' => 0, - 'lsid_authority' => 0 - }, - 'mobyrelationship' => { - 'lsid_namespace' => 0, - 'lsid_authority' => 0 - }, - } + # make sure that the key lsid_namespace & lsid_authority exists ... + my $search = search_config_file( + "$apache_conf/mobycentral.config", + { + 'mobycentral' => { + 'lsid_namespace' => 0, + 'lsid_authority' => 0, + }, + 'mobyobject' => { + 'lsid_namespace' => 0, + 'lsid_authority' => 0, + }, + 'mobyservice' => { + 'lsid_namespace' => 0, + 'lsid_authority' => 0, + }, + 'mobynamespace' => { + 'lsid_namespace' => 0, + 'lsid_authority' => 0, + }, + 'mobyrelationship' => { + 'lsid_namespace' => 0, + 'lsid_authority' => 0, + }, + } ); add_missing_keys_to_config_file( "$apache_conf/mobycentral.config", - $search ); + $search ); # copy the information config_file_from_template( @@ -1136,85 +1259,92 @@ # lsid info { 'mobycentral' => { - 'NAMESPACE' => prompt_user_input( + 'NAMESPACE' => prompt_user_input( "Please enter an LSID namespace for the services ontology: ", - "serviceinstance" + "serviceinstance" ), 'AUTHORITY' => prompt_user_input( - "Please enter the LSID authority for services: ", - "biomoby.org" + "Please enter the LSID authority for services: ", + "biomoby.org" ), }, 'mobyobject' => { 'NAMESPACE' => prompt_user_input( "Please enter an LSID namespace for the datatype ontology: ", - "objectclass" + "objectclass" ), 'AUTHORITY' => prompt_user_input( - "Please enter the LSID authority for datatypes: ", - "biomoby.org" +"Please enter the LSID authority for datatypes: ", + "biomoby.org" ), }, 'mobyservice' => { 'NAMESPACE' => prompt_user_input( "Please enter an LSID namespace for the service types ontology: ", - "servicetype" + "servicetype" ), 'AUTHORITY' => prompt_user_input( - "Please enter the LSID authority for service types: ", - "biomoby.org" +"Please enter the LSID authority for service types: ", + "biomoby.org" ), }, 'mobynamespace' => { 'NAMESPACE' => prompt_user_input( "Please enter an LSID namespace for the namespaces ontology: ", - "namespacetype" + "namespacetype" ), 'AUTHORITY' => prompt_user_input( - "Please enter the LSID authority for namespaces: ", - "biomoby.org" +"Please enter the LSID authority for namespaces: ", + "biomoby.org" ), }, 'mobyrelationship' => { 'NAMESPACE' => prompt_user_input( "Please enter an LSID namespace for the relationship ontology: ", - "relationshiptype" + "relationshiptype" ), 'AUTHORITY' => prompt_user_input( - "Please enter the LSID authority for relationships: ", - "biomoby.org" +"Please enter the LSID authority for relationships: ", + "biomoby.org" ), }, } - ); - } - if pprompt( -"Shall we update mobycentral.config to reflect the installation of this script? [y] ", - -ynd => 'y' - ) eq 'y'; + ); + } + + # tell the user to make sure that apache serves the script from + # http://domain.com/authority -# tell the user to make sure that apache serves the script from http://domain.com/authority - say -"\nPlease ensure that you set up apache to serve the script from\n\t'http://your.domain/authority'\nso that the script will work properly!\n"; - } - if pprompt( "Would you like to install the LSID authority script? [y] ", - -ynd => 'y' ) eq 'y'; + say < 'y' + ); +if ($answer eq 'y') { # prompt for a location for the service_tester_path my $service_tester_path = prompt_for_directory_expand( - "Where would you like to place the service pinger script?", - "$apache_base/moby_tester" ); + "Where would you like to place the service pinger script?", + "$apache_base/moby_tester" ); say 'Please make sure that you make that directory read/writable by your web server!\n'; # make sure that the key service_tester_path exists for the config file - my $search = search_config_file( "$apache_conf/mobycentral.config", - { 'mobycentral' => { 'service_tester_path' => 0, } } ); + my $search = search_config_file( + "$apache_conf/mobycentral.config", + { 'mobycentral' => { 'service_tester_path' => 0, } } + ); add_missing_keys_to_config_file( "$apache_conf/mobycentral.config", - $search ); + $search ); # copy the information config_file_from_template( @@ -1236,61 +1366,56 @@ ); file_from_template( - "$service_tester_path/service_tester.pl", - File::ShareDir::dist_file( - 'MOBY', 'cgi/service_tester.pl' - ), - 'MOBY-Central service tester script', - { '#!/usr/bin/perl -w' => "#!$perl_exec", } + "$service_tester_path/service_tester.pl", + File::ShareDir::dist_file( + 'MOBY', 'cgi/service_tester.pl' + ), + 'MOBY-Central service tester script', + { '#!/usr/bin/perl -w' => "#!$perl_exec", } ); say 'Please don\'t forget to place the service pinger on a cron! TODO - explain how to do that!'; #copy the other scripts now file_from_template( - "$apache_cgi/AgentRDFValidator", - File::ShareDir::dist_file( - 'MOBY', 'cgi/AgentRDFValidator' - ), - 'The RDF agent validator page', - { '#!/usr/bin/perl -w' => "#!$perl_exec", } - ); + "$apache_cgi/AgentRDFValidator", + File::ShareDir::dist_file( + 'MOBY', 'cgi/AgentRDFValidator' + ), + 'The RDF agent validator page', + { '#!/usr/bin/perl -w' => "#!$perl_exec", } + ); file_from_template( - "$apache_cgi/GenerateRDF.cgi", - File::ShareDir::dist_file( - 'MOBY', 'cgi/GenerateRDF.cgi' - ), - 'MOBY-Central service instance RDF generating form', - { '#!/usr/bin/perl -w' => "#!$perl_exec", } - ); + "$apache_cgi/GenerateRDF.cgi", + File::ShareDir::dist_file( + 'MOBY', 'cgi/GenerateRDF.cgi' + ), + 'MOBY-Central service instance RDF generating form', + { '#!/usr/bin/perl -w' => "#!$perl_exec", } + ); file_from_template( - "$apache_cgi/Moby", - File::ShareDir::dist_file( 'MOBY', 'cgi/Moby' ), - 'MOBY-Central test page for auxillary scripts', - { '#!/usr/bin/perl -w' => "#!$perl_exec", } - ); + "$apache_cgi/Moby", + File::ShareDir::dist_file( 'MOBY', 'cgi/Moby' ), + 'MOBY-Central test page for auxillary scripts', + { '#!/usr/bin/perl -w' => "#!$perl_exec", } + ); file_from_template( - "$apache_cgi/ServicePingerValidator", - File::ShareDir::dist_file( - 'MOBY', 'cgi/ServicePingerValidator' - ), - 'MOBY-Central service invocation test form', - { '#!/usr/bin/perl -w' => "#!$perl_exec", } - ); + "$apache_cgi/ServicePingerValidator", + File::ShareDir::dist_file( + 'MOBY', 'cgi/ServicePingerValidator' + ), + 'MOBY-Central service invocation test form', + { '#!/usr/bin/perl -w' => "#!$perl_exec", } + ); file_from_template( - "$apache_cgi/ValidateService", - File::ShareDir::dist_file( - 'MOBY', 'cgi/ValidateService' - ), - 'MOBY-Central service tester information page', - { '#!/usr/bin/perl -w' => "#!$perl_exec", } - ); - } - if pprompt( -"Would you like to auxillary scripts? These include the service pinger, a test page for the rdf agent, an RDF generator page, etc? [y] ", - -ynd => 'y' - ) eq 'y'; - + "$apache_cgi/ValidateService", + File::ShareDir::dist_file( + 'MOBY', 'cgi/ValidateService' + ), + 'MOBY-Central service tester information page', + { '#!/usr/bin/perl -w' => "#!$perl_exec", } + ); +} # say From kawas at dev.open-bio.org Thu May 29 15:59:21 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 29 May 2008 15:59:21 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805291959.m4TJxL7h016209@dev.open-bio.org> kawas Thu May 29 15:59:21 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts In directory dev.open-bio.org:/tmp/cvs-serv16174/Perl/MOBY-Server/bin/scripts Modified Files: moby-s-install.pl Log Message: *made mobycentral.config readable by all *prompt user for a new db user/pass for access to the registry so that root password isnt used moby-live/Perl/MOBY-Server/bin/scripts moby-s-install.pl,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts/moby-s-install.pl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts/moby-s-install.pl 2008/05/29 14:15:13 1.5 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts/moby-s-install.pl 2008/05/29 19:59:21 1.6 @@ -30,6 +30,11 @@ sub say { print @_, "\n"; } + # query is for creating the moby_username and password for local access to dbs + sub prepare_query { + my $s = join "", @_; + return qq|GRANT ALL ON $s TO ?\@'localhost' IDENTIFIED BY ? WITH GRANT OPTION|; + } sub check_module { eval "require $_[0]"; if ($@) { @@ -378,6 +383,10 @@ my $url = prompt_user_input( "What is the mysql url?", "localhost" ); my $port = prompt_user_input( "What is the mysql port #?", "3306" ); + # prompt for a new user/password combo so that people cant determine the root password from MOBY::Config + my $moby_username = prompt_user_input( "What username (I will create it if it doesn't exist)\n would you like to access your local db?", "moby_user" ); + my $moby_password = prompt_user_input( "Please provide a password for '$moby_username': ", "" ); + #db names say "\nPrompting for mysql table names. Use default names unless you know what you are doing!"; @@ -400,10 +409,12 @@ You have provided the following values: mySQL Details - username : $username - password : $password - URL : $url - port : $port + username : $username + password : $password + URL : $url + port : $port + registry db username : $moby_username + registry db password : $moby_password Tables: Object ontology : $m_object @@ -416,9 +427,10 @@ say($msg); return ( - $username, $password, $url, - $port, $m_object, $m_relationship, - $m_service, $m_namespace, $m_central + $username, $password, $url, + $port, $m_object, $m_relationship, + $m_service, $m_namespace, $m_central, + $moby_username, $moby_password ); } @@ -461,7 +473,7 @@ # since the file contains the root DB password # make it only readable by root - chmod 0600, $file; + chmod 0644, $file; die "Couldn't make MOBY config file readable only by root: $!" if $?; @@ -533,7 +545,8 @@ my ( $username, $password, $url, $port, $m_object, $m_relationship, - $m_service, $m_namespace, $m_central + $m_service, $m_namespace, $m_central, + $moby_username, $moby_password ); say "We are going to be placing files into your apache setup, in the cgi-bin/ directory and conf/ directory"; @@ -600,18 +613,19 @@ # copy mobycentral.config to conf directory ( - $username, $password, $url, - $port, $m_object, $m_relationship, - $m_service, $m_namespace, $m_central + $username, $password, $url, + $port, $m_object, $m_relationship, + $m_service, $m_namespace, $m_central, + $moby_username, $moby_password ) = prompt_moby_config_info; # TODO - collect the values and do this at the end # fill out mobycentral.config fill_out_moby_conf("$apache_conf/mobycentral.config", - $username, $password, $url, - $port, $m_object, $m_relationship, - $m_service, $m_namespace, $m_central + $moby_username, $moby_password, $url, + $port, $m_object, $m_relationship, + $m_service, $m_namespace, $m_central ); } @@ -623,16 +637,17 @@ say " Installing the file '$apache_conf/mobycentral.config' ..."; # fill out mobycentral.config - ( $username, $password, $url, - $port, $m_object, $m_relationship, - $m_service, $m_namespace, $m_central + ( $username, $password, $url, + $port, $m_object, $m_relationship, + $m_service, $m_namespace, $m_central, + $moby_username, $moby_password ) = prompt_moby_config_info; # TODO - collect the values and do this at the end fill_out_moby_conf("$apache_conf/mobycentral.config", - $username, $password, $url, - $port, $m_object, $m_relationship, - $m_service, $m_namespace, $m_central + $moby_username, $moby_password, $url, + $port, $m_object, $m_relationship, + $m_service, $m_namespace, $m_central ); } @@ -829,7 +844,9 @@ and $m_relationship and $m_service and $m_namespace - and $m_central; + and $m_central, + and $moby_username, + and $moby_password; # check to see if mobycentral.config has been created in the conf # directory first -> if so, parse it @@ -852,8 +869,8 @@ $db_sections{$dbname} = $dbConfig; } - $username = $db_sections{mobycentral}->{username}; - $password = $db_sections{mobycentral}->{password} || ""; + $moby_username = $db_sections{mobycentral}->{username}; + $moby_password = $db_sections{mobycentral}->{password} || ""; $url = $db_sections{mobycentral}->{url}; $port = $db_sections{mobycentral}->{port}; $m_object = $db_sections{mobyobject}->{dbname}; @@ -871,19 +888,27 @@ say " Installing the file '$apache_conf/mobycentral.config' ..."; # fill out mobycentral.config - ($username, $password, $url, - $port, $m_object, $m_relationship, - $m_service, $m_namespace, $m_central + ($username, $password, $url, + $port, $m_object, $m_relationship, + $m_service, $m_namespace, $m_central, + $moby_username, $moby_password ) = prompt_moby_config_info; fill_out_moby_conf( "$apache_conf/mobycentral.config", - $username, $password, $url, - $port, $m_object, $m_relationship, - $m_service, $m_namespace, $m_central + $moby_username, $moby_password, $url, + $port, $m_object, $m_relationship, + $m_service, $m_namespace, $m_central ); } + # make sure that we have a root password/username + unless ($username and $password) { + $username = + prompt_user_input( "What is your root mysql username?", "root" ); + $password = + prompt_user_input( "What is your root mysql users' password?", "" ); + } # now start creating the tables say " creating the tables to use for the registry ..."; my %dbsections = ( @@ -940,7 +965,8 @@ $mobynamespace, $mobyrelationship ) = $central->MOBY::Client::Central::DUMP(); my $drh = DBI->install_driver("mysql"); - + # used for creating the user/pass for the registry + my $dbh = DBI->connect("DBI:mysql:mysql:localhost:3306", "root", "root", { RaiseError => 1, AutoCommit => 1 }); my ( $fh, $filename ) = tempfile( UNLINK => 1 ); say "Processing dump for service instances ..."; print $fh $mobycentral; @@ -952,6 +978,12 @@ $drh->func( 'createdb', $dbsections{mobycentral}, $url, $username, $password, 'admin' ); }; + eval { + my $db = $dbsections{mobycentral} . ".*"; + $dbh->do(prepare_query($db),undef,$moby_username,$moby_password) + || say ("Could not give '$moby_username' access to $db - Error:\n$DBI::errstr"); + }; + die $! if $!; system( "mysql -h $url -P $port -u $username --password=$password " . $dbsections{mobycentral} . "<$filename" ) == 0 @@ -969,6 +1001,11 @@ $drh->func( 'createdb', $dbsections{mobyobject}, $url, $username, $password, 'admin' ); }; + eval { + my $db = $dbsections{mobyobject} . ".*"; + $dbh->do(prepare_query($db),undef,$moby_username,$moby_password) + || say ("Could not give '$moby_username' access to $db - Error:\n$DBI::errstr"); + }; system( "mysql -h $url -P $port -u $username --password=$password " . $dbsections{mobyobject} . "<$filename" ) == 0 @@ -986,6 +1023,11 @@ $drh->func( 'createdb', $dbsections{mobyservice}, $url, $username, $password, 'admin' ); }; + eval { + my $db = $dbsections{mobyservice} . ".*"; + $dbh->do(prepare_query($db),undef,$moby_username,$moby_password) + || say ("Could not give '$moby_username' access to $db - Error:\n$DBI::errstr"); + }; system( "mysql -h $url -P $port -u $username --password=$password " . $dbsections{mobyservice} . "<$filename" ) == 0 @@ -1003,6 +1045,11 @@ $drh->func( 'createdb', $dbsections{mobynamespace}, $url, $username, $password, 'admin' ); }; + eval { + my $db = $dbsections{mobynamespace} . ".*"; + $dbh->do(prepare_query($db),undef,$moby_username,$moby_password) + || say ("Could not give '$moby_username' access to $db - Error:\n$DBI::errstr"); + }; system( "mysql -h $url -P $port -u $username --password=$password " . $dbsections{mobynamespace} . "<$filename" ) == 0 @@ -1020,6 +1067,11 @@ $drh->func( 'createdb', $dbsections{mobyrelationship}, $url, $username, $password, 'admin' ); }; + eval { + my $db = $dbsections{mobyrelationship} . ".*"; + $dbh->do(prepare_query($db),undef,$moby_username,$moby_password) + || say ("Could not give '$moby_username' access to $db - Error:\n$DBI::errstr"); + }; system( "mysql -h $url -P $port -u $username --password=$password " . $dbsections{mobyrelationship} . "<$filename" ) == 0 @@ -1042,31 +1094,38 @@ #process each db foreach my $section ( keys %dbsections ) { - my $sqlfilepath = File::ShareDir::dist_file( 'MOBY', - "db/schema/$section.mysql" ); - my $drh = DBI->install_driver("mysql"); - - # drop the db - eval { - $drh->func( 'dropdb', $dbsections{$section}, $url, - $username, $password, 'admin' ); - } if $drop_db; - - # create the db - eval { - $drh->func( 'createdb', $dbsections{$section}, $url, - $username, $password, 'admin' ); - }; - - #create the tables in the db - do { - say "\n\tProblem creating tables in the db: $section: $!"; - } - unless system( - "mysql -h $url -P $port -u $username --password=$password " - . $dbsections{$section} - . "<$sqlfilepath" ) == 0; - say "\tProcessing of $section completed ... "; + my $sqlfilepath = File::ShareDir::dist_file( 'MOBY', + "db/schema/$section.mysql" ); + my $drh = DBI->install_driver("mysql"); + # used for creating the user/pass for the registry + my $dbh = DBI->connect("DBI:mysql:mysql:localhost:3306", "root", "root", { RaiseError => 1, AutoCommit => 1 }); + # drop the db + eval { + $drh->func( 'dropdb', $dbsections{$section}, $url, + $username, $password, 'admin' ); + } if $drop_db; + + # create the db + eval { + $drh->func( 'createdb', $dbsections{$section}, $url, + $username, $password, 'admin' ); + }; + + # give moby_username permission to access it + eval { + my $db = $dbsections{$section} . ".*"; + $dbh->do(prepare_query($db),undef,$moby_username,$moby_password) + || say ("Could not give '$moby_username' access to $db - Error:\n$DBI::errstr"); + }; + #create the tables in the db + do { + say "\n\tProblem creating tables in the db: $section: $!"; + } + unless system( + "mysql -h $url -P $port -u $username --password=$password " + . $dbsections{$section} + . "<$sqlfilepath" ) == 0; + say "\tProcessing of $section completed ... "; } say "populating the tables with basic data ..."; %dbsections = ( @@ -1075,14 +1134,14 @@ 'mobyrelationship' => $m_relationship ); foreach my $section ( keys %dbsections ) { - my $sqlfilepath = - File::ShareDir::dist_file( 'MOBY', "db/data/$section.data" ); - system( - "mysql -h $url -P $port -u $username --password=$password " - . $dbsections{$section} - . "<$sqlfilepath" ) == 0 - or say "\n\tProblem populating the db: $section: $!"; - say "\tPopulation processing for db $section completed ..."; + my $sqlfilepath = + File::ShareDir::dist_file( 'MOBY', "db/data/$section.data" ); + system( + "mysql -h $url -P $port -u $username --password=$password " + . $dbsections{$section} + . "<$sqlfilepath" ) == 0 + or (say "\n\tProblem populating the db: $section: $!" and $error++); + say "\tPopulation processing for db $section completed ..."; } } From kawas at dev.open-bio.org Fri May 30 11:49:31 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 30 May 2008 11:49:31 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805301549.m4UFnVqM018231@dev.open-bio.org> kawas Fri May 30 11:49:30 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard In directory dev.open-bio.org:/tmp/cvs-serv18196/src/main/org/biomoby/service/dashboard Modified Files: PerlMoSeSPanel.java Log Message: added a default font when a user doesnt have one added default text in the Perl path field moby-live/Java/src/main/org/biomoby/service/dashboard PerlMoSeSPanel.java,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java 2008/05/27 23:10:54 1.6 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java 2008/05/30 15:49:30 1.7 @@ -379,6 +379,7 @@ JTextFieldWithHistory lib1 = createText (null, PM_PERL_LIB_1, PM_PERL_LIB_1); JTextFieldWithHistory lib2 = createText (null, PM_PERL_LIB_2, PM_PERL_LIB_2); JTextFieldWithHistory install_path = createText (null, PM_SCRIPTS_INSTALL_DIR, PM_SCRIPTS_INSTALL_DIR); + install_path.setText(is_windows_pc ? "perl.exe" : "/usr/bin/perl"); JTextFieldWithHistory perl_install_path = createText(null, PM_PERL_INSTALL_DIR, PM_PERL_INSTALL_DIR); SwingUtils.addComponent(sPanel, new JLabel("Perl Path: "), 0, 0, 1, 1, NONE, NWEST, 0.0, 0.0); @@ -683,6 +684,10 @@ String[] fontFamilies = env.getAvailableFontFamilyNames(); int index = 0; String saved_font = getPrefValue(PM_EDITOR_FONT, ""); + if (saved_font.equals("")) { + saved_font = new Font(null).getName(); + setPrefValue(PM_EDITOR_FONT, saved_font); + } if (saved_font != null && !saved_font.trim().equals("")) { index = 0; for (String f:fontFamilies) { @@ -698,7 +703,7 @@ // set up the combobox fonts = new JComboBox(fontFamilies); - fonts.setSelectedIndex(index >= fontFamilies.length -1 ? 0 : index); + fonts.setSelectedIndex(index >= fontFamilies.length ? 0 : index); // add a listener fonts.addItemListener(new ItemListener(){ public void itemStateChanged(ItemEvent e) { From kawas at dev.open-bio.org Fri May 30 11:52:09 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 30 May 2008 11:52:09 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805301552.m4UFq94k018271@dev.open-bio.org> kawas Fri May 30 11:52:09 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server In directory dev.open-bio.org:/tmp/cvs-serv18236/Perl/MOBY-Server Modified Files: Changes Log Message: moby-live/Perl/MOBY-Server Changes,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/Changes,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Perl/MOBY-Server/Changes 2008/05/29 14:19:47 1.6 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/Changes 2008/05/30 15:52:09 1.7 @@ -26,11 +26,14 @@ * in prompt_for_directory() switched the cases around for -e and -w otherwise -e wouldn't get triggered * in config_file_from_template() added an if defined $fh test - * added a chmod 600 to the mobycentral.config because it has + * added a chmod 644 to the mobycentral.config because it has the DB root password * called die() if mysql wasn't detected - fixed a bug in the service_tester.pl script that referenced $opt_c instead of $url. (thanks to Jason Stewart) + - prompt for a username/password for the registry to access the db. + if the user doesnt exist, we add it. This helps us stay away from + using the root password in the mobycentral.config file. 1.04 - fixed bug in MOBY::Client::Central::DUMP that resulted From kawas at dev.open-bio.org Thu May 1 17:42:47 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 1 May 2008 13:42:47 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805011742.m41Hgk04016495@dev.open-bio.org> kawas Thu May 1 13:42:46 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/share/db/schema In directory dev.open-bio.org:/tmp/cvs-serv16460/Perl/MOBY-Server/share/db/schema Modified Files: mobycentral.mysql Log Message: missing description field in the schema moby-live/Perl/MOBY-Server/share/db/schema mobycentral.mysql,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/share/db/schema/mobycentral.mysql,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/share/db/schema/mobycentral.mysql 2008/02/21 00:21:28 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/share/db/schema/mobycentral.mysql 2008/05/01 17:42:46 1.2 @@ -50,6 +50,7 @@ enum_value text, datatype enum('String','Integer','DateTime','Float','Boolean') default NULL, article_name varchar(255) default NULL, + description text, service_instance_id int(10) unsigned NOT NULL default '0', PRIMARY KEY (secondary_input_id) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; @@ -59,7 +60,7 @@ -- CREATE TABLE service_instance ( - category enum('moby','soap','wsdl','cgi','moby-async') default NULL, + category enum('moby','soap','wsdl','rest','moby-async') default NULL, servicename varchar(255) NOT NULL default '', service_type_uri varchar(255) NOT NULL default '', authority_id int(10) unsigned NOT NULL default '0', From kawas at dev.open-bio.org Thu May 1 18:56:43 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 1 May 2008 14:56:43 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805011856.m41Iuh6b016609@dev.open-bio.org> kawas Thu May 1 14:56:43 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts In directory dev.open-bio.org:/tmp/cvs-serv16574/Perl/MOSES-MOBY/bin/scripts Modified Files: moses-testing-service.pl Log Message: fixed the code to get rid of the warning message moby-live/Perl/MOSES-MOBY/bin/scripts moses-testing-service.pl,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts/moses-testing-service.pl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts/moses-testing-service.pl 2008/04/29 19:58:37 1.4 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts/moses-testing-service.pl 2008/05/01 18:56:43 1.5 @@ -66,7 +66,7 @@ } elsif ($opt_c) { # calling a real service, using cgi - eval "use HTTP::Request::Common qw(POST); 1;" + eval "use HTTP::Request; 1;" or die "$@\n"; eval "use LWP::UserAgent; 1;" or die "$@\n"; @@ -145,7 +145,9 @@ $input = _empty_input; } - my $req = POST $opt_c, [ data => $input]; + my $req = HTTP::Request->new(POST => $opt_c); + $req->content_type('application/x-www-form-urlencoded'); + $req->content('data=$input'); print "\n" . $ua->request($req)->as_string . "\n"; } else { From kawas at dev.open-bio.org Thu May 1 21:44:47 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 1 May 2008 17:44:47 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805012144.m41LilXS016802@dev.open-bio.org> kawas Thu May 1 17:44:46 EDT 2008 Update of /home/repository/moby/moby-live/Docs/MOBY-S_API/Perl In directory dev.open-bio.org:/tmp/cvs-serv16771/Docs/MOBY-S_API/Perl Added Files: construct_moses_soap_service.html Log Message: tutorial on implementing a soap based perl moses service. moby-live/Docs/MOBY-S_API/Perl construct_moses_soap_service.html,NONE,1.1 From kawas at dev.open-bio.org Thu May 1 21:48:30 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 1 May 2008 17:48:30 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805012148.m41LmUGt016860@dev.open-bio.org> kawas Thu May 1 17:48:30 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server In directory dev.open-bio.org:/tmp/cvs-serv16825/Perl/MOBY-Server Modified Files: Changes Log Message: moby-live/Perl/MOBY-Server Changes,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/Changes,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOBY-Server/Changes 2008/04/30 17:02:54 1.3 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/Changes 2008/05/01 21:48:30 1.4 @@ -3,7 +3,7 @@ 1.04 - fixed bug that allowed service types to be registered - with empty ISA relationships. + with empty ISA relationships. - MOBY::Config now only reads the config file once instead of numerous times. @@ -20,6 +20,9 @@ - Added checks for those cases where RDF is wanted for a particular ontology that is empty. Instead of dying, we now return an empty document (as should be expected). + + - Fixed a bug in the schema for secondary inputs. The schema + was missing the column 'description' 1.00 - CVS version of MOBY released to the world via CPAN! From kawas at dev.open-bio.org Tue May 6 16:52:49 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 6 May 2008 12:52:49 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805061652.m46GqnhI031664@dev.open-bio.org> kawas Tue May 6 12:52:48 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts In directory dev.open-bio.org:/tmp/cvs-serv31628/Perl/MOSES-MOBY/bin/scripts Modified Files: moses-testing-service.pl Log Message: moby-live/Perl/MOSES-MOBY/bin/scripts moses-testing-service.pl,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts/moses-testing-service.pl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts/moses-testing-service.pl 2008/05/01 18:56:43 1.5 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts/moses-testing-service.pl 2008/05/06 16:52:48 1.6 @@ -96,7 +96,7 @@ } # --- what service to call -my $module = shift; # eg. Service::Mabuhay, or just Mabuhay +my $module = shift unless $opt_c; # eg. Service::Mabuhay, or just Mabuhay my $service; ($service = $module) =~ s/.*::// unless $opt_c; @@ -147,7 +147,7 @@ my $req = HTTP::Request->new(POST => $opt_c); $req->content_type('application/x-www-form-urlencoded'); - $req->content('data=$input'); + $req->content("data=$input"); print "\n" . $ua->request($req)->as_string . "\n"; } else { From kawas at dev.open-bio.org Tue May 6 17:15:00 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 6 May 2008 13:15:00 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805061715.m46HF0DC031742@dev.open-bio.org> kawas Tue May 6 13:15:00 EDT 2008 Update of /home/repository/moby/moby-live/Docs/MOBY-S_API/Perl In directory dev.open-bio.org:/tmp/cvs-serv31711/Docs/MOBY-S_API/Perl Added Files: construct_moses_cgi_service.html Log Message: tutorial on implementing a cgi based perl moses service. moby-live/Docs/MOBY-S_API/Perl construct_moses_cgi_service.html,NONE,1.1 From kawas at dev.open-bio.org Wed May 7 17:21:29 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 May 2008 13:21:29 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805071721.m47HLTf1009071@dev.open-bio.org> kawas Wed May 7 13:21:29 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module In directory dev.open-bio.org:/tmp/cvs-serv9036/Perl/MOSES-MOBY/inc/Module Modified Files: Install.pm Log Message: updated the Module::Install libraries to version 0.72 moby-live/Perl/MOSES-MOBY/inc/Module Install.pm,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install.pm 2008/02/21 00:12:56 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install.pm 2008/05/07 17:21:28 1.4 @@ -17,20 +17,30 @@ # 3. The ./inc/ version of Module::Install loads # } -use 5.004; +BEGIN { + require 5.004; +} use strict 'vars'; use vars qw{$VERSION}; BEGIN { - # All Module::Install core packages now require synchronised versions. - # This will be used to ensure we don't accidentally load old or - # different versions of modules. - # This is not enforced yet, but will be some time in the next few - # releases once we can make sure it won't clash with custom - # Module::Install extensions. - $VERSION = '0.67'; + # All Module::Install core packages now require synchronised versions. + # This will be used to ensure we don't accidentally load old or + # different versions of modules. + # This is not enforced yet, but will be some time in the next few + # releases once we can make sure it won't clash with custom + # Module::Install extensions. + $VERSION = '0.72'; + + *inc::Module::Install::VERSION = *VERSION; + @inc::Module::Install::ISA = __PACKAGE__; + } + + + + # Whether or not inc::Module::Install is actually loaded, the # $INC{inc/Module/Install.pm} is what will still get set as long as # the caller loaded module this in the documented manner. @@ -38,26 +48,29 @@ # they may not have a MI version that works with the Makefile.PL. This would # result in false errors or unexpected behaviour. And we don't want that. my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm'; -unless ( $INC{$file} ) { - die <<"END_DIE"; +unless ( $INC{$file} ) { die <<"END_DIE" } + Please invoke ${\__PACKAGE__} with: - use inc::${\__PACKAGE__}; + use inc::${\__PACKAGE__}; not: - use ${\__PACKAGE__}; + use ${\__PACKAGE__}; END_DIE -} + + + + # If the script that is loading Module::Install is from the future, # then make will detect this and cause it to re-run over and over # again. This is bad. Rather than taking action to touch it (which # is unreliable on some platforms and requires write permissions) # for now we should catch this and refuse to run. -if ( -f $0 and (stat($0))[9] > time ) { - die << "END_DIE"; +if ( -f $0 and (stat($0))[9] > time ) { die <<"END_DIE" } + Your installer $0 has a modification time in the future. This is known to create infinite loops in make. @@ -65,115 +78,142 @@ Please correct this, then run $0 again. END_DIE -} + + + + + +# Build.PL was formerly supported, but no longer is due to excessive +# difficulty in implementing every single feature twice. +if ( $0 =~ /Build.PL$/i or -f 'Build.PL' ) { die <<"END_DIE" } + +Module::Install no longer supports Build.PL. + +It was impossible to maintain duel backends, and has been deprecated. + +Please remove all Build.PL files and only use the Makefile.PL installer. + +END_DIE + + + + + +# To save some more typing in Module::Install installers, every... +# use inc::Module::Install +# ...also acts as an implicit use strict. +$^H |= strict::bits(qw(refs subs vars)); + + + + use Cwd (); use File::Find (); use File::Path (); use FindBin; -*inc::Module::Install::VERSION = *VERSION; - at inc::Module::Install::ISA = __PACKAGE__; - sub autoload { - my $self = shift; - my $who = $self->_caller; - my $cwd = Cwd::cwd(); - my $sym = "${who}::AUTOLOAD"; - $sym->{$cwd} = sub { - my $pwd = Cwd::cwd(); - if ( my $code = $sym->{$pwd} ) { - # delegate back to parent dirs - goto &$code unless $cwd eq $pwd; - } - $$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym"; - unshift @_, ($self, $1); - goto &{$self->can('call')} unless uc($1) eq $1; - }; + my $self = shift; + my $who = $self->_caller; + my $cwd = Cwd::cwd(); + my $sym = "${who}::AUTOLOAD"; + $sym->{$cwd} = sub { + my $pwd = Cwd::cwd(); + if ( my $code = $sym->{$pwd} ) { + # delegate back to parent dirs + goto &$code unless $cwd eq $pwd; + } + $$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym"; + unshift @_, ( $self, $1 ); + goto &{$self->can('call')} unless uc($1) eq $1; + }; } sub import { - my $class = shift; - my $self = $class->new(@_); - my $who = $self->_caller; - - unless ( -f $self->{file} ) { - require "$self->{path}/$self->{dispatch}.pm"; - File::Path::mkpath("$self->{prefix}/$self->{author}"); - $self->{admin} = "$self->{name}::$self->{dispatch}"->new( _top => $self ); - $self->{admin}->init; - @_ = ($class, _self => $self); - goto &{"$self->{name}::import"}; - } - - *{"${who}::AUTOLOAD"} = $self->autoload; - $self->preload; - - # Unregister loader and worker packages so subdirs can use them again - delete $INC{"$self->{file}"}; - delete $INC{"$self->{path}.pm"}; + my $class = shift; + my $self = $class->new(@_); + my $who = $self->_caller; + + unless ( -f $self->{file} ) { + require "$self->{path}/$self->{dispatch}.pm"; + File::Path::mkpath("$self->{prefix}/$self->{author}"); + $self->{admin} = "$self->{name}::$self->{dispatch}"->new( _top => $self ); + $self->{admin}->init; + @_ = ($class, _self => $self); + goto &{"$self->{name}::import"}; + } + + *{"${who}::AUTOLOAD"} = $self->autoload; + $self->preload; + + # Unregister loader and worker packages so subdirs can use them again + delete $INC{"$self->{file}"}; + delete $INC{"$self->{path}.pm"}; + + return 1; } sub preload { - my ($self) = @_; - - unless ( $self->{extensions} ) { - $self->load_extensions( - "$self->{prefix}/$self->{path}", $self - ); - } - - my @exts = @{$self->{extensions}}; - unless ( @exts ) { - my $admin = $self->{admin}; - @exts = $admin->load_all_extensions; - } - - my %seen; - foreach my $obj ( @exts ) { - while (my ($method, $glob) = each %{ref($obj) . '::'}) { - next unless $obj->can($method); - next if $method =~ /^_/; - next if $method eq uc($method); - $seen{$method}++; - } - } - - my $who = $self->_caller; - foreach my $name ( sort keys %seen ) { - *{"${who}::$name"} = sub { - ${"${who}::AUTOLOAD"} = "${who}::$name"; - goto &{"${who}::AUTOLOAD"}; - }; - } + my $self = shift; + unless ( $self->{extensions} ) { + $self->load_extensions( + "$self->{prefix}/$self->{path}", $self + ); + } + + my @exts = @{$self->{extensions}}; + unless ( @exts ) { + my $admin = $self->{admin}; + @exts = $admin->load_all_extensions; + } + + my %seen; + foreach my $obj ( @exts ) { + while (my ($method, $glob) = each %{ref($obj) . '::'}) { + next unless $obj->can($method); + next if $method =~ /^_/; + next if $method eq uc($method); + $seen{$method}++; + } + } + + my $who = $self->_caller; + foreach my $name ( sort keys %seen ) { + *{"${who}::$name"} = sub { + ${"${who}::AUTOLOAD"} = "${who}::$name"; + goto &{"${who}::AUTOLOAD"}; + }; + } } sub new { - my ($class, %args) = @_; + my ($class, %args) = @_; - # ignore the prefix on extension modules built from top level. - my $base_path = Cwd::abs_path($FindBin::Bin); - unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) { - delete $args{prefix}; - } - - return $args{_self} if $args{_self}; - - $args{dispatch} ||= 'Admin'; - $args{prefix} ||= 'inc'; - $args{author} ||= ($^O eq 'VMS' ? '_author' : '.author'); - $args{bundle} ||= 'inc/BUNDLES'; - $args{base} ||= $base_path; - $class =~ s/^\Q$args{prefix}\E:://; - $args{name} ||= $class; - $args{version} ||= $class->VERSION; - unless ( $args{path} ) { - $args{path} = $args{name}; - $args{path} =~ s!::!/!g; - } - $args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm"; + # ignore the prefix on extension modules built from top level. + my $base_path = Cwd::abs_path($FindBin::Bin); + unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) { + delete $args{prefix}; + } + + return $args{_self} if $args{_self}; + + $args{dispatch} ||= 'Admin'; + $args{prefix} ||= 'inc'; + $args{author} ||= ($^O eq 'VMS' ? '_author' : '.author'); + $args{bundle} ||= 'inc/BUNDLES'; + $args{base} ||= $base_path; + $class =~ s/^\Q$args{prefix}\E:://; + $args{name} ||= $class; + $args{version} ||= $class->VERSION; + unless ( $args{path} ) { + $args{path} = $args{name}; + $args{path} =~ s!::!/!g; + } + $args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm"; + $args{wrote} = 0; - bless( \%args, $class ); + bless( \%args, $class ); } sub call { @@ -184,98 +224,130 @@ } sub load { - my ($self, $method) = @_; - - $self->load_extensions( - "$self->{prefix}/$self->{path}", $self - ) unless $self->{extensions}; + my ($self, $method) = @_; - foreach my $obj (@{$self->{extensions}}) { - return $obj if $obj->can($method); - } + $self->load_extensions( + "$self->{prefix}/$self->{path}", $self + ) unless $self->{extensions}; + + foreach my $obj (@{$self->{extensions}}) { + return $obj if $obj->can($method); + } - my $admin = $self->{admin} or die <<"END_DIE"; + my $admin = $self->{admin} or die <<"END_DIE"; The '$method' method does not exist in the '$self->{prefix}' path! Please remove the '$self->{prefix}' directory and run $0 again to load it. END_DIE - my $obj = $admin->load($method, 1); - push @{$self->{extensions}}, $obj; + my $obj = $admin->load($method, 1); + push @{$self->{extensions}}, $obj; - $obj; + $obj; } sub load_extensions { - my ($self, $path, $top) = @_; + my ($self, $path, $top) = @_; - unless ( grep { lc $_ eq lc $self->{prefix} } @INC ) { - unshift @INC, $self->{prefix}; - } - - foreach my $rv ( $self->find_extensions($path) ) { - my ($file, $pkg) = @{$rv}; - next if $self->{pathnames}{$pkg}; - - local $@; - my $new = eval { require $file; $pkg->can('new') }; - unless ( $new ) { - warn $@ if $@; - next; - } - $self->{pathnames}{$pkg} = delete $INC{$file}; - push @{$self->{extensions}}, &{$new}($pkg, _top => $top ); - } + unless ( grep { lc $_ eq lc $self->{prefix} } @INC ) { + unshift @INC, $self->{prefix}; + } + + foreach my $rv ( $self->find_extensions($path) ) { + my ($file, $pkg) = @{$rv}; + next if $self->{pathnames}{$pkg}; + + local $@; + my $new = eval { require $file; $pkg->can('new') }; + unless ( $new ) { + warn $@ if $@; + next; + } + $self->{pathnames}{$pkg} = delete $INC{$file}; + push @{$self->{extensions}}, &{$new}($pkg, _top => $top ); + } - $self->{extensions} ||= []; + $self->{extensions} ||= []; } sub find_extensions { - my ($self, $path) = @_; + my ($self, $path) = @_; + + my @found; + File::Find::find( sub { + my $file = $File::Find::name; + return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is; + my $subpath = $1; + return if lc($subpath) eq lc($self->{dispatch}); + + $file = "$self->{path}/$subpath.pm"; + my $pkg = "$self->{name}::$subpath"; + $pkg =~ s!/!::!g; - my @found; - File::Find::find( sub { - my $file = $File::Find::name; - return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is; - my $subpath = $1; - return if lc($subpath) eq lc($self->{dispatch}); - - $file = "$self->{path}/$subpath.pm"; - my $pkg = "$self->{name}::$subpath"; - $pkg =~ s!/!::!g; - - # If we have a mixed-case package name, assume case has been preserved - # correctly. Otherwise, root through the file to locate the case-preserved - # version of the package name. - if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) { - open PKGFILE, "<$subpath.pm" or die "find_extensions: Can't open $subpath.pm: $!"; - my $in_pod = 0; - while ( ) { - $in_pod = 1 if /^=\w/; - $in_pod = 0 if /^=cut/; - next if ($in_pod || /^=cut/); # skip pod text - next if /^\s*#/; # and comments - if ( m/^\s*package\s+($pkg)\s*;/i ) { - $pkg = $1; - last; - } - } - close PKGFILE; - } + # If we have a mixed-case package name, assume case has been preserved + # correctly. Otherwise, root through the file to locate the case-preserved + # version of the package name. + if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) { + my $content = Module::Install::_read($subpath . '.pm'); + my $in_pod = 0; + foreach ( split //, $content ) { + $in_pod = 1 if /^=\w/; + $in_pod = 0 if /^=cut/; + next if ($in_pod || /^=cut/); # skip pod text + next if /^\s*#/; # and comments + if ( m/^\s*package\s+($pkg)\s*;/i ) { + $pkg = $1; + last; + } + } + } - push @found, [ $file, $pkg ]; - }, $path ) if -d $path; + push @found, [ $file, $pkg ]; + }, $path ) if -d $path; - @found; + @found; } + + + + +##################################################################### +# Utility Functions + sub _caller { - my $depth = 0; - my $call = caller($depth); - while ( $call eq __PACKAGE__ ) { - $depth++; - $call = caller($depth); - } - return $call; + my $depth = 0; + my $call = caller($depth); + while ( $call eq __PACKAGE__ ) { + $depth++; + $call = caller($depth); + } + return $call; +} + +sub _read { + local *FH; + open FH, "< $_[0]" or die "open($_[0]): $!"; + my $str = do { local $/; }; + close FH or die "close($_[0]): $!"; + return $str; +} + +sub _write { + local *FH; + open FH, "> $_[0]" or die "open($_[0]): $!"; + foreach ( 1 .. $#_ ) { print FH $_[$_] or die "print($_[0]): $!" } + close FH or die "close($_[0]): $!"; +} + +sub _version { + my $s = shift || 0; + $s =~ s/^(\d+)\.?//; + my $l = $1 || 0; + my @v = map { $_ . '0' x (3 - length $_) } $s =~ /(\d{1,3})\D?/g; + $l = $l . '.' . join '', @v if @v; + return $l + 0; } 1; + +# Copyright 2008 Adam Kennedy. From kawas at dev.open-bio.org Wed May 7 17:21:29 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 May 2008 13:21:29 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805071721.m47HLTnF009126@dev.open-bio.org> kawas Wed May 7 13:21:29 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install In directory dev.open-bio.org:/tmp/cvs-serv9036/Perl/MOSES-MOBY/inc/Module/Install Modified Files: Include.pm AutoInstall.pm Base.pm Makefile.pm Fetch.pm WriteAll.pm Can.pm Share.pm Win32.pm Metadata.pm Removed Files: Scripts.pm Log Message: updated the Module::Install libraries to version 0.72 moby-live/Perl/MOSES-MOBY/inc/Module/Install Include.pm,1.3,1.4 AutoInstall.pm,1.3,1.4 Base.pm,1.3,1.4 Makefile.pm,1.3,1.4 Fetch.pm,1.3,1.4 WriteAll.pm,1.3,1.4 Can.pm,1.3,1.4 Share.pm,1.3,1.4 Win32.pm,1.3,1.4 Metadata.pm,1.3,1.4 Scripts.pm,1.3,NONE =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Include.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Include.pm 2008/02/21 00:12:55 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Include.pm 2008/05/07 17:21:29 1.4 @@ -6,7 +6,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/AutoInstall.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/AutoInstall.pm 2008/02/21 00:12:55 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/AutoInstall.pm 2008/05/07 17:21:29 1.4 @@ -6,7 +6,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Base.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Base.pm 2008/02/21 00:12:55 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Base.pm 2008/05/07 17:21:29 1.4 @@ -1,7 +1,7 @@ #line 1 package Module::Install::Base; -$VERSION = '0.67'; +$VERSION = '0.72'; # Suspend handler for "redefined" warnings BEGIN { =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Makefile.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Makefile.pm 2008/02/21 00:12:55 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Makefile.pm 2008/05/07 17:21:29 1.4 @@ -7,7 +7,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } @@ -37,7 +37,7 @@ sub makemaker_args { my $self = shift; my $args = ($self->{makemaker_args} ||= {}); - %$args = ( %$args, @_ ) if @_; + %$args = ( %$args, @_ ) if @_; $args; } @@ -63,18 +63,18 @@ sub clean_files { my $self = shift; my $clean = $self->makemaker_args->{clean} ||= {}; - %$clean = ( + %$clean = ( %$clean, - FILES => join(' ', grep length, $clean->{FILES}, @_), + FILES => join ' ', grep { length $_ } ($clean->{FILES} || (), @_), ); } sub realclean_files { - my $self = shift; + my $self = shift; my $realclean = $self->makemaker_args->{realclean} ||= {}; - %$realclean = ( + %$realclean = ( %$realclean, - FILES => join(' ', grep length, $realclean->{FILES}, @_), + FILES => join ' ', grep { length $_ } ($realclean->{FILES} || (), @_), ); } @@ -104,8 +104,8 @@ unless ( -d $dir ) { die "tests_recursive dir '$dir' does not exist"; } - require File::Find; %test_dir = (); + require File::Find; File::Find::find( \&_wanted_t, $dir ); $self->tests( join ' ', map { "$_/*.t" } sort keys %test_dir ); } @@ -114,10 +114,15 @@ my $self = shift; die "&Makefile->write() takes no arguments\n" if @_; + # Make sure we have a new enough + require ExtUtils::MakeMaker; + $self->configure_requires( 'ExtUtils::MakeMaker' => $ExtUtils::MakeMaker::VERSION ); + + # Generate the my $args = $self->makemaker_args; $args->{DISTNAME} = $self->name; - $args->{NAME} = $self->module_name || $self->name || $self->determine_NAME($args); - $args->{VERSION} = $self->version || $self->determine_VERSION($args); + $args->{NAME} = $self->module_name || $self->name; + $args->{VERSION} = $self->version; $args->{NAME} =~ s/-/::/g; if ( $self->tests ) { $args->{test} = { TESTS => $self->tests }; @@ -142,9 +147,12 @@ map { @$_ } map { @$_ } grep $_, - ($self->build_requires, $self->requires) + ($self->configure_requires, $self->build_requires, $self->requires) ); + # Remove any reference to perl, PREREQ_PM doesn't support it + delete $args->{PREREQ_PM}->{perl}; + # merge both kinds of requires into prereq_pm my $subdirs = ($args->{DIR} ||= []); if ($self->bundles) { @@ -205,7 +213,7 @@ #$makefile =~ s/^PERL_ARCHLIB = .+/PERL_ARCHLIB =/m; # Perl 5.005 mentions PERL_LIB explicitly, so we have to remove that as well. - $makefile =~ s/("?)-I\$\(PERL_LIB\)\1//g; + $makefile =~ s/(\"?)-I\$\(PERL_LIB\)\1//g; # XXX - This is currently unused; not sure if it breaks other MM-users # $makefile =~ s/^pm_to_blib\s+:\s+/pm_to_blib :: /mg; @@ -234,4 +242,4 @@ __END__ -#line 363 +#line 371 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Fetch.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Fetch.pm 2008/02/21 00:12:55 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Fetch.pm 2008/05/07 17:21:29 1.4 @@ -6,7 +6,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/WriteAll.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/WriteAll.pm 2008/02/21 00:12:55 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/WriteAll.pm 2008/05/07 17:21:29 1.4 @@ -4,40 +4,37 @@ use strict; use Module::Install::Base; -use vars qw{$VERSION $ISCORE @ISA}; +use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '0.67'; - $ISCORE = 1; + $VERSION = '0.72'; @ISA = qw{Module::Install::Base}; + $ISCORE = 1; } sub WriteAll { - my $self = shift; - my %args = ( - meta => 1, - sign => 0, - inline => 0, - check_nmake => 1, - @_ - ); - - $self->sign(1) if $args{sign}; - $self->Meta->write if $args{meta}; - $self->admin->WriteAll(%args) if $self->is_admin; - - if ( $0 =~ /Build.PL$/i ) { - $self->Build->write; - } else { - $self->check_nmake if $args{check_nmake}; - unless ( $self->makemaker_args->{'PL_FILES'} ) { - $self->makemaker_args( PL_FILES => {} ); - } - if ($args{inline}) { - $self->Inline->write; - } else { - $self->Makefile->write; - } - } + my $self = shift; + my %args = ( + meta => 1, + sign => 0, + inline => 0, + check_nmake => 1, + @_, + ); + + $self->sign(1) if $args{sign}; + $self->Meta->write if $args{meta}; + $self->admin->WriteAll(%args) if $self->is_admin; + + $self->check_nmake if $args{check_nmake}; + unless ( $self->makemaker_args->{PL_FILES} ) { + $self->makemaker_args( PL_FILES => {} ); + } + + if ( $args{inline} ) { + $self->Inline->write; + } else { + $self->Makefile->write; + } } 1; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Can.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Can.pm 2008/02/21 00:12:55 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Can.pm 2008/05/07 17:21:29 1.4 @@ -11,7 +11,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Share.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Share.pm 2008/02/21 00:12:55 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Share.pm 2008/05/07 17:21:29 1.4 @@ -6,7 +6,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } @@ -31,10 +31,13 @@ # So when we need to install a share directory, make sure we add a # dependency on a moderately new version of ExtUtils::MakeMaker. $self->build_requires( 'ExtUtils::MakeMaker' => '6.11' ); + + # 99% of the time we don't want to index a shared dir + $self->no_index( directory => $dir ); } 1; __END__ -#line 98 +#line 101 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Win32.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Win32.pm 2008/02/21 00:12:55 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Win32.pm 2008/05/07 17:21:29 1.4 @@ -4,11 +4,11 @@ use strict; use Module::Install::Base; -use vars qw{$VERSION $ISCORE @ISA}; +use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '0.67'; - $ISCORE = 1; + $VERSION = '0.72'; @ISA = qw{Module::Install::Base}; + $ISCORE = 1; } # determine if the user needs nmake, and download it if needed @@ -16,7 +16,7 @@ my $self = shift; $self->load('can_run'); $self->load('get_file'); - + require Config; return unless ( $^O eq 'MSWin32' and @@ -38,8 +38,7 @@ remove => 1, ); - if (!$rv) { - die <<'END_MESSAGE'; + die <<'END_MESSAGE' unless $rv; ------------------------------------------------------------------------------- @@ -59,7 +58,7 @@ ------------------------------------------------------------------------------- END_MESSAGE - } + } 1; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Metadata.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Metadata.pm 2008/02/21 00:12:55 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/Metadata.pm 2008/05/07 17:21:29 1.4 @@ -6,18 +6,30 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } my @scalar_keys = qw{ - name module_name abstract author version license - distribution_type perl_version tests installdirs + name + module_name + abstract + author + version + license + distribution_type + perl_version + tests + installdirs }; my @tuple_keys = qw{ - build_requires requires recommends bundles + configure_requires + build_requires + requires + recommends + bundles }; sub Meta { shift } @@ -25,44 +37,68 @@ sub Meta_TupleKeys { @tuple_keys } foreach my $key (@scalar_keys) { - *$key = sub { - my $self = shift; - return $self->{values}{$key} if defined wantarray and !@_; - $self->{values}{$key} = shift; - return $self; - }; -} - -foreach my $key (@tuple_keys) { - *$key = sub { - my $self = shift; - return $self->{values}{$key} unless @_; - - my @rv; - while (@_) { - my $module = shift or last; - my $version = shift || 0; - if ( $module eq 'perl' ) { - $version =~ s{^(\d+)\.(\d+)\.(\d+)} - {$1 + $2/1_000 + $3/1_000_000}e; - $self->perl_version($version); - next; - } - my $rv = [ $module, $version ]; - push @rv, $rv; - } - push @{ $self->{values}{$key} }, @rv; - @rv; - }; + *$key = sub { + my $self = shift; + return $self->{values}{$key} if defined wantarray and !@_; + $self->{values}{$key} = shift; + return $self; + }; +} + +sub requires { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{requires} }, [ $module, $version ]; + } + $self->{values}{requires}; +} + +sub build_requires { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{build_requires} }, [ $module, $version ]; + } + $self->{values}{build_requires}; +} + +sub configure_requires { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{configure_requires} }, [ $module, $version ]; + } + $self->{values}{configure_requires}; +} + +sub recommends { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{recommends} }, [ $module, $version ]; + } + $self->{values}{recommends}; } -# configure_requires is currently a null-op -sub configure_requires { 1 } +sub bundles { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{bundles} }, [ $module, $version ]; + } + $self->{values}{bundles}; +} # Aliases for build_requires that will have alternative # meanings in some future version of META.yml. -sub test_requires { shift->build_requires(@_) } -sub install_requires { shift->build_requires(@_) } +sub test_requires { shift->build_requires(@_) } +sub install_requires { shift->build_requires(@_) } # Aliases for installdirs options sub install_as_core { $_[0]->installdirs('perl') } @@ -71,10 +107,10 @@ sub install_as_vendor { $_[0]->installdirs('vendor') } sub sign { - my $self = shift; - return $self->{'values'}{'sign'} if defined wantarray and ! @_; - $self->{'values'}{'sign'} = ( @_ ? $_[0] : 1 ); - return $self; + my $self = shift; + return $self->{'values'}{'sign'} if defined wantarray and ! @_; + $self->{'values'}{'sign'} = ( @_ ? $_[0] : 1 ); + return $self; } sub dynamic_config { @@ -83,254 +119,268 @@ warn "You MUST provide an explicit true/false value to dynamic_config, skipping\n"; return $self; } - $self->{'values'}{'dynamic_config'} = $_[0] ? 1 : 0; + $self->{values}{dynamic_config} = $_[0] ? 1 : 0; return $self; } sub all_from { - my ( $self, $file ) = @_; + my ( $self, $file ) = @_; + + unless ( defined($file) ) { + my $name = $self->name + or die "all_from called with no args without setting name() first"; + $file = join('/', 'lib', split(/-/, $name)) . '.pm'; + $file =~ s{.*/}{} unless -e $file; + die "all_from: cannot find $file from $name" unless -e $file; + } + + # Some methods pull from POD instead of code. + # If there is a matching .pod, use that instead + my $pod = $file; + $pod =~ s/\.pm$/.pod/i; + $pod = $file unless -e $pod; + + # Pull the different values + $self->name_from($file) unless $self->name; + $self->version_from($file) unless $self->version; + $self->perl_version_from($file) unless $self->perl_version; + $self->author_from($pod) unless $self->author; + $self->license_from($pod) unless $self->license; + $self->abstract_from($pod) unless $self->abstract; - unless ( defined($file) ) { - my $name = $self->name - or die "all_from called with no args without setting name() first"; - $file = join('/', 'lib', split(/-/, $name)) . '.pm'; - $file =~ s{.*/}{} unless -e $file; - die "all_from: cannot find $file from $name" unless -e $file; - } - - $self->version_from($file) unless $self->version; - $self->perl_version_from($file) unless $self->perl_version; - - # The remaining probes read from POD sections; if the file - # has an accompanying .pod, use that instead - my $pod = $file; - if ( $pod =~ s/\.pm$/.pod/i and -e $pod ) { - $file = $pod; - } - - $self->author_from($file) unless $self->author; - $self->license_from($file) unless $self->license; - $self->abstract_from($file) unless $self->abstract; + return 1; } sub provides { - my $self = shift; - my $provides = ( $self->{values}{provides} ||= {} ); - %$provides = (%$provides, @_) if @_; - return $provides; + my $self = shift; + my $provides = ( $self->{values}{provides} ||= {} ); + %$provides = (%$provides, @_) if @_; + return $provides; } sub auto_provides { - my $self = shift; - return $self unless $self->is_admin; - - unless (-e 'MANIFEST') { - warn "Cannot deduce auto_provides without a MANIFEST, skipping\n"; - return $self; - } - - # Avoid spurious warnings as we are not checking manifest here. - - local $SIG{__WARN__} = sub {1}; - require ExtUtils::Manifest; - local *ExtUtils::Manifest::manicheck = sub { return }; - - require Module::Build; - my $build = Module::Build->new( - dist_name => $self->name, - dist_version => $self->version, - license => $self->license, - ); - $self->provides(%{ $build->find_dist_packages || {} }); + my $self = shift; + return $self unless $self->is_admin; + unless (-e 'MANIFEST') { + warn "Cannot deduce auto_provides without a MANIFEST, skipping\n"; + return $self; + } + # Avoid spurious warnings as we are not checking manifest here. + local $SIG{__WARN__} = sub {1}; + require ExtUtils::Manifest; + local *ExtUtils::Manifest::manicheck = sub { return }; + + require Module::Build; + my $build = Module::Build->new( + dist_name => $self->name, + dist_version => $self->version, + license => $self->license, + ); + $self->provides( %{ $build->find_dist_packages || {} } ); } sub feature { - my $self = shift; - my $name = shift; - my $features = ( $self->{values}{features} ||= [] ); - - my $mods; - - if ( @_ == 1 and ref( $_[0] ) ) { - # The user used ->feature like ->features by passing in the second - # argument as a reference. Accomodate for that. - $mods = $_[0]; - } else { - $mods = \@_; - } - - my $count = 0; - push @$features, ( - $name => [ - map { - ref($_) ? ( ref($_) eq 'HASH' ) ? %$_ - : @$_ - : $_ - } @$mods - ] - ); + my $self = shift; + my $name = shift; + my $features = ( $self->{values}{features} ||= [] ); + my $mods; + + if ( @_ == 1 and ref( $_[0] ) ) { + # The user used ->feature like ->features by passing in the second + # argument as a reference. Accomodate for that. + $mods = $_[0]; + } else { + $mods = \@_; + } - return @$features; + my $count = 0; + push @$features, ( + $name => [ + map { + ref($_) ? ( ref($_) eq 'HASH' ) ? %$_ : @$_ : $_ + } @$mods + ] + ); + + return @$features; } sub features { - my $self = shift; - while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) { - $self->feature( $name, @$mods ); - } - return $self->{values}->{features} - ? @{ $self->{values}->{features} } - : (); + my $self = shift; + while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) { + $self->feature( $name, @$mods ); + } + return $self->{values}->{features} + ? @{ $self->{values}->{features} } + : (); } sub no_index { - my $self = shift; - my $type = shift; - push @{ $self->{values}{no_index}{$type} }, @_ if $type; - return $self->{values}{no_index}; + my $self = shift; + my $type = shift; + push @{ $self->{values}{no_index}{$type} }, @_ if $type; + return $self->{values}{no_index}; } sub read { - my $self = shift; - $self->include_deps( 'YAML', 0 ); + my $self = shift; + $self->include_deps( 'YAML::Tiny', 0 ); - require YAML; - my $data = YAML::LoadFile('META.yml'); + require YAML::Tiny; + my $data = YAML::Tiny::LoadFile('META.yml'); - # Call methods explicitly in case user has already set some values. - while ( my ( $key, $value ) = each %$data ) { - next unless $self->can($key); - if ( ref $value eq 'HASH' ) { - while ( my ( $module, $version ) = each %$value ) { - $self->can($key)->($self, $module => $version ); - } - } - else { - $self->can($key)->($self, $value); - } - } - return $self; + # Call methods explicitly in case user has already set some values. + while ( my ( $key, $value ) = each %$data ) { + next unless $self->can($key); + if ( ref $value eq 'HASH' ) { + while ( my ( $module, $version ) = each %$value ) { + $self->can($key)->($self, $module => $version ); + } + } else { + $self->can($key)->($self, $value); + } + } + return $self; } sub write { - my $self = shift; - return $self unless $self->is_admin; - $self->admin->write_meta; - return $self; + my $self = shift; + return $self unless $self->is_admin; + $self->admin->write_meta; + return $self; } sub version_from { - my ( $self, $file ) = @_; - require ExtUtils::MM_Unix; - $self->version( ExtUtils::MM_Unix->parse_version($file) ); + require ExtUtils::MM_Unix; + my ( $self, $file ) = @_; + $self->version( ExtUtils::MM_Unix->parse_version($file) ); } sub abstract_from { - my ( $self, $file ) = @_; - require ExtUtils::MM_Unix; - $self->abstract( - bless( - { DISTNAME => $self->name }, - 'ExtUtils::MM_Unix' - )->parse_abstract($file) - ); -} - -sub _slurp { - my ( $self, $file ) = @_; - - local *FH; - open FH, "< $file" or die "Cannot open $file.pod: $!"; - do { local $/; }; + require ExtUtils::MM_Unix; + my ( $self, $file ) = @_; + $self->abstract( + bless( + { DISTNAME => $self->name }, + 'ExtUtils::MM_Unix' + )->parse_abstract($file) + ); } -sub perl_version_from { - my ( $self, $file ) = @_; +sub name_from { + my $self = shift; + if ( + Module::Install::_read($_[0]) =~ m/ + ^ \s* + package \s* + ([\w:]+) + \s* ; + /ixms + ) { + my $name = $1; + $name =~ s{::}{-}g; + $self->name($name); + } else { + die "Cannot determine name from $_[0]\n"; + return; + } +} - if ( - $self->_slurp($file) =~ m/ - ^ - use \s* - v? - ([\d_\.]+) - \s* ; - /ixms - ) - { - my $v = $1; - $v =~ s{_}{}g; - $self->perl_version($1); - } - else { - warn "Cannot determine perl version info from $file\n"; - return; - } +sub perl_version_from { + my $self = shift; + if ( + Module::Install::_read($_[0]) =~ m/ + ^ + use \s* + v? + ([\d_\.]+) + \s* ; + /ixms + ) { + my $perl_version = $1; + $perl_version =~ s{_}{}g; + $self->perl_version($perl_version); + } else { + warn "Cannot determine perl version info from $_[0]\n"; + return; + } } sub author_from { - my ( $self, $file ) = @_; - my $content = $self->_slurp($file); - if ($content =~ m/ - =head \d \s+ (?:authors?)\b \s* - ([^\n]*) - | - =head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b \s* - .*? copyright .*? \d\d\d[\d.]+ \s* (?:\bby\b)? \s* - ([^\n]*) - /ixms) { - my $author = $1 || $2; - $author =~ s{E}{<}g; - $author =~ s{E}{>}g; - $self->author($author); - } - else { - warn "Cannot determine author info from $file\n"; - } + my $self = shift; + my $content = Module::Install::_read($_[0]); + if ($content =~ m/ + =head \d \s+ (?:authors?)\b \s* + ([^\n]*) + | + =head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b \s* + .*? copyright .*? \d\d\d[\d.]+ \s* (?:\bby\b)? \s* + ([^\n]*) + /ixms) { + my $author = $1 || $2; + $author =~ s{E}{<}g; + $author =~ s{E}{>}g; + $self->author($author); + } else { + warn "Cannot determine author info from $_[0]\n"; + } } sub license_from { - my ( $self, $file ) = @_; - - if ( - $self->_slurp($file) =~ m/ - ( - =head \d \s+ - (?:licen[cs]e|licensing|copyright|legal)\b - .*? - ) - (=head\\d.*|=cut.*|) - \z - /ixms - ) - { - my $license_text = $1; - my @phrases = ( - 'under the same (?:terms|license) as perl itself' => 'perl', 1, - 'GNU public license' => 'gpl', 1, - 'GNU lesser public license' => 'gpl', 1, - 'BSD license' => 'bsd', 1, - 'Artistic license' => 'artistic', 1, - 'GPL' => 'gpl', 1, - 'LGPL' => 'lgpl', 1, - 'BSD' => 'bsd', 1, - 'Artistic' => 'artistic', 1, - 'MIT' => 'mit', 1, - 'proprietary' => 'proprietary', 0, - ); - while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) { - $pattern =~ s{\s+}{\\s+}g; - if ( $license_text =~ /\b$pattern\b/i ) { - if ( $osi and $license_text =~ /All rights reserved/i ) { - warn "LEGAL WARNING: 'All rights reserved' may invalidate Open Source licenses. Consider removing it."; + my $self = shift; + if ( + Module::Install::_read($_[0]) =~ m/ + ( + =head \d \s+ + (?:licen[cs]e|licensing|copyright|legal)\b + .*? + ) + (=head\\d.*|=cut.*|) + \z + /ixms ) { + my $license_text = $1; + my @phrases = ( + 'under the same (?:terms|license) as perl itself' => 'perl', 1, + 'GNU public license' => 'gpl', 1, + 'GNU lesser public license' => 'lgpl', 1, + 'BSD license' => 'bsd', 1, + 'Artistic license' => 'artistic', 1, + 'GPL' => 'gpl', 1, + 'LGPL' => 'lgpl', 1, + 'BSD' => 'bsd', 1, + 'Artistic' => 'artistic', 1, + 'MIT' => 'mit', 1, + 'proprietary' => 'proprietary', 0, + ); + while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) { + $pattern =~ s{\s+}{\\s+}g; + if ( $license_text =~ /\b$pattern\b/i ) { + if ( $osi and $license_text =~ /All rights reserved/i ) { + warn "LEGAL WARNING: 'All rights reserved' may invalidate Open Source licenses. Consider removing it."; + } + $self->license($license); + return 1; + } } - $self->license($license); - return 1; - } - } - } + } + + warn "Cannot determine license info from $_[0]\n"; + return 'unknown'; +} - warn "Cannot determine license info from $file\n"; - return 'unknown'; +sub install_script { + my $self = shift; + my $args = $self->makemaker_args; + my $exe = $args->{EXE_FILES} ||= []; + foreach ( @_ ) { + if ( -f $_ ) { + push @$exe, $_; + } elsif ( -d 'script' and -f "script/$_" ) { + push @$exe, "script/$_"; + } else { + die "Cannot find script '$_'"; + } + } } 1; rcsdiff: /home/repository/moby/moby-live/Perl/MOSES-MOBY/inc/Module/Install/RCS/Scripts.pm,v: No such file or directory From kawas at dev.open-bio.org Wed May 7 17:22:12 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 May 2008 13:22:12 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805071722.m47HMCZi009188@dev.open-bio.org> kawas Wed May 7 13:22:12 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY In directory dev.open-bio.org:/tmp/cvs-serv9153/Perl/MOSES-MOBY Modified Files: Makefile.PL Log Message: updated the makefile to require the exact version of IO::Prompt necessary. moby-live/Perl/MOSES-MOBY Makefile.PL,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/Makefile.PL,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/Makefile.PL 2008/02/21 00:12:55 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/Makefile.PL 2008/05/07 17:22:12 1.4 @@ -3,7 +3,7 @@ # Define metadata name 'MOSES-MOBY'; - version '0.84'; + version '0.85'; license 'perl'; abstract 'This distribution aids in the creation of BioMOBY perl based web services.'; @@ -11,6 +11,7 @@ # Specific dependencies requires 'Carp' => 0; + requires 'CGI' => 0; requires 'File::Spec' => 0.80; requires 'SOAP::Lite' => 0.69; requires 'XML::LibXML' => 1.62; @@ -25,8 +26,9 @@ requires 'Params::Util' => 0.28; # requires 'Want' => 0; - requires 'IO::Prompt' => 0.99; - + if ( not( $^O =~ /MSWin32|Windows_NT/i ) ) { + requires 'IO::Prompt' => '0.99.2'; + } build_requires 'Test::More' => '0.42'; no_index 'directory' => 'bin/scripts'; From kawas at dev.open-bio.org Wed May 7 17:26:15 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 May 2008 13:26:15 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805071726.m47HQFWP009282@dev.open-bio.org> kawas Wed May 7 13:26:15 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY In directory dev.open-bio.org:/tmp/cvs-serv9247/Perl/MOSES-MOBY Modified Files: META.yml Log Message: moby-live/Perl/MOSES-MOBY META.yml,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/META.yml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/META.yml 2008/04/29 20:10:06 1.4 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/META.yml 2008/05/07 17:26:15 1.5 @@ -1,10 +1,12 @@ --- abstract: 'This distribution aids in the creation of BioMOBY perl based web services.' +author: + - 'Edward Kawas (edward.kawas [at] gmail [dot] com)' build_requires: ExtUtils::MakeMaker: 6.11 Test::More: 0.42 distribution_type: module -generated_by: 'Module::Install version 0.67' +generated_by: 'Module::Install version 0.72' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.3.html @@ -13,21 +15,24 @@ no_index: directory: - bin/scripts + - share + - share - inc - t requires: Carp: 0 + Class::Inspector: 1.17 Config::Simple: 4.58 File::HomeDir: 0.65 File::ShareDir: 0.05 - File::Spec: 0.80 + File::Spec: 0.8 + IO::Prompt: 0.99.2 IO::Stringy: 2.11 Log::Log4perl: 1.12 + Params::Util: 0.28 SOAP::Lite: 0.69 Template: 1.11 Unicode::String: 2.09 XML::LibXML: 1.62 - IO::Prompt: 0.99 - Want: 0 - version: 0 version: 0.85 + From kawas at dev.open-bio.org Wed May 7 17:33:30 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 May 2008 13:33:30 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805071733.m47HXUcU009322@dev.open-bio.org> kawas Wed May 7 13:33:30 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY In directory dev.open-bio.org:/tmp/cvs-serv9287/Perl/MOSES-MOBY Modified Files: MANIFEST Log Message: moby-live/Perl/MOSES-MOBY MANIFEST,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/MANIFEST,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/MANIFEST 2008/04/29 20:07:50 1.4 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/MANIFEST 2008/05/07 17:33:30 1.5 @@ -1,6 +1,3 @@ -share/samples/Service/HelloBiomobyWorld.pm -share/samples/Service/Mabuhay.pm -share/samples/SERVICES_TABLE bin/scripts/moses-cache-tester.pl bin/scripts/moses-config-status.pl bin/scripts/moses-generate-datatypes.pl @@ -22,7 +19,6 @@ inc/Module/Install/Include.pm inc/Module/Install/Makefile.pm inc/Module/Install/Metadata.pm -inc/Module/Install/Scripts.pm inc/Module/Install/Share.pm inc/Module/Install/Win32.pm inc/Module/Install/WriteAll.pm @@ -58,14 +54,18 @@ lib/MOSES/MOBY/ServiceException.pm lib/MOSES/MOBY/Tags.pm Makefile.PL -MANIFEST This list of files +MANIFEST This list of files META.yml README share/log4perl.properties.template +share/mabuhay.file share/moby-services.cfg.template share/MobyServer.cgi.template -share/mabuhay.file -share/USER_REGISTRIES share/notes -t/MOSES-MOBY.t +share/samples/Service/HelloBiomobyWorld.pm +share/samples/Service/Mabuhay.pm +share/samples/SERVICES_TABLE +share/USER_REGISTRIES t/MOSES-MOBY-Cache.t +t/MOSES-MOBY-Registry.t +t/MOSES-MOBY.t \ No newline at end of file From kawas at dev.open-bio.org Wed May 7 17:50:57 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 May 2008 13:50:57 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805071750.m47Hovl7009383@dev.open-bio.org> kawas Wed May 7 13:50:57 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY In directory dev.open-bio.org:/tmp/cvs-serv9348/Perl/MOSES-MOBY Modified Files: Makefile.PL Log Message: moby-live/Perl/MOSES-MOBY Makefile.PL,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/Makefile.PL,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/Makefile.PL 2008/05/07 17:22:12 1.4 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/Makefile.PL 2008/05/07 17:50:57 1.5 @@ -27,6 +27,7 @@ # requires 'Want' => 0; if ( not( $^O =~ /MSWin32|Windows_NT/i ) ) { + requires 'Want' => '0.18'; requires 'IO::Prompt' => '0.99.2'; } build_requires 'Test::More' => '0.42'; From kawas at dev.open-bio.org Wed May 7 18:15:19 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 May 2008 14:15:19 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805071815.m47IFJ3m009598@dev.open-bio.org> kawas Wed May 7 14:15:19 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install In directory dev.open-bio.org:/tmp/cvs-serv9526/Perl/MOBY-Client/inc/Module/Install Modified Files: Metadata.pm AutoInstall.pm Share.pm Win32.pm Include.pm Base.pm WriteAll.pm Fetch.pm Can.pm Makefile.pm Removed Files: Scripts.pm Log Message: updated the Module::Install libraries to version 0.72 moby-live/Perl/MOBY-Client/inc/Module/Install Metadata.pm,1.1,1.2 AutoInstall.pm,1.1,1.2 Share.pm,1.1,1.2 Win32.pm,1.1,1.2 Include.pm,1.1,1.2 Base.pm,1.1,1.2 WriteAll.pm,1.1,1.2 Fetch.pm,1.1,1.2 Can.pm,1.1,1.2 Makefile.pm,1.1,1.2 Scripts.pm,1.1,NONE =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Metadata.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Metadata.pm 2008/02/21 00:14:33 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Metadata.pm 2008/05/07 18:15:19 1.2 @@ -6,18 +6,30 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.68'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } my @scalar_keys = qw{ - name module_name abstract author version license - distribution_type perl_version tests installdirs + name + module_name + abstract + author + version + license + distribution_type + perl_version + tests + installdirs }; my @tuple_keys = qw{ - build_requires requires recommends bundles + configure_requires + build_requires + requires + recommends + bundles }; sub Meta { shift } @@ -25,44 +37,68 @@ sub Meta_TupleKeys { @tuple_keys } foreach my $key (@scalar_keys) { - *$key = sub { - my $self = shift; - return $self->{values}{$key} if defined wantarray and !@_; - $self->{values}{$key} = shift; - return $self; - }; -} - -foreach my $key (@tuple_keys) { - *$key = sub { - my $self = shift; - return $self->{values}{$key} unless @_; - - my @rv; - while (@_) { - my $module = shift or last; - my $version = shift || 0; - if ( $module eq 'perl' ) { - $version =~ s{^(\d+)\.(\d+)\.(\d+)} - {$1 + $2/1_000 + $3/1_000_000}e; - $self->perl_version($version); - next; - } - my $rv = [ $module, $version ]; - push @rv, $rv; - } - push @{ $self->{values}{$key} }, @rv; - @rv; - }; + *$key = sub { + my $self = shift; + return $self->{values}{$key} if defined wantarray and !@_; + $self->{values}{$key} = shift; + return $self; + }; +} + +sub requires { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{requires} }, [ $module, $version ]; + } + $self->{values}{requires}; +} + +sub build_requires { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{build_requires} }, [ $module, $version ]; + } + $self->{values}{build_requires}; +} + +sub configure_requires { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{configure_requires} }, [ $module, $version ]; + } + $self->{values}{configure_requires}; +} + +sub recommends { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{recommends} }, [ $module, $version ]; + } + $self->{values}{recommends}; } -# configure_requires is currently a null-op -sub configure_requires { 1 } +sub bundles { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{bundles} }, [ $module, $version ]; + } + $self->{values}{bundles}; +} # Aliases for build_requires that will have alternative # meanings in some future version of META.yml. -sub test_requires { shift->build_requires(@_) } -sub install_requires { shift->build_requires(@_) } +sub test_requires { shift->build_requires(@_) } +sub install_requires { shift->build_requires(@_) } # Aliases for installdirs options sub install_as_core { $_[0]->installdirs('perl') } @@ -71,10 +107,10 @@ sub install_as_vendor { $_[0]->installdirs('vendor') } sub sign { - my $self = shift; - return $self->{'values'}{'sign'} if defined wantarray and ! @_; - $self->{'values'}{'sign'} = ( @_ ? $_[0] : 1 ); - return $self; + my $self = shift; + return $self->{'values'}{'sign'} if defined wantarray and ! @_; + $self->{'values'}{'sign'} = ( @_ ? $_[0] : 1 ); + return $self; } sub dynamic_config { @@ -83,254 +119,268 @@ warn "You MUST provide an explicit true/false value to dynamic_config, skipping\n"; return $self; } - $self->{'values'}{'dynamic_config'} = $_[0] ? 1 : 0; + $self->{values}{dynamic_config} = $_[0] ? 1 : 0; return $self; } sub all_from { - my ( $self, $file ) = @_; + my ( $self, $file ) = @_; + + unless ( defined($file) ) { + my $name = $self->name + or die "all_from called with no args without setting name() first"; + $file = join('/', 'lib', split(/-/, $name)) . '.pm'; + $file =~ s{.*/}{} unless -e $file; + die "all_from: cannot find $file from $name" unless -e $file; + } + + # Some methods pull from POD instead of code. + # If there is a matching .pod, use that instead + my $pod = $file; + $pod =~ s/\.pm$/.pod/i; + $pod = $file unless -e $pod; + + # Pull the different values + $self->name_from($file) unless $self->name; + $self->version_from($file) unless $self->version; + $self->perl_version_from($file) unless $self->perl_version; + $self->author_from($pod) unless $self->author; + $self->license_from($pod) unless $self->license; + $self->abstract_from($pod) unless $self->abstract; - unless ( defined($file) ) { - my $name = $self->name - or die "all_from called with no args without setting name() first"; - $file = join('/', 'lib', split(/-/, $name)) . '.pm'; - $file =~ s{.*/}{} unless -e $file; - die "all_from: cannot find $file from $name" unless -e $file; - } - - $self->version_from($file) unless $self->version; - $self->perl_version_from($file) unless $self->perl_version; - - # The remaining probes read from POD sections; if the file - # has an accompanying .pod, use that instead - my $pod = $file; - if ( $pod =~ s/\.pm$/.pod/i and -e $pod ) { - $file = $pod; - } - - $self->author_from($file) unless $self->author; - $self->license_from($file) unless $self->license; - $self->abstract_from($file) unless $self->abstract; + return 1; } sub provides { - my $self = shift; - my $provides = ( $self->{values}{provides} ||= {} ); - %$provides = (%$provides, @_) if @_; - return $provides; + my $self = shift; + my $provides = ( $self->{values}{provides} ||= {} ); + %$provides = (%$provides, @_) if @_; + return $provides; } sub auto_provides { - my $self = shift; - return $self unless $self->is_admin; - - unless (-e 'MANIFEST') { - warn "Cannot deduce auto_provides without a MANIFEST, skipping\n"; - return $self; - } - - # Avoid spurious warnings as we are not checking manifest here. - - local $SIG{__WARN__} = sub {1}; - require ExtUtils::Manifest; - local *ExtUtils::Manifest::manicheck = sub { return }; - - require Module::Build; - my $build = Module::Build->new( - dist_name => $self->name, - dist_version => $self->version, - license => $self->license, - ); - $self->provides(%{ $build->find_dist_packages || {} }); + my $self = shift; + return $self unless $self->is_admin; + unless (-e 'MANIFEST') { + warn "Cannot deduce auto_provides without a MANIFEST, skipping\n"; + return $self; + } + # Avoid spurious warnings as we are not checking manifest here. + local $SIG{__WARN__} = sub {1}; + require ExtUtils::Manifest; + local *ExtUtils::Manifest::manicheck = sub { return }; + + require Module::Build; + my $build = Module::Build->new( + dist_name => $self->name, + dist_version => $self->version, + license => $self->license, + ); + $self->provides( %{ $build->find_dist_packages || {} } ); } sub feature { - my $self = shift; - my $name = shift; - my $features = ( $self->{values}{features} ||= [] ); - - my $mods; - - if ( @_ == 1 and ref( $_[0] ) ) { - # The user used ->feature like ->features by passing in the second - # argument as a reference. Accomodate for that. - $mods = $_[0]; - } else { - $mods = \@_; - } - - my $count = 0; - push @$features, ( - $name => [ - map { - ref($_) ? ( ref($_) eq 'HASH' ) ? %$_ - : @$_ - : $_ - } @$mods - ] - ); + my $self = shift; + my $name = shift; + my $features = ( $self->{values}{features} ||= [] ); + my $mods; + + if ( @_ == 1 and ref( $_[0] ) ) { + # The user used ->feature like ->features by passing in the second + # argument as a reference. Accomodate for that. + $mods = $_[0]; + } else { + $mods = \@_; + } - return @$features; + my $count = 0; + push @$features, ( + $name => [ + map { + ref($_) ? ( ref($_) eq 'HASH' ) ? %$_ : @$_ : $_ + } @$mods + ] + ); + + return @$features; } sub features { - my $self = shift; - while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) { - $self->feature( $name, @$mods ); - } - return $self->{values}->{features} - ? @{ $self->{values}->{features} } - : (); + my $self = shift; + while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) { + $self->feature( $name, @$mods ); + } + return $self->{values}->{features} + ? @{ $self->{values}->{features} } + : (); } sub no_index { - my $self = shift; - my $type = shift; - push @{ $self->{values}{no_index}{$type} }, @_ if $type; - return $self->{values}{no_index}; + my $self = shift; + my $type = shift; + push @{ $self->{values}{no_index}{$type} }, @_ if $type; + return $self->{values}{no_index}; } sub read { - my $self = shift; - $self->include_deps( 'YAML', 0 ); + my $self = shift; + $self->include_deps( 'YAML::Tiny', 0 ); - require YAML; - my $data = YAML::LoadFile('META.yml'); + require YAML::Tiny; + my $data = YAML::Tiny::LoadFile('META.yml'); - # Call methods explicitly in case user has already set some values. - while ( my ( $key, $value ) = each %$data ) { - next unless $self->can($key); - if ( ref $value eq 'HASH' ) { - while ( my ( $module, $version ) = each %$value ) { - $self->can($key)->($self, $module => $version ); - } - } - else { - $self->can($key)->($self, $value); - } - } - return $self; + # Call methods explicitly in case user has already set some values. + while ( my ( $key, $value ) = each %$data ) { + next unless $self->can($key); + if ( ref $value eq 'HASH' ) { + while ( my ( $module, $version ) = each %$value ) { + $self->can($key)->($self, $module => $version ); + } + } else { + $self->can($key)->($self, $value); + } + } + return $self; } sub write { - my $self = shift; - return $self unless $self->is_admin; - $self->admin->write_meta; - return $self; + my $self = shift; + return $self unless $self->is_admin; + $self->admin->write_meta; + return $self; } sub version_from { - my ( $self, $file ) = @_; - require ExtUtils::MM_Unix; - $self->version( ExtUtils::MM_Unix->parse_version($file) ); + require ExtUtils::MM_Unix; + my ( $self, $file ) = @_; + $self->version( ExtUtils::MM_Unix->parse_version($file) ); } sub abstract_from { - my ( $self, $file ) = @_; - require ExtUtils::MM_Unix; - $self->abstract( - bless( - { DISTNAME => $self->name }, - 'ExtUtils::MM_Unix' - )->parse_abstract($file) - ); -} - -sub _slurp { - my ( $self, $file ) = @_; - - local *FH; - open FH, "< $file" or die "Cannot open $file.pod: $!"; - do { local $/; }; + require ExtUtils::MM_Unix; + my ( $self, $file ) = @_; + $self->abstract( + bless( + { DISTNAME => $self->name }, + 'ExtUtils::MM_Unix' + )->parse_abstract($file) + ); } -sub perl_version_from { - my ( $self, $file ) = @_; +sub name_from { + my $self = shift; + if ( + Module::Install::_read($_[0]) =~ m/ + ^ \s* + package \s* + ([\w:]+) + \s* ; + /ixms + ) { + my $name = $1; + $name =~ s{::}{-}g; + $self->name($name); + } else { + die "Cannot determine name from $_[0]\n"; + return; + } +} - if ( - $self->_slurp($file) =~ m/ - ^ - use \s* - v? - ([\d_\.]+) - \s* ; - /ixms - ) - { - my $v = $1; - $v =~ s{_}{}g; - $self->perl_version($1); - } - else { - warn "Cannot determine perl version info from $file\n"; - return; - } +sub perl_version_from { + my $self = shift; + if ( + Module::Install::_read($_[0]) =~ m/ + ^ + use \s* + v? + ([\d_\.]+) + \s* ; + /ixms + ) { + my $perl_version = $1; + $perl_version =~ s{_}{}g; + $self->perl_version($perl_version); + } else { + warn "Cannot determine perl version info from $_[0]\n"; + return; + } } sub author_from { - my ( $self, $file ) = @_; - my $content = $self->_slurp($file); - if ($content =~ m/ - =head \d \s+ (?:authors?)\b \s* - ([^\n]*) - | - =head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b \s* - .*? copyright .*? \d\d\d[\d.]+ \s* (?:\bby\b)? \s* - ([^\n]*) - /ixms) { - my $author = $1 || $2; - $author =~ s{E}{<}g; - $author =~ s{E}{>}g; - $self->author($author); - } - else { - warn "Cannot determine author info from $file\n"; - } + my $self = shift; + my $content = Module::Install::_read($_[0]); + if ($content =~ m/ + =head \d \s+ (?:authors?)\b \s* + ([^\n]*) + | + =head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b \s* + .*? copyright .*? \d\d\d[\d.]+ \s* (?:\bby\b)? \s* + ([^\n]*) + /ixms) { + my $author = $1 || $2; + $author =~ s{E}{<}g; + $author =~ s{E}{>}g; + $self->author($author); + } else { + warn "Cannot determine author info from $_[0]\n"; + } } sub license_from { - my ( $self, $file ) = @_; - - if ( - $self->_slurp($file) =~ m/ - ( - =head \d \s+ - (?:licen[cs]e|licensing|copyright|legal)\b - .*? - ) - (=head\\d.*|=cut.*|) - \z - /ixms - ) - { - my $license_text = $1; - my @phrases = ( - 'under the same (?:terms|license) as perl itself' => 'perl', 1, - 'GNU public license' => 'gpl', 1, - 'GNU lesser public license' => 'gpl', 1, - 'BSD license' => 'bsd', 1, - 'Artistic license' => 'artistic', 1, - 'GPL' => 'gpl', 1, - 'LGPL' => 'lgpl', 1, - 'BSD' => 'bsd', 1, - 'Artistic' => 'artistic', 1, - 'MIT' => 'mit', 1, - 'proprietary' => 'proprietary', 0, - ); - while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) { - $pattern =~ s{\s+}{\\s+}g; - if ( $license_text =~ /\b$pattern\b/i ) { - if ( $osi and $license_text =~ /All rights reserved/i ) { - warn "LEGAL WARNING: 'All rights reserved' may invalidate Open Source licenses. Consider removing it."; + my $self = shift; + if ( + Module::Install::_read($_[0]) =~ m/ + ( + =head \d \s+ + (?:licen[cs]e|licensing|copyright|legal)\b + .*? + ) + (=head\\d.*|=cut.*|) + \z + /ixms ) { + my $license_text = $1; + my @phrases = ( + 'under the same (?:terms|license) as perl itself' => 'perl', 1, + 'GNU public license' => 'gpl', 1, + 'GNU lesser public license' => 'lgpl', 1, + 'BSD license' => 'bsd', 1, + 'Artistic license' => 'artistic', 1, + 'GPL' => 'gpl', 1, + 'LGPL' => 'lgpl', 1, + 'BSD' => 'bsd', 1, + 'Artistic' => 'artistic', 1, + 'MIT' => 'mit', 1, + 'proprietary' => 'proprietary', 0, + ); + while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) { + $pattern =~ s{\s+}{\\s+}g; + if ( $license_text =~ /\b$pattern\b/i ) { + if ( $osi and $license_text =~ /All rights reserved/i ) { + warn "LEGAL WARNING: 'All rights reserved' may invalidate Open Source licenses. Consider removing it."; + } + $self->license($license); + return 1; + } } - $self->license($license); - return 1; - } - } - } + } + + warn "Cannot determine license info from $_[0]\n"; + return 'unknown'; +} - warn "Cannot determine license info from $file\n"; - return 'unknown'; +sub install_script { + my $self = shift; + my $args = $self->makemaker_args; + my $exe = $args->{EXE_FILES} ||= []; + foreach ( @_ ) { + if ( -f $_ ) { + push @$exe, $_; + } elsif ( -d 'script' and -f "script/$_" ) { + push @$exe, "script/$_"; + } else { + die "Cannot find script '$_'"; + } + } } 1; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/AutoInstall.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/AutoInstall.pm 2008/02/21 00:14:33 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/AutoInstall.pm 2008/05/07 18:15:19 1.2 @@ -6,7 +6,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.68'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Share.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Share.pm 2008/02/22 16:40:30 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Share.pm 2008/05/07 18:15:19 1.2 @@ -6,7 +6,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } @@ -31,10 +31,13 @@ # So when we need to install a share directory, make sure we add a # dependency on a moderately new version of ExtUtils::MakeMaker. $self->build_requires( 'ExtUtils::MakeMaker' => '6.11' ); + + # 99% of the time we don't want to index a shared dir + $self->no_index( directory => $dir ); } 1; __END__ -#line 98 +#line 101 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Win32.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Win32.pm 2008/02/21 00:14:33 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Win32.pm 2008/05/07 18:15:19 1.2 @@ -4,11 +4,11 @@ use strict; use Module::Install::Base; -use vars qw{$VERSION $ISCORE @ISA}; +use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '0.68'; - $ISCORE = 1; + $VERSION = '0.72'; @ISA = qw{Module::Install::Base}; + $ISCORE = 1; } # determine if the user needs nmake, and download it if needed @@ -16,7 +16,7 @@ my $self = shift; $self->load('can_run'); $self->load('get_file'); - + require Config; return unless ( $^O eq 'MSWin32' and @@ -38,8 +38,7 @@ remove => 1, ); - if (!$rv) { - die <<'END_MESSAGE'; + die <<'END_MESSAGE' unless $rv; ------------------------------------------------------------------------------- @@ -59,7 +58,7 @@ ------------------------------------------------------------------------------- END_MESSAGE - } + } 1; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Include.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Include.pm 2008/02/21 00:14:33 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Include.pm 2008/05/07 18:15:19 1.2 @@ -6,7 +6,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.68'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Base.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Base.pm 2008/02/21 00:14:33 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Base.pm 2008/05/07 18:15:19 1.2 @@ -1,7 +1,7 @@ #line 1 package Module::Install::Base; -$VERSION = '0.68'; +$VERSION = '0.72'; # Suspend handler for "redefined" warnings BEGIN { =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/WriteAll.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/WriteAll.pm 2008/02/21 00:14:33 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/WriteAll.pm 2008/05/07 18:15:19 1.2 @@ -4,40 +4,37 @@ use strict; use Module::Install::Base; -use vars qw{$VERSION $ISCORE @ISA}; +use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '0.68'; - $ISCORE = 1; + $VERSION = '0.72'; @ISA = qw{Module::Install::Base}; + $ISCORE = 1; } sub WriteAll { - my $self = shift; - my %args = ( - meta => 1, - sign => 0, - inline => 0, - check_nmake => 1, - @_ - ); - - $self->sign(1) if $args{sign}; - $self->Meta->write if $args{meta}; - $self->admin->WriteAll(%args) if $self->is_admin; - - if ( $0 =~ /Build.PL$/i ) { - $self->Build->write; - } else { - $self->check_nmake if $args{check_nmake}; - unless ( $self->makemaker_args->{'PL_FILES'} ) { - $self->makemaker_args( PL_FILES => {} ); - } - if ($args{inline}) { - $self->Inline->write; - } else { - $self->Makefile->write; - } - } + my $self = shift; + my %args = ( + meta => 1, + sign => 0, + inline => 0, + check_nmake => 1, + @_, + ); + + $self->sign(1) if $args{sign}; + $self->Meta->write if $args{meta}; + $self->admin->WriteAll(%args) if $self->is_admin; + + $self->check_nmake if $args{check_nmake}; + unless ( $self->makemaker_args->{PL_FILES} ) { + $self->makemaker_args( PL_FILES => {} ); + } + + if ( $args{inline} ) { + $self->Inline->write; + } else { + $self->Makefile->write; + } } 1; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Fetch.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Fetch.pm 2008/02/21 00:14:33 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Fetch.pm 2008/05/07 18:15:19 1.2 @@ -6,7 +6,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.68'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Can.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Can.pm 2008/02/21 00:14:33 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Can.pm 2008/05/07 18:15:19 1.2 @@ -11,7 +11,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.68'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Makefile.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Makefile.pm 2008/02/21 00:14:33 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/Makefile.pm 2008/05/07 18:15:19 1.2 @@ -7,7 +7,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.68'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } @@ -37,7 +37,7 @@ sub makemaker_args { my $self = shift; my $args = ($self->{makemaker_args} ||= {}); - %$args = ( %$args, @_ ) if @_; + %$args = ( %$args, @_ ) if @_; $args; } @@ -63,18 +63,18 @@ sub clean_files { my $self = shift; my $clean = $self->makemaker_args->{clean} ||= {}; - %$clean = ( + %$clean = ( %$clean, - FILES => join(' ', grep length, $clean->{FILES}, @_), + FILES => join ' ', grep { length $_ } ($clean->{FILES} || (), @_), ); } sub realclean_files { - my $self = shift; + my $self = shift; my $realclean = $self->makemaker_args->{realclean} ||= {}; - %$realclean = ( + %$realclean = ( %$realclean, - FILES => join(' ', grep length, $realclean->{FILES}, @_), + FILES => join ' ', grep { length $_ } ($realclean->{FILES} || (), @_), ); } @@ -104,8 +104,8 @@ unless ( -d $dir ) { die "tests_recursive dir '$dir' does not exist"; } - require File::Find; %test_dir = (); + require File::Find; File::Find::find( \&_wanted_t, $dir ); $self->tests( join ' ', map { "$_/*.t" } sort keys %test_dir ); } @@ -114,10 +114,15 @@ my $self = shift; die "&Makefile->write() takes no arguments\n" if @_; + # Make sure we have a new enough + require ExtUtils::MakeMaker; + $self->configure_requires( 'ExtUtils::MakeMaker' => $ExtUtils::MakeMaker::VERSION ); + + # Generate the my $args = $self->makemaker_args; $args->{DISTNAME} = $self->name; - $args->{NAME} = $self->module_name || $self->name || $self->determine_NAME($args); - $args->{VERSION} = $self->version || $self->determine_VERSION($args); + $args->{NAME} = $self->module_name || $self->name; + $args->{VERSION} = $self->version; $args->{NAME} =~ s/-/::/g; if ( $self->tests ) { $args->{test} = { TESTS => $self->tests }; @@ -142,9 +147,12 @@ map { @$_ } map { @$_ } grep $_, - ($self->build_requires, $self->requires) + ($self->configure_requires, $self->build_requires, $self->requires) ); + # Remove any reference to perl, PREREQ_PM doesn't support it + delete $args->{PREREQ_PM}->{perl}; + # merge both kinds of requires into prereq_pm my $subdirs = ($args->{DIR} ||= []); if ($self->bundles) { @@ -205,7 +213,7 @@ #$makefile =~ s/^PERL_ARCHLIB = .+/PERL_ARCHLIB =/m; # Perl 5.005 mentions PERL_LIB explicitly, so we have to remove that as well. - $makefile =~ s/("?)-I\$\(PERL_LIB\)\1//g; + $makefile =~ s/(\"?)-I\$\(PERL_LIB\)\1//g; # XXX - This is currently unused; not sure if it breaks other MM-users # $makefile =~ s/^pm_to_blib\s+:\s+/pm_to_blib :: /mg; @@ -234,4 +242,4 @@ __END__ -#line 363 +#line 371 rcsdiff: /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install/RCS/Scripts.pm,v: No such file or directory From kawas at dev.open-bio.org Wed May 7 18:15:19 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 May 2008 14:15:19 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805071815.m47IFJ7J009618@dev.open-bio.org> kawas Wed May 7 14:15:19 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module In directory dev.open-bio.org:/tmp/cvs-serv9526/Perl/MOBY-Client/inc/Module Modified Files: Install.pm Log Message: updated the Module::Install libraries to version 0.72 moby-live/Perl/MOBY-Client/inc/Module Install.pm,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install.pm 2008/02/21 00:14:33 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/inc/Module/Install.pm 2008/05/07 18:15:19 1.2 @@ -17,20 +17,30 @@ # 3. The ./inc/ version of Module::Install loads # } -use 5.004; +BEGIN { + require 5.004; +} use strict 'vars'; use vars qw{$VERSION}; BEGIN { - # All Module::Install core packages now require synchronised versions. - # This will be used to ensure we don't accidentally load old or - # different versions of modules. - # This is not enforced yet, but will be some time in the next few - # releases once we can make sure it won't clash with custom - # Module::Install extensions. - $VERSION = '0.68'; + # All Module::Install core packages now require synchronised versions. + # This will be used to ensure we don't accidentally load old or + # different versions of modules. + # This is not enforced yet, but will be some time in the next few + # releases once we can make sure it won't clash with custom + # Module::Install extensions. + $VERSION = '0.72'; + + *inc::Module::Install::VERSION = *VERSION; + @inc::Module::Install::ISA = __PACKAGE__; + } + + + + # Whether or not inc::Module::Install is actually loaded, the # $INC{inc/Module/Install.pm} is what will still get set as long as # the caller loaded module this in the documented manner. @@ -38,26 +48,29 @@ # they may not have a MI version that works with the Makefile.PL. This would # result in false errors or unexpected behaviour. And we don't want that. my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm'; -unless ( $INC{$file} ) { - die <<"END_DIE"; +unless ( $INC{$file} ) { die <<"END_DIE" } + Please invoke ${\__PACKAGE__} with: - use inc::${\__PACKAGE__}; + use inc::${\__PACKAGE__}; not: - use ${\__PACKAGE__}; + use ${\__PACKAGE__}; END_DIE -} + + + + # If the script that is loading Module::Install is from the future, # then make will detect this and cause it to re-run over and over # again. This is bad. Rather than taking action to touch it (which # is unreliable on some platforms and requires write permissions) # for now we should catch this and refuse to run. -if ( -f $0 and (stat($0))[9] > time ) { - die << "END_DIE"; +if ( -f $0 and (stat($0))[9] > time ) { die <<"END_DIE" } + Your installer $0 has a modification time in the future. This is known to create infinite loops in make. @@ -65,115 +78,142 @@ Please correct this, then run $0 again. END_DIE -} + + + + + +# Build.PL was formerly supported, but no longer is due to excessive +# difficulty in implementing every single feature twice. +if ( $0 =~ /Build.PL$/i or -f 'Build.PL' ) { die <<"END_DIE" } + +Module::Install no longer supports Build.PL. + +It was impossible to maintain duel backends, and has been deprecated. + +Please remove all Build.PL files and only use the Makefile.PL installer. + +END_DIE + + + + + +# To save some more typing in Module::Install installers, every... +# use inc::Module::Install +# ...also acts as an implicit use strict. +$^H |= strict::bits(qw(refs subs vars)); + + + + use Cwd (); use File::Find (); use File::Path (); use FindBin; -*inc::Module::Install::VERSION = *VERSION; - at inc::Module::Install::ISA = __PACKAGE__; - sub autoload { - my $self = shift; - my $who = $self->_caller; - my $cwd = Cwd::cwd(); - my $sym = "${who}::AUTOLOAD"; - $sym->{$cwd} = sub { - my $pwd = Cwd::cwd(); - if ( my $code = $sym->{$pwd} ) { - # delegate back to parent dirs - goto &$code unless $cwd eq $pwd; - } - $$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym"; - unshift @_, ($self, $1); - goto &{$self->can('call')} unless uc($1) eq $1; - }; + my $self = shift; + my $who = $self->_caller; + my $cwd = Cwd::cwd(); + my $sym = "${who}::AUTOLOAD"; + $sym->{$cwd} = sub { + my $pwd = Cwd::cwd(); + if ( my $code = $sym->{$pwd} ) { + # delegate back to parent dirs + goto &$code unless $cwd eq $pwd; + } + $$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym"; + unshift @_, ( $self, $1 ); + goto &{$self->can('call')} unless uc($1) eq $1; + }; } sub import { - my $class = shift; - my $self = $class->new(@_); - my $who = $self->_caller; - - unless ( -f $self->{file} ) { - require "$self->{path}/$self->{dispatch}.pm"; - File::Path::mkpath("$self->{prefix}/$self->{author}"); - $self->{admin} = "$self->{name}::$self->{dispatch}"->new( _top => $self ); - $self->{admin}->init; - @_ = ($class, _self => $self); - goto &{"$self->{name}::import"}; - } - - *{"${who}::AUTOLOAD"} = $self->autoload; - $self->preload; - - # Unregister loader and worker packages so subdirs can use them again - delete $INC{"$self->{file}"}; - delete $INC{"$self->{path}.pm"}; + my $class = shift; + my $self = $class->new(@_); + my $who = $self->_caller; + + unless ( -f $self->{file} ) { + require "$self->{path}/$self->{dispatch}.pm"; + File::Path::mkpath("$self->{prefix}/$self->{author}"); + $self->{admin} = "$self->{name}::$self->{dispatch}"->new( _top => $self ); + $self->{admin}->init; + @_ = ($class, _self => $self); + goto &{"$self->{name}::import"}; + } + + *{"${who}::AUTOLOAD"} = $self->autoload; + $self->preload; + + # Unregister loader and worker packages so subdirs can use them again + delete $INC{"$self->{file}"}; + delete $INC{"$self->{path}.pm"}; + + return 1; } sub preload { - my ($self) = @_; - - unless ( $self->{extensions} ) { - $self->load_extensions( - "$self->{prefix}/$self->{path}", $self - ); - } - - my @exts = @{$self->{extensions}}; - unless ( @exts ) { - my $admin = $self->{admin}; - @exts = $admin->load_all_extensions; - } - - my %seen; - foreach my $obj ( @exts ) { - while (my ($method, $glob) = each %{ref($obj) . '::'}) { - next unless $obj->can($method); - next if $method =~ /^_/; - next if $method eq uc($method); - $seen{$method}++; - } - } - - my $who = $self->_caller; - foreach my $name ( sort keys %seen ) { - *{"${who}::$name"} = sub { - ${"${who}::AUTOLOAD"} = "${who}::$name"; - goto &{"${who}::AUTOLOAD"}; - }; - } + my $self = shift; + unless ( $self->{extensions} ) { + $self->load_extensions( + "$self->{prefix}/$self->{path}", $self + ); + } + + my @exts = @{$self->{extensions}}; + unless ( @exts ) { + my $admin = $self->{admin}; + @exts = $admin->load_all_extensions; + } + + my %seen; + foreach my $obj ( @exts ) { + while (my ($method, $glob) = each %{ref($obj) . '::'}) { + next unless $obj->can($method); + next if $method =~ /^_/; + next if $method eq uc($method); + $seen{$method}++; + } + } + + my $who = $self->_caller; + foreach my $name ( sort keys %seen ) { + *{"${who}::$name"} = sub { + ${"${who}::AUTOLOAD"} = "${who}::$name"; + goto &{"${who}::AUTOLOAD"}; + }; + } } sub new { - my ($class, %args) = @_; + my ($class, %args) = @_; - # ignore the prefix on extension modules built from top level. - my $base_path = Cwd::abs_path($FindBin::Bin); - unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) { - delete $args{prefix}; - } - - return $args{_self} if $args{_self}; - - $args{dispatch} ||= 'Admin'; - $args{prefix} ||= 'inc'; - $args{author} ||= ($^O eq 'VMS' ? '_author' : '.author'); - $args{bundle} ||= 'inc/BUNDLES'; - $args{base} ||= $base_path; - $class =~ s/^\Q$args{prefix}\E:://; - $args{name} ||= $class; - $args{version} ||= $class->VERSION; - unless ( $args{path} ) { - $args{path} = $args{name}; - $args{path} =~ s!::!/!g; - } - $args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm"; + # ignore the prefix on extension modules built from top level. + my $base_path = Cwd::abs_path($FindBin::Bin); + unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) { + delete $args{prefix}; + } + + return $args{_self} if $args{_self}; + + $args{dispatch} ||= 'Admin'; + $args{prefix} ||= 'inc'; + $args{author} ||= ($^O eq 'VMS' ? '_author' : '.author'); + $args{bundle} ||= 'inc/BUNDLES'; + $args{base} ||= $base_path; + $class =~ s/^\Q$args{prefix}\E:://; + $args{name} ||= $class; + $args{version} ||= $class->VERSION; + unless ( $args{path} ) { + $args{path} = $args{name}; + $args{path} =~ s!::!/!g; + } + $args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm"; + $args{wrote} = 0; - bless( \%args, $class ); + bless( \%args, $class ); } sub call { @@ -184,98 +224,130 @@ } sub load { - my ($self, $method) = @_; - - $self->load_extensions( - "$self->{prefix}/$self->{path}", $self - ) unless $self->{extensions}; + my ($self, $method) = @_; - foreach my $obj (@{$self->{extensions}}) { - return $obj if $obj->can($method); - } + $self->load_extensions( + "$self->{prefix}/$self->{path}", $self + ) unless $self->{extensions}; + + foreach my $obj (@{$self->{extensions}}) { + return $obj if $obj->can($method); + } - my $admin = $self->{admin} or die <<"END_DIE"; + my $admin = $self->{admin} or die <<"END_DIE"; The '$method' method does not exist in the '$self->{prefix}' path! Please remove the '$self->{prefix}' directory and run $0 again to load it. END_DIE - my $obj = $admin->load($method, 1); - push @{$self->{extensions}}, $obj; + my $obj = $admin->load($method, 1); + push @{$self->{extensions}}, $obj; - $obj; + $obj; } sub load_extensions { - my ($self, $path, $top) = @_; + my ($self, $path, $top) = @_; - unless ( grep { lc $_ eq lc $self->{prefix} } @INC ) { - unshift @INC, $self->{prefix}; - } - - foreach my $rv ( $self->find_extensions($path) ) { - my ($file, $pkg) = @{$rv}; - next if $self->{pathnames}{$pkg}; - - local $@; - my $new = eval { require $file; $pkg->can('new') }; - unless ( $new ) { - warn $@ if $@; - next; - } - $self->{pathnames}{$pkg} = delete $INC{$file}; - push @{$self->{extensions}}, &{$new}($pkg, _top => $top ); - } + unless ( grep { lc $_ eq lc $self->{prefix} } @INC ) { + unshift @INC, $self->{prefix}; + } + + foreach my $rv ( $self->find_extensions($path) ) { + my ($file, $pkg) = @{$rv}; + next if $self->{pathnames}{$pkg}; + + local $@; + my $new = eval { require $file; $pkg->can('new') }; + unless ( $new ) { + warn $@ if $@; + next; + } + $self->{pathnames}{$pkg} = delete $INC{$file}; + push @{$self->{extensions}}, &{$new}($pkg, _top => $top ); + } - $self->{extensions} ||= []; + $self->{extensions} ||= []; } sub find_extensions { - my ($self, $path) = @_; + my ($self, $path) = @_; + + my @found; + File::Find::find( sub { + my $file = $File::Find::name; + return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is; + my $subpath = $1; + return if lc($subpath) eq lc($self->{dispatch}); + + $file = "$self->{path}/$subpath.pm"; + my $pkg = "$self->{name}::$subpath"; + $pkg =~ s!/!::!g; - my @found; - File::Find::find( sub { - my $file = $File::Find::name; - return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is; - my $subpath = $1; - return if lc($subpath) eq lc($self->{dispatch}); - - $file = "$self->{path}/$subpath.pm"; - my $pkg = "$self->{name}::$subpath"; - $pkg =~ s!/!::!g; - - # If we have a mixed-case package name, assume case has been preserved - # correctly. Otherwise, root through the file to locate the case-preserved - # version of the package name. - if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) { - open PKGFILE, "<$subpath.pm" or die "find_extensions: Can't open $subpath.pm: $!"; - my $in_pod = 0; - while ( ) { - $in_pod = 1 if /^=\w/; - $in_pod = 0 if /^=cut/; - next if ($in_pod || /^=cut/); # skip pod text - next if /^\s*#/; # and comments - if ( m/^\s*package\s+($pkg)\s*;/i ) { - $pkg = $1; - last; - } - } - close PKGFILE; - } + # If we have a mixed-case package name, assume case has been preserved + # correctly. Otherwise, root through the file to locate the case-preserved + # version of the package name. + if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) { + my $content = Module::Install::_read($subpath . '.pm'); + my $in_pod = 0; + foreach ( split //, $content ) { + $in_pod = 1 if /^=\w/; + $in_pod = 0 if /^=cut/; + next if ($in_pod || /^=cut/); # skip pod text + next if /^\s*#/; # and comments + if ( m/^\s*package\s+($pkg)\s*;/i ) { + $pkg = $1; + last; + } + } + } - push @found, [ $file, $pkg ]; - }, $path ) if -d $path; + push @found, [ $file, $pkg ]; + }, $path ) if -d $path; - @found; + @found; } + + + + +##################################################################### +# Utility Functions + sub _caller { - my $depth = 0; - my $call = caller($depth); - while ( $call eq __PACKAGE__ ) { - $depth++; - $call = caller($depth); - } - return $call; + my $depth = 0; + my $call = caller($depth); + while ( $call eq __PACKAGE__ ) { + $depth++; + $call = caller($depth); + } + return $call; +} + +sub _read { + local *FH; + open FH, "< $_[0]" or die "open($_[0]): $!"; + my $str = do { local $/; }; + close FH or die "close($_[0]): $!"; + return $str; +} + +sub _write { + local *FH; + open FH, "> $_[0]" or die "open($_[0]): $!"; + foreach ( 1 .. $#_ ) { print FH $_[$_] or die "print($_[0]): $!" } + close FH or die "close($_[0]): $!"; +} + +sub _version { + my $s = shift || 0; + $s =~ s/^(\d+)\.?//; + my $l = $1 || 0; + my @v = map { $_ . '0' x (3 - length $_) } $s =~ /(\d{1,3})\D?/g; + $l = $l . '.' . join '', @v if @v; + return $l + 0; } 1; + +# Copyright 2008 Adam Kennedy. From kawas at dev.open-bio.org Wed May 7 18:16:52 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 May 2008 14:16:52 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805071816.m47IGqir009696@dev.open-bio.org> kawas Wed May 7 14:16:52 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module In directory dev.open-bio.org:/tmp/cvs-serv9661/Perl/MOBY-Server/inc/Module Modified Files: Install.pm Log Message: updated the Module::Install libraries to version 0.72 moby-live/Perl/MOBY-Server/inc/Module Install.pm,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install.pm 2008/02/21 00:21:28 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install.pm 2008/05/07 18:16:52 1.2 @@ -17,20 +17,30 @@ # 3. The ./inc/ version of Module::Install loads # } -use 5.004; +BEGIN { + require 5.004; +} use strict 'vars'; use vars qw{$VERSION}; BEGIN { - # All Module::Install core packages now require synchronised versions. - # This will be used to ensure we don't accidentally load old or - # different versions of modules. - # This is not enforced yet, but will be some time in the next few - # releases once we can make sure it won't clash with custom - # Module::Install extensions. - $VERSION = '0.67'; + # All Module::Install core packages now require synchronised versions. + # This will be used to ensure we don't accidentally load old or + # different versions of modules. + # This is not enforced yet, but will be some time in the next few + # releases once we can make sure it won't clash with custom + # Module::Install extensions. + $VERSION = '0.72'; + + *inc::Module::Install::VERSION = *VERSION; + @inc::Module::Install::ISA = __PACKAGE__; + } + + + + # Whether or not inc::Module::Install is actually loaded, the # $INC{inc/Module/Install.pm} is what will still get set as long as # the caller loaded module this in the documented manner. @@ -38,26 +48,29 @@ # they may not have a MI version that works with the Makefile.PL. This would # result in false errors or unexpected behaviour. And we don't want that. my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm'; -unless ( $INC{$file} ) { - die <<"END_DIE"; +unless ( $INC{$file} ) { die <<"END_DIE" } + Please invoke ${\__PACKAGE__} with: - use inc::${\__PACKAGE__}; + use inc::${\__PACKAGE__}; not: - use ${\__PACKAGE__}; + use ${\__PACKAGE__}; END_DIE -} + + + + # If the script that is loading Module::Install is from the future, # then make will detect this and cause it to re-run over and over # again. This is bad. Rather than taking action to touch it (which # is unreliable on some platforms and requires write permissions) # for now we should catch this and refuse to run. -if ( -f $0 and (stat($0))[9] > time ) { - die << "END_DIE"; +if ( -f $0 and (stat($0))[9] > time ) { die <<"END_DIE" } + Your installer $0 has a modification time in the future. This is known to create infinite loops in make. @@ -65,115 +78,142 @@ Please correct this, then run $0 again. END_DIE -} + + + + + +# Build.PL was formerly supported, but no longer is due to excessive +# difficulty in implementing every single feature twice. +if ( $0 =~ /Build.PL$/i or -f 'Build.PL' ) { die <<"END_DIE" } + +Module::Install no longer supports Build.PL. + +It was impossible to maintain duel backends, and has been deprecated. + +Please remove all Build.PL files and only use the Makefile.PL installer. + +END_DIE + + + + + +# To save some more typing in Module::Install installers, every... +# use inc::Module::Install +# ...also acts as an implicit use strict. +$^H |= strict::bits(qw(refs subs vars)); + + + + use Cwd (); use File::Find (); use File::Path (); use FindBin; -*inc::Module::Install::VERSION = *VERSION; - at inc::Module::Install::ISA = __PACKAGE__; - sub autoload { - my $self = shift; - my $who = $self->_caller; - my $cwd = Cwd::cwd(); - my $sym = "${who}::AUTOLOAD"; - $sym->{$cwd} = sub { - my $pwd = Cwd::cwd(); - if ( my $code = $sym->{$pwd} ) { - # delegate back to parent dirs - goto &$code unless $cwd eq $pwd; - } - $$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym"; - unshift @_, ($self, $1); - goto &{$self->can('call')} unless uc($1) eq $1; - }; + my $self = shift; + my $who = $self->_caller; + my $cwd = Cwd::cwd(); + my $sym = "${who}::AUTOLOAD"; + $sym->{$cwd} = sub { + my $pwd = Cwd::cwd(); + if ( my $code = $sym->{$pwd} ) { + # delegate back to parent dirs + goto &$code unless $cwd eq $pwd; + } + $$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym"; + unshift @_, ( $self, $1 ); + goto &{$self->can('call')} unless uc($1) eq $1; + }; } sub import { - my $class = shift; - my $self = $class->new(@_); - my $who = $self->_caller; - - unless ( -f $self->{file} ) { - require "$self->{path}/$self->{dispatch}.pm"; - File::Path::mkpath("$self->{prefix}/$self->{author}"); - $self->{admin} = "$self->{name}::$self->{dispatch}"->new( _top => $self ); - $self->{admin}->init; - @_ = ($class, _self => $self); - goto &{"$self->{name}::import"}; - } - - *{"${who}::AUTOLOAD"} = $self->autoload; - $self->preload; - - # Unregister loader and worker packages so subdirs can use them again - delete $INC{"$self->{file}"}; - delete $INC{"$self->{path}.pm"}; + my $class = shift; + my $self = $class->new(@_); + my $who = $self->_caller; + + unless ( -f $self->{file} ) { + require "$self->{path}/$self->{dispatch}.pm"; + File::Path::mkpath("$self->{prefix}/$self->{author}"); + $self->{admin} = "$self->{name}::$self->{dispatch}"->new( _top => $self ); + $self->{admin}->init; + @_ = ($class, _self => $self); + goto &{"$self->{name}::import"}; + } + + *{"${who}::AUTOLOAD"} = $self->autoload; + $self->preload; + + # Unregister loader and worker packages so subdirs can use them again + delete $INC{"$self->{file}"}; + delete $INC{"$self->{path}.pm"}; + + return 1; } sub preload { - my ($self) = @_; - - unless ( $self->{extensions} ) { - $self->load_extensions( - "$self->{prefix}/$self->{path}", $self - ); - } - - my @exts = @{$self->{extensions}}; - unless ( @exts ) { - my $admin = $self->{admin}; - @exts = $admin->load_all_extensions; - } - - my %seen; - foreach my $obj ( @exts ) { - while (my ($method, $glob) = each %{ref($obj) . '::'}) { - next unless $obj->can($method); - next if $method =~ /^_/; - next if $method eq uc($method); - $seen{$method}++; - } - } - - my $who = $self->_caller; - foreach my $name ( sort keys %seen ) { - *{"${who}::$name"} = sub { - ${"${who}::AUTOLOAD"} = "${who}::$name"; - goto &{"${who}::AUTOLOAD"}; - }; - } + my $self = shift; + unless ( $self->{extensions} ) { + $self->load_extensions( + "$self->{prefix}/$self->{path}", $self + ); + } + + my @exts = @{$self->{extensions}}; + unless ( @exts ) { + my $admin = $self->{admin}; + @exts = $admin->load_all_extensions; + } + + my %seen; + foreach my $obj ( @exts ) { + while (my ($method, $glob) = each %{ref($obj) . '::'}) { + next unless $obj->can($method); + next if $method =~ /^_/; + next if $method eq uc($method); + $seen{$method}++; + } + } + + my $who = $self->_caller; + foreach my $name ( sort keys %seen ) { + *{"${who}::$name"} = sub { + ${"${who}::AUTOLOAD"} = "${who}::$name"; + goto &{"${who}::AUTOLOAD"}; + }; + } } sub new { - my ($class, %args) = @_; + my ($class, %args) = @_; - # ignore the prefix on extension modules built from top level. - my $base_path = Cwd::abs_path($FindBin::Bin); - unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) { - delete $args{prefix}; - } - - return $args{_self} if $args{_self}; - - $args{dispatch} ||= 'Admin'; - $args{prefix} ||= 'inc'; - $args{author} ||= ($^O eq 'VMS' ? '_author' : '.author'); - $args{bundle} ||= 'inc/BUNDLES'; - $args{base} ||= $base_path; - $class =~ s/^\Q$args{prefix}\E:://; - $args{name} ||= $class; - $args{version} ||= $class->VERSION; - unless ( $args{path} ) { - $args{path} = $args{name}; - $args{path} =~ s!::!/!g; - } - $args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm"; + # ignore the prefix on extension modules built from top level. + my $base_path = Cwd::abs_path($FindBin::Bin); + unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) { + delete $args{prefix}; + } + + return $args{_self} if $args{_self}; + + $args{dispatch} ||= 'Admin'; + $args{prefix} ||= 'inc'; + $args{author} ||= ($^O eq 'VMS' ? '_author' : '.author'); + $args{bundle} ||= 'inc/BUNDLES'; + $args{base} ||= $base_path; + $class =~ s/^\Q$args{prefix}\E:://; + $args{name} ||= $class; + $args{version} ||= $class->VERSION; + unless ( $args{path} ) { + $args{path} = $args{name}; + $args{path} =~ s!::!/!g; + } + $args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm"; + $args{wrote} = 0; - bless( \%args, $class ); + bless( \%args, $class ); } sub call { @@ -184,98 +224,130 @@ } sub load { - my ($self, $method) = @_; - - $self->load_extensions( - "$self->{prefix}/$self->{path}", $self - ) unless $self->{extensions}; + my ($self, $method) = @_; - foreach my $obj (@{$self->{extensions}}) { - return $obj if $obj->can($method); - } + $self->load_extensions( + "$self->{prefix}/$self->{path}", $self + ) unless $self->{extensions}; + + foreach my $obj (@{$self->{extensions}}) { + return $obj if $obj->can($method); + } - my $admin = $self->{admin} or die <<"END_DIE"; + my $admin = $self->{admin} or die <<"END_DIE"; The '$method' method does not exist in the '$self->{prefix}' path! Please remove the '$self->{prefix}' directory and run $0 again to load it. END_DIE - my $obj = $admin->load($method, 1); - push @{$self->{extensions}}, $obj; + my $obj = $admin->load($method, 1); + push @{$self->{extensions}}, $obj; - $obj; + $obj; } sub load_extensions { - my ($self, $path, $top) = @_; + my ($self, $path, $top) = @_; - unless ( grep { lc $_ eq lc $self->{prefix} } @INC ) { - unshift @INC, $self->{prefix}; - } - - foreach my $rv ( $self->find_extensions($path) ) { - my ($file, $pkg) = @{$rv}; - next if $self->{pathnames}{$pkg}; - - local $@; - my $new = eval { require $file; $pkg->can('new') }; - unless ( $new ) { - warn $@ if $@; - next; - } - $self->{pathnames}{$pkg} = delete $INC{$file}; - push @{$self->{extensions}}, &{$new}($pkg, _top => $top ); - } + unless ( grep { lc $_ eq lc $self->{prefix} } @INC ) { + unshift @INC, $self->{prefix}; + } + + foreach my $rv ( $self->find_extensions($path) ) { + my ($file, $pkg) = @{$rv}; + next if $self->{pathnames}{$pkg}; + + local $@; + my $new = eval { require $file; $pkg->can('new') }; + unless ( $new ) { + warn $@ if $@; + next; + } + $self->{pathnames}{$pkg} = delete $INC{$file}; + push @{$self->{extensions}}, &{$new}($pkg, _top => $top ); + } - $self->{extensions} ||= []; + $self->{extensions} ||= []; } sub find_extensions { - my ($self, $path) = @_; + my ($self, $path) = @_; + + my @found; + File::Find::find( sub { + my $file = $File::Find::name; + return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is; + my $subpath = $1; + return if lc($subpath) eq lc($self->{dispatch}); + + $file = "$self->{path}/$subpath.pm"; + my $pkg = "$self->{name}::$subpath"; + $pkg =~ s!/!::!g; - my @found; - File::Find::find( sub { - my $file = $File::Find::name; - return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is; - my $subpath = $1; - return if lc($subpath) eq lc($self->{dispatch}); - - $file = "$self->{path}/$subpath.pm"; - my $pkg = "$self->{name}::$subpath"; - $pkg =~ s!/!::!g; - - # If we have a mixed-case package name, assume case has been preserved - # correctly. Otherwise, root through the file to locate the case-preserved - # version of the package name. - if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) { - open PKGFILE, "<$subpath.pm" or die "find_extensions: Can't open $subpath.pm: $!"; - my $in_pod = 0; - while ( ) { - $in_pod = 1 if /^=\w/; - $in_pod = 0 if /^=cut/; - next if ($in_pod || /^=cut/); # skip pod text - next if /^\s*#/; # and comments - if ( m/^\s*package\s+($pkg)\s*;/i ) { - $pkg = $1; - last; - } - } - close PKGFILE; - } + # If we have a mixed-case package name, assume case has been preserved + # correctly. Otherwise, root through the file to locate the case-preserved + # version of the package name. + if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) { + my $content = Module::Install::_read($subpath . '.pm'); + my $in_pod = 0; + foreach ( split //, $content ) { + $in_pod = 1 if /^=\w/; + $in_pod = 0 if /^=cut/; + next if ($in_pod || /^=cut/); # skip pod text + next if /^\s*#/; # and comments + if ( m/^\s*package\s+($pkg)\s*;/i ) { + $pkg = $1; + last; + } + } + } - push @found, [ $file, $pkg ]; - }, $path ) if -d $path; + push @found, [ $file, $pkg ]; + }, $path ) if -d $path; - @found; + @found; } + + + + +##################################################################### +# Utility Functions + sub _caller { - my $depth = 0; - my $call = caller($depth); - while ( $call eq __PACKAGE__ ) { - $depth++; - $call = caller($depth); - } - return $call; + my $depth = 0; + my $call = caller($depth); + while ( $call eq __PACKAGE__ ) { + $depth++; + $call = caller($depth); + } + return $call; +} + +sub _read { + local *FH; + open FH, "< $_[0]" or die "open($_[0]): $!"; + my $str = do { local $/; }; + close FH or die "close($_[0]): $!"; + return $str; +} + +sub _write { + local *FH; + open FH, "> $_[0]" or die "open($_[0]): $!"; + foreach ( 1 .. $#_ ) { print FH $_[$_] or die "print($_[0]): $!" } + close FH or die "close($_[0]): $!"; +} + +sub _version { + my $s = shift || 0; + $s =~ s/^(\d+)\.?//; + my $l = $1 || 0; + my @v = map { $_ . '0' x (3 - length $_) } $s =~ /(\d{1,3})\D?/g; + $l = $l . '.' . join '', @v if @v; + return $l + 0; } 1; + +# Copyright 2008 Adam Kennedy. From kawas at dev.open-bio.org Wed May 7 18:16:53 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 May 2008 14:16:53 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805071816.m47IGrGf009753@dev.open-bio.org> kawas Wed May 7 14:16:52 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install In directory dev.open-bio.org:/tmp/cvs-serv9661/Perl/MOBY-Server/inc/Module/Install Modified Files: Include.pm Share.pm Base.pm Makefile.pm AutoInstall.pm Metadata.pm WriteAll.pm Win32.pm Can.pm Fetch.pm Removed Files: Scripts.pm Log Message: updated the Module::Install libraries to version 0.72 moby-live/Perl/MOBY-Server/inc/Module/Install Include.pm,1.1,1.2 Share.pm,1.1,1.2 Base.pm,1.1,1.2 Makefile.pm,1.1,1.2 AutoInstall.pm,1.1,1.2 Metadata.pm,1.1,1.2 WriteAll.pm,1.1,1.2 Win32.pm,1.1,1.2 Can.pm,1.1,1.2 Fetch.pm,1.1,1.2 Scripts.pm,1.1,NONE =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Include.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Include.pm 2008/02/21 00:21:28 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Include.pm 2008/05/07 18:16:52 1.2 @@ -6,7 +6,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Share.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Share.pm 2008/02/21 00:21:28 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Share.pm 2008/05/07 18:16:52 1.2 @@ -6,7 +6,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } @@ -31,10 +31,13 @@ # So when we need to install a share directory, make sure we add a # dependency on a moderately new version of ExtUtils::MakeMaker. $self->build_requires( 'ExtUtils::MakeMaker' => '6.11' ); + + # 99% of the time we don't want to index a shared dir + $self->no_index( directory => $dir ); } 1; __END__ -#line 98 +#line 101 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Base.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Base.pm 2008/02/21 00:21:28 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Base.pm 2008/05/07 18:16:52 1.2 @@ -1,7 +1,7 @@ #line 1 package Module::Install::Base; -$VERSION = '0.67'; +$VERSION = '0.72'; # Suspend handler for "redefined" warnings BEGIN { =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Makefile.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Makefile.pm 2008/02/21 00:21:28 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Makefile.pm 2008/05/07 18:16:52 1.2 @@ -7,7 +7,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } @@ -37,7 +37,7 @@ sub makemaker_args { my $self = shift; my $args = ($self->{makemaker_args} ||= {}); - %$args = ( %$args, @_ ) if @_; + %$args = ( %$args, @_ ) if @_; $args; } @@ -63,18 +63,18 @@ sub clean_files { my $self = shift; my $clean = $self->makemaker_args->{clean} ||= {}; - %$clean = ( + %$clean = ( %$clean, - FILES => join(' ', grep length, $clean->{FILES}, @_), + FILES => join ' ', grep { length $_ } ($clean->{FILES} || (), @_), ); } sub realclean_files { - my $self = shift; + my $self = shift; my $realclean = $self->makemaker_args->{realclean} ||= {}; - %$realclean = ( + %$realclean = ( %$realclean, - FILES => join(' ', grep length, $realclean->{FILES}, @_), + FILES => join ' ', grep { length $_ } ($realclean->{FILES} || (), @_), ); } @@ -104,8 +104,8 @@ unless ( -d $dir ) { die "tests_recursive dir '$dir' does not exist"; } - require File::Find; %test_dir = (); + require File::Find; File::Find::find( \&_wanted_t, $dir ); $self->tests( join ' ', map { "$_/*.t" } sort keys %test_dir ); } @@ -114,10 +114,15 @@ my $self = shift; die "&Makefile->write() takes no arguments\n" if @_; + # Make sure we have a new enough + require ExtUtils::MakeMaker; + $self->configure_requires( 'ExtUtils::MakeMaker' => $ExtUtils::MakeMaker::VERSION ); + + # Generate the my $args = $self->makemaker_args; $args->{DISTNAME} = $self->name; - $args->{NAME} = $self->module_name || $self->name || $self->determine_NAME($args); - $args->{VERSION} = $self->version || $self->determine_VERSION($args); + $args->{NAME} = $self->module_name || $self->name; + $args->{VERSION} = $self->version; $args->{NAME} =~ s/-/::/g; if ( $self->tests ) { $args->{test} = { TESTS => $self->tests }; @@ -142,9 +147,12 @@ map { @$_ } map { @$_ } grep $_, - ($self->build_requires, $self->requires) + ($self->configure_requires, $self->build_requires, $self->requires) ); + # Remove any reference to perl, PREREQ_PM doesn't support it + delete $args->{PREREQ_PM}->{perl}; + # merge both kinds of requires into prereq_pm my $subdirs = ($args->{DIR} ||= []); if ($self->bundles) { @@ -205,7 +213,7 @@ #$makefile =~ s/^PERL_ARCHLIB = .+/PERL_ARCHLIB =/m; # Perl 5.005 mentions PERL_LIB explicitly, so we have to remove that as well. - $makefile =~ s/("?)-I\$\(PERL_LIB\)\1//g; + $makefile =~ s/(\"?)-I\$\(PERL_LIB\)\1//g; # XXX - This is currently unused; not sure if it breaks other MM-users # $makefile =~ s/^pm_to_blib\s+:\s+/pm_to_blib :: /mg; @@ -234,4 +242,4 @@ __END__ -#line 363 +#line 371 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/AutoInstall.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/AutoInstall.pm 2008/02/21 00:21:28 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/AutoInstall.pm 2008/05/07 18:16:52 1.2 @@ -6,7 +6,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Metadata.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Metadata.pm 2008/02/21 00:21:28 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Metadata.pm 2008/05/07 18:16:52 1.2 @@ -6,18 +6,30 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } my @scalar_keys = qw{ - name module_name abstract author version license - distribution_type perl_version tests installdirs + name + module_name + abstract + author + version + license + distribution_type + perl_version + tests + installdirs }; my @tuple_keys = qw{ - build_requires requires recommends bundles + configure_requires + build_requires + requires + recommends + bundles }; sub Meta { shift } @@ -25,44 +37,68 @@ sub Meta_TupleKeys { @tuple_keys } foreach my $key (@scalar_keys) { - *$key = sub { - my $self = shift; - return $self->{values}{$key} if defined wantarray and !@_; - $self->{values}{$key} = shift; - return $self; - }; -} - -foreach my $key (@tuple_keys) { - *$key = sub { - my $self = shift; - return $self->{values}{$key} unless @_; - - my @rv; - while (@_) { - my $module = shift or last; - my $version = shift || 0; - if ( $module eq 'perl' ) { - $version =~ s{^(\d+)\.(\d+)\.(\d+)} - {$1 + $2/1_000 + $3/1_000_000}e; - $self->perl_version($version); - next; - } - my $rv = [ $module, $version ]; - push @rv, $rv; - } - push @{ $self->{values}{$key} }, @rv; - @rv; - }; + *$key = sub { + my $self = shift; + return $self->{values}{$key} if defined wantarray and !@_; + $self->{values}{$key} = shift; + return $self; + }; +} + +sub requires { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{requires} }, [ $module, $version ]; + } + $self->{values}{requires}; +} + +sub build_requires { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{build_requires} }, [ $module, $version ]; + } + $self->{values}{build_requires}; +} + +sub configure_requires { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{configure_requires} }, [ $module, $version ]; + } + $self->{values}{configure_requires}; +} + +sub recommends { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{recommends} }, [ $module, $version ]; + } + $self->{values}{recommends}; } -# configure_requires is currently a null-op -sub configure_requires { 1 } +sub bundles { + my $self = shift; + while ( @_ ) { + my $module = shift or last; + my $version = shift || 0; + push @{ $self->{values}->{bundles} }, [ $module, $version ]; + } + $self->{values}{bundles}; +} # Aliases for build_requires that will have alternative # meanings in some future version of META.yml. -sub test_requires { shift->build_requires(@_) } -sub install_requires { shift->build_requires(@_) } +sub test_requires { shift->build_requires(@_) } +sub install_requires { shift->build_requires(@_) } # Aliases for installdirs options sub install_as_core { $_[0]->installdirs('perl') } @@ -71,10 +107,10 @@ sub install_as_vendor { $_[0]->installdirs('vendor') } sub sign { - my $self = shift; - return $self->{'values'}{'sign'} if defined wantarray and ! @_; - $self->{'values'}{'sign'} = ( @_ ? $_[0] : 1 ); - return $self; + my $self = shift; + return $self->{'values'}{'sign'} if defined wantarray and ! @_; + $self->{'values'}{'sign'} = ( @_ ? $_[0] : 1 ); + return $self; } sub dynamic_config { @@ -83,254 +119,268 @@ warn "You MUST provide an explicit true/false value to dynamic_config, skipping\n"; return $self; } - $self->{'values'}{'dynamic_config'} = $_[0] ? 1 : 0; + $self->{values}{dynamic_config} = $_[0] ? 1 : 0; return $self; } sub all_from { - my ( $self, $file ) = @_; + my ( $self, $file ) = @_; + + unless ( defined($file) ) { + my $name = $self->name + or die "all_from called with no args without setting name() first"; + $file = join('/', 'lib', split(/-/, $name)) . '.pm'; + $file =~ s{.*/}{} unless -e $file; + die "all_from: cannot find $file from $name" unless -e $file; + } + + # Some methods pull from POD instead of code. + # If there is a matching .pod, use that instead + my $pod = $file; + $pod =~ s/\.pm$/.pod/i; + $pod = $file unless -e $pod; + + # Pull the different values + $self->name_from($file) unless $self->name; + $self->version_from($file) unless $self->version; + $self->perl_version_from($file) unless $self->perl_version; + $self->author_from($pod) unless $self->author; + $self->license_from($pod) unless $self->license; + $self->abstract_from($pod) unless $self->abstract; - unless ( defined($file) ) { - my $name = $self->name - or die "all_from called with no args without setting name() first"; - $file = join('/', 'lib', split(/-/, $name)) . '.pm'; - $file =~ s{.*/}{} unless -e $file; - die "all_from: cannot find $file from $name" unless -e $file; - } - - $self->version_from($file) unless $self->version; - $self->perl_version_from($file) unless $self->perl_version; - - # The remaining probes read from POD sections; if the file - # has an accompanying .pod, use that instead - my $pod = $file; - if ( $pod =~ s/\.pm$/.pod/i and -e $pod ) { - $file = $pod; - } - - $self->author_from($file) unless $self->author; - $self->license_from($file) unless $self->license; - $self->abstract_from($file) unless $self->abstract; + return 1; } sub provides { - my $self = shift; - my $provides = ( $self->{values}{provides} ||= {} ); - %$provides = (%$provides, @_) if @_; - return $provides; + my $self = shift; + my $provides = ( $self->{values}{provides} ||= {} ); + %$provides = (%$provides, @_) if @_; + return $provides; } sub auto_provides { - my $self = shift; - return $self unless $self->is_admin; - - unless (-e 'MANIFEST') { - warn "Cannot deduce auto_provides without a MANIFEST, skipping\n"; - return $self; - } - - # Avoid spurious warnings as we are not checking manifest here. - - local $SIG{__WARN__} = sub {1}; - require ExtUtils::Manifest; - local *ExtUtils::Manifest::manicheck = sub { return }; - - require Module::Build; - my $build = Module::Build->new( - dist_name => $self->name, - dist_version => $self->version, - license => $self->license, - ); - $self->provides(%{ $build->find_dist_packages || {} }); + my $self = shift; + return $self unless $self->is_admin; + unless (-e 'MANIFEST') { + warn "Cannot deduce auto_provides without a MANIFEST, skipping\n"; + return $self; + } + # Avoid spurious warnings as we are not checking manifest here. + local $SIG{__WARN__} = sub {1}; + require ExtUtils::Manifest; + local *ExtUtils::Manifest::manicheck = sub { return }; + + require Module::Build; + my $build = Module::Build->new( + dist_name => $self->name, + dist_version => $self->version, + license => $self->license, + ); + $self->provides( %{ $build->find_dist_packages || {} } ); } sub feature { - my $self = shift; - my $name = shift; - my $features = ( $self->{values}{features} ||= [] ); - - my $mods; - - if ( @_ == 1 and ref( $_[0] ) ) { - # The user used ->feature like ->features by passing in the second - # argument as a reference. Accomodate for that. - $mods = $_[0]; - } else { - $mods = \@_; - } - - my $count = 0; - push @$features, ( - $name => [ - map { - ref($_) ? ( ref($_) eq 'HASH' ) ? %$_ - : @$_ - : $_ - } @$mods - ] - ); + my $self = shift; + my $name = shift; + my $features = ( $self->{values}{features} ||= [] ); + my $mods; + + if ( @_ == 1 and ref( $_[0] ) ) { + # The user used ->feature like ->features by passing in the second + # argument as a reference. Accomodate for that. + $mods = $_[0]; + } else { + $mods = \@_; + } - return @$features; + my $count = 0; + push @$features, ( + $name => [ + map { + ref($_) ? ( ref($_) eq 'HASH' ) ? %$_ : @$_ : $_ + } @$mods + ] + ); + + return @$features; } sub features { - my $self = shift; - while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) { - $self->feature( $name, @$mods ); - } - return $self->{values}->{features} - ? @{ $self->{values}->{features} } - : (); + my $self = shift; + while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) { + $self->feature( $name, @$mods ); + } + return $self->{values}->{features} + ? @{ $self->{values}->{features} } + : (); } sub no_index { - my $self = shift; - my $type = shift; - push @{ $self->{values}{no_index}{$type} }, @_ if $type; - return $self->{values}{no_index}; + my $self = shift; + my $type = shift; + push @{ $self->{values}{no_index}{$type} }, @_ if $type; + return $self->{values}{no_index}; } sub read { - my $self = shift; - $self->include_deps( 'YAML', 0 ); + my $self = shift; + $self->include_deps( 'YAML::Tiny', 0 ); - require YAML; - my $data = YAML::LoadFile('META.yml'); + require YAML::Tiny; + my $data = YAML::Tiny::LoadFile('META.yml'); - # Call methods explicitly in case user has already set some values. - while ( my ( $key, $value ) = each %$data ) { - next unless $self->can($key); - if ( ref $value eq 'HASH' ) { - while ( my ( $module, $version ) = each %$value ) { - $self->can($key)->($self, $module => $version ); - } - } - else { - $self->can($key)->($self, $value); - } - } - return $self; + # Call methods explicitly in case user has already set some values. + while ( my ( $key, $value ) = each %$data ) { + next unless $self->can($key); + if ( ref $value eq 'HASH' ) { + while ( my ( $module, $version ) = each %$value ) { + $self->can($key)->($self, $module => $version ); + } + } else { + $self->can($key)->($self, $value); + } + } + return $self; } sub write { - my $self = shift; - return $self unless $self->is_admin; - $self->admin->write_meta; - return $self; + my $self = shift; + return $self unless $self->is_admin; + $self->admin->write_meta; + return $self; } sub version_from { - my ( $self, $file ) = @_; - require ExtUtils::MM_Unix; - $self->version( ExtUtils::MM_Unix->parse_version($file) ); + require ExtUtils::MM_Unix; + my ( $self, $file ) = @_; + $self->version( ExtUtils::MM_Unix->parse_version($file) ); } sub abstract_from { - my ( $self, $file ) = @_; - require ExtUtils::MM_Unix; - $self->abstract( - bless( - { DISTNAME => $self->name }, - 'ExtUtils::MM_Unix' - )->parse_abstract($file) - ); -} - -sub _slurp { - my ( $self, $file ) = @_; - - local *FH; - open FH, "< $file" or die "Cannot open $file.pod: $!"; - do { local $/; }; + require ExtUtils::MM_Unix; + my ( $self, $file ) = @_; + $self->abstract( + bless( + { DISTNAME => $self->name }, + 'ExtUtils::MM_Unix' + )->parse_abstract($file) + ); } -sub perl_version_from { - my ( $self, $file ) = @_; +sub name_from { + my $self = shift; + if ( + Module::Install::_read($_[0]) =~ m/ + ^ \s* + package \s* + ([\w:]+) + \s* ; + /ixms + ) { + my $name = $1; + $name =~ s{::}{-}g; + $self->name($name); + } else { + die "Cannot determine name from $_[0]\n"; + return; + } +} - if ( - $self->_slurp($file) =~ m/ - ^ - use \s* - v? - ([\d_\.]+) - \s* ; - /ixms - ) - { - my $v = $1; - $v =~ s{_}{}g; - $self->perl_version($1); - } - else { - warn "Cannot determine perl version info from $file\n"; - return; - } +sub perl_version_from { + my $self = shift; + if ( + Module::Install::_read($_[0]) =~ m/ + ^ + use \s* + v? + ([\d_\.]+) + \s* ; + /ixms + ) { + my $perl_version = $1; + $perl_version =~ s{_}{}g; + $self->perl_version($perl_version); + } else { + warn "Cannot determine perl version info from $_[0]\n"; + return; + } } sub author_from { - my ( $self, $file ) = @_; - my $content = $self->_slurp($file); - if ($content =~ m/ - =head \d \s+ (?:authors?)\b \s* - ([^\n]*) - | - =head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b \s* - .*? copyright .*? \d\d\d[\d.]+ \s* (?:\bby\b)? \s* - ([^\n]*) - /ixms) { - my $author = $1 || $2; - $author =~ s{E}{<}g; - $author =~ s{E}{>}g; - $self->author($author); - } - else { - warn "Cannot determine author info from $file\n"; - } + my $self = shift; + my $content = Module::Install::_read($_[0]); + if ($content =~ m/ + =head \d \s+ (?:authors?)\b \s* + ([^\n]*) + | + =head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b \s* + .*? copyright .*? \d\d\d[\d.]+ \s* (?:\bby\b)? \s* + ([^\n]*) + /ixms) { + my $author = $1 || $2; + $author =~ s{E}{<}g; + $author =~ s{E}{>}g; + $self->author($author); + } else { + warn "Cannot determine author info from $_[0]\n"; + } } sub license_from { - my ( $self, $file ) = @_; - - if ( - $self->_slurp($file) =~ m/ - ( - =head \d \s+ - (?:licen[cs]e|licensing|copyright|legal)\b - .*? - ) - (=head\\d.*|=cut.*|) - \z - /ixms - ) - { - my $license_text = $1; - my @phrases = ( - 'under the same (?:terms|license) as perl itself' => 'perl', 1, - 'GNU public license' => 'gpl', 1, - 'GNU lesser public license' => 'gpl', 1, - 'BSD license' => 'bsd', 1, - 'Artistic license' => 'artistic', 1, - 'GPL' => 'gpl', 1, - 'LGPL' => 'lgpl', 1, - 'BSD' => 'bsd', 1, - 'Artistic' => 'artistic', 1, - 'MIT' => 'mit', 1, - 'proprietary' => 'proprietary', 0, - ); - while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) { - $pattern =~ s{\s+}{\\s+}g; - if ( $license_text =~ /\b$pattern\b/i ) { - if ( $osi and $license_text =~ /All rights reserved/i ) { - warn "LEGAL WARNING: 'All rights reserved' may invalidate Open Source licenses. Consider removing it."; + my $self = shift; + if ( + Module::Install::_read($_[0]) =~ m/ + ( + =head \d \s+ + (?:licen[cs]e|licensing|copyright|legal)\b + .*? + ) + (=head\\d.*|=cut.*|) + \z + /ixms ) { + my $license_text = $1; + my @phrases = ( + 'under the same (?:terms|license) as perl itself' => 'perl', 1, + 'GNU public license' => 'gpl', 1, + 'GNU lesser public license' => 'lgpl', 1, + 'BSD license' => 'bsd', 1, + 'Artistic license' => 'artistic', 1, + 'GPL' => 'gpl', 1, + 'LGPL' => 'lgpl', 1, + 'BSD' => 'bsd', 1, + 'Artistic' => 'artistic', 1, + 'MIT' => 'mit', 1, + 'proprietary' => 'proprietary', 0, + ); + while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) { + $pattern =~ s{\s+}{\\s+}g; + if ( $license_text =~ /\b$pattern\b/i ) { + if ( $osi and $license_text =~ /All rights reserved/i ) { + warn "LEGAL WARNING: 'All rights reserved' may invalidate Open Source licenses. Consider removing it."; + } + $self->license($license); + return 1; + } } - $self->license($license); - return 1; - } - } - } + } + + warn "Cannot determine license info from $_[0]\n"; + return 'unknown'; +} - warn "Cannot determine license info from $file\n"; - return 'unknown'; +sub install_script { + my $self = shift; + my $args = $self->makemaker_args; + my $exe = $args->{EXE_FILES} ||= []; + foreach ( @_ ) { + if ( -f $_ ) { + push @$exe, $_; + } elsif ( -d 'script' and -f "script/$_" ) { + push @$exe, "script/$_"; + } else { + die "Cannot find script '$_'"; + } + } } 1; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/WriteAll.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/WriteAll.pm 2008/02/21 00:21:28 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/WriteAll.pm 2008/05/07 18:16:52 1.2 @@ -4,40 +4,37 @@ use strict; use Module::Install::Base; -use vars qw{$VERSION $ISCORE @ISA}; +use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '0.67'; - $ISCORE = 1; + $VERSION = '0.72'; @ISA = qw{Module::Install::Base}; + $ISCORE = 1; } sub WriteAll { - my $self = shift; - my %args = ( - meta => 1, - sign => 0, - inline => 0, - check_nmake => 1, - @_ - ); - - $self->sign(1) if $args{sign}; - $self->Meta->write if $args{meta}; - $self->admin->WriteAll(%args) if $self->is_admin; - - if ( $0 =~ /Build.PL$/i ) { - $self->Build->write; - } else { - $self->check_nmake if $args{check_nmake}; - unless ( $self->makemaker_args->{'PL_FILES'} ) { - $self->makemaker_args( PL_FILES => {} ); - } - if ($args{inline}) { - $self->Inline->write; - } else { - $self->Makefile->write; - } - } + my $self = shift; + my %args = ( + meta => 1, + sign => 0, + inline => 0, + check_nmake => 1, + @_, + ); + + $self->sign(1) if $args{sign}; + $self->Meta->write if $args{meta}; + $self->admin->WriteAll(%args) if $self->is_admin; + + $self->check_nmake if $args{check_nmake}; + unless ( $self->makemaker_args->{PL_FILES} ) { + $self->makemaker_args( PL_FILES => {} ); + } + + if ( $args{inline} ) { + $self->Inline->write; + } else { + $self->Makefile->write; + } } 1; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Win32.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Win32.pm 2008/02/21 00:21:28 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Win32.pm 2008/05/07 18:16:52 1.2 @@ -4,11 +4,11 @@ use strict; use Module::Install::Base; -use vars qw{$VERSION $ISCORE @ISA}; +use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '0.67'; - $ISCORE = 1; + $VERSION = '0.72'; @ISA = qw{Module::Install::Base}; + $ISCORE = 1; } # determine if the user needs nmake, and download it if needed @@ -16,7 +16,7 @@ my $self = shift; $self->load('can_run'); $self->load('get_file'); - + require Config; return unless ( $^O eq 'MSWin32' and @@ -38,8 +38,7 @@ remove => 1, ); - if (!$rv) { - die <<'END_MESSAGE'; + die <<'END_MESSAGE' unless $rv; ------------------------------------------------------------------------------- @@ -59,7 +58,7 @@ ------------------------------------------------------------------------------- END_MESSAGE - } + } 1; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Can.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Can.pm 2008/02/21 00:21:28 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Can.pm 2008/05/07 18:16:52 1.2 @@ -11,7 +11,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Fetch.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Fetch.pm 2008/02/21 00:21:28 1.1 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/Fetch.pm 2008/05/07 18:16:52 1.2 @@ -6,7 +6,7 @@ use vars qw{$VERSION $ISCORE @ISA}; BEGIN { - $VERSION = '0.67'; + $VERSION = '0.72'; $ISCORE = 1; @ISA = qw{Module::Install::Base}; } rcsdiff: /home/repository/moby/moby-live/Perl/MOBY-Server/inc/Module/Install/RCS/Scripts.pm,v: No such file or directory From kawas at dev.open-bio.org Wed May 7 18:20:29 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 May 2008 14:20:29 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805071820.m47IKTDD009819@dev.open-bio.org> kawas Wed May 7 14:20:29 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server In directory dev.open-bio.org:/tmp/cvs-serv9784 Modified Files: MANIFEST Log Message: updated the manifest to take into account the module install update moby-live/Perl/MOBY-Server MANIFEST,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/MANIFEST,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Perl/MOBY-Server/MANIFEST 2008/03/20 17:36:33 1.5 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/MANIFEST 2008/05/07 18:20:29 1.6 @@ -1,5 +1,6 @@ bin/scripts/moby-s-install.pl Changes +drop_tables.sql inc/Module/AutoInstall.pm inc/Module/Install.pm inc/Module/Install/AutoInstall.pm @@ -9,7 +10,6 @@ inc/Module/Install/Include.pm inc/Module/Install/Makefile.pm inc/Module/Install/Metadata.pm -inc/Module/Install/Scripts.pm inc/Module/Install/Share.pm inc/Module/Install/Win32.pm inc/Module/Install/WriteAll.pm @@ -54,9 +54,6 @@ lib/MOBY/MOBYXSLT.pm lib/MOBY/mysql.pm lib/MOBY/OntologyServer.pm -lib/MOBY/RDF/Parsers/NamespaceParser.pm -lib/MOBY/RDF/Parsers/ServiceTypeParser.pm -lib/MOBY/RDF/Parsers/DatatypeParser.pm lib/MOBY/RDF/Ontologies/Cache/CacheUtils.pm lib/MOBY/RDF/Ontologies/Cache/NamespaceCache.pm lib/MOBY/RDF/Ontologies/Cache/ObjectCache.pm @@ -66,6 +63,9 @@ lib/MOBY/RDF/Ontologies/Objects.pm lib/MOBY/RDF/Ontologies/Services.pm lib/MOBY/RDF/Ontologies/ServiceTypes.pm +lib/MOBY/RDF/Parsers/DatatypeParser.pm +lib/MOBY/RDF/Parsers/NamespaceParser.pm +lib/MOBY/RDF/Parsers/ServiceTypeParser.pm lib/MOBY/RDF/Predicates/DC_PROTEGE.pm lib/MOBY/RDF/Predicates/FETA.pm lib/MOBY/RDF/Predicates/MOBY_PREDICATES.pm @@ -119,5 +119,5 @@ t/Config.t t/CrossReference.t t/MOBY.t +t/mobycentral.config t/Template.t - From kawas at dev.open-bio.org Wed May 7 18:24:29 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 May 2008 14:24:29 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805071824.m47IOTDf009949@dev.open-bio.org> kawas Wed May 7 14:24:29 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Client In directory dev.open-bio.org:/tmp/cvs-serv9914/Perl/MOBY-Client Modified Files: Makefile.PL Log Message: moby-live/Perl/MOBY-Client Makefile.PL,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/Makefile.PL,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Perl/MOBY-Client/Makefile.PL 2008/04/23 13:08:11 1.6 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/Makefile.PL 2008/05/07 18:24:29 1.7 @@ -10,8 +10,6 @@ build_requires 'Test::More' => 0; build_requires 'Test::Pod' => 0; -requires( perl => 5.005 ); - # MOBY::Client::* depends requires 'SOAP::Lite' => '0.60'; requires 'XML::LibXML' => 0; From kawas at dev.open-bio.org Wed May 7 18:27:31 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 7 May 2008 14:27:31 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805071827.m47IRV5m010013@dev.open-bio.org> kawas Wed May 7 14:27:31 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Client In directory dev.open-bio.org:/tmp/cvs-serv9978 Modified Files: MANIFEST Log Message: updated the manifest to take into account the module install update moby-live/Perl/MOBY-Client MANIFEST,1.8,1.9 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/MANIFEST,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Perl/MOBY-Client/MANIFEST 2008/03/13 19:12:59 1.8 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/MANIFEST 2008/05/07 18:27:31 1.9 @@ -8,17 +8,16 @@ inc/Module/Install/Include.pm inc/Module/Install/Makefile.pm inc/Module/Install/Metadata.pm -inc/Module/Install/Scripts.pm inc/Module/Install/Share.pm inc/Module/Install/Win32.pm inc/Module/Install/WriteAll.pm INSTALL -lib/MOBY/Client/Central.pm -lib/MOBY/Client/CollectionArticle.pm lib/MOBY/Async/LSAE.pm lib/MOBY/Async/Service.pm lib/MOBY/Async/SimpleServer.pm lib/MOBY/Async/WSRF.pm +lib/MOBY/Client/Central.pm +lib/MOBY/Client/CollectionArticle.pm lib/MOBY/Client/Exception/MobyException.pm lib/MOBY/Client/Exception/MobyExceptionCodes.pm lib/MOBY/Client/OntologyServer.pm @@ -28,9 +27,12 @@ lib/MOBY/Client/ServiceInstance.pm lib/MOBY/Client/SimpleArticle.pm lib/MOBY/Client/SimpleInput.pm +lib/MOBY/CommonSubs.pm +lib/MOBY/CrossReference.pm +lib/MOBY/MobyXMLConstants.pm +lib/MOBY/RDF/Parsers/DatatypeParser.pm lib/MOBY/RDF/Parsers/NamespaceParser.pm lib/MOBY/RDF/Parsers/ServiceTypeParser.pm -lib/MOBY/RDF/Parsers/DatatypeParser.pm lib/MOBY/RDF/Predicates/DC_PROTEGE.pm lib/MOBY/RDF/Predicates/FETA.pm lib/MOBY/RDF/Predicates/MOBY_PREDICATES.pm @@ -38,17 +40,13 @@ lib/MOBY/RDF/Predicates/OWL.pm lib/MOBY/RDF/Predicates/RDF.pm lib/MOBY/RDF/Predicates/RDFS.pm -lib/MOBY/CommonSubs.pm -lib/MOBY/CrossReference.pm -lib/MOBY/MobyXMLConstants.pm lib/MOBY/RDF/Utils.pm License Makefile.PL MANIFEST This list of files META.yml +populate_libs.pl README -share/HelloWorldService.pm -share/LocalServices.pm scripts/DebugYourService.pl scripts/FindServices.pl scripts/GetDump.pl @@ -57,6 +55,8 @@ scripts/GetServicesProviders.pl scripts/GetServicesTypes.pl scripts/MOBY-Client05.cgi +share/HelloWorldService.pm +share/LocalServices.pm t/Client-Central.t t/Client-CollectionArticle.t t/Client-OntologyServer.t @@ -65,4 +65,3 @@ t/Client-Service.t t/Client-ServiceInstance.t t/Client-SimpleArticle.t - From kawas at dev.open-bio.org Fri May 9 20:21:49 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 9 May 2008 16:21:49 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805092021.m49KLntG019598@dev.open-bio.org> kawas Fri May 9 16:21:48 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY/Cache In directory dev.open-bio.org:/tmp/cvs-serv19562/Perl/MOSES-MOBY/lib/MOSES/MOBY/Cache Modified Files: Central.pm Log Message: fixed bug that occurs when a registry url is specified. The bug is that the endpoint and namespace end up being the registry url and this causes a failure when the SOAP calls are made. moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY/Cache Central.pm,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY/Cache/Central.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY/Cache/Central.pm 2008/04/29 19:02:37 1.5 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY/Cache/Central.pm 2008/05/09 20:21:48 1.6 @@ -213,7 +213,7 @@ sub _namespace { my ($self, $registry) = @_; $registry ||= $self->registry; - return $registry if $registry =~ m"^http://"; + return "http://localhost/MOBY/Central" if $registry =~ m"^http://"; my $reg = $self->registries->get ($registry); return $reg->{namespace} if $reg; return $self->registries->get ('default')->{namespace}; From kawas at dev.open-bio.org Fri May 9 20:26:04 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 9 May 2008 16:26:04 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805092026.m49KQ4ic019660@dev.open-bio.org> kawas Fri May 9 16:26:04 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts In directory dev.open-bio.org:/tmp/cvs-serv19621/Perl/MOSES-MOBY/bin/scripts Modified Files: moses-generate-datatypes.pl moses-generate-services.pl Log Message: new -R option added. this allows you to specify a registry url on the command line moby-live/Perl/MOSES-MOBY/bin/scripts moses-generate-datatypes.pl,1.3,1.4 moses-generate-services.pl,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts/moses-generate-datatypes.pl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts/moses-generate-datatypes.pl 2008/02/21 00:12:55 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts/moses-generate-datatypes.pl 2008/05/09 20:26:04 1.4 @@ -8,15 +8,15 @@ # some command-line options use Getopt::Std; -use vars qw/ $opt_h $opt_f $opt_u $opt_d $opt_v $opt_s /; -getopt; +use vars qw/ $opt_h $opt_f $opt_R $opt_u $opt_d $opt_v $opt_s /; +getopts('hfudvsR:'); # usage if ($opt_h) { print STDOUT <<'END_OF_USAGE'; Generate datatypes. -Usage: [-vds] [data-type-name] [data-type-name...] - [-uf] +Usage: [-R registry-string] [-vds] [data-type-name] [data-type-name...] + [-R registry-string] [-uf] It also needs to get a location of a local cache (and potentially a BioMoby registry endpoint, and an output directory). It takes @@ -24,6 +24,14 @@ If no data type given it generates all of them. + -R ... a registry string in the form: + registry-url[@registry-uri] + where registry-uri is optional. + For example: + http://localhost/cgi-bin/MOBY-Central.pl + or + http://localhost/cgi-bin/MOBY-Central.pl at http://localhost/MOBY/Central + -s ... show generated code on STDOUT (no file is created, disabled when no data type name given) -f ... fill the cache @@ -46,8 +54,14 @@ sub say { print @_, "\n"; } +if ($opt_R) { + my @r = split(/\@/, $opt_R); + $opt_R = $r[0]; +} my $generator = new MOSES::MOBY::Generators::GenTypes; +$generator->registry($opt_R) if $opt_R; + if ($opt_f) { my $cache = MOSES::MOBY::Cache::Central->new ( cachedir => $generator->cachedir, =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts/moses-generate-services.pl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts/moses-generate-services.pl 2008/04/29 19:58:37 1.4 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/bin/scripts/moses-generate-services.pl 2008/05/09 20:26:04 1.5 @@ -8,17 +8,17 @@ # some command-line options use Getopt::Std; -use vars qw/ $opt_h $opt_d $opt_v $opt_a $opt_s $opt_b $opt_f $opt_u $opt_F $opt_S $opt_t $opt_c /; -getopt; +use vars qw/ $opt_h $opt_d $opt_R $opt_v $opt_a $opt_s $opt_b $opt_f $opt_u $opt_F $opt_S $opt_t $opt_c /; +getopts('hdvasbfuFStcR:'); # usage if (not($opt_u or $opt_f)) { if ($opt_h or (not $opt_a and @ARGV == 0)) { print STDOUT <<'END_OF_USAGE'; Generate Services. -Usage: [-vds] [-b|S|t] authority [service-name] [service-name...] - [-vds] [-b|S|t] authority - [-vd] [-b|S|t]a - [-fu] +Usage: [-vds] [-R registry-string] [-b|S|t] authority [service-name] [service-name...] + [-vds] [-R registry-string] [-b|S|t] authority + [-vd] [-R registry-string] [-b|S|t] -a + [-R registry-string] [-fu] It also needs to get a location of a local cache (and potentially a BioMoby registry endpoint, and an output directory). It takes @@ -27,6 +27,14 @@ -f ... fill the cache -u ... update the cache + -R ... a registry string in the form: + registry-url[@registry-uri] + where registry-uri is optional. + For example: + http://localhost/cgi-bin/MOBY-Central.pl + or + http://localhost/cgi-bin/MOBY-Central.pl at http://localhost/MOBY/Central + -b ... generate base[s] of given service[s] -S ... generate implementation and the base of service[s], the implementation module has enabled option to read the base @@ -66,8 +74,13 @@ sub say { print @_, "\n"; } +if ($opt_R) { + my @r = split(/\@/, $opt_R); + $opt_R = $r[0]; +} my $generator = new MOSES::MOBY::Generators::GenServices; +$generator->registry($opt_R) if $opt_R; if ($opt_f) { my $cache = MOSES::MOBY::Cache::Central->new ( From kawas at dev.open-bio.org Fri May 9 20:37:03 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 9 May 2008 16:37:03 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805092037.m49Kb3m4019720@dev.open-bio.org> kawas Fri May 9 16:37:03 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY In directory dev.open-bio.org:/tmp/cvs-serv19685/Perl/MOSES-MOBY Modified Files: Changes Log Message: changes made for 0.85 release moby-live/Perl/MOSES-MOBY Changes,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/Changes,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/Changes 2008/04/01 16:56:35 1.4 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/Changes 2008/05/09 20:37:03 1.5 @@ -1,13 +1,26 @@ Revision history for Perl extension MOSES::MOBY. -.84 Date here .... +.85 Fri May 9 7:52:35 2008 - fixed a bug in Parser.pm that created xrefs and called non-existent method isSimpleXref. - added namespace checking for inputs. It is inserted into impl code that is generated, but is commented out. + - added $VERSION to every module. As a result, + some of the modules have large increments in + version numbers with little changes to back up + the jump. Sorry. + - added support for 'cgi' category moby services + - updated the makefile to correctly identify the + version of IO::Prompt to use so that users dont + have to downgrade when they accidently install + the wrong version (i.e. 0.99.4) + - added a new -R option to the generate-* scripts. + This option allows you to specify a registry URL + to use when generating moses scripts. + -.83 Tue Dec 11 7:52:35 2007 +.84 Tue Dec 11 7:52:35 2007 - updated the default moby url to be the new ucalgary one because the one hosted at icapture died From kawas at dev.open-bio.org Fri May 9 20:51:37 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 9 May 2008 16:51:37 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805092051.m49Kpavl019761@dev.open-bio.org> kawas Fri May 9 16:51:36 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES In directory dev.open-bio.org:/tmp/cvs-serv19726/Perl/MOSES-MOBY/lib/MOSES Modified Files: MOBY.pm Log Message: added some more brief documentation. more to come moby-live/Perl/MOSES-MOBY/lib/MOSES MOBY.pm,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY.pm 2008/02/21 00:12:56 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY.pm 2008/05/09 20:51:36 1.4 @@ -7,7 +7,7 @@ use vars qw{$VERSION @ISA @EXPORT @EXPORT_OK}; BEGIN { - $VERSION = '0.84'; + $VERSION = sprintf "%d.%02d", q$Revision$ =~ /: (\d+)\.(\d+)/; @ISA = qw{ Exporter }; @EXPORT = qw{}; @EXPORT_OK = qw{}; @@ -318,6 +318,9 @@ =item * FindBin +=item * + IO::Prompt - try to install version 0.99.2 and not 0.99.4 + =back =cut @@ -786,9 +789,11 @@ You can use option I<-s> to get the generated result directly on the screen (in that case no file is created). -You can use the option B<-u> updates the datatype cache. +You can use the option B<-u> to update the datatype cache. + +You can use the option B<-f> to fill the datatype cache. -You can use the option B<-f> fills the datatype cache. +The B<-R> option allows you to specify a registry endpoint. For instance, -R http://moby.ucalgary.ca/moby/MOBY-Central.pl would cause the script to use UCalgary registry. The BioMoby primitive types (String, Integer, Float, Boolean and DateTime) are never generated. They were created manually. @@ -873,6 +878,10 @@ rather than load the base" enabled.

        Option -u updates the service cache.

        Option -f fills the service cache.

        + Option -R allows you to specify a registry endpoint. + For instance, + -R http://moby.ucalgary.ca/moby/MOBY-Central.pl + would cause the script to use UCalgary registry.

  • =end html @@ -1903,7 +1912,7 @@ ScriptAlias /cgi-bin/
  • Underneath this text, enter something like the following (replace Eddie with your username):
    ScriptAlias /services/ "C:/Documents and Settings/Eddie/Perl-MoSeS/"
  • -
  • Just below this, after the </IfModule> line, add the following text (replace Eddie with your username): +
  • Just below this, after the </IfModule> line, add the following text (replace Eddie with your username and the directory with your directory):
           <Directory "C:/Documents and Settings/Eddie/Perl-MoSeS">
              AllowOverride None
    @@ -1949,7 +1958,7 @@
     
     It is B that you change the name of the file if you anticipate other users B to the cgi-bin directory as well!
     
    -Once the file has been copied, then change the ownership of the file to the web servers' user/group.
    +Once the file has been copied, change the ownership of the file to the web servers' user/group. Also, make sure that the path (and its parents) to all of the directories in the 'use lib ...' are readable by your web server. 
     
     That's all there is to it! Now when you test your services, remember that your file may no longer be called MobyServer.cgi, but something else that you named it!
     
    @@ -1997,21 +2006,26 @@
     
     =cut
     
    -=head2 EXPORT
    +=head1 EXPORT
     
     None by default.
     
     
     =head1 SEE ALSO
     
    -For the most up-to-date documentation, visit the Perl MoSes online documentation:
    +=head2 Tutorials on building services
    +
    +For some tutorials on using Perl MoSeS:
     
     =begin html
     
    -	Perl MoSeS - Online
    +	Tutorial for creating SOAP based Biomoby Services
    + Tutorial for creating CGI based Biomoby Services =end html +=cut + If you have questions or comments, please feel free to message us on the following mailing lists: =over From kawas at dev.open-bio.org Fri May 9 20:54:31 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 9 May 2008 16:54:31 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805092054.m49KsV2v019837@dev.open-bio.org> kawas Fri May 9 16:54:31 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY In directory dev.open-bio.org:/tmp/cvs-serv19802/Perl/MOSES-MOBY Modified Files: README Log Message: moby-live/Perl/MOSES-MOBY README,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/README,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/README 2008/04/29 20:09:35 1.4 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/README 2008/05/09 20:54:31 1.5 @@ -1,17 +1,18 @@ -MOSES-MOBY version .84 +MOSES-MOBY version .85 ====================== OVERVIEW -Perl Moses is a generator of Perl code - but this -code does not need to be always stored in files, -it can be generated on-the-fly every time a -service is called. Also, there are up to four -things to be generated: objects representing -BioMoby data types, classes establishing bases -for services, empty (but working) service -implementation modules, and cgi-bin scripts, -the entry points to BioMoby services. +Perl MoSeS is a generator of Perl based BioMOBY +web services (SOAP & CGI based). This module +will hopefully help all those service providers +that have something to offer, but don't want to +get overwhelmed by the BioMOBY services protocol. + +Perl MoSeS takes care of all data marshalling and +un-marshalling, web service transporting, and much +more, leaving the service provider the sole task +of providing the business logic for their service. INSTALLATION From kawas at dev.open-bio.org Sat May 10 00:23:06 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 9 May 2008 20:23:06 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805100023.m4A0N5uv020332@dev.open-bio.org> kawas Fri May 9 20:23:05 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY/Generators In directory dev.open-bio.org:/tmp/cvs-serv20297/Perl/MOSES-MOBY/lib/MOSES/MOBY/Generators Modified Files: GenServices.pm Log Message: moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY/Generators GenServices.pm,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY/Generators/GenServices.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY/Generators/GenServices.pm 2008/04/29 19:58:37 1.5 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY/Generators/GenServices.pm 2008/05/10 00:23:05 1.6 @@ -332,8 +332,7 @@ # we cannot easily check whether the same file was already # generated - so we don't my $outfile = - File::Spec->catfile ( $outdir, split (/\./, $obj->authority), $obj->name ) - . '.cgi'; + File::Spec->catfile ( $outdir, split (/\./, $obj->authority), $obj->name ) . '.cgi'; $tt->process ( $input, { obj => $obj, @@ -342,7 +341,9 @@ services_dir => $MOBYCFG::GENERATORS_IMPL_OUTDIR, }, $outfile ) || $LOG->logdie ($tt->error()); - chmod 0755, $outfile; + chmod (0755, $outfile); + $LOG->info ("\tCGI service created at '$outfile'\n"); + } } } From kawas at dev.open-bio.org Sat May 10 00:23:44 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 9 May 2008 20:23:44 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805100023.m4A0NiOZ020372@dev.open-bio.org> kawas Fri May 9 20:23:44 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES In directory dev.open-bio.org:/tmp/cvs-serv20337/Perl/MOSES-MOBY/lib/MOSES Modified Files: MOBY.pm Log Message: moby-live/Perl/MOSES-MOBY/lib/MOSES MOBY.pm,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY.pm 2008/05/09 20:51:36 1.4 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/lib/MOSES/MOBY.pm 2008/05/10 00:23:44 1.5 @@ -876,6 +876,8 @@ do it again in the run-time - therefore, the service implementation is generated slightly differently - with an option "use the base, rather than load the base" enabled.

    + Option -c generates both a service base + as well as a CGI dispatcher script.

    Option -u updates the service cache.

    Option -f fills the service cache.

    Option -R allows you to specify a registry endpoint. From kawas at dev.open-bio.org Sun May 11 23:41:48 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Sun, 11 May 2008 19:41:48 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805112341.m4BNfmOh000997@dev.open-bio.org> kawas Sun May 11 19:41:48 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY/t In directory dev.open-bio.org:/tmp/cvs-serv961/Perl/MOSES-MOBY/t Modified Files: MOSES-MOBY-Registry.t Log Message: updated the registry in the test to be the ucalgary one. moby-live/Perl/MOSES-MOBY/t MOSES-MOBY-Registry.t,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/t/MOSES-MOBY-Registry.t,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/t/MOSES-MOBY-Registry.t 2008/02/21 00:12:55 1.3 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/t/MOSES-MOBY-Registry.t 2008/05/11 23:41:48 1.4 @@ -21,7 +21,7 @@ can_ok($registry, ("get", "list", "add", "remove", "all")); # get should return default registry details -ok($registry->get->{endpoint} eq 'http://mobycentral.icapture.ubc.ca/cgi-bin/MOBY05/mobycentral.pl', "Check the 'get' method returns the default registry") or diag("'" . $registry->get->{endpoint} . "' was not expected."); +ok($registry->get->{endpoint} eq 'http://moby.ucalgary.ca/moby/MOBY-Central.pl', "Check the 'get' method returns the default registry") or diag("'" . $registry->get->{endpoint} . "' was not expected."); # shouldnt be able to add to persistent store, but should be in memory (0). my $ret = $registry->add( From kawas at dev.open-bio.org Sun May 11 23:44:37 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Sun, 11 May 2008 19:44:37 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805112344.m4BNibGn001157@dev.open-bio.org> kawas Sun May 11 19:44:37 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOSES-MOBY In directory dev.open-bio.org:/tmp/cvs-serv1118/Perl/MOSES-MOBY Modified Files: Makefile.PL Changes Log Message: fixed a test case and re-releasing on cpan moby-live/Perl/MOSES-MOBY Makefile.PL,1.5,1.6 Changes,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/Makefile.PL,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/Makefile.PL 2008/05/07 17:50:57 1.5 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/Makefile.PL 2008/05/11 23:44:37 1.6 @@ -3,7 +3,7 @@ # Define metadata name 'MOSES-MOBY'; - version '0.85'; + version '0.86'; license 'perl'; abstract 'This distribution aids in the creation of BioMOBY perl based web services.'; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOSES-MOBY/Changes,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Perl/MOSES-MOBY/Changes 2008/05/09 20:37:03 1.5 +++ /home/repository/moby/moby-live/Perl/MOSES-MOBY/Changes 2008/05/11 23:44:37 1.6 @@ -1,6 +1,9 @@ Revision history for Perl extension MOSES::MOBY. .85 Fri May 9 7:52:35 2008 + - fixed a bug in one of the test cases. + +.85 Fri May 9 7:52:35 2008 - fixed a bug in Parser.pm that created xrefs and called non-existent method isSimpleXref. - added namespace checking for inputs. It is From kawas at dev.open-bio.org Mon May 12 15:05:29 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 12 May 2008 11:05:29 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805121505.m4CF5T7p005633@dev.open-bio.org> kawas Mon May 12 11:05:28 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv5598/Perl/MOBY-Server/lib/MOBY/Client Modified Files: Central.pm Log Message: Fixed DUMP Not sure when DUMP broke, but our custom serializer (MOBY::SOAP::Serializer) stated that 'this wont work for the DUMP call if and when a SOAP::Data object is passed' and sure enough, in the _call() method in MOBY::Client::Central, a SOAP::Data object was passed to DUMP. This is now fixed thanks to Pieter Neerincx moby-live/Perl/MOBY-Server/lib/MOBY/Client Central.pm,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Client/Central.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Client/Central.pm 2008/03/06 18:04:35 1.3 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Client/Central.pm 2008/05/12 15:05:28 1.4 @@ -1924,10 +1924,16 @@ # return $self->SOAP_connection($reg)->call('DUMP')->paramsall; my ($SQLs) = $self->_call( $reg, 'DUMP_MySQL', "" ); my ( - $mobycentral, $mobyobject, $mobyservice, - $mobynamespace, $mobyrelationship - ) - = @{$SQLs}; + $mobycentral, $mobyobject, $mobyservice, + $mobynamespace, $mobyrelationship + ) = @{$SQLs} unless ref($SQLs) eq 'HASH'; + + # cases where soap message is serialized as a HASH + ( + $mobycentral, $mobyobject, $mobyservice, + $mobynamespace, $mobyrelationship + ) = @{$SQLs->{item}} if ref($SQLs) eq 'HASH'; + return ( $mobycentral, $mobyobject, $mobyservice, $mobynamespace, $mobyrelationship From kawas at dev.open-bio.org Mon May 12 15:08:10 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Mon, 12 May 2008 11:08:10 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805121508.m4CF8A0V005673@dev.open-bio.org> kawas Mon May 12 11:08:10 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server In directory dev.open-bio.org:/tmp/cvs-serv5638/Perl/MOBY-Server Modified Files: Changes Log Message: moby-live/Perl/MOBY-Server Changes,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/Changes,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Perl/MOBY-Server/Changes 2008/05/01 21:48:30 1.4 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/Changes 2008/05/12 15:08:10 1.5 @@ -1,7 +1,12 @@ Revision history for Perl extension MOBY. 1.04 - + - fixed bug in MOBY::Client::Central::DUMP that resulted + in an error ('Not an ARRAY reference at + MOBY/Client/Central.pm line 1927') being raised. + Thanks to Pieter Neerincx for finding the bug and a + solution. + - fixed bug that allowed service types to be registered with empty ISA relationships. From kawas at dev.open-bio.org Wed May 14 14:00:05 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 14 May 2008 10:00:05 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805141400.m4EE05jA012182@dev.open-bio.org> kawas Wed May 14 10:00:05 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/share/db/schema In directory dev.open-bio.org:/tmp/cvs-serv12146/Perl/MOBY-Server/share/db/schema Modified Files: mobycentral.mysql Log Message: reverted the schema for service_instance. moby-live/Perl/MOBY-Server/share/db/schema mobycentral.mysql,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/share/db/schema/mobycentral.mysql,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/MOBY-Server/share/db/schema/mobycentral.mysql 2008/05/01 17:42:46 1.2 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/share/db/schema/mobycentral.mysql 2008/05/14 14:00:05 1.3 @@ -60,7 +60,7 @@ -- CREATE TABLE service_instance ( - category enum('moby','soap','wsdl','rest','moby-async') default NULL, + category enum('moby','soap','wsdl','cgi','moby-async') default NULL, servicename varchar(255) NOT NULL default '', service_type_uri varchar(255) NOT NULL default '', authority_id int(10) unsigned NOT NULL default '0', From kawas at dev.open-bio.org Wed May 14 14:01:19 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 14 May 2008 10:01:19 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805141401.m4EE1Je5012242@dev.open-bio.org> kawas Wed May 14 10:01:19 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/share/cgi In directory dev.open-bio.org:/tmp/cvs-serv12207/Perl/MOBY-Server/share/cgi Modified Files: service_tester.pl Log Message: added code for testing category 'cgi' services moby-live/Perl/MOBY-Server/share/cgi service_tester.pl,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/share/cgi/service_tester.pl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/MOBY-Server/share/cgi/service_tester.pl 2008/04/16 13:52:03 1.2 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/share/cgi/service_tester.pl 2008/05/14 14:01:19 1.3 @@ -35,6 +35,8 @@ use MOBY::Client::Central; use SOAP::Lite; use XML::LibXML; +use HTTP::Request::Common qw(POST); +use LWP::UserAgent; # Because of this library, cannot run on windows use IPC::Shareable; @@ -116,28 +118,40 @@ } if $url =~ /localhost/; # child - stuff to do goes here + my $out = undef; + my $input = _empty_input(); + #print "Calling: " . $auth . "," . $name . "\n"; - my $soap = - SOAP::Lite->uri("http://biomoby.org/") - ->proxy( $url, timeout => $TIMEOUT )->on_fault( - sub { - my $soap = shift; - my $res = shift; - - #TODO add to DEAD hash ... - $alive_handle->shlock(); - $ALIVE{$auth} = () if not exists $ALIVE{$auth}; - push @{ $ALIVE{$auth} }, {name=>$name, alive=>undef}; - $alive_handle->shunlock(); + do { + my $soap = + SOAP::Lite->uri("http://biomoby.org/") + ->proxy( $url, timeout => $TIMEOUT )->on_fault( + sub { + my $soap = shift; + my $res = shift; + + #TODO add to DEAD hash ... + $alive_handle->shlock(); + $ALIVE{$auth} = () if not exists $ALIVE{$auth}; + push @{ $ALIVE{$auth} }, {name=>$name, alive=>undef}; + $alive_handle->shunlock(); + + #print "\t" . $auth . "," . $name . " ~isAlive\n"; + exit(0); + } + ); - #print "\t" . $auth . "," . $name . " ~isAlive\n"; - exit(0); - } - ); + $out = + $soap->$name( SOAP::Data->type( 'string' => "$input" ) )->result; + } unless $cat eq 'cgi'; + # test cgi services + do { + my $ua = LWP::UserAgent->new; + my $req = POST $opt_c, [ data => $input]; + $req = $ua->request($req); + $out = $req->content if $req->is_success; + } if $cat eq 'cgi'; - my $input = _empty_input(); - my $out = - $soap->$name( SOAP::Data->type( 'string' => "$input" ) )->result; do { #TODO add to ALIVE hash ... #print "\t" . $auth . "," . $name . " isAlive\n"; From kawas at dev.open-bio.org Wed May 14 14:04:03 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 14 May 2008 10:04:03 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805141404.m4EE43hF012302@dev.open-bio.org> kawas Wed May 14 10:04:03 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Client In directory dev.open-bio.org:/tmp/cvs-serv12267/Perl/MOBY-Server/lib/MOBY/Client Modified Files: Central.pm Log Message: category 'cgi' is what the registry expects. fixed instances in the code that 'post' was used, rather than 'cgi' moby-live/Perl/MOBY-Server/lib/MOBY/Client Central.pm,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Client/Central.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Client/Central.pm 2008/05/12 15:05:28 1.4 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Client/Central.pm 2008/05/14 14:04:03 1.5 @@ -640,7 +640,7 @@ authURI => $authURI, contactEmail => "your at mail.address", description => $human_readable_description, - category => "moby" | "post" | "moby-async" + category => "moby" | "cgi" | "moby-async" URL => $URL_TO_SERVICE (or URL to WSDL document for wsdl-type services) input: listref; (articleName may be undef) @@ -738,13 +738,13 @@ #____________________________________________________________________________________________ return $self->errorRegXML( -"Only 'moby', 'post', 'moby-async', 'doc-literal', 'doc-literal-async' Service Categories are currently allowed - you gave me $Category" +"Only 'moby', 'cgi', 'moby-async', 'doc-literal', 'doc-literal-async' Service Categories are currently allowed - you gave me $Category" ) unless ( ( $Category eq 'moby' ) || ( $Category eq 'moby-async' ) || ( $Category eq 'doc-literal' ) || ( $Category eq 'doc-literal-async' ) - || ( $Category eq 'post' )); + || ( $Category eq 'cgi' )); return $self->errorRegXML( "All Fields Required: serviceName, serviceType, authURI, contactEmail, URL, description, Category, input, output, secondary" ) @@ -971,7 +971,7 @@ serviceType => $serviceType, (optional) authURI => $authURI, (optional) authoritative => 1, (optional) - category => "moby" | "post" | "moby-async" (optional) + category => "moby" | "cgi" | "moby-async" (optional) expandObjects => 1, (optional) expandServices => 1, (optional) URL => $URL_TO_SERVICE (optional) From kawas at dev.open-bio.org Wed May 14 14:06:23 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Wed, 14 May 2008 10:06:23 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805141406.m4EE6N2s012416@dev.open-bio.org> kawas Wed May 14 10:06:23 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY In directory dev.open-bio.org:/tmp/cvs-serv12381/Perl/MOBY-Server/lib/MOBY Modified Files: Central.pm Log Message: category 'cgi' is what the registry expects. fixed instances in the code that 'post' was used, rather than 'cgi' moby-live/Perl/MOBY-Server/lib/MOBY Central.pm,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Central.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Central.pm 2008/04/23 13:08:11 1.4 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/lib/MOBY/Central.pm 2008/05/14 14:06:23 1.5 @@ -1102,7 +1102,7 @@ Input XML : - moby + moby YourServiceNameHere TypeOntologyTerm http://path.to/your/signature/RDF.rdf @@ -1330,14 +1330,14 @@ $error .= "missing Category \n" unless defined $Category; return &_error( "malformed payload $error\n\n", "" ) if ($error); return &_error( - "Category may take the (case sensitive) values 'moby', 'moby-async', 'post', 'doc-literal', and 'doc-literal-async', \n", + "Category may take the (case sensitive) values 'moby', 'moby-async', 'cgi', 'doc-literal', and 'doc-literal-async', \n", "" ) unless ( ( $Category eq "wsdl" ) || ( $Category eq "moby" ) || ( $Category eq "moby-async" ) - || ( $Category eq "post" ) + || ( $Category eq "cgi" ) || ( $Category eq "doc-literal" ) || ( $Category eq "doc-literal-async")); @@ -3274,7 +3274,7 @@ # do substitutions my $serviceType = $SI->category; my $wsdl; - if ($serviceType eq "post"){ + if ($serviceType eq "cgi"){ $wsdl = &_doPostWSDLReplacement(@_) } elsif ($serviceType eq "moby"){ $wsdl = &_doMobyWSDLReplacement(@_) @@ -4073,7 +4073,7 @@ END -# MOBY POST service template +# MOBY CGI service template $WSDL_POST_TEMPLATE = < From walexander at dev.open-bio.org Wed May 14 20:37:10 2008 From: walexander at dev.open-bio.org (Wendy Alexander) Date: Wed, 14 May 2008 16:37:10 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805142037.m4EKbAPu013256@dev.open-bio.org> walexander Wed May 14 16:37:10 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard In directory dev.open-bio.org:/tmp/cvs-serv13213 Modified Files: DashboardProperties.java ServiceCallerModel.java SimpleClientPanel.java Log Message: Modified the ping functionality in the Simple Client panel. Ping is now a checkbox option instead of a radio button. Also the 'Call Service' button text changes to reflect whether a ping is used or the data is being sent as bytes. moby-live/Java/src/main/org/biomoby/service/dashboard DashboardProperties.java,1.27,1.28 ServiceCallerModel.java,1.5,1.6 SimpleClientPanel.java,1.10,1.11 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DashboardProperties.java,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DashboardProperties.java 2008/03/19 22:50:46 1.27 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/DashboardProperties.java 2008/05/14 20:37:10 1.28 @@ -65,7 +65,6 @@ static final String DP_CS_URL = "service-endpoint"; static final String DP_CS_NEWURL = "service-new-endpoint"; static final String DP_CS_REGISTRY = "as-registered"; - static final String DP_CS_PING = "ping"; static final String DP_ENDPOINT = "serviceEndpoint"; static final String DP_IMPL_CLASS = "serviceImplClass"; @@ -73,6 +72,7 @@ static final String DP_INP_SHOW = "showInput"; static final String DP_INP_SHOWXML = "showInputAsXML"; static final String DP_INP_ASBYTES = "sendInputAsBytes"; + static final String DP_INP_PING = "sendEmptyInputAsPing"; static final String DP_OUT_SHOW = "showOutput"; static final String DP_OUT_SHOWXML = "showOutputAsXML"; =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/ServiceCallerModel.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/ServiceCallerModel.java 2008/03/19 22:50:14 1.5 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/ServiceCallerModel.java 2008/05/14 20:37:10 1.6 @@ -145,7 +145,7 @@ if (! UUtils.isEmpty (sEndpoint)) clonedService.setURL (sEndpoint); - } else if (DP_CS_REGISTRY.equals (howToCall) || DP_CS_PING.equals(howToCall)) { + } else if (DP_CS_REGISTRY.equals (howToCall)) { clonedService.setURL (null); setRegistryEndpoint (propertyChannel.getString (DP_REGISTRY_ENDPOINT)); setRegistryNamespace (propertyChannel.getString (DP_REGISTRY_NAMESPACE)); =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/SimpleClientPanel.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/SimpleClientPanel.java 2008/03/19 22:49:47 1.10 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/SimpleClientPanel.java 2008/05/14 20:37:10 1.11 @@ -248,48 +248,28 @@ className = createText (null, DP_IMPL_CLASS, DP_IMPL_CLASS); ButtonGroup group = new ButtonGroup(); - JRadioButton htNone, htRegistry, htEndpoint, htLocal, htNewURL, htPing; + JRadioButton htNone, htRegistry, htEndpoint, htLocal, htNewURL; group.add (htEndpoint = createHowToButton ("Use service's usual endpoint", DP_CS_URL)); group.add (htNone = createHowToButton ("No real call, just show/echo input", DP_CS_NONE)); group.add (htRegistry = createHowToButton ("Ask registry where service is, and call it", DP_CS_REGISTRY)); group.add (htNewURL = createHowToButton ("Use this endpoint", DP_CS_NEWURL)); group.add (htLocal = createHowToButton ("Use this local class", DP_CS_CLASS)); - group.add (htPing = createHowToButton ("'Ping' this service", DP_CS_PING)); - htPing.setToolTipText("A Moby 'Ping' is used to determine if the service is responsive, " + - "and if it responds in an API-compliant manner"); - - - boolean usingAsBytes = getPrefValue (DP_INP_ASBYTES, false); - JCheckBox asBytes = createCheckBox - ("Send data to service as a byte array", - usingAsBytes, -1, - new ItemListener() { - public void itemStateChanged (ItemEvent e) { - boolean enabled = (e.getStateChange() == ItemEvent.SELECTED); - onAsBytes (enabled); - setPrefValue (DP_INP_ASBYTES, enabled); - propertyChannel.put (DP_INP_ASBYTES, - new Boolean (enabled).toString()); - } - }); - onAsBytes (usingAsBytes); - asBytes.setToolTipText ("It should not have any effect on result; it is for debugging"); - Font font = asBytes.getFont(); - asBytes.setFont (font.deriveFont (Math.max (1, font.getSize2D() - 1))); - - SwingUtils.addComponent (howTo, htEndpoint, 0, 0, 2, 1, HORI, NWEST, 1.0, 0.0); - SwingUtils.addComponent (howTo, htNewURL, 0, 1, 1, 1, NONE, NWEST, 0.0, 0.0); - SwingUtils.addComponent (howTo, endpoint, 1, 1, 1, 1, HORI, NWEST, 1.0, 0.0); - SwingUtils.addComponent (howTo, htRegistry, 0, 2, 2, 1, NONE, NWEST, 0.0, 0.0); - SwingUtils.addComponent (howTo, htLocal, 0, 3, 1, 1, NONE, NWEST, 0.0, 0.0); - SwingUtils.addComponent (howTo, className, 1, 3, 1, 1, HORI, NWEST, 1.0, 0.0); - SwingUtils.addComponent (howTo, htNone, 0, 4, 2, 1, NONE, NWEST, 0.0, 0.0); - SwingUtils.addComponent (howTo, htPing, 0, 5, 2, 1, NONE, NWEST, 0.0, 0.0); - SwingUtils.addComponent (howTo, asBytes, 0, 6, 2, 1, NONE, NWEST, 0.0, 0.0, BREATH_TOP); // run the service + // determine button text from preferences + boolean usingPing = getPrefValue (DP_INP_PING, false); + boolean usingAsBytes = getPrefValue (DP_INP_ASBYTES, false); + String runLabel = " Call Service "; + if (usingPing) { + if (usingAsBytes) runLabel = " Ping and Show Input "; + else runLabel = " Ping Service "; + } + else { + if (usingAsBytes) runLabel = " Show Input "; + } + runButton = - createButton (" Call service ", + createButton (runLabel, "Invoke selected service", KeyEvent.VK_C, new ActionListener() { @@ -324,6 +304,74 @@ JPanel buttonPanel = createButtonPanel (new JButton[] { runButton, stopButton }); + + JCheckBox asPing = createCheckBox + ("'Ping' this service", + usingPing, -1, + new ItemListener() { + public void itemStateChanged (ItemEvent e) { + boolean enabled = (e.getStateChange() == ItemEvent.SELECTED); + setPropertySelect (enabled, DP_INP_PING); + setPrefValue (DP_INP_PING, enabled); + propertyChannel.put (DP_INP_PING, + new Boolean (enabled).toString()); + if (enabled) { + if (propertyChannel.getString(DP_INP_ASBYTES).toLowerCase().equals("true")) + runButton.setText(" Ping and Show Input "); + else runButton.setText(" Ping Service "); + } + else { + if (propertyChannel.getString(DP_INP_ASBYTES).toLowerCase().equals("true")) + runButton.setText(" Show Input "); + else runButton.setText(" Call Service "); + } + } + }); + setPropertySelect (usingPing, DP_INP_PING); + asPing.setToolTipText ("A Moby 'Ping' is used to determine if the service is responsive " + + "and if it responds in an API-compliant manner."); + Font font = asPing.getFont(); + asPing.setFont (font.deriveFont (Math.max (1, font.getSize2D() - 1))); + + JCheckBox asBytes = createCheckBox + ("Send data to service as a byte array", + usingAsBytes, -1, + new ItemListener() { + public void itemStateChanged (ItemEvent e) { + boolean enabled = (e.getStateChange() == ItemEvent.SELECTED); + setPropertySelect (enabled, DP_INP_ASBYTES); + setPrefValue (DP_INP_ASBYTES, enabled); + propertyChannel.put (DP_INP_ASBYTES, + new Boolean (enabled).toString()); + if (enabled) { + if (propertyChannel.getString(DP_INP_PING).toLowerCase().equals("true")) + runButton.setText(" Ping and Show Input "); + else runButton.setText(" Show Input "); + } + else { + if (propertyChannel.getString(DP_INP_PING).toLowerCase().equals("true")) + runButton.setText(" Ping Service "); + else runButton.setText(" Call Service "); + } + + } + }); + setPropertySelect (usingAsBytes, DP_INP_ASBYTES); + asBytes.setToolTipText ("It should not have any effect on result; it is for debugging"); + font = asBytes.getFont(); + asBytes.setFont (font.deriveFont (Math.max (1, font.getSize2D() - 1))); + + + SwingUtils.addComponent (howTo, htEndpoint, 0, 0, 2, 1, HORI, NWEST, 1.0, 0.0); + SwingUtils.addComponent (howTo, htNewURL, 0, 1, 1, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent (howTo, endpoint, 1, 1, 1, 1, HORI, NWEST, 1.0, 0.0); + SwingUtils.addComponent (howTo, htRegistry, 0, 2, 2, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent (howTo, htLocal, 0, 3, 1, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent (howTo, className, 1, 3, 1, 1, HORI, NWEST, 1.0, 0.0); + SwingUtils.addComponent (howTo, htNone, 0, 4, 2, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent (howTo, asPing, 0, 5, 2, 1, NONE, NWEST, 0.0, 0.0, BREATH_TOP); + SwingUtils.addComponent (howTo, asBytes, 0, 6, 2, 1, NONE, NWEST, 0.0, 0.0); + Component glue = Box.createVerticalGlue(); SwingUtils.addComponent (p, selService, 0, 0, 1, 1, NONE, CENTER, 0.0, 0.0); @@ -334,12 +382,11 @@ } /************************************************************************** - * Select/unselect using 'send as bytes'... + * Select/unselect using 'send as bytes' or 'ping'... **************************************************************************/ - protected void onAsBytes (boolean enabled) { - setPrefValue (DP_INP_ASBYTES, enabled); - propertyChannel.put (DP_INP_ASBYTES, - new Boolean (enabled).toString()); + protected void setPropertySelect (boolean enabled, String property) { + setPrefValue (property, enabled); + propertyChannel.put (property, new Boolean (enabled).toString()); } /************************************************************************** @@ -542,7 +589,7 @@ } // If we are only pinging the service, set the data object to an empty message - if (DP_CS_PING.equals(propertyChannel.getString(DP_CALL_SERVICE))) { + if (propertyChannel.getString(DP_INP_PING).toLowerCase().equals("true")) { String emptyMsg = "\n" + "\n" + " \n" + @@ -576,7 +623,7 @@ if (exception == null) { // handle results here (using renderers...) - if (DP_CS_PING.equals(propertyChannel.getString(DP_CALL_SERVICE))) { + if (propertyChannel.getString(DP_INP_PING).toLowerCase().equals("true")) { propertyChannel.fire (DP_STATUS_MSG, service.getName()+" isAlive."); } else { propertyChannel.fire (DP_STATUS_MSG, "Service invocation finished."); @@ -587,7 +634,7 @@ } } else { - if (DP_CS_PING.equals(propertyChannel.getString(DP_CALL_SERVICE))) { + if (propertyChannel.getString(DP_INP_PING).toLowerCase().equals("true")) { propertyChannel.fire (DP_STATUS_MSG, service.getName()+" is dead."); results.removeResults(); } else { From kawas at dev.open-bio.org Thu May 15 18:58:47 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 15 May 2008 14:58:47 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805151858.m4FIwlMp016599@dev.open-bio.org> kawas Thu May 15 14:58:47 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/help In directory dev.open-bio.org:/tmp/cvs-serv16554/src/main/org/biomoby/service/dashboard/help Added Files: PerlMoSeSPanel.html Log Message: initial commit of panel for Perl-MoSeS moby-live/Java/src/main/org/biomoby/service/dashboard/help PerlMoSeSPanel.html,NONE,1.1 From kawas at dev.open-bio.org Thu May 15 18:58:47 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 15 May 2008 14:58:47 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805151858.m4FIwl0T016585@dev.open-bio.org> kawas Thu May 15 14:58:47 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard In directory dev.open-bio.org:/tmp/cvs-serv16554/src/main/org/biomoby/service/dashboard Added Files: PerlMoSeSPanel.java PerlMoSeSSyntaxDocument.java Log Message: initial commit of panel for Perl-MoSeS moby-live/Java/src/main/org/biomoby/service/dashboard PerlMoSeSPanel.java,NONE,1.1 PerlMoSeSSyntaxDocument.java,NONE,1.1 From kawas at dev.open-bio.org Thu May 15 18:59:25 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 15 May 2008 14:59:25 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805151859.m4FIxPM3016661@dev.open-bio.org> kawas Thu May 15 14:59:25 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/config/dashboard/META-INF/services In directory dev.open-bio.org:/tmp/cvs-serv16626/src/config/dashboard/META-INF/services Modified Files: org.biomoby.service.dashboard.DashboardPanel Log Message: added the panel for Perl-MoSeS moby-live/Java/src/config/dashboard/META-INF/services org.biomoby.service.dashboard.DashboardPanel,1.8,1.9 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/config/dashboard/META-INF/services/org.biomoby.service.dashboard.DashboardPanel,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- /home/repository/moby/moby-live/Java/src/config/dashboard/META-INF/services/org.biomoby.service.dashboard.DashboardPanel 2006/02/19 18:42:55 1.8 +++ /home/repository/moby/moby-live/Java/src/config/dashboard/META-INF/services/org.biomoby.service.dashboard.DashboardPanel 2008/05/15 18:59:25 1.9 @@ -5,3 +5,4 @@ org.biomoby.service.dashboard.StatisticsPanel org.biomoby.service.dashboard.DebuggingPanel org.biomoby.service.dashboard.ExamplePanel +org.biomoby.service.dashboard.PerlMoSeSPanel \ No newline at end of file From kawas at dev.open-bio.org Thu May 15 19:03:54 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 15 May 2008 15:03:54 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805151903.m4FJ3sL6016765@dev.open-bio.org> kawas Thu May 15 15:03:54 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/images In directory dev.open-bio.org:/tmp/cvs-serv16734/src/main/org/biomoby/service/dashboard/images Added Files: pMoses.gif Log Message: moby-live/Java/src/main/org/biomoby/service/dashboard/images pMoses.gif,NONE,1.1 From kawas at dev.open-bio.org Fri May 16 14:42:19 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 16 May 2008 10:42:19 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805161442.m4GEgJs2020120@dev.open-bio.org> kawas Fri May 16 10:42:18 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server In directory dev.open-bio.org:/tmp/cvs-serv20081/Perl/MOBY-Server Modified Files: Makefile.PL META.yml Log Message: moby-live/Perl/MOBY-Server Makefile.PL,1.5,1.6 META.yml,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/Makefile.PL,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Perl/MOBY-Server/Makefile.PL 2008/04/23 13:08:11 1.5 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/Makefile.PL 2008/05/16 14:42:18 1.6 @@ -3,7 +3,7 @@ # Define metadata name 'MOBY'; - version '1.03'; + version '1.04'; license 'perl'; abstract 'This distribution is for communicating with or creating your own MOBY Central registry'; @@ -30,6 +30,7 @@ if ( not( $^O =~ /MSWin32|Windows_NT/i ) ) { # non portable requires + requires 'Want' => '0'; requires 'IO::Prompt' => '0.99.2'; requires 'IPC::Shareable' => '0.6'; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/META.yml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/MOBY-Server/META.yml 2008/03/20 17:36:33 1.2 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/META.yml 2008/05/16 14:42:18 1.3 @@ -41,4 +41,4 @@ XML::DOM: 0 XML::LibXML: 1.62 XML::XPath: 1.12 -version: 1.03 +version: 1.04 From kawas at dev.open-bio.org Fri May 16 15:07:55 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 16 May 2008 11:07:55 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805161507.m4GF7tEZ020405@dev.open-bio.org> kawas Fri May 16 11:07:55 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Client In directory dev.open-bio.org:/tmp/cvs-serv20366/Perl/MOBY-Client Modified Files: Makefile.PL Changes Log Message: moby-live/Perl/MOBY-Client Makefile.PL,1.7,1.8 Changes,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/Makefile.PL,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- /home/repository/moby/moby-live/Perl/MOBY-Client/Makefile.PL 2008/05/07 18:24:29 1.7 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/Makefile.PL 2008/05/16 15:07:55 1.8 @@ -4,8 +4,9 @@ # all_from 'lib/MOBY/Client/Central.pm'; author 'Mark Wilkinson '; -version '1.01'; +version '1.02'; license 'perl'; +abstract 'This distribution is for communicating with a MOBY Central registry'; build_requires 'Test::More' => 0; build_requires 'Test::Pod' => 0; =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Client/Changes,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Perl/MOBY-Client/Changes 2008/03/05 18:38:40 1.2 +++ /home/repository/moby/moby-live/Perl/MOBY-Client/Changes 2008/05/16 15:07:55 1.3 @@ -1,4 +1,18 @@ -Revision history for Moby-Client +Revision history for MOBY-Client + +1.02 16 May 2008 + * fixed bug in MOBY::Client::Central::DUMP that resulted + in an error ('Not an ARRAY reference at + MOBY/Client/Central.pm line 1927') being raised. + Thanks to Pieter Neerincx for finding the bug and a + solution. + + * fixed bug that allowed service types to be registered + with empty ISA relationships. + + * MOBY WSRF implementation was not WSRF compliant in some + points, and the same happened with sample code. Both the + libraries and the generated WSDL have been fixed. 1.01 5 March 2008 * removed some failing pod tests From kawas at dev.open-bio.org Sun May 18 12:43:10 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Sun, 18 May 2008 08:43:10 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805181243.m4IChAPJ029618@dev.open-bio.org> kawas Sun May 18 08:43:09 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard In directory dev.open-bio.org:/tmp/cvs-serv29582/src/main/org/biomoby/service/dashboard Modified Files: PerlMoSeSPanel.java Log Message: made the 'generate cgi services' check box a radio button added a pop that occurs when generating services. moby-live/Java/src/main/org/biomoby/service/dashboard PerlMoSeSPanel.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java 2008/05/15 18:58:47 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java 2008/05/18 12:43:09 1.2 @@ -30,6 +30,7 @@ import javax.swing.AbstractButton; import javax.swing.BorderFactory; import javax.swing.Box; +import javax.swing.ButtonGroup; import javax.swing.Icon; import javax.swing.JButton; import javax.swing.JCheckBox; @@ -39,6 +40,7 @@ import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; +import javax.swing.JRadioButton; import javax.swing.JScrollPane; import javax.swing.JSplitPane; import javax.swing.JTabbedPane; @@ -71,6 +73,8 @@ static String PM_OVERWRITE = "perl-moses-overwrite"; static String PM_CGI = "perl-moses-cgi"; + + static String PM_SOAP = "perl-moses-soap"; static String PM_UPDATE_SERVICE_CACHE = "perl-moses-update-service-cache"; @@ -266,8 +270,7 @@ JPanel bPanel = createTitledPanel("Generate"); JCheckBox genOverwrite = createActionBox("Overwrite Existing Code", PM_OVERWRITE); - JCheckBox genCgi = createActionBox("Generate CGI Service", PM_CGI); - + generateBtn = createButton("Generate Skeletons", "Generate skeletons from selected services", KeyEvent.VK_G, new ActionListener() { @@ -305,9 +308,15 @@ } }); + ButtonGroup group = new ButtonGroup(); + JRadioButton genCgi, genSoap; + group.add (genCgi = createHowToButton ("Generate CGI Service", PM_CGI)); + group.add (genSoap = createHowToButton ("Generate SOAP Service", PM_SOAP)); + SwingUtils.addComponent(bPanel, genOverwrite, 0, 0, 1, 1, NONE, NWEST, 0.0, 0.0); SwingUtils.addComponent(bPanel, genCgi, 0, 1, 2, 1, NONE, NWEST, 0.0, 0.0); - SwingUtils.addComponent(bPanel, generateBtn, 0, 2, 2, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent(bPanel, genSoap, 0, 2, 2, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent(bPanel, generateBtn, 0, 3, 2, 1, NONE, NWEST, 0.0, 0.0); JPanel uPanel = createTitledPanel("Utilities"); JCheckBox syncServices = createActionBox("Synchronize Services", @@ -585,6 +594,23 @@ return panel; } + private JRadioButton createHowToButton (String title, String howTo) { + JRadioButton radio = new JRadioButton (title); + radio.setActionCommand (howTo); + radio.addActionListener (howToListener); + if (!howTo.equals(PM_CGI)) { + radio.setSelected (true); + radio.setEnabled (true); + } + propertyChannel.put (PM_CGI, false); + return radio; + } + private ActionListener howToListener = new ActionListener() { + public void actionPerformed (ActionEvent e) { + String howTo = e.getActionCommand(); + propertyChannel.put (PM_CGI, howTo.equals(PM_CGI)); + } + }; private JPanel getServicesSelectionPanel() { JPanel p = new JPanel(new GridBagLayout()); p.setBorder(createFatBorder("Select services to work with", @@ -810,8 +836,9 @@ .add(propertyChannel .getString(DashboardProperties.DP_REGISTRY_ENDPOINT)); if (Boolean.parseBoolean(propertyChannel - .getString(PM_CGI))) + .getString(PM_CGI))){ command.add("-c"); + } command.add(authority); // place command into com String[] com = command.toArray(new String[] {}); @@ -858,6 +885,10 @@ propertyChannel .fire(DP_STATUS_MSG, "Generating Perl-MoSeS service skeletons complete!"); + JOptionPane.showMessageDialog(null, + "Processing of selected service completed!\n" + + "Please check the 'console' to ensure that the service\n" + + "skeletons were generated correctly.", "Completed", JOptionPane.INFORMATION_MESSAGE); if (!(propertyChannel.getBoolean(PM_SYNC_DATATYPES, false) || propertyChannel .getBoolean(PM_SYNC_SERVICES, false))) { syncBtn.setEnabled(true); @@ -900,8 +931,9 @@ .add(propertyChannel .getString(DashboardProperties.DP_REGISTRY_ENDPOINT)); if (Boolean.parseBoolean(propertyChannel - .getString(PM_CGI))) + .getString(PM_CGI))){ command.add("-c"); + } command.add(auth); command.add(name); // place command into com @@ -951,6 +983,10 @@ propertyChannel .fire(DP_STATUS_MSG, "Generating Perl-MoSeS service skeletons complete!"); + JOptionPane.showMessageDialog(null, + "Processing of selected service completed!\n" + + "Please check the 'console' to ensure that the service\n" + + "skeletons were generated correctly.", "Completed", JOptionPane.INFORMATION_MESSAGE); if (!(propertyChannel.getBoolean(PM_SYNC_DATATYPES, false) || propertyChannel .getBoolean(PM_SYNC_SERVICES, false))) { syncBtn.setEnabled(true); From kawas at dev.open-bio.org Tue May 20 15:33:01 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 20 May 2008 11:33:01 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805201533.m4KFX1it007192@dev.open-bio.org> kawas Tue May 20 11:33:00 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard In directory dev.open-bio.org:/tmp/cvs-serv7153/src/main/org/biomoby/service/dashboard Modified Files: PerlMoSeSPanel.java PerlMoSeSSyntaxDocument.java Log Message: added code that moves the cursor around when certain characters are inserted. the way i did it is less than ideal and should be changed once a better method is found. moby-live/Java/src/main/org/biomoby/service/dashboard PerlMoSeSPanel.java,1.2,1.3 PerlMoSeSSyntaxDocument.java,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java 2008/05/18 12:43:09 1.2 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java 2008/05/20 15:33:00 1.3 @@ -128,7 +128,7 @@ private Icon zoomInIcon, zoomInIconDis; private Icon zoomOutIcon, zoomOutIconDis; - private JTextPane editorTextPane; + private static JTextPane editorTextPane; private JComboBox fonts; @@ -533,6 +533,10 @@ return p; } + protected static void moveCursor(int pos) { + if (editorTextPane != null && editorTextPane.isEnabled() && pos >= 0 && pos < editorTextPane.getText().length()) + editorTextPane.setCaretPosition(pos); + } private JComponent getFontChooser() { JLabel label = new JLabel("Font:"); JPanel panel = new JPanel(new FlowLayout()); =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSSyntaxDocument.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSSyntaxDocument.java 2008/05/15 18:58:47 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSSyntaxDocument.java 2008/05/20 15:33:00 1.2 @@ -14,6 +14,7 @@ import javax.swing.text.SimpleAttributeSet; import javax.swing.text.StyleConstants; + /** * This class implements the functionality needed to create * a Stylized view of perl scripts in the Perl MoSeS editor @@ -152,12 +153,18 @@ @Override public void insertString(int offset, String str, AttributeSet a) throws BadLocationException { + boolean replaced = false; if (str.equals("{") || str.equals("[") || str.equals("(")) { str = addMatchingToken(offset, str); + replaced = true; } super.insertString(offset, str, a); processChangedLines(offset, str.length()); + if (replaced) { + // FIXME bad hack to move the cursor ... + PerlMoSeSPanel.moveCursor(offset+str.length() - 2); + } } @Override @@ -344,6 +351,7 @@ /* * Parse the line for tokens to highlight */ + boolean inQuote = false; private void checkForTokens(String content, int startOffset, int endOffset) { while (startOffset <= endOffset) { // skip the delimiters to find the start of a new token @@ -393,8 +401,7 @@ else endOfQuote = index; - doc.setCharacterAttributes(startOffset, endOfQuote - startOffset + 1, - quote, false); + doc.setCharacterAttributes(startOffset, endOfQuote - startOffset + 1, quote, false); return endOfQuote + 1; } @@ -590,6 +597,6 @@ if (token.equals("{")) return token + "\n" + whiteSpace.toString() + " \n" + whiteSpace.toString() + token_map.get(token); - return token + whiteSpace.toString() + " " + whiteSpace.toString() + token_map.get(token); + return token + " " + token_map.get(token); } } From kawas at dev.open-bio.org Tue May 20 17:20:38 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 20 May 2008 13:20:38 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805201720.m4KHKc3I007403@dev.open-bio.org> kawas Tue May 20 13:20:38 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard In directory dev.open-bio.org:/tmp/cvs-serv7368/src/main/org/biomoby/service/dashboard Modified Files: PerlMoSeSSyntaxDocument.java Log Message: fixed the nesting of curly braces moby-live/Java/src/main/org/biomoby/service/dashboard PerlMoSeSSyntaxDocument.java,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSSyntaxDocument.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSSyntaxDocument.java 2008/05/20 15:33:00 1.2 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSSyntaxDocument.java 2008/05/20 17:20:38 1.3 @@ -156,6 +156,7 @@ boolean replaced = false; if (str.equals("{") || str.equals("[") || str.equals("(")) { str = addMatchingToken(offset, str); + replaced = true; } @@ -163,7 +164,7 @@ processChangedLines(offset, str.length()); if (replaced) { // FIXME bad hack to move the cursor ... - PerlMoSeSPanel.moveCursor(offset+str.length() - 2); + PerlMoSeSPanel.moveCursor(str.lastIndexOf("\n") >= 0 ? offset + str.lastIndexOf("\n") : offset+str.length() - 2); } } From gordonp at dev.open-bio.org Tue May 20 22:59:48 2008 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Tue, 20 May 2008 18:59:48 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805202259.m4KMxmd3007719@dev.open-bio.org> gordonp Tue May 20 18:59:48 EDT 2008 Update of /home/repository/moby/moby-live/Java/docs In directory dev.open-bio.org:/tmp/cvs-serv7679 Modified Files: deployingServices.html deployingServicesBasic.html Log Message: Added note re: registration with non-default Moby Central moby-live/Java/docs deployingServices.html,1.15,1.16 deployingServicesBasic.html,1.2,1.3 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/deployingServices.html,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- /home/repository/moby/moby-live/Java/docs/deployingServices.html 2007/12/17 17:49:44 1.15 +++ /home/repository/moby/moby-live/Java/docs/deployingServices.html 2008/05/20 22:59:48 1.16 @@ -296,6 +296,12 @@ in the Tomcat manager interface shown previously).

    +

    Using a different MOBY Central: + By default, the annotation assumes that the default public Moby Central will be used (this is determined + automagically by a combination of hardcoding and fetching info from biomoby.org). If you want to + use a different Moby Central, e.g. a test registry, add the centralEndpoint string + to the annotation.

    +

    Moving Your Service: The WAR you've built is completely self-contained, therefore you should be able to move your service simply by copying the WAR to another servlet container. You can e-mail it to your friends, so they can =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/deployingServicesBasic.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- /home/repository/moby/moby-live/Java/docs/deployingServicesBasic.html 2007/03/12 17:57:51 1.2 +++ /home/repository/moby/moby-live/Java/docs/deployingServicesBasic.html 2008/05/20 22:59:48 1.3 @@ -293,6 +293,12 @@ in the Tomcat manager interface shown previously).

    +

    Using a different MOBY Central: + By default, the annotation assumes that the default public Moby Central will be used (this is determined + automagically by a combination of hardcoding and fetching info from biomoby.org). If you want to + use a different Moby Central, e.g. a test registry, add the centralEndpoint string + to the annotation.

    +

    Moving Your Service: The WAR you've built is completely self-contained, therefore you should be able to move your service simply by copying the WAR to another servlet container. You can e-mail it to your friends, so they can From gordonp at dev.open-bio.org Wed May 21 19:14:10 2008 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 21 May 2008 15:14:10 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805211914.m4LJEAHS010851@dev.open-bio.org> gordonp Wed May 21 15:14:10 EDT 2008 Update of /home/repository/moby/moby-live/Java/docs In directory dev.open-bio.org:/tmp/cvs-serv10819 Added Files: acdServlet.html Log Message: Added preliminary ACDServlet documentation moby-live/Java/docs acdServlet.html,NONE,1.1 From gordonp at dev.open-bio.org Wed May 21 19:14:10 2008 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 21 May 2008 15:14:10 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805211914.m4LJEAPC010865@dev.open-bio.org> gordonp Wed May 21 15:14:10 EDT 2008 Update of /home/repository/moby/moby-live/Java/docs/images In directory dev.open-bio.org:/tmp/cvs-serv10819/images Added Files: acdservlet.png Log Message: Added preliminary ACDServlet documentation moby-live/Java/docs/images acdservlet.png,NONE,1.1 From gordonp at dev.open-bio.org Wed May 21 19:18:23 2008 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 21 May 2008 15:18:23 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805211918.m4LJINKJ010935@dev.open-bio.org> gordonp Wed May 21 15:18:22 EDT 2008 Update of /home/repository/moby/moby-live/Java/docs In directory dev.open-bio.org:/tmp/cvs-serv10899 Modified Files: index.html Log Message: Added preliminary ACDServlet documentation moby-live/Java/docs index.html,1.32,1.33 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/index.html,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- /home/repository/moby/moby-live/Java/docs/index.html 2008/03/08 12:34:07 1.32 +++ /home/repository/moby/moby-live/Java/docs/index.html 2008/05/21 19:18:22 1.33 @@ -170,12 +170,12 @@

  • Using general methods
      -
    • How to develop a BioMoby +
    • How to develop a BioMoby service, an alternate mechanism for the Extremely Lazy, Complete Idiots, Dummies, etc. (a.k.a. "MobyServlet") +
    • A note on using secondary articles with MobyServlet
    • A note on using secondary articles with MobyServlet +border=0/>How to wrap an EMBOSS/ACD program as a Moby service
    • The org.biomoby.shared.data package "In Anger": creating data instances
    • From gordonp at dev.open-bio.org Wed May 21 19:20:56 2008 From: gordonp at dev.open-bio.org (Paul Gordon) Date: Wed, 21 May 2008 15:20:56 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805211920.m4LJKuvK010997@dev.open-bio.org> gordonp Wed May 21 15:20:56 EDT 2008 Update of /home/repository/moby/jars-archive/current In directory dev.open-bio.org:/tmp/cvs-serv10965 Added Files: ACDServlet.war ACDServlet.README.txt Log Message: Preliminary commit of EMBOSS wrapping servlet jars-archive/current ACDServlet.war,NONE,1.1 ACDServlet.README.txt,NONE,1.1 From senger at dev.open-bio.org Thu May 22 17:09:31 2008 From: senger at dev.open-bio.org (Martin Senger) Date: Thu, 22 May 2008 13:09:31 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805221709.m4MH9V3q014439@dev.open-bio.org> senger Thu May 22 13:09:31 EDT 2008 Update of /home/repository/moby/moby-live/Java/docs In directory dev.open-bio.org:/tmp/cvs-serv14420 Modified Files: ChangeLog Log Message: fixed registering data type from an XML file, in Dashboard moby-live/Java/docs ChangeLog,1.89,1.90 =================================================================== RCS file: /home/repository/moby/moby-live/Java/docs/ChangeLog,v retrieving revision 1.89 retrieving revision 1.90 diff -u -r1.89 -r1.90 --- /home/repository/moby/moby-live/Java/docs/ChangeLog 2008/04/19 19:11:17 1.89 +++ /home/repository/moby/moby-live/Java/docs/ChangeLog 2008/05/22 17:09:30 1.90 @@ -1,3 +1,7 @@ +2008-05-23 Martin Senger + + * Fixed: registering data types from an XML file, in Dashboard + 2008-04-20 Martin Senger * Changed CreateMobyInput client - it now requires to use the From senger at dev.open-bio.org Thu May 22 17:09:40 2008 From: senger at dev.open-bio.org (Martin Senger) Date: Thu, 22 May 2008 13:09:40 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805221709.m4MH9eUO014476@dev.open-bio.org> senger Thu May 22 13:09:40 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard In directory dev.open-bio.org:/tmp/cvs-serv14457 Modified Files: RegistrationDataTypeSubPanel.java Log Message: fixed registering data type from an XML file, in Dashboard moby-live/Java/src/main/org/biomoby/service/dashboard RegistrationDataTypeSubPanel.java,1.10,1.11 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationDataTypeSubPanel.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationDataTypeSubPanel.java 2005/12/20 20:00:41 1.10 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/RegistrationDataTypeSubPanel.java 2008/05/22 17:09:40 1.11 @@ -130,7 +130,7 @@ KeyEvent.VK_X); fromXMLButton = createFromXMLButton ("Register this data type from a raw XML in a file", - "registerDataType", + "registerObjectClass", KeyEvent.VK_F, REG_DT_FROM_XML, createXMLChooser (REG_DT_FROM_XML)); From walexander at dev.open-bio.org Tue May 27 16:06:14 2008 From: walexander at dev.open-bio.org (Wendy Alexander) Date: Tue, 27 May 2008 12:06:14 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805271606.m4RG6EHP011022@dev.open-bio.org> walexander Tue May 27 12:06:14 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard In directory dev.open-bio.org:/tmp/cvs-serv10987 Modified Files: SimpleClientPanel.java Log Message: Changed the way the label on the run button changes when the ping checkbox or the show input radio button is selected. moby-live/Java/src/main/org/biomoby/service/dashboard SimpleClientPanel.java,1.11,1.12 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/SimpleClientPanel.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/SimpleClientPanel.java 2008/05/14 20:37:10 1.11 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/SimpleClientPanel.java 2008/05/27 16:06:14 1.12 @@ -250,7 +250,23 @@ ButtonGroup group = new ButtonGroup(); JRadioButton htNone, htRegistry, htEndpoint, htLocal, htNewURL; group.add (htEndpoint = createHowToButton ("Use service's usual endpoint", DP_CS_URL)); - group.add (htNone = createHowToButton ("No real call, just show/echo input", DP_CS_NONE)); + htNone = createHowToButton ("No real call, just show/echo input", DP_CS_NONE); + htNone.addItemListener( + new ItemListener() { + public void itemStateChanged (ItemEvent e) { + boolean enabled = (e.getStateChange() == ItemEvent.SELECTED); + if (enabled) runButton.setText(" Show Input "); + else { + if (propertyChannel.getBoolean(DP_INP_PING, false)){ + runButton.setText(" Ping Service "); + } + else { + runButton.setText(" Call Service "); + } + } + } + }); + group.add (htNone); group.add (htRegistry = createHowToButton ("Ask registry where service is, and call it", DP_CS_REGISTRY)); group.add (htNewURL = createHowToButton ("Use this endpoint", DP_CS_NEWURL)); group.add (htLocal = createHowToButton ("Use this local class", DP_CS_CLASS)); @@ -260,13 +276,9 @@ boolean usingPing = getPrefValue (DP_INP_PING, false); boolean usingAsBytes = getPrefValue (DP_INP_ASBYTES, false); String runLabel = " Call Service "; - if (usingPing) { - if (usingAsBytes) runLabel = " Ping and Show Input "; - else runLabel = " Ping Service "; - } - else { - if (usingAsBytes) runLabel = " Show Input "; - } + if (propertyChannel.getString(DP_CALL_SERVICE).equals(DP_CS_NONE)) + runLabel = " Show Input "; + else if (usingPing) runLabel = " Ping Service "; runButton = createButton (runLabel, @@ -316,14 +328,16 @@ propertyChannel.put (DP_INP_PING, new Boolean (enabled).toString()); if (enabled) { - if (propertyChannel.getString(DP_INP_ASBYTES).toLowerCase().equals("true")) - runButton.setText(" Ping and Show Input "); - else runButton.setText(" Ping Service "); + if (propertyChannel.getString(DP_CALL_SERVICE).equals(DP_CS_NONE)) + runButton.setText(" Show Input "); + else + runButton.setText(" Ping Service "); } else { - if (propertyChannel.getString(DP_INP_ASBYTES).toLowerCase().equals("true")) + if (propertyChannel.getString(DP_CALL_SERVICE).equals(DP_CS_NONE)) runButton.setText(" Show Input "); - else runButton.setText(" Call Service "); + else + runButton.setText(" Call Service "); } } }); @@ -343,17 +357,6 @@ setPrefValue (DP_INP_ASBYTES, enabled); propertyChannel.put (DP_INP_ASBYTES, new Boolean (enabled).toString()); - if (enabled) { - if (propertyChannel.getString(DP_INP_PING).toLowerCase().equals("true")) - runButton.setText(" Ping and Show Input "); - else runButton.setText(" Show Input "); - } - else { - if (propertyChannel.getString(DP_INP_PING).toLowerCase().equals("true")) - runButton.setText(" Ping Service "); - else runButton.setText(" Call Service "); - } - } }); setPropertySelect (usingAsBytes, DP_INP_ASBYTES); From kawas at dev.open-bio.org Tue May 27 17:23:53 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 27 May 2008 13:23:53 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805271723.m4RHNrbI011135@dev.open-bio.org> kawas Tue May 27 13:23:53 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/help In directory dev.open-bio.org:/tmp/cvs-serv11100/src/main/org/biomoby/service/dashboard/help Modified Files: PerlMoSeSPanel.html Log Message: * new documentation for the 'Local User Config' sub panel * modifed the the 'generator' section to reflect some ui changes moby-live/Java/src/main/org/biomoby/service/dashboard/help PerlMoSeSPanel.html,1.1,1.2 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/help/PerlMoSeSPanel.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/help/PerlMoSeSPanel.html 2008/05/15 18:58:47 1.1 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/help/PerlMoSeSPanel.html 2008/05/27 17:23:53 1.2 @@ -18,11 +18,14 @@

      All activities are done using the command line utilities installed by the Perl-MoSeS module.

      MoSeS Toolkit

      The MoSeS Toolkit sub panel allows you to:

      -
        -
      • Generate - generate perl modules for services that you select,
      • +
        • Generate - generate perl modules for services that you select,
        • Utilities - for synchronizing Perl-MoSeS with the Dashboard, and an
        • Editor - .for easily editing the business logic of services that you create.
        • +
        • Local User Config - for those users without root access when they installed Perl-MoSeS*
        +
        +

        * when the panel is created, it makes a best attempt to determine whether or not the cpan module MOSES-MOBY was installed as root. If it was not, this sub panel is visible.

        +

        Possible caveats:

        • The actions in this panel depend on the availability of certain command line tools (installed by MOSES-MOBY) being available on the system PATH.
        • @@ -31,7 +34,8 @@

          There is one generator in this panel for creating services, with a couple of options.

          • Overwrite Existing Code - use this to overwrite any service code that has already been generated with MoSeS
          • -
          • Generate CGI Service - use this to generate a category 'cgi' BioMOBY web service.
          • +
          • Generate CGI Service - use this to generate a category 'cgi' BioMOBY web service.
          • +
          • Generate SOAP Service - use this to generate a category 'moby' BioMOBY web service.

          Once you have chosen your desired options, you can click on the Generate Skeletons button. This will go through and generate perl modules that represent the services that you selected in the 'Service Browser'.

          All files are generated into your local Perl-MoSeS/ installation. For instance, assuming that your username is moby_user and that your home directory is /home/moby_user/, then you could find your service skeletons in /home/moby_user/Perl-MoSeS/services/Service/ directory.

          @@ -50,6 +54,27 @@
        • Close - used to remove the script from view.

        There are also a two buttons for enlarging or shrinking the text in the editor.

        +

        Local User Config

        +

        The configuration sub panel allows you to specify:

        +
          +
        • Perl Install Path - this is the path to the PERL executable, for instance, /usr/bin/perl [required]
        • +
        • PERL5LIB directory - a directory to add to Perls' @INC [optional]
        • +
        • PERL5LIB directory (2) - another directory to add to Perls' @INC [optional]
        • +
        • MoSeS Scripts Directory - the directory that contains the moses-*.pl scripts [required]
        • +
        +

        Once this information is entered, and the 'Test user config' is clicked, we check whether the required MOSES scripts are accessible. If everything is deemed to be fine, the other sub panels are enabled. Otherwise, you will be prompted to check your values.

        +

        Help on setting your local user configuration

        +

        Some users find this information hard to obtain. One trick that I use is to enter 'perl -V' at the command prompt. Among other things, one of the last things that you will see displayed is something like:

        +
        Built under linux
        Compiled at Nov 27 2007 10:44:36
        @INC:
        /etc/perl
        /usr/local/lib/perl/5.8.8
        /usr/local/share/perl/5.8.8
        /usr/lib/perl5
        /usr/share/perl5
        /usr/lib/perl/5.8
        /usr/share/perl/5.8
        /usr/local/lib/site_perl
        .
        +

        Keeping the above in mind and remembering that when you installed (locally for just you and not system wide!) MOSES-MOBY from the command prompt, you specified a PREFIX=/some/path/, similar to the following:

        +
           perl Makefile.PL PREFIX=/home/ekawas/usr/local
        +

        The values that you would then enter for PERL5LIB are:

        +
          +
        • /home/ekawas/usr/local/lib/perl/5.8.8
        • +
        • /home/ekawas/usr/local/lib/site_perl
        • +
        +

        In other words, you are interested in using the PREFIX/lib/ directories.

        +

        The value that you should set for the MoSeS Scripts Directory are usually located in the PREFIX/bin/ directory.

        Service deployment

        Once you have created your service, you will want to deploy it. Depending on whether you have generated a SOAP service or a CGI based service, the steps to involved to deploy your service.

        Deploying a SOAP Service

        From kawas at dev.open-bio.org Tue May 27 17:25:17 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 27 May 2008 13:25:17 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805271725.m4RHPHhx011193@dev.open-bio.org> kawas Tue May 27 13:25:17 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard In directory dev.open-bio.org:/tmp/cvs-serv11158/src/main/org/biomoby/service/dashboard Modified Files: PerlMoSeSPanel.java Log Message: *the detection for MOSES::MOBY is now silent. *added a subpanel to the perl-moses panel that allows users to use a locally installed version of moses-moby. moby-live/Java/src/main/org/biomoby/service/dashboard PerlMoSeSPanel.java,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java 2008/05/20 15:33:00 1.3 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java 2008/05/27 17:25:17 1.4 @@ -59,46 +59,77 @@ import org.apache.commons.io.FilenameUtils; import org.biomoby.shared.MobyException; +import org.tulsoft.tools.gui.JTextFieldWithHistory; import org.tulsoft.tools.gui.SwingUtils; public class PerlMoSeSPanel extends AbstractPanel { // some properties for the channel + // String: set this to pop up a warning message static String PM_WARNING = "perl-moses-warning"; + // String: set this to pop up an error message static String PM_ERROR = "perl-moses-error"; + // String: set this for an information message static String PM_INFORMATION = "perl-moses-information"; + // boolean - do we over write files static String PM_OVERWRITE = "perl-moses-overwrite"; + // boolean: do we generate cgi services static String PM_CGI = "perl-moses-cgi"; + // boolean do we generate soap services static String PM_SOAP = "perl-moses-soap"; + // boolean: do we update the service cache static String PM_UPDATE_SERVICE_CACHE = "perl-moses-update-service-cache"; + // boolean: do we update the datatype cache static String PM_UPDATE_DATATYPE_CACHE = "perl-moses-update-datatype-cache"; + // boolean: are we currently updating the datatype cache static String PM_SYNC_DATATYPES = "perl-moses-sync-datatypes"; + // boolean: are we currently updating the services cache static String PM_SYNC_SERVICES = "perl-moses-sync-services"; + // boolean: are we generating services by name static String PM_GENERATING_SPECIFIC_SERVICES = "perl-moses-generating-specific-services"; + // boolean: are we generating services by authority static String PM_GENERATING_BY_AUTHORITY = "perl-moses-generating-by-authority"; + // N/A: set this to make the editor save the current file static String PM_FILE_ACTION_SAVE = "perl-moses-file-action-save"; + // N/A: set this to make the editor open a file static String PM_FILE_ACTION_OPEN = "perl-moses-file-action-open"; + // N/A: set this to make the editor close a file static String PM_FILE_ACTION_CLOSE = "perl-moses-file-action-close"; + // String: the full path of the file that we are editing static String PM_FILE_CURRENT = "perl-moses-file-current"; + // String: the checksum of the current open file static String PM_FILE_CURRENT_CHECKSUM = "perl-moses-file-current-checksum"; + // String: the parent directory of the last opened file static String PM_FILE_LAST_DIRECTORY = "perl-moses-file-last-directory"; + + // String: one of the PERL5LIB directories for those that install modules locally + static String PM_PERL_LIB_1 = "perl-moses-perl-lib-1"; + + // String: one of the PERL5LIB directories for those that install modules locally + static String PM_PERL_LIB_2 = "perl-moses-perl-lib-2"; + + // String: the exact path to the locally installed moses scripts + static String PM_SCRIPTS_INSTALL_DIR = "perl-moses-scripts-install-dir"; + + // String: the exact path to the users perl (in case it is not available on the path) + static String PM_PERL_INSTALL_DIR = "perl-moses-perl-install-dir"; // generated serialversionUID private static final long serialVersionUID = 1379466985182986776L; @@ -109,52 +140,95 @@ private JLabel aSelectedCount, sSelectedCount, currentlyEditing; - private JButton generateBtn; - - private JButton syncBtn; - - private JButton editorSaveButton, editorCloseButton, editorOpenButton; + private JButton editorSaveButton, editorCloseButton, editorOpenButton, scriptsBtn, generateBtn, syncBtn; + // are we enabling moses actions private boolean enable_moses_actions = true; + // is the user running windows private boolean is_windows_pc = false; - private Icon openFileIcon, openFileIconDis; - - private Icon closeFileIcon, closeFileIconDis; - - private Icon saveFileIcon, saveFileIconDis; - - private Icon zoomInIcon, zoomInIconDis; - private Icon zoomOutIcon, zoomOutIconDis; + private Icon openFileIcon, openFileIconDis, closeFileIcon, + closeFileIconDis, saveFileIcon, saveFileIconDis, + zoomInIcon, zoomInIconDis, zoomOutIcon, zoomOutIconDis; private static JTextPane editorTextPane; private JComboBox fonts; + /** + * Default constructor: set the image, and determines + * whether or not we are using windows + */ public PerlMoSeSPanel() { super(); panelIconFileName = "images/pMoses.gif"; + if (System.getProperty("os.name").startsWith("Windows")) is_windows_pc = true; // determine if perl & moses are installed - String[] command; + } + + /* + * private method that determines if + * moses is available from the command line. + */ + private void check_install() { + String[] command; + ArrayList prefix = generatePerlPrefix(); + if (is_windows_pc) { - command = new String[] {"moses-cache-tester.bat"}; + prefix.add("moses-cache-tester.bat"); + command = prefix.toArray(new String[]{}); } else { - command = new String[] {"moses-cache-tester.pl"}; + prefix.add((prefix.size() > 0 ? prefix.remove(prefix.size()-1) : "") + "moses-cache-tester.pl"); + command = prefix.toArray(new String[]{}); } - try { Process process; process = Runtime.getRuntime().exec(command); - process.waitFor(); + process.waitFor(); + enable_moses_actions = true; } catch (Exception e) { enable_moses_actions = false; } } /* + * private method that generates the + * + * /path/to/perl -I/some/dir /path/to/scripts + * + * part of the perl call + * + */ + private ArrayList generatePerlPrefix() { + // usually windows installs everything as root + if (is_windows_pc) + return new ArrayList(); + + ArrayList list = new ArrayList(); + String script_path = propertyChannel.getString(PM_SCRIPTS_INSTALL_DIR); + String lib1 = propertyChannel.getString(PM_PERL_LIB_1); + String lib2 = propertyChannel.getString(PM_PERL_LIB_2); + String perl = propertyChannel.getString(PM_PERL_INSTALL_DIR); + + if (perl != null && !perl.trim().equals("") && script_path != null && !script_path.trim().equals("")) { + list.add(perl); + if (lib1 != null && !lib1.trim().equals("")) { + list.add("-I" + lib1.trim()); + } + if (lib2 != null && !lib2.trim().equals("")) { + list.add("-I" + lib2.trim()); + } + if (!script_path.endsWith("/")) + script_path += "/"; + list.add(script_path); + } + return list; + } + + /* * (non-Javadoc) * * @see org.biomoby.service.dashboard.AbstractPanel#getComponent(org.biomoby.service.dashboard.PropertyChannel) @@ -162,18 +236,8 @@ @Override public JComponent getComponent(PropertyChannel propertyChannel) { - if (!enable_moses_actions) { - JOptionPane.showMessageDialog( - null, - "Sorry, Perl-MoSeS is not enabled because we couldn't detect" + - "\nit on your system. Please make sure that it is installed\n" + - "on your machine!", "Perl-MoSeS",JOptionPane.ERROR_MESSAGE); - JPanel p = new JPanel(new BorderLayout(), true); - JLabel l = new JLabel("Please install Perl-MoSes from CPAN before continuing!"); - p.add(l, BorderLayout.PAGE_START); - return p; - } - setPropertyChannel(propertyChannel); + setPropertyChannel(propertyChannel); + determineMoSeSDirectory(); // put some properties in the channel propertyChannel.put(PM_GENERATING_BY_AUTHORITY, new Boolean(false)); @@ -182,7 +246,7 @@ propertyChannel.put(PM_SYNC_DATATYPES, new Boolean(false)); propertyChannel.put(PM_OVERWRITE, new Boolean(false)); propertyChannel.put(PM_CGI, new Boolean(false)); - + propertyChannel.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { if (e.getPropertyName().equals(PM_ERROR)) { @@ -241,20 +305,21 @@ // set up the splitpane JSplitPane vsplit = vSplit(getServicesSelectionPanel(), tabbedPane, 0.8); JSplitPane splitPane = hSplit(vsplit, getEditorPanel(), 0.1); - splitPane.resetToPreferredSizes(); // add the components SwingUtils.addComponent(pComponent, splitPane, 0, 0, 1, 1, BOTH, NWEST, 1.0, 1.0); return pComponent; } + /* + * method for setting what we think is the Perl-MoSeS home + * directory + */ private void determineMoSeSDirectory() { try { // set PM_FILE_LAST_DIRECTORY File f = new File(System.getProperty("user.home"),"Perl-MoSeS"); if (f.exists() && f.isDirectory() && f.canRead() && f.canWrite()) propertyChannel.put(PM_FILE_LAST_DIRECTORY, f.getPath()); - - } catch (Exception e) { } @@ -262,11 +327,70 @@ } private JPanel getMoSeSPanel() { + + check_install(); JPanel p = new JPanel (new GridBagLayout()); p.setBorder (createFatBorder ("Perl-MoSeS", GraphColours.getColour ("cadetblue", Color.blue))); + JPanel sPanel = createTitledPanel("Local User Config"); + if (!enable_moses_actions) { + scriptsBtn = createButton( + "Test user config", + "Check whether or not your local user config is correct", + KeyEvent.VK_R, new ActionListener() { + public void actionPerformed(ActionEvent e) { + if (!enable_moses_actions) { + if (propertyChannel.getString(PM_SCRIPTS_INSTALL_DIR) != null + && !propertyChannel.getString(PM_SCRIPTS_INSTALL_DIR).endsWith("/")) + propertyChannel.put( + PM_SCRIPTS_INSTALL_DIR, + propertyChannel.getString(PM_SCRIPTS_INSTALL_DIR) + "/"); + // check for the scripts + check_install(); + if (enable_moses_actions) { + // we are good to go! enable buttons + syncBtn.setEnabled(enable_moses_actions); + generateBtn.setEnabled(enable_moses_actions); + scriptsBtn.setEnabled(!enable_moses_actions); + propertyChannel.fire(PM_INFORMATION, "Your local configuration was successful!"); + + } else { + // alert them that this directory didnt + // contain anything useful + + propertyChannel.fire(PM_ERROR, + "Sorry, your configuration resulted in error.\n" + + "Please review your values and try again!"); + } + } + } + }); + + JTextFieldWithHistory lib1 = createText (null, PM_PERL_LIB_1, PM_PERL_LIB_1); + JTextFieldWithHistory lib2 = createText (null, PM_PERL_LIB_2, PM_PERL_LIB_2); + JTextFieldWithHistory install_path = createText (null, PM_SCRIPTS_INSTALL_DIR, PM_SCRIPTS_INSTALL_DIR); + JTextFieldWithHistory perl_install_path = createText(null, PM_PERL_INSTALL_DIR, PM_PERL_INSTALL_DIR); + + SwingUtils.addComponent(sPanel, new JLabel("Perl Path: "), 0, 0, 1, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent(sPanel, perl_install_path, 1, 0, 3, 1, HORI, NWEST, 1.0, 0.0); + SwingUtils.addComponent(sPanel, new JLabel("PERL5LIB dir: "), 0, 1, 1, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent(sPanel, lib1, 1, 1, 3, 1, HORI, NWEST, 1.0, 0.0); + SwingUtils.addComponent(sPanel, new JLabel("PERL5LIB dir (2): "), 0, 2, 1, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent(sPanel, lib2, 1, 2, 3, 1, HORI, NWEST, 1.0, 0.0); + SwingUtils.addComponent(sPanel, new JLabel("MoSeS Scripts dir: "),0, 3, 1, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent(sPanel, install_path, 1, 3, 3, 1, HORI, NWEST, 1.0, 0.0); + SwingUtils.addComponent(sPanel, scriptsBtn, 1, 4, 3, 1, REMAINDER, NWEST, 1.0, 0.0); + } else { + // we dont show the config sub panel + // remove the PERL5LIB, ScriptsInstallDir and PerlInstallDir so that they dont cause problems + propertyChannel.put(PM_PERL_INSTALL_DIR, ""); + propertyChannel.put(PM_PERL_LIB_1, ""); + propertyChannel.put(PM_PERL_LIB_2, ""); + propertyChannel.put(PM_SCRIPTS_INSTALL_DIR, ""); + } + JPanel bPanel = createTitledPanel("Generate"); JCheckBox genOverwrite = createActionBox("Overwrite Existing Code", PM_OVERWRITE); @@ -290,7 +414,7 @@ "Processing MoSeS skeletons..."); if (propertyChannel .get(DashboardProperties.DP_SEL_SERVICES) != null) { - propertyChannel.fire( + propertyChannel.put( PM_GENERATING_SPECIFIC_SERVICES, new Boolean(true)); onGenerateSpecificService(); @@ -299,7 +423,7 @@ if (propertyChannel .get(DashboardProperties.DP_SEL_AUTHORITIES) != null) { - propertyChannel.fire(PM_GENERATING_BY_AUTHORITY, + propertyChannel.put(PM_GENERATING_BY_AUTHORITY, new Boolean(true)); onGenerateFromAuthority(); } @@ -307,7 +431,7 @@ "Processing MoSeS skeletons completed"); } }); - + generateBtn.setEnabled(enable_moses_actions); ButtonGroup group = new ButtonGroup(); JRadioButton genCgi, genSoap; group.add (genCgi = createHowToButton ("Generate CGI Service", PM_CGI)); @@ -315,8 +439,8 @@ SwingUtils.addComponent(bPanel, genOverwrite, 0, 0, 1, 1, NONE, NWEST, 0.0, 0.0); SwingUtils.addComponent(bPanel, genCgi, 0, 1, 2, 1, NONE, NWEST, 0.0, 0.0); - SwingUtils.addComponent(bPanel, genSoap, 0, 2, 2, 1, NONE, NWEST, 0.0, 0.0); - SwingUtils.addComponent(bPanel, generateBtn, 0, 3, 2, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent(bPanel, genSoap, 0, 2, 2, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent(bPanel, generateBtn, 0, 3, 2, 1, HORI, NWEST, 0.0, 0.0); JPanel uPanel = createTitledPanel("Utilities"); JCheckBox syncServices = createActionBox("Synchronize Services", @@ -337,21 +461,21 @@ generateBtn.setEnabled(false); syncBtn.setEnabled(false); if (syncData) { - propertyChannel.fire(PM_SYNC_DATATYPES, true); + propertyChannel.put(PM_SYNC_DATATYPES, true); onUpdateDatatypeCache(); } if (syncServices) { - propertyChannel.fire(PM_SYNC_SERVICES, true); + propertyChannel.put(PM_SYNC_SERVICES, true); onUpdateServiceCache(); } } - } }); - + syncBtn.setEnabled(enable_moses_actions); + SwingUtils.addComponent(uPanel, syncServices, 0, 0, 1, 1, NONE, NWEST, 0.0, 0.0); SwingUtils.addComponent(uPanel, syncDatatypes, 0, 1, 1, 1, NONE, NWEST, 0.0, 0.0); - SwingUtils.addComponent(uPanel, syncBtn, 0, 2, 1, 1, NONE, NWEST, 0.0, 0.0); + SwingUtils.addComponent(uPanel, syncBtn, 0, 2, 1, 1, HORI, NWEST, 0.0, 0.0); JPanel ePanel = createTitledPanel("Editor"); @@ -421,14 +545,18 @@ editorCloseButton.setEnabled(false); editorSaveButton.setEnabled(false); - SwingUtils.addComponent(ePanel, editorOpenButton, 0, 0, 1, 1, NONE, NWEST, 1.0, 0.0); + SwingUtils.addComponent(ePanel, editorOpenButton, 0, 0, 1, 1, NONE, NWEST, 0.0, 0.0); SwingUtils.addComponent(ePanel, editorSaveButton, 1, 0, 1, 1, NONE, NWEST, 0.0, 0.0); SwingUtils.addComponent(ePanel, editorCloseButton, 2, 0, 1, 1, NONE, NWEST, 0.0, 0.0); // add to the main panel - SwingUtils.addComponent(p, bPanel, 0, 0, 1, 1, HORI, NWEST, 0.0, 0.0); - SwingUtils.addComponent(p, uPanel, 0, 1, 1, 1, HORI, NWEST, 0.0, 0.0); - SwingUtils.addComponent(p, ePanel, 0, 2, 1, 1, HORI, NWEST, 0.0, 0.0); + int count = 0; + if (!enable_moses_actions) + SwingUtils.addComponent(p, sPanel, 0, count++, 2, 1, HORI, NWEST, 0.0, 0.0); + SwingUtils.addComponent(p, bPanel, 0, count++, 2, 1, HORI, NWEST, 0.0, 0.0); + SwingUtils.addComponent(p, uPanel, 0, count++, 2, 1, HORI, NWEST, 0.0, 0.0); + SwingUtils.addComponent(p, ePanel, 0, count++, 2, 1, HORI, NWEST, 0.0, 0.0); + return p; } @@ -677,14 +805,17 @@ try { // empty the command list command = new ArrayList(); + command.addAll(generatePerlPrefix()); + String s = (command.size() > 0 ? command.remove(command.size()-1) : "") ; + // construct the command - command.add(is_windows_pc ? "moses-generate-datatypes" - : "moses-generate-datatypes.pl"); + command.add(is_windows_pc ? "moses-generate-datatypes" + : s + "moses-generate-datatypes.pl"); command.add("-R"); command .add(propertyChannel .getString(DashboardProperties.DP_REGISTRY_ENDPOINT)); - command.add("-u"); + command.add("-f"); // place command into com String[] com = command.toArray(new String[] {}); @@ -727,12 +858,14 @@ propertyChannel .fire(DP_STATUS_MSG, "Synchronization of Perl-MoSeS Datatype Cache Complete"); - propertyChannel.fire(PM_SYNC_DATATYPES, new Boolean(false)); + propertyChannel.put(PM_SYNC_DATATYPES, new Boolean(false)); + if (!(propertyChannel.getBoolean(PM_SYNC_DATATYPES, false) || propertyChannel .getBoolean(PM_SYNC_SERVICES, false))) { syncBtn.setEnabled(true); generateBtn.setEnabled(true); } + } }; worker.start(); @@ -752,14 +885,16 @@ try { // empty the command list command = new ArrayList(); + command.addAll(generatePerlPrefix()); + String s = (command.size() > 0 ? command.remove(command.size()-1) : "") ; // construct the command - command.add(is_windows_pc ? "moses-generate-services" - : "moses-generate-services.pl"); + command.add(is_windows_pc ? "moses-generate-services" + : s + "moses-generate-services.pl"); command.add("-R"); command .add(propertyChannel .getString(DashboardProperties.DP_REGISTRY_ENDPOINT)); - command.add("-u"); + command.add("-f"); // place command into com String[] com = command.toArray(new String[] {}); @@ -799,11 +934,13 @@ error("Problem executing 'moses-generate-services.pl'", exception); console.setEnabledAppendMode(true); - propertyChannel.fire(PM_SYNC_SERVICES, new Boolean(false)); + propertyChannel.put(PM_SYNC_SERVICES, new Boolean(false)); propertyChannel.fire(DP_STATUS_MSG, "Synchronization of Perl-MoSeS Service Cache Complete"); - if (!(propertyChannel.getBoolean(PM_SYNC_DATATYPES, false) || propertyChannel - .getBoolean(PM_SYNC_SERVICES, false))) { + if (!( + propertyChannel.getBoolean(PM_SYNC_DATATYPES, false) + || + propertyChannel.getBoolean(PM_SYNC_SERVICES, false))) { syncBtn.setEnabled(true); generateBtn.setEnabled(true); } @@ -827,11 +964,13 @@ ArrayList command = new ArrayList(); // update the moses cache first ... command = new ArrayList(); + command.addAll(generatePerlPrefix()); + String s = (command.size() > 0 ? command.remove(command.size()-1) : "") ; Process p; try { - // construct the command - command.add(is_windows_pc ? "moses-generate-services" - : "moses-generate-services.pl"); + // construct the command + command.add(is_windows_pc ? "moses-generate-services" + : s + "moses-generate-services.pl"); if (Boolean.parseBoolean(propertyChannel .getString(PM_OVERWRITE))) command.add("-F"); @@ -881,7 +1020,7 @@ error("Problem executing 'moses-generate-services.pl'", exception); console.setEnabledAppendMode(true); - propertyChannel.fire(PM_GENERATING_BY_AUTHORITY, new Boolean( + propertyChannel.put(PM_GENERATING_BY_AUTHORITY, new Boolean( false)); if (!(propertyChannel.getBoolean(PM_GENERATING_BY_AUTHORITY, false)|| propertyChannel.getBoolean(PM_GENERATING_SPECIFIC_SERVICES, false))) { @@ -922,11 +1061,13 @@ + name + "' provided by '" + auth + "' ..."); console.setEnabledAppendMode(false); ArrayList command = new ArrayList(); + command.addAll(generatePerlPrefix()); + String s = (command.size() > 0 ? command.remove(command.size()-1) : "") ; Process p; try { // construct the command command.add(is_windows_pc ? "moses-generate-services" - : "moses-generate-services.pl"); + : s + "moses-generate-services.pl"); if (Boolean.parseBoolean(propertyChannel .getString(PM_OVERWRITE))) command.add("-F"); @@ -979,7 +1120,7 @@ error("Problem executing 'moses-generate-services.pl'", exception); console.setEnabledAppendMode(true); - propertyChannel.fire(PM_GENERATING_SPECIFIC_SERVICES, + propertyChannel.put(PM_GENERATING_SPECIFIC_SERVICES, new Boolean(false)); if (!(propertyChannel.getBoolean(PM_GENERATING_BY_AUTHORITY, false)|| propertyChannel.getBoolean(PM_GENERATING_SPECIFIC_SERVICES, false))) { @@ -1153,8 +1294,7 @@ Object uo2 = ((DefaultMutableTreeNode) en .nextElement()).getUserObject(); if (uo2 instanceof CommonNode) - System.out.println(((CommonNode) uo2) - .getValue()); + System.out.println(((CommonNode) uo2).getValue()); } } else if (nodeType == CommonNode.NODE_SERVICE) { From kawas at dev.open-bio.org Tue May 27 20:08:38 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 27 May 2008 16:08:38 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805272008.m4RK8cPe011600@dev.open-bio.org> kawas Tue May 27 16:08:37 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard In directory dev.open-bio.org:/tmp/cvs-serv11565/src/main/org/biomoby/service/dashboard Modified Files: PerlMoSeSPanel.java Log Message: *made commands that run on windows end in .bat *added reading of input stream -- windows hung when it was ignored. moby-live/Java/src/main/org/biomoby/service/dashboard PerlMoSeSPanel.java,1.4,1.5 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java 2008/05/27 17:25:17 1.4 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java 2008/05/27 20:08:37 1.5 @@ -176,7 +176,6 @@ private void check_install() { String[] command; ArrayList prefix = generatePerlPrefix(); - if (is_windows_pc) { prefix.add("moses-cache-tester.bat"); command = prefix.toArray(new String[]{}); @@ -187,6 +186,12 @@ try { Process process; process = Runtime.getRuntime().exec(command); + BufferedReader br = new BufferedReader( + new InputStreamReader(process.getInputStream())); + String line = null; + while ((line = br.readLine()) != null) { + //System.out.println(line + System.getProperty("line.separator")); + } process.waitFor(); enable_moses_actions = true; } catch (Exception e) { @@ -809,7 +814,7 @@ String s = (command.size() > 0 ? command.remove(command.size()-1) : "") ; // construct the command - command.add(is_windows_pc ? "moses-generate-datatypes" + command.add(is_windows_pc ? "moses-generate-datatypes.bat" : s + "moses-generate-datatypes.pl"); command.add("-R"); command @@ -839,11 +844,11 @@ } catch (IOException ioe) { exception = new MobyException( - "There was a problem synchronizing the datatype cache(x001):", + "There was a problem synchronizing the datatype cache(x001):\n" + ioe.getMessage(), ioe); } catch (InterruptedException ie) { exception = new MobyException( - "There was a problem synchronizing the datatype cache(x002):", + "There was a problem synchronizing the datatype cache(x002)\n: + ie.getMessage()", ie); } return null; // not used here @@ -888,7 +893,7 @@ command.addAll(generatePerlPrefix()); String s = (command.size() > 0 ? command.remove(command.size()-1) : "") ; // construct the command - command.add(is_windows_pc ? "moses-generate-services" + command.add(is_windows_pc ? "moses-generate-services.bat" : s + "moses-generate-services.pl"); command.add("-R"); command @@ -918,11 +923,11 @@ } catch (IOException ioe) { exception = new MobyException( - "There was a problem synchronizing the service cache(x001):", + "There was a problem synchronizing the service cache(x001):\n" + ioe.getMessage(), ioe); } catch (InterruptedException ie) { exception = new MobyException( - "There was a problem synchronizing the service cache(x002):", + "There was a problem synchronizing the service cache(x002):\n" + ie.getMessage(), ie); } return null; // not used here @@ -969,7 +974,7 @@ Process p; try { // construct the command - command.add(is_windows_pc ? "moses-generate-services" + command.add(is_windows_pc ? "moses-generate-services.bat" : s + "moses-generate-services.pl"); if (Boolean.parseBoolean(propertyChannel .getString(PM_OVERWRITE))) @@ -1004,11 +1009,11 @@ } catch (IOException ioe) { exception = new MobyException( "There was a problem generating MoSeS skeletons for '" - + authority + "'(x001):", ioe); + + authority + "'(x001):\n" + ioe.getMessage(), ioe); } catch (InterruptedException ie) { exception = new MobyException( "There was a problem generating MoSeS skeletons for '" - + authority + "'(x002):", ie); + + authority + "'(x002):\n" + ie.getMessage(), ie); } } return null; // not used here @@ -1066,7 +1071,7 @@ Process p; try { // construct the command - command.add(is_windows_pc ? "moses-generate-services" + command.add(is_windows_pc ? "moses-generate-services.bat" : s + "moses-generate-services.pl"); if (Boolean.parseBoolean(propertyChannel .getString(PM_OVERWRITE))) @@ -1103,12 +1108,12 @@ exception = new MobyException( "There was a problem generating service skeleton for service '" + name + "' provided by '" + auth - + "' (x001):", ioe); + + "' (x001):\n" + ioe.getMessage(), ioe); } catch (InterruptedException ie) { exception = new MobyException( "There was a problem generating service skeleton for service '" + name + "' provided by '" + auth - + "' (x002):", ie); + + "' (x002):\n" + ie.getMessage(), ie); } } return null; // not used here From kawas at dev.open-bio.org Tue May 27 23:10:55 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Tue, 27 May 2008 19:10:55 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805272310.m4RNAtM3011812@dev.open-bio.org> kawas Tue May 27 19:10:54 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard In directory dev.open-bio.org:/tmp/cvs-serv11777/src/main/org/biomoby/service/dashboard Modified Files: PerlMoSeSPanel.java Log Message: *last font selected is saved moby-live/Java/src/main/org/biomoby/service/dashboard PerlMoSeSPanel.java,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java 2008/05/27 20:08:37 1.5 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java 2008/05/27 23:10:54 1.6 @@ -130,6 +130,9 @@ // String: the exact path to the users perl (in case it is not available on the path) static String PM_PERL_INSTALL_DIR = "perl-moses-perl-install-dir"; + + // String: the font that the editor uses + static String PM_EDITOR_FONT = "perl-moses-editor-font"; // generated serialversionUID private static final long serialVersionUID = 1379466985182986776L; @@ -678,14 +681,30 @@ GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); String[] fontFamilies = env.getAvailableFontFamilyNames(); + int index = 0; + String saved_font = getPrefValue(PM_EDITOR_FONT, ""); + if (saved_font != null && !saved_font.trim().equals("")) { + index = 0; + for (String f:fontFamilies) { + if (f.equals(saved_font)) + break; + else + index++; + } + Font oldFont = editorTextPane.getFont(); + Font font = new Font(saved_font, oldFont.getStyle(), oldFont.getSize()); + editorTextPane.setFont(font); + } + // set up the combobox fonts = new JComboBox(fontFamilies); - fonts.setSelectedIndex(0); + fonts.setSelectedIndex(index >= fontFamilies.length -1 ? 0 : index); // add a listener fonts.addItemListener(new ItemListener(){ public void itemStateChanged(ItemEvent e) { String newFont = (String)e.getItem(); Font oldFont = editorTextPane.getFont(); + setPrefValue(PM_EDITOR_FONT, newFont); Font font = new Font(newFont, oldFont.getStyle(), oldFont.getSize()); editorTextPane.setFont(font); } From kawas at dev.open-bio.org Thu May 29 13:32:23 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 29 May 2008 09:32:23 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805291332.m4TDWNIR015385@dev.open-bio.org> kawas Thu May 29 09:32:23 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/share/cgi In directory dev.open-bio.org:/tmp/cvs-serv15350/Perl/MOBY-Server/share/cgi Modified Files: service_tester.pl Log Message: $opt_c was supposed to read $url ... Thanks Jason for pointing this out moby-live/Perl/MOBY-Server/share/cgi service_tester.pl,1.3,1.4 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/share/cgi/service_tester.pl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- /home/repository/moby/moby-live/Perl/MOBY-Server/share/cgi/service_tester.pl 2008/05/14 14:01:19 1.3 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/share/cgi/service_tester.pl 2008/05/29 13:32:23 1.4 @@ -147,7 +147,7 @@ # test cgi services do { my $ua = LWP::UserAgent->new; - my $req = POST $opt_c, [ data => $input]; + my $req = POST $url, [ data => $input]; $req = $ua->request($req); $out = $req->content if $req->is_success; } if $cat eq 'cgi'; From kawas at dev.open-bio.org Thu May 29 14:19:47 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 29 May 2008 10:19:47 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805291419.m4TEJlI2015779@dev.open-bio.org> kawas Thu May 29 10:19:47 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server In directory dev.open-bio.org:/tmp/cvs-serv15744/Perl/MOBY-Server Modified Files: Changes Log Message: updating the changes to reflect recent commits moby-live/Perl/MOBY-Server Changes,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/Changes,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Perl/MOBY-Server/Changes 2008/05/12 15:08:10 1.5 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/Changes 2008/05/29 14:19:47 1.6 @@ -1,5 +1,37 @@ Revision history for Perl extension MOBY. +1.05 + + - Multiple bug fixes / additions to installer (thanks to Jason Stewart), + as follows: + Additions + * detecting root and giving a warning if not root + * creating apache file in conf.d/ if running apache2 + * added apache defaults for debian/ubuntu systems + * added a couple longer messages to give people a heads up + what is happening. + * changed many/most of the do {...} if pprompt() to + if (prompt()) {...} + * changed the big multi-line messages from multiple + say "..." to say < kawas Thu May 29 10:15:13 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts In directory dev.open-bio.org:/tmp/cvs-serv15629/Perl/MOBY-Server/bin/scripts Modified Files: moby-s-install.pl Log Message: Commiting fixes implemented by Jason Stewart. Thanks! Additions * detecting root and giving a warning if not root * creating apache file in conf.d/ if running apache2 * added apache defaults for debian/ubuntu systems * added a couple longer messages to give people a heads up what is happening. * changed many/most of the do {...} if pprompt() to if (prompt()) {...} * changed the big multi-line messages from multiple say "..." to say <$file" @@ -457,10 +459,44 @@ {} ); + # since the file contains the root DB password + # make it only readable by root + chmod 0600, $file; + die "Couldn't make MOBY config file readable only by root: $!" + if $?; + # finished! return; } +sub check_root { + unless (getpwuid($<) eq 'root') { + print STDOUT <; $tmp =~ s/\s//g; + exit() unless $tmp =~ /y/i; + } else { + print STDOUT < 'n' - ) eq 'y'; - } else { - say " Installing the file '$apache_conf/mobycentral.config' ..."; +EOT - # fill out mobycentral.config - ( - $username, $password, $url, - $port, $m_object, $m_relationship, - $m_service, $m_namespace, $m_central - ) - = prompt_moby_config_info; +$answer = pprompt( "$apache_info\nShall we begin setting up apache? [n] ", + -ynd => 'n' ); + +if ($answer eq 'y') { + + say "Configuring your MOBY/SQL config file ..."; - # TODO - collect the values and do this at the end - fill_out_moby_conf( - "$apache_conf/mobycentral.config", - $username, $password, $url, - $port, $m_object, $m_relationship, - $m_service, $m_namespace, $m_central + # mobycentral.config exists + if ( -e "$apache_conf/mobycentral.config" ) { + do { + + # copy mobycentral.config to conf directory + ( + $username, $password, $url, + $port, $m_object, $m_relationship, + $m_service, $m_namespace, $m_central + ) + = prompt_moby_config_info; + + # TODO - collect the values and do this at the end + # fill out mobycentral.config + fill_out_moby_conf("$apache_conf/mobycentral.config", + $username, $password, $url, + $port, $m_object, $m_relationship, + $m_service, $m_namespace, $m_central ); + } + if pprompt( + "Would you like to overwrite the file '$apache_conf/mobycentral.config'? [n] ", + -ynd => 'n' + ) eq 'y'; + } else { + say " Installing the file '$apache_conf/mobycentral.config' ..."; + + # fill out mobycentral.config + ( $username, $password, $url, + $port, $m_object, $m_relationship, + $m_service, $m_namespace, $m_central + ) = prompt_moby_config_info; - #install MOBY-Central.pl and OntologyServer.cgi - say " Installing the MOBY-Central.pl & OntologyServer.cgi ..."; - file_from_template( - "$apache_cgi/MOBY-Central.pl", - File::ShareDir::dist_file( - 'MOBY', 'cgi/MOBY-Central.pl' - ), - 'MOBY-Central Dispatch file', - { '#!/usr/bin/perl -w' => "#!$perl_exec", } + # TODO - collect the values and do this at the end + fill_out_moby_conf("$apache_conf/mobycentral.config", + $username, $password, $url, + $port, $m_object, $m_relationship, + $m_service, $m_namespace, $m_central + ); + } + + #install MOBY-Central.pl and OntologyServer.cgi + say " Installing the MOBY-Central.pl & OntologyServer.cgi ..."; + file_from_template( + "$apache_cgi/MOBY-Central.pl", + File::ShareDir::dist_file('MOBY', 'cgi/MOBY-Central.pl'), + 'MOBY-Central Dispatch file', + { '#!/usr/bin/perl -w' => "#!$perl_exec", } ); - file_from_template( - "$apache_cgi/OntologyServer.cgi", - File::ShareDir::dist_file( - 'MOBY', 'cgi/OntologyServer.cgi' - ), - 'MOBY-Central Ontology Server file', - { '#!/usr/bin/perl -w' => "#!$perl_exec", } + file_from_template( + "$apache_cgi/OntologyServer.cgi", + File::ShareDir::dist_file('MOBY', 'cgi/OntologyServer.cgi'), + 'MOBY-Central Ontology Server file', + { '#!/usr/bin/perl -w' => "#!$perl_exec", } ); - #install the moby-admin module - file_from_template( - "$apache_cgi/MOBY-Admin.pl", - File::ShareDir::dist_file( - 'MOBY', 'cgi/MOBY-Admin.pl' - ), - 'MOBY-Admin Dispatch file', - { '#!/usr/bin/perl -w' => "#!$perl_exec", } + #install the moby-admin module + file_from_template( + "$apache_cgi/MOBY-Admin.pl", + File::ShareDir::dist_file('MOBY', 'cgi/MOBY-Admin.pl'), + 'MOBY-Admin Dispatch file', + { '#!/usr/bin/perl -w' => "#!$perl_exec", } ); - # configure httpd.conf - if ( -e "$apache_conf/httpd.conf" ) { - say "I would like to add the following lines to your httpd.conf file:\n" - . "\tSetEnv MOBY_CENTRAL_CONFIG \"$apache_conf/mobycentral.config\"\n" - . "\tSetEnv MOBY_URI \"http://localhost/MOBY/Central\"\n" - . "\tSetEnv MOBY_SERVER \"http://localhost/cgi-bin/MOBY/MOBY-Central.pl\"\n" - . "\tSetEnv MOBY_ONTOLOGYSERVER \"http://localhost/cgi-bin/OntologyServer.cgi\"\n" - . "Of course, those lines may not be exactly right, so I will give you a chance to modify them!\n"; - do { + # + # Configure Apache - check for Apache2 first + # + + say < 'y'); + + if ($answer eq 'y') { + open( DAT, ">$conf_file" ) + or die("Could not open $conf_file for reading!"); + + print DAT <; - close(DAT); - - open( DAT, "> $apache_conf/httpd.conf_backup" . time() ) - || die("Trouble creating a backup of httpd.conf!\n$@"); - print DAT @raw_data; - close(DAT); - - my %added = ( - 'DIRTY' => 0, - 'MOBY_CENTRAL_CONFIG' => 0, - 'MOBY_URI' => 0, - 'MOBY_SERVER' => 0, - 'MOBY_ONTOLOGYSERVER' => 0, - ); - tie @raw_data, 'Tie::File', "$apache_conf/httpd.conf" or die "$@"; - for (@raw_data) { - - if ( -/SETENV\s*(MOBY_CENTRAL_CONFIG|MOBY_URI|MOBY_SERVER|MOBY_ONTOLOGYSERVER)\s*.*/gi - ) - { - $added{'DIRTY'}++; - if ( $1 eq "MOBY_CENTRAL_CONFIG" ) { - $_ = "SetEnv MOBY_CENTRAL_CONFIG \"$env1\""; - $added{$1} = 1; - } elsif ( $1 eq "MOBY_URI" ) { - $_ = "SetEnv MOBY_URI \"$env2\""; - $added{$1} = 1; - } elsif ( $1 eq "MOBY_SERVER" ) { - $_ = "SetEnv MOBY_SERVER \"$env3\""; - $added{$1} = 1; - } else { - $_ = "SetEnv MOBY_ONTOLOGYSERVER \"$env4\""; - $added{$1} = 1; - } - } - } - untie @raw_data; + } + } elsif (not -e "$apache_conf/httpd.conf" ) { + die "Could not detect Apache2 setup ($apache_conf/conf.d/) or Apache1.3 ($apache_conf/httpd.conf). Please restart and enter the correct info"; + } else { + + # configure httpd.conf create backup of httpd.conf and append the values + # to the begining of the file + + $answer = pprompt( "May I edit your httpd.conf file? [y] ", + -ynd => 'y' ); + if ($answer eq 'y') { + open( DAT, "< $apache_conf/httpd.conf" ) + || die("Could not open file for reading!"); + my @raw_data = ; + close(DAT); + + open( DAT, "> $apache_conf/httpd.conf_backup" . time() ) + || die("Trouble creating a backup of httpd.conf!\n$@"); + print DAT @raw_data; + close(DAT); + + my %added = ( + 'DIRTY' => 0, + 'MOBY_CENTRAL_CONFIG' => 0, + 'MOBY_URI' => 0, + 'MOBY_SERVER' => 0, + 'MOBY_ONTOLOGYSERVER' => 0, + ); + tie @raw_data, 'Tie::File', "$apache_conf/httpd.conf" or die "$@"; + + for (@raw_data) { + + if ( + /SETENV\s*(MOBY_CENTRAL_CONFIG|MOBY_URI|MOBY_SERVER|MOBY_ONTOLOGYSERVER)\s*.*/gi + ) + { + $added{'DIRTY'}++; + if ( $1 eq "MOBY_CENTRAL_CONFIG" ) { + $_ = "SetEnv MOBY_CENTRAL_CONFIG \"$env1\""; + $added{$1} = 1; + } elsif ( $1 eq "MOBY_URI" ) { + $_ = "SetEnv MOBY_URI \"$env2\""; + $added{$1} = 1; + } elsif ( $1 eq "MOBY_SERVER" ) { + $_ = "SetEnv MOBY_SERVER \"$env3\""; + $added{$1} = 1; + } else { + $_ = "SetEnv MOBY_ONTOLOGYSERVER \"$env4\""; + $added{$1} = 1; + } + } + } + untie @raw_data; + + do { + open( DAT, ">> $apache_conf/httpd.conf" ) + || die("Trouble updating httpd.conf!\n$@"); + print DAT "\n# Values added by moby-s-install.pl\n" + if $added{'DIRTY'} == 0; + print DAT "SetEnv MOBY_CENTRAL_CONFIG \"$env1\"\n" + if $added{'MOBY_CENTRAL_CONFIG'} == 0; + print DAT "SetEnv MOBY_URI \"$env2\"\n" + if $added{'MOBY_URI'} == 0; + print DAT "SetEnv MOBY_SERVER \"$env3\"\n" + if $added{'MOBY_SERVER'} == 0; + print DAT "SetEnv MOBY_ONTOLOGYSERVER \"$env4\"\n" + if $added{'MOBY_ONTOLOGYSERVER'} == 0; + close(DAT); + } unless $added{'DIRTY'} == 4; + + say <> $apache_conf/httpd.conf" ) - || die("Trouble updating httpd.conf!\n$@"); - print DAT "\n# Values added by moby-s-install.pl\n" - if $added{'DIRTY'} == 0; - print DAT "SetEnv MOBY_CENTRAL_CONFIG \"$env1\"\n" - if $added{'MOBY_CENTRAL_CONFIG'} == 0; - print DAT "SetEnv MOBY_URI \"$env2\"\n" - if $added{'MOBY_URI'} == 0; - print DAT "SetEnv MOBY_SERVER \"$env3\"\n" - if $added{'MOBY_SERVER'} == 0; - print DAT "SetEnv MOBY_ONTOLOGYSERVER \"$env4\"\n" - if $added{'MOBY_ONTOLOGYSERVER'} == 0; - close(DAT); - } unless $added{'DIRTY'} == 4; - - say -"\nPlease don't forget to add the following ENV variables to your profile so that they\n" - . "are always available when calling client BioMOBY API methods from scripts!\n" - . "\tMOBY_CENTRAL_CONFIG = \"$env1\"\n" - . "\tMOBY_URI = \"$env2\"\n" - . "\tMOBY_SERVER = \"$env3\"\n" - . "\tMOBY_ONTOLOGYSERVER = \"$env4\"\n"; - - } - if pprompt( "May I edit your httpd.conf file? [y] ", -ynd => 'y' ) eq - 'y'; +EOT } + } +} -} if pprompt( "Would you like to set up apache? [n] ", -ynd => 'n' ) eq 'y'; +$answer = pprompt( "Would you like to set up mySQL? [n] ", -ynd => 'n' ); +if ($answer eq 'y') { -do { my $ready_to_go = 0; my $sql_error = 0; #check to see if we can call mysql ... if not, then die! + my $mysql_installed = (`mysql --version 2>&1` =~ m/^mysql\s+Ver\s+.*$/); + my $mysql_started = (`mysql 2>&1` !~ m/^ERROR 200.*Can't connect to .*$/); print "mysql is installed ...\n" - if `mysql --version 2>&1` =~ m/^mysql\s+Ver\s+.*$/; + if $mysql_installed; print "mysql is started ...\n" - unless `mysql 2>&1` =~ m/^ERROR 200.*Can't connect to .*$/; + if $mysql_started; - unless ( `mysql --version 2>&1` =~ m/^mysql\s+Ver\s+.*$/ - and not( `mysql 2>&1` =~ m/^ERROR .*Can't connect to local MySQL .*$/ ) - ) + unless ($mysql_installed and $mysql_started) { + die < if so, parse it + + if ( -e "$apache_conf/mobycentral.config" + && !( -d "$apache_conf/mobycentral.config" ) + && !$ready_to_go ) { - say -"\nmysql doesn't seem to be accessible ... please ensure that it is on the path, started and try again.\n"; - $sql_error = 1; + open IN, "$apache_conf/mobycentral.config" + or die + "can't open MOBY Configuration file '$apache_conf/mobycentral.config' for unknown reasons: $!\n"; + + my @sections = split /(\[\s*\S+\s*\][^\[]*)/s, join "", ; + my %db_sections = (); + foreach my $section (@sections) { + my $dbConfig = MOBY::dbConfig->new( section => $section ); + next unless $dbConfig; + my $dbname = $dbConfig->section_title; + next unless $dbname; + $db_sections{$dbname} = $dbConfig; + } + + $username = $db_sections{mobycentral}->{username}; + $password = $db_sections{mobycentral}->{password} || ""; + $url = $db_sections{mobycentral}->{url}; + $port = $db_sections{mobycentral}->{port}; + $m_object = $db_sections{mobyobject}->{dbname}; + $m_relationship = $db_sections{mobyrelationship}->{dbname}; + $m_service = $db_sections{mobyservice}->{dbname}; + $m_namespace = $db_sections{mobynamespace}->{dbname}; + $m_central = $db_sections{mobycentral}->{dbname}; + + $ready_to_go = 1; } - # proceed if mysql check was good - do { + # if the values havent been set, then prompt for them + unless ($ready_to_go) { - # have the values been set already? - $ready_to_go = 1 - if $username - and $url - and $port - and $m_object - and $m_relationship - and $m_service - and $m_namespace - and $m_central; - -#check to see if mobycentral.config has been created in the conf directory first -> if so, parse it - if ( -e "$apache_conf/mobycentral.config" - && !( -d "$apache_conf/mobycentral.config" ) - && !$ready_to_go ) - { - my %db_sections = (); - open IN, "$apache_conf/mobycentral.config" - or die -"can't open MOBY Configuration file '$apache_conf/mobycentral.config' for unknown reasons: $!\n"; - my @sections = split /(\[\s*\S+\s*\][^\[]*)/s, join "", ; - foreach my $section (@sections) { - my $dbConfig = MOBY::dbConfig->new( section => $section ); - next unless $dbConfig; - my $dbname = $dbConfig->section_title; - next unless $dbname; - $db_sections{$dbname} = $dbConfig; - } + say " Installing the file '$apache_conf/mobycentral.config' ..."; - $username = $db_sections{mobycentral}->{username}; - $password = $db_sections{mobycentral}->{password} || ""; - $url = $db_sections{mobycentral}->{url}; - $port = $db_sections{mobycentral}->{port}; - $m_object = $db_sections{mobyobject}->{dbname}; - $m_relationship = $db_sections{mobyrelationship}->{dbname}; - $m_service = $db_sections{mobyservice}->{dbname}; - $m_namespace = $db_sections{mobynamespace}->{dbname}; - $m_central = $db_sections{mobycentral}->{dbname}; + # fill out mobycentral.config + ($username, $password, $url, + $port, $m_object, $m_relationship, + $m_service, $m_namespace, $m_central + ) = prompt_moby_config_info; + + fill_out_moby_conf( + "$apache_conf/mobycentral.config", + $username, $password, $url, + $port, $m_object, $m_relationship, + $m_service, $m_namespace, $m_central + ); + } + + # now start creating the tables + say " creating the tables to use for the registry ..."; + my %dbsections = ( + 'mobycentral' => $m_central, + 'mobyobject' => $m_object, + 'mobyservice' => $m_service, + 'mobynamespace' => $m_namespace, + 'mobyrelationship' => $m_relationship + ); + + my $clone = 0; + my $central; + $answer = pprompt( "Would you like to clone a mobycentral registry? [n] ", + -ynd => 'n' ); + if ($answer eq 'y') { + $clone = 1; + my %registries = ( + default => { + url => "http://moby.ucalgary.ca/moby/MOBY-Central.pl", + uri => "http://moby.ucalgary.ca/MOBY/Central" + }, + testing => { + url => "http://bioinfo.icapture.ubc.ca/cgi-bin/mobycentral/MOBY-Central.pl", + uri => "http://bioinfo.icapture.ubc.ca/MOBY/Central" + }, + IRRI => { + url => "http://cropwiki.irri.org/cgi-bin/MOBY-Central.pl", + uri => "http://cropwiki.irri.org/MOBY/Central" + }, + + # localhost => { + # url=>"http://localhost/cgi-bin/MOBY-Central.pl", + # uri=>"http://localhost/MOBY/Central" + # }, + ); + my $registry = pprompt( "What registry to use? [b] ", + -d => 'b', + -m => [ sort keys %registries ], + ); - $ready_to_go = 1; + $central = MOBY::Client::Central->new( + Registries => { + mobycentral => { + URL => $registries{$registry}{url}, + URI => $registries{$registry}{uri} + } } + ); + } + my $error = 0; + if ($clone) { + say "Getting db dumps ..."; + my ($mobycentral, $mobyobject, $mobyservice, + $mobynamespace, $mobyrelationship + ) = $central->MOBY::Client::Central::DUMP(); + my $drh = DBI->install_driver("mysql"); + + my ( $fh, $filename ) = tempfile( UNLINK => 1 ); + say "Processing dump for service instances ..."; + print $fh $mobycentral; + eval { + $drh->func( 'dropdb', $dbsections{mobycentral}, + $url, $username, $password, 'admin' ); + }; + eval { + $drh->func( 'createdb', $dbsections{mobycentral}, + $url, $username, $password, 'admin' ); + }; + system( "mysql -h $url -P $port -u $username --password=$password " + . $dbsections{mobycentral} + . "<$filename" ) == 0 + or ( say "Error populating service instance ontology ...\n$!" + and $error++ ); + + ( $fh, $filename ) = tempfile( UNLINK => 1 ); + say "Processing dump for the objects ontology ..."; + print $fh $mobyobject; + eval { + $drh->func( 'dropdb', $dbsections{mobyobject}, $url, $username, + $password, 'admin' ); + }; + eval { + $drh->func( 'createdb', $dbsections{mobyobject}, $url, + $username, $password, 'admin' ); + }; + system( "mysql -h $url -P $port -u $username --password=$password " + . $dbsections{mobyobject} + . "<$filename" ) == 0 + or + ( say "Error populating objects ontology ...\n$!" and $error++ ); + + ( $fh, $filename ) = tempfile( UNLINK => 1 ); + say "Processing dump for service types ..."; + print $fh $mobyservice; + eval { + $drh->func( 'dropdb', $dbsections{mobyservice}, + $url, $username, $password, 'admin' ); + }; + eval { + $drh->func( 'createdb', $dbsections{mobyservice}, + $url, $username, $password, 'admin' ); + }; + system( "mysql -h $url -P $port -u $username --password=$password " + . $dbsections{mobyservice} + . "<$filename" ) == 0 + or ( say "Error populating service types ontology ...\n$!" + and $error++ ); + + ( $fh, $filename ) = tempfile( UNLINK => 1 ); + say "Processing dump for the namespace ontology ..."; + print $fh $mobynamespace; + eval { + $drh->func( 'dropdb', $dbsections{mobynamespace}, + $url, $username, $password, 'admin' ); + }; + eval { + $drh->func( 'createdb', $dbsections{mobynamespace}, + $url, $username, $password, 'admin' ); + }; + system( "mysql -h $url -P $port -u $username --password=$password " + . $dbsections{mobynamespace} + . "<$filename" ) == 0 + or ( say "Error populating namespace ontology ...\n$!" + and $error++ ); + + ( $fh, $filename ) = tempfile( UNLINK => 1 ); + say "Processing dump for the relationships ontology ..."; + print $fh $mobyrelationship; + eval { + $drh->func( 'dropdb', $dbsections{mobyrelationship}, + $url, $username, $password, 'admin' ); + }; + eval { + $drh->func( 'createdb', $dbsections{mobyrelationship}, + $url, $username, $password, 'admin' ); + }; + system( "mysql -h $url -P $port -u $username --password=$password " + . $dbsections{mobyrelationship} + . "<$filename" ) == 0 + or ( say "Error populating relationships ontology ...\n$!" + and $error++ ); - # if the values havent been set, then prompt for them - do { + } else { - say " Installing the file '$apache_conf/mobycentral.config' ..."; + # no clone, so create minimalist databases + my $drop_db = 0; - # fill out mobycentral.config - ( - $username, $password, $url, - $port, $m_object, $m_relationship, - $m_service, $m_namespace, $m_central - ) - = prompt_moby_config_info; - fill_out_moby_conf( - "$apache_conf/mobycentral.config", - $username, $password, $url, - $port, $m_object, $m_relationship, - $m_service, $m_namespace, $m_central - ); - - } unless $ready_to_go; - - # now start creating the tables - say " creating the tables to use for the registry ..."; - my %dbsections = ( - 'mobycentral' => $m_central, - 'mobyobject' => $m_object, - 'mobyservice' => $m_service, - 'mobynamespace' => $m_namespace, - 'mobyrelationship' => $m_relationship + #ask for permission on dropping data from db ... + $answer = pprompt( + "Shall I drop all pre-existing databases used by BioMOBY? [n] ", + -ynd => 'n' ); + if ($answer eq 'y') { + $drop_db = 1; + } + + #process each db + foreach my $section ( keys %dbsections ) { + my $sqlfilepath = File::ShareDir::dist_file( 'MOBY', + "db/schema/$section.mysql" ); + my $drh = DBI->install_driver("mysql"); + + # drop the db + eval { + $drh->func( 'dropdb', $dbsections{$section}, $url, + $username, $password, 'admin' ); + } if $drop_db; + + # create the db + eval { + $drh->func( 'createdb', $dbsections{$section}, $url, + $username, $password, 'admin' ); + }; - my $clone = 0; - my $central; + #create the tables in the db do { - $clone = 1; - my %registries = ( - default => { - url => "http://moby.ucalgary.ca/moby/MOBY-Central.pl", - uri => "http://moby.ucalgary.ca/MOBY/Central" - }, - testing => { - url => -"http://bioinfo.icapture.ubc.ca/cgi-bin/mobycentral/MOBY-Central.pl", - uri => "http://bioinfo.icapture.ubc.ca/MOBY/Central" - }, - IRRI => { - url => "http://cropwiki.irri.org/cgi-bin/MOBY-Central.pl", - uri => "http://cropwiki.irri.org/MOBY/Central" - }, - - # localhost => { - # url=>"http://localhost/cgi-bin/MOBY-Central.pl", - # uri=>"http://localhost/MOBY/Central" - # }, - ); - my $registry = pprompt( "What registry to use? [b] ", - -m => [ sort keys %registries ] ); - - $central = MOBY::Client::Central->new( - Registries => { - mobycentral => { - URL => $registries{$registry}{url}, - URI => $registries{$registry}{uri} - } - } - ); - } - if pprompt( "Would you like to clone a mobycentral registry? [n] ", - -ynd => 'n' ) eq 'y'; - my $error = 0; - if ($clone) { - say "Getting db dumps ..."; - my ( - $mobycentral, $mobyobject, $mobyservice, - $mobynamespace, $mobyrelationship - ) - = $central->MOBY::Client::Central::DUMP(); - my $drh = DBI->install_driver("mysql"); - - my ( $fh, $filename ) = tempfile( UNLINK => 1 ); - say "Processing dump for service instances ..."; - print $fh $mobycentral; - eval { - $drh->func( 'dropdb', $dbsections{mobycentral}, - $url, $username, $password, 'admin' ); - }; - eval { - $drh->func( 'createdb', $dbsections{mobycentral}, - $url, $username, $password, 'admin' ); - }; - system( "mysql -h $url -P $port -u $username --password=$password " - . $dbsections{mobycentral} - . "<$filename" ) == 0 - or ( say "Error populating service instance ontology ...\n$!" - and $error++ ); - - ( $fh, $filename ) = tempfile( UNLINK => 1 ); - say "Processing dump for the objects ontology ..."; - print $fh $mobyobject; - eval { - $drh->func( 'dropdb', $dbsections{mobyobject}, $url, $username, - $password, 'admin' ); - }; - eval { - $drh->func( 'createdb', $dbsections{mobyobject}, $url, - $username, $password, 'admin' ); - }; - system( "mysql -h $url -P $port -u $username --password=$password " - . $dbsections{mobyobject} - . "<$filename" ) == 0 - or - ( say "Error populating objects ontology ...\n$!" and $error++ ); - - ( $fh, $filename ) = tempfile( UNLINK => 1 ); - say "Processing dump for service types ..."; - print $fh $mobyservice; - eval { - $drh->func( 'dropdb', $dbsections{mobyservice}, - $url, $username, $password, 'admin' ); - }; - eval { - $drh->func( 'createdb', $dbsections{mobyservice}, - $url, $username, $password, 'admin' ); - }; - system( "mysql -h $url -P $port -u $username --password=$password " - . $dbsections{mobyservice} - . "<$filename" ) == 0 - or ( say "Error populating service types ontology ...\n$!" - and $error++ ); - - ( $fh, $filename ) = tempfile( UNLINK => 1 ); - say "Processing dump for the namespace ontology ..."; - print $fh $mobynamespace; - eval { - $drh->func( 'dropdb', $dbsections{mobynamespace}, - $url, $username, $password, 'admin' ); - }; - eval { - $drh->func( 'createdb', $dbsections{mobynamespace}, - $url, $username, $password, 'admin' ); - }; - system( "mysql -h $url -P $port -u $username --password=$password " - . $dbsections{mobynamespace} - . "<$filename" ) == 0 - or ( say "Error populating namespace ontology ...\n$!" - and $error++ ); - - ( $fh, $filename ) = tempfile( UNLINK => 1 ); - say "Processing dump for the relationships ontology ..."; - print $fh $mobyrelationship; - eval { - $drh->func( 'dropdb', $dbsections{mobyrelationship}, - $url, $username, $password, 'admin' ); - }; - eval { - $drh->func( 'createdb', $dbsections{mobyrelationship}, - $url, $username, $password, 'admin' ); - }; - system( "mysql -h $url -P $port -u $username --password=$password " - . $dbsections{mobyrelationship} - . "<$filename" ) == 0 - or ( say "Error populating relationships ontology ...\n$!" - and $error++ ); - - } else { - - # no clone, so create minimalist databases - my $drop_db = 0; - - #ask for permission on dropping data from db ... - do { - $drop_db = 1; - } - if pprompt( - "Shall I drop all pre-existing databases used by BioMOBY? [n] ", - -ynd => 'n' - ) eq 'y'; - - #process each db - foreach my $section ( keys %dbsections ) { - my $sqlfilepath = File::ShareDir::dist_file( 'MOBY', - "db/schema/$section.mysql" ); - my $drh = DBI->install_driver("mysql"); - - # drop the db - eval { - $drh->func( 'dropdb', $dbsections{$section}, $url, - $username, $password, 'admin' ); - } if $drop_db; - - # create the db - eval { - $drh->func( 'createdb', $dbsections{$section}, $url, - $username, $password, 'admin' ); - }; - - #create the tables in the db - do { - say "\n\tProblem creating tables in the db: $section: $!"; - } - unless system( - "mysql -h $url -P $port -u $username --password=$password " - . $dbsections{$section} - . "<$sqlfilepath" ) == 0; - say "\tProcessing of $section completed ... "; - } - say "populating the tables with basic data ..."; - %dbsections = ( - 'mobyobject' => $m_object, - 'mobyservice' => $m_service, - 'mobyrelationship' => $m_relationship - ); - foreach my $section ( keys %dbsections ) { - my $sqlfilepath = - File::ShareDir::dist_file( 'MOBY', "db/data/$section.data" ); - system( - "mysql -h $url -P $port -u $username --password=$password " - . $dbsections{$section} - . "<$sqlfilepath" ) == 0 - or say "\n\tProblem populating the db: $section: $!"; - say "\tPopulation processing for db $section completed ..."; - } + say "\n\tProblem creating tables in the db: $section: $!"; } + unless system( + "mysql -h $url -P $port -u $username --password=$password " + . $dbsections{$section} + . "<$sqlfilepath" ) == 0; + say "\tProcessing of $section completed ... "; + } + say "populating the tables with basic data ..."; + %dbsections = ( + 'mobyobject' => $m_object, + 'mobyservice' => $m_service, + 'mobyrelationship' => $m_relationship + ); + foreach my $section ( keys %dbsections ) { + my $sqlfilepath = + File::ShareDir::dist_file( 'MOBY', "db/data/$section.data" ); + system( + "mysql -h $url -P $port -u $username --password=$password " + . $dbsections{$section} + . "<$sqlfilepath" ) == 0 + or say "\n\tProblem populating the db: $section: $!"; + say "\tPopulation processing for db $section completed ..."; + } + } - say "Set up of mySQL complete!" if $error == 0; - say -"There were some problems encountered. Please correct the errors and re-run this script!" - if $error > 0; - } unless $sql_error; -} if pprompt( "Would you like to set up mySQL? [n] ", -ynd => 'n' ) eq 'y'; - -do { + say "Set up of mySQL complete!" if $error == 0; + say + "There were some problems encountered. Please correct the errors and re-run this script!" + if $error > 0; +} + +$answer = pprompt( "Would you like to install the RESOURCES script? [y] ", + -ynd => 'y' ); +if ($answer eq 'y') { my $exists = 0; # install the script, confirm if it exists - do { - $exists = 1; - do { - $exists = 0; - } - if pprompt( "The RESOURCES script already exists, overwrite? [n] ", - -ynd => 'n' ) eq 'y'; - } if -e "$apache_cgi/RESOURCES"; + if (-e "$apache_cgi/RESOURCES") { + $exists = 1; + $answer = pprompt( "The RESOURCES script already exists, overwrite? [n] ", + -ynd => 'n' ); + if ($answer eq 'y') { + $exists = 0; + } + } my $rdf_cache_location = prompt_for_directory_expand( - "Where would you like to store the RDF cache?", - "$apache_base/moby_cache" ); + "Where would you like to store the RDF cache?", + "$apache_base/moby_cache" ); say "Please make sure that you make that directory read/writable by your web server!\n"; # copy the file - file_from_template( - "$apache_cgi/RESOURCES", - File::ShareDir::dist_file( 'MOBY', 'cgi/RESOURCES' ), - 'RESOURCES script', - { '#!/usr/bin/perl -w' => "#!$perl_exec", } - ) - if $exists == 0; + if ($exists == 0) { + file_from_template( + "$apache_cgi/RESOURCES", + File::ShareDir::dist_file( 'MOBY', 'cgi/RESOURCES' ), + 'RESOURCES script', + { '#!/usr/bin/perl -w' => "#!$perl_exec", } + ) + } # update mobycentral.config file to reflect the location of the script - do { + $answer = pprompt( +"Shall we update mobycentral.config to reflect the installation of this script? [y] ", + -ynd => 'y'); + if ($answer eq 'y') { - # confirm server name, etc then change the values - my $url = "http://localhost/cgi-bin"; - $url = - prompt_user_input( - "Please enter the correct url to your cgi-bin directory: ", - "$url" ); - - # make sure that the key resourceURL exists ... - my $search = search_config_file( - "$apache_conf/mobycentral.config", - { - 'mobycentral' => { - 'resourceURL' => 0, - 'allResources' => 0, - 'rdf_cache' => 0 - }, - 'mobyobject' => { 'resourceURL' => 0 }, - 'mobyservice' => { 'resourceURL' => 0 }, - 'mobynamespace' => { 'resourceURL' => 0 }, - } + # confirm server name, etc then change the values + my $url = "http://localhost/cgi-bin"; + $url = prompt_user_input( + "Please enter the correct url to your cgi-bin directory: ", + "$url" ); + + # make sure that the key resourceURL exists ... + my $search = search_config_file( + "$apache_conf/mobycentral.config", + { + 'mobycentral' => { + 'resourceURL' => 0, + 'allResources' => 0, + 'rdf_cache' => 0, + }, + 'mobyobject' => { 'resourceURL' => 0 }, + 'mobyservice' => { 'resourceURL' => 0 }, + 'mobynamespace' => { 'resourceURL' => 0 }, + } ); - add_missing_keys_to_config_file( "$apache_conf/mobycentral.config", - $search ); + add_missing_keys_to_config_file( "$apache_conf/mobycentral.config", + $search ); - # copy the information - config_file_from_template( - "$apache_conf/mobycentral.config", - "$apache_conf/mobycentral.config", - 'MOBY/SQL Configuration file', + # copy the information + config_file_from_template( + "$apache_conf/mobycentral.config", + "$apache_conf/mobycentral.config", + 'MOBY/SQL Configuration file', - # mysql settings - { 'rdf_cache' => "$rdf_cache_location" }, + # mysql settings + { 'rdf_cache' => "$rdf_cache_location" }, - # db section mappings - {}, + # db section mappings + {}, - # resource urls - { - 'ALL' => "$url/RESOURCES/MOBY-S/FULL", - 'mobycentral' => "$url/RESOURCES/MOBY-S/ServiceInstances", - 'mobyobject' => "$url/RESOURCES/MOBY-S/Objects", - 'mobynamespace' => "$url/RESOURCES/MOBY-S/Namespaces", - 'mobyservice' => "$url/RESOURCES/MOBY-S/Services", - }, + # resource urls + { + 'ALL' => "$url/RESOURCES/MOBY-S/FULL", + 'mobycentral' => "$url/RESOURCES/MOBY-S/ServiceInstances", + 'mobyobject' => "$url/RESOURCES/MOBY-S/Objects", + 'mobynamespace' => "$url/RESOURCES/MOBY-S/Namespaces", + 'mobyservice' => "$url/RESOURCES/MOBY-S/Services", + }, - # lsid info - {} + # lsid info + {} ); } - if pprompt( -"Shall we update mobycentral.config to reflect the installation of this script? [y] ", - -ynd => 'y' - ) eq 'y'; - } - if pprompt( "Would you like to install the RESOURCES script? [y] ", - -ynd => 'y' ) eq 'y'; +} -do { +$answer = pprompt( "Would you like to install the LSID authority script? [y] ", + -ynd => 'y' ); +if ($answer eq 'y') { # install the script, confirm if it exists my $exists = 0; - do { - $exists = 1; - do { - $exists = 0; - } - if pprompt( "The authority script already exists, overwrite? [n] ", - -ynd => 'n' ) eq 'y'; - } if -e "$apache_cgi/authority.pl"; + if (-e "$apache_cgi/authority.pl") { + $exists = 1; + $answer = pprompt( "The authority script already exists, overwrite? [n] ", + -ynd => 'n' ); + if ($answer eq 'y') { + $exists = 0; + } + } file_from_template( "$apache_cgi/authority.pl", @@ -1085,38 +1205,41 @@ if $exists == 0; # update mobycentral.config file to reflect the particulars of the script - do { + $answer = pprompt( +"Shall we update mobycentral.config to reflect the installation of this script? [y] ", + -ynd => 'y'); + if ($answer eq 'y') { - #ask for namespace/authority information + #ask for namespace/authority information - # make sure that the key lsid_namespace & lsid_authority exists ... - my $search = search_config_file( - "$apache_conf/mobycentral.config", - { - 'mobycentral' => { - 'lsid_namespace' => 0, - 'lsid_authority' => 0 - }, - 'mobyobject' => { - 'lsid_namespace' => 0, - 'lsid_authority' => 0 - }, - 'mobyservice' => { - 'lsid_namespace' => 0, - 'lsid_authority' => 0 - }, - 'mobynamespace' => { - 'lsid_namespace' => 0, - 'lsid_authority' => 0 - }, - 'mobyrelationship' => { - 'lsid_namespace' => 0, - 'lsid_authority' => 0 - }, - } + # make sure that the key lsid_namespace & lsid_authority exists ... + my $search = search_config_file( + "$apache_conf/mobycentral.config", + { + 'mobycentral' => { + 'lsid_namespace' => 0, + 'lsid_authority' => 0, + }, + 'mobyobject' => { + 'lsid_namespace' => 0, + 'lsid_authority' => 0, + }, + 'mobyservice' => { + 'lsid_namespace' => 0, + 'lsid_authority' => 0, + }, + 'mobynamespace' => { + 'lsid_namespace' => 0, + 'lsid_authority' => 0, + }, + 'mobyrelationship' => { + 'lsid_namespace' => 0, + 'lsid_authority' => 0, + }, + } ); add_missing_keys_to_config_file( "$apache_conf/mobycentral.config", - $search ); + $search ); # copy the information config_file_from_template( @@ -1136,85 +1259,92 @@ # lsid info { 'mobycentral' => { - 'NAMESPACE' => prompt_user_input( + 'NAMESPACE' => prompt_user_input( "Please enter an LSID namespace for the services ontology: ", - "serviceinstance" + "serviceinstance" ), 'AUTHORITY' => prompt_user_input( - "Please enter the LSID authority for services: ", - "biomoby.org" + "Please enter the LSID authority for services: ", + "biomoby.org" ), }, 'mobyobject' => { 'NAMESPACE' => prompt_user_input( "Please enter an LSID namespace for the datatype ontology: ", - "objectclass" + "objectclass" ), 'AUTHORITY' => prompt_user_input( - "Please enter the LSID authority for datatypes: ", - "biomoby.org" +"Please enter the LSID authority for datatypes: ", + "biomoby.org" ), }, 'mobyservice' => { 'NAMESPACE' => prompt_user_input( "Please enter an LSID namespace for the service types ontology: ", - "servicetype" + "servicetype" ), 'AUTHORITY' => prompt_user_input( - "Please enter the LSID authority for service types: ", - "biomoby.org" +"Please enter the LSID authority for service types: ", + "biomoby.org" ), }, 'mobynamespace' => { 'NAMESPACE' => prompt_user_input( "Please enter an LSID namespace for the namespaces ontology: ", - "namespacetype" + "namespacetype" ), 'AUTHORITY' => prompt_user_input( - "Please enter the LSID authority for namespaces: ", - "biomoby.org" +"Please enter the LSID authority for namespaces: ", + "biomoby.org" ), }, 'mobyrelationship' => { 'NAMESPACE' => prompt_user_input( "Please enter an LSID namespace for the relationship ontology: ", - "relationshiptype" + "relationshiptype" ), 'AUTHORITY' => prompt_user_input( - "Please enter the LSID authority for relationships: ", - "biomoby.org" +"Please enter the LSID authority for relationships: ", + "biomoby.org" ), }, } - ); - } - if pprompt( -"Shall we update mobycentral.config to reflect the installation of this script? [y] ", - -ynd => 'y' - ) eq 'y'; + ); + } + + # tell the user to make sure that apache serves the script from + # http://domain.com/authority -# tell the user to make sure that apache serves the script from http://domain.com/authority - say -"\nPlease ensure that you set up apache to serve the script from\n\t'http://your.domain/authority'\nso that the script will work properly!\n"; - } - if pprompt( "Would you like to install the LSID authority script? [y] ", - -ynd => 'y' ) eq 'y'; + say < 'y' + ); +if ($answer eq 'y') { # prompt for a location for the service_tester_path my $service_tester_path = prompt_for_directory_expand( - "Where would you like to place the service pinger script?", - "$apache_base/moby_tester" ); + "Where would you like to place the service pinger script?", + "$apache_base/moby_tester" ); say 'Please make sure that you make that directory read/writable by your web server!\n'; # make sure that the key service_tester_path exists for the config file - my $search = search_config_file( "$apache_conf/mobycentral.config", - { 'mobycentral' => { 'service_tester_path' => 0, } } ); + my $search = search_config_file( + "$apache_conf/mobycentral.config", + { 'mobycentral' => { 'service_tester_path' => 0, } } + ); add_missing_keys_to_config_file( "$apache_conf/mobycentral.config", - $search ); + $search ); # copy the information config_file_from_template( @@ -1236,61 +1366,56 @@ ); file_from_template( - "$service_tester_path/service_tester.pl", - File::ShareDir::dist_file( - 'MOBY', 'cgi/service_tester.pl' - ), - 'MOBY-Central service tester script', - { '#!/usr/bin/perl -w' => "#!$perl_exec", } + "$service_tester_path/service_tester.pl", + File::ShareDir::dist_file( + 'MOBY', 'cgi/service_tester.pl' + ), + 'MOBY-Central service tester script', + { '#!/usr/bin/perl -w' => "#!$perl_exec", } ); say 'Please don\'t forget to place the service pinger on a cron! TODO - explain how to do that!'; #copy the other scripts now file_from_template( - "$apache_cgi/AgentRDFValidator", - File::ShareDir::dist_file( - 'MOBY', 'cgi/AgentRDFValidator' - ), - 'The RDF agent validator page', - { '#!/usr/bin/perl -w' => "#!$perl_exec", } - ); + "$apache_cgi/AgentRDFValidator", + File::ShareDir::dist_file( + 'MOBY', 'cgi/AgentRDFValidator' + ), + 'The RDF agent validator page', + { '#!/usr/bin/perl -w' => "#!$perl_exec", } + ); file_from_template( - "$apache_cgi/GenerateRDF.cgi", - File::ShareDir::dist_file( - 'MOBY', 'cgi/GenerateRDF.cgi' - ), - 'MOBY-Central service instance RDF generating form', - { '#!/usr/bin/perl -w' => "#!$perl_exec", } - ); + "$apache_cgi/GenerateRDF.cgi", + File::ShareDir::dist_file( + 'MOBY', 'cgi/GenerateRDF.cgi' + ), + 'MOBY-Central service instance RDF generating form', + { '#!/usr/bin/perl -w' => "#!$perl_exec", } + ); file_from_template( - "$apache_cgi/Moby", - File::ShareDir::dist_file( 'MOBY', 'cgi/Moby' ), - 'MOBY-Central test page for auxillary scripts', - { '#!/usr/bin/perl -w' => "#!$perl_exec", } - ); + "$apache_cgi/Moby", + File::ShareDir::dist_file( 'MOBY', 'cgi/Moby' ), + 'MOBY-Central test page for auxillary scripts', + { '#!/usr/bin/perl -w' => "#!$perl_exec", } + ); file_from_template( - "$apache_cgi/ServicePingerValidator", - File::ShareDir::dist_file( - 'MOBY', 'cgi/ServicePingerValidator' - ), - 'MOBY-Central service invocation test form', - { '#!/usr/bin/perl -w' => "#!$perl_exec", } - ); + "$apache_cgi/ServicePingerValidator", + File::ShareDir::dist_file( + 'MOBY', 'cgi/ServicePingerValidator' + ), + 'MOBY-Central service invocation test form', + { '#!/usr/bin/perl -w' => "#!$perl_exec", } + ); file_from_template( - "$apache_cgi/ValidateService", - File::ShareDir::dist_file( - 'MOBY', 'cgi/ValidateService' - ), - 'MOBY-Central service tester information page', - { '#!/usr/bin/perl -w' => "#!$perl_exec", } - ); - } - if pprompt( -"Would you like to auxillary scripts? These include the service pinger, a test page for the rdf agent, an RDF generator page, etc? [y] ", - -ynd => 'y' - ) eq 'y'; - + "$apache_cgi/ValidateService", + File::ShareDir::dist_file( + 'MOBY', 'cgi/ValidateService' + ), + 'MOBY-Central service tester information page', + { '#!/usr/bin/perl -w' => "#!$perl_exec", } + ); +} # say From kawas at dev.open-bio.org Thu May 29 19:59:21 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Thu, 29 May 2008 15:59:21 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805291959.m4TJxL7h016209@dev.open-bio.org> kawas Thu May 29 15:59:21 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts In directory dev.open-bio.org:/tmp/cvs-serv16174/Perl/MOBY-Server/bin/scripts Modified Files: moby-s-install.pl Log Message: *made mobycentral.config readable by all *prompt user for a new db user/pass for access to the registry so that root password isnt used moby-live/Perl/MOBY-Server/bin/scripts moby-s-install.pl,1.5,1.6 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts/moby-s-install.pl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts/moby-s-install.pl 2008/05/29 14:15:13 1.5 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts/moby-s-install.pl 2008/05/29 19:59:21 1.6 @@ -30,6 +30,11 @@ sub say { print @_, "\n"; } + # query is for creating the moby_username and password for local access to dbs + sub prepare_query { + my $s = join "", @_; + return qq|GRANT ALL ON $s TO ?\@'localhost' IDENTIFIED BY ? WITH GRANT OPTION|; + } sub check_module { eval "require $_[0]"; if ($@) { @@ -378,6 +383,10 @@ my $url = prompt_user_input( "What is the mysql url?", "localhost" ); my $port = prompt_user_input( "What is the mysql port #?", "3306" ); + # prompt for a new user/password combo so that people cant determine the root password from MOBY::Config + my $moby_username = prompt_user_input( "What username (I will create it if it doesn't exist)\n would you like to access your local db?", "moby_user" ); + my $moby_password = prompt_user_input( "Please provide a password for '$moby_username': ", "" ); + #db names say "\nPrompting for mysql table names. Use default names unless you know what you are doing!"; @@ -400,10 +409,12 @@ You have provided the following values: mySQL Details - username : $username - password : $password - URL : $url - port : $port + username : $username + password : $password + URL : $url + port : $port + registry db username : $moby_username + registry db password : $moby_password Tables: Object ontology : $m_object @@ -416,9 +427,10 @@ say($msg); return ( - $username, $password, $url, - $port, $m_object, $m_relationship, - $m_service, $m_namespace, $m_central + $username, $password, $url, + $port, $m_object, $m_relationship, + $m_service, $m_namespace, $m_central, + $moby_username, $moby_password ); } @@ -461,7 +473,7 @@ # since the file contains the root DB password # make it only readable by root - chmod 0600, $file; + chmod 0644, $file; die "Couldn't make MOBY config file readable only by root: $!" if $?; @@ -533,7 +545,8 @@ my ( $username, $password, $url, $port, $m_object, $m_relationship, - $m_service, $m_namespace, $m_central + $m_service, $m_namespace, $m_central, + $moby_username, $moby_password ); say "We are going to be placing files into your apache setup, in the cgi-bin/ directory and conf/ directory"; @@ -600,18 +613,19 @@ # copy mobycentral.config to conf directory ( - $username, $password, $url, - $port, $m_object, $m_relationship, - $m_service, $m_namespace, $m_central + $username, $password, $url, + $port, $m_object, $m_relationship, + $m_service, $m_namespace, $m_central, + $moby_username, $moby_password ) = prompt_moby_config_info; # TODO - collect the values and do this at the end # fill out mobycentral.config fill_out_moby_conf("$apache_conf/mobycentral.config", - $username, $password, $url, - $port, $m_object, $m_relationship, - $m_service, $m_namespace, $m_central + $moby_username, $moby_password, $url, + $port, $m_object, $m_relationship, + $m_service, $m_namespace, $m_central ); } @@ -623,16 +637,17 @@ say " Installing the file '$apache_conf/mobycentral.config' ..."; # fill out mobycentral.config - ( $username, $password, $url, - $port, $m_object, $m_relationship, - $m_service, $m_namespace, $m_central + ( $username, $password, $url, + $port, $m_object, $m_relationship, + $m_service, $m_namespace, $m_central, + $moby_username, $moby_password ) = prompt_moby_config_info; # TODO - collect the values and do this at the end fill_out_moby_conf("$apache_conf/mobycentral.config", - $username, $password, $url, - $port, $m_object, $m_relationship, - $m_service, $m_namespace, $m_central + $moby_username, $moby_password, $url, + $port, $m_object, $m_relationship, + $m_service, $m_namespace, $m_central ); } @@ -829,7 +844,9 @@ and $m_relationship and $m_service and $m_namespace - and $m_central; + and $m_central, + and $moby_username, + and $moby_password; # check to see if mobycentral.config has been created in the conf # directory first -> if so, parse it @@ -852,8 +869,8 @@ $db_sections{$dbname} = $dbConfig; } - $username = $db_sections{mobycentral}->{username}; - $password = $db_sections{mobycentral}->{password} || ""; + $moby_username = $db_sections{mobycentral}->{username}; + $moby_password = $db_sections{mobycentral}->{password} || ""; $url = $db_sections{mobycentral}->{url}; $port = $db_sections{mobycentral}->{port}; $m_object = $db_sections{mobyobject}->{dbname}; @@ -871,19 +888,27 @@ say " Installing the file '$apache_conf/mobycentral.config' ..."; # fill out mobycentral.config - ($username, $password, $url, - $port, $m_object, $m_relationship, - $m_service, $m_namespace, $m_central + ($username, $password, $url, + $port, $m_object, $m_relationship, + $m_service, $m_namespace, $m_central, + $moby_username, $moby_password ) = prompt_moby_config_info; fill_out_moby_conf( "$apache_conf/mobycentral.config", - $username, $password, $url, - $port, $m_object, $m_relationship, - $m_service, $m_namespace, $m_central + $moby_username, $moby_password, $url, + $port, $m_object, $m_relationship, + $m_service, $m_namespace, $m_central ); } + # make sure that we have a root password/username + unless ($username and $password) { + $username = + prompt_user_input( "What is your root mysql username?", "root" ); + $password = + prompt_user_input( "What is your root mysql users' password?", "" ); + } # now start creating the tables say " creating the tables to use for the registry ..."; my %dbsections = ( @@ -940,7 +965,8 @@ $mobynamespace, $mobyrelationship ) = $central->MOBY::Client::Central::DUMP(); my $drh = DBI->install_driver("mysql"); - + # used for creating the user/pass for the registry + my $dbh = DBI->connect("DBI:mysql:mysql:localhost:3306", "root", "root", { RaiseError => 1, AutoCommit => 1 }); my ( $fh, $filename ) = tempfile( UNLINK => 1 ); say "Processing dump for service instances ..."; print $fh $mobycentral; @@ -952,6 +978,12 @@ $drh->func( 'createdb', $dbsections{mobycentral}, $url, $username, $password, 'admin' ); }; + eval { + my $db = $dbsections{mobycentral} . ".*"; + $dbh->do(prepare_query($db),undef,$moby_username,$moby_password) + || say ("Could not give '$moby_username' access to $db - Error:\n$DBI::errstr"); + }; + die $! if $!; system( "mysql -h $url -P $port -u $username --password=$password " . $dbsections{mobycentral} . "<$filename" ) == 0 @@ -969,6 +1001,11 @@ $drh->func( 'createdb', $dbsections{mobyobject}, $url, $username, $password, 'admin' ); }; + eval { + my $db = $dbsections{mobyobject} . ".*"; + $dbh->do(prepare_query($db),undef,$moby_username,$moby_password) + || say ("Could not give '$moby_username' access to $db - Error:\n$DBI::errstr"); + }; system( "mysql -h $url -P $port -u $username --password=$password " . $dbsections{mobyobject} . "<$filename" ) == 0 @@ -986,6 +1023,11 @@ $drh->func( 'createdb', $dbsections{mobyservice}, $url, $username, $password, 'admin' ); }; + eval { + my $db = $dbsections{mobyservice} . ".*"; + $dbh->do(prepare_query($db),undef,$moby_username,$moby_password) + || say ("Could not give '$moby_username' access to $db - Error:\n$DBI::errstr"); + }; system( "mysql -h $url -P $port -u $username --password=$password " . $dbsections{mobyservice} . "<$filename" ) == 0 @@ -1003,6 +1045,11 @@ $drh->func( 'createdb', $dbsections{mobynamespace}, $url, $username, $password, 'admin' ); }; + eval { + my $db = $dbsections{mobynamespace} . ".*"; + $dbh->do(prepare_query($db),undef,$moby_username,$moby_password) + || say ("Could not give '$moby_username' access to $db - Error:\n$DBI::errstr"); + }; system( "mysql -h $url -P $port -u $username --password=$password " . $dbsections{mobynamespace} . "<$filename" ) == 0 @@ -1020,6 +1067,11 @@ $drh->func( 'createdb', $dbsections{mobyrelationship}, $url, $username, $password, 'admin' ); }; + eval { + my $db = $dbsections{mobyrelationship} . ".*"; + $dbh->do(prepare_query($db),undef,$moby_username,$moby_password) + || say ("Could not give '$moby_username' access to $db - Error:\n$DBI::errstr"); + }; system( "mysql -h $url -P $port -u $username --password=$password " . $dbsections{mobyrelationship} . "<$filename" ) == 0 @@ -1042,31 +1094,38 @@ #process each db foreach my $section ( keys %dbsections ) { - my $sqlfilepath = File::ShareDir::dist_file( 'MOBY', - "db/schema/$section.mysql" ); - my $drh = DBI->install_driver("mysql"); - - # drop the db - eval { - $drh->func( 'dropdb', $dbsections{$section}, $url, - $username, $password, 'admin' ); - } if $drop_db; - - # create the db - eval { - $drh->func( 'createdb', $dbsections{$section}, $url, - $username, $password, 'admin' ); - }; - - #create the tables in the db - do { - say "\n\tProblem creating tables in the db: $section: $!"; - } - unless system( - "mysql -h $url -P $port -u $username --password=$password " - . $dbsections{$section} - . "<$sqlfilepath" ) == 0; - say "\tProcessing of $section completed ... "; + my $sqlfilepath = File::ShareDir::dist_file( 'MOBY', + "db/schema/$section.mysql" ); + my $drh = DBI->install_driver("mysql"); + # used for creating the user/pass for the registry + my $dbh = DBI->connect("DBI:mysql:mysql:localhost:3306", "root", "root", { RaiseError => 1, AutoCommit => 1 }); + # drop the db + eval { + $drh->func( 'dropdb', $dbsections{$section}, $url, + $username, $password, 'admin' ); + } if $drop_db; + + # create the db + eval { + $drh->func( 'createdb', $dbsections{$section}, $url, + $username, $password, 'admin' ); + }; + + # give moby_username permission to access it + eval { + my $db = $dbsections{$section} . ".*"; + $dbh->do(prepare_query($db),undef,$moby_username,$moby_password) + || say ("Could not give '$moby_username' access to $db - Error:\n$DBI::errstr"); + }; + #create the tables in the db + do { + say "\n\tProblem creating tables in the db: $section: $!"; + } + unless system( + "mysql -h $url -P $port -u $username --password=$password " + . $dbsections{$section} + . "<$sqlfilepath" ) == 0; + say "\tProcessing of $section completed ... "; } say "populating the tables with basic data ..."; %dbsections = ( @@ -1075,14 +1134,14 @@ 'mobyrelationship' => $m_relationship ); foreach my $section ( keys %dbsections ) { - my $sqlfilepath = - File::ShareDir::dist_file( 'MOBY', "db/data/$section.data" ); - system( - "mysql -h $url -P $port -u $username --password=$password " - . $dbsections{$section} - . "<$sqlfilepath" ) == 0 - or say "\n\tProblem populating the db: $section: $!"; - say "\tPopulation processing for db $section completed ..."; + my $sqlfilepath = + File::ShareDir::dist_file( 'MOBY', "db/data/$section.data" ); + system( + "mysql -h $url -P $port -u $username --password=$password " + . $dbsections{$section} + . "<$sqlfilepath" ) == 0 + or (say "\n\tProblem populating the db: $section: $!" and $error++); + say "\tPopulation processing for db $section completed ..."; } } From kawas at dev.open-bio.org Fri May 30 15:49:31 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 30 May 2008 11:49:31 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805301549.m4UFnVqM018231@dev.open-bio.org> kawas Fri May 30 11:49:30 EDT 2008 Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard In directory dev.open-bio.org:/tmp/cvs-serv18196/src/main/org/biomoby/service/dashboard Modified Files: PerlMoSeSPanel.java Log Message: added a default font when a user doesnt have one added default text in the Perl path field moby-live/Java/src/main/org/biomoby/service/dashboard PerlMoSeSPanel.java,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java 2008/05/27 23:10:54 1.6 +++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/service/dashboard/PerlMoSeSPanel.java 2008/05/30 15:49:30 1.7 @@ -379,6 +379,7 @@ JTextFieldWithHistory lib1 = createText (null, PM_PERL_LIB_1, PM_PERL_LIB_1); JTextFieldWithHistory lib2 = createText (null, PM_PERL_LIB_2, PM_PERL_LIB_2); JTextFieldWithHistory install_path = createText (null, PM_SCRIPTS_INSTALL_DIR, PM_SCRIPTS_INSTALL_DIR); + install_path.setText(is_windows_pc ? "perl.exe" : "/usr/bin/perl"); JTextFieldWithHistory perl_install_path = createText(null, PM_PERL_INSTALL_DIR, PM_PERL_INSTALL_DIR); SwingUtils.addComponent(sPanel, new JLabel("Perl Path: "), 0, 0, 1, 1, NONE, NWEST, 0.0, 0.0); @@ -683,6 +684,10 @@ String[] fontFamilies = env.getAvailableFontFamilyNames(); int index = 0; String saved_font = getPrefValue(PM_EDITOR_FONT, ""); + if (saved_font.equals("")) { + saved_font = new Font(null).getName(); + setPrefValue(PM_EDITOR_FONT, saved_font); + } if (saved_font != null && !saved_font.trim().equals("")) { index = 0; for (String f:fontFamilies) { @@ -698,7 +703,7 @@ // set up the combobox fonts = new JComboBox(fontFamilies); - fonts.setSelectedIndex(index >= fontFamilies.length -1 ? 0 : index); + fonts.setSelectedIndex(index >= fontFamilies.length ? 0 : index); // add a listener fonts.addItemListener(new ItemListener(){ public void itemStateChanged(ItemEvent e) { From kawas at dev.open-bio.org Fri May 30 15:52:09 2008 From: kawas at dev.open-bio.org (Eddie Kawas) Date: Fri, 30 May 2008 11:52:09 -0400 Subject: [MOBY-guts] biomoby commit Message-ID: <200805301552.m4UFq94k018271@dev.open-bio.org> kawas Fri May 30 11:52:09 EDT 2008 Update of /home/repository/moby/moby-live/Perl/MOBY-Server In directory dev.open-bio.org:/tmp/cvs-serv18236/Perl/MOBY-Server Modified Files: Changes Log Message: moby-live/Perl/MOBY-Server Changes,1.6,1.7 =================================================================== RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/Changes,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- /home/repository/moby/moby-live/Perl/MOBY-Server/Changes 2008/05/29 14:19:47 1.6 +++ /home/repository/moby/moby-live/Perl/MOBY-Server/Changes 2008/05/30 15:52:09 1.7 @@ -26,11 +26,14 @@ * in prompt_for_directory() switched the cases around for -e and -w otherwise -e wouldn't get triggered * in config_file_from_template() added an if defined $fh test - * added a chmod 600 to the mobycentral.config because it has + * added a chmod 644 to the mobycentral.config because it has the DB root password * called die() if mysql wasn't detected - fixed a bug in the service_tester.pl script that referenced $opt_c instead of $url. (thanks to Jason Stewart) + - prompt for a username/password for the registry to access the db. + if the user doesnt exist, we add it. This helps us stay away from + using the root password in the mobycentral.config file. 1.04 - fixed bug in MOBY::Client::Central::DUMP that resulted