Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

revert the dirty hack of jifty help speedup

git-svn-id: svn+ssh://svn.bestpractical.com/svn/jifty.org/jifty/trunk@7496 e84bef0a-9b06-0410-84ba-c4c9edb13aeb
  • Loading branch information...
commit b392e3d48d0aa35dc767ef026f4444db2442d6fc 1 parent 452727a
@sunnavy sunnavy authored
Showing with 8 additions and 82 deletions.
  1. +6 −29 bin/jifty
  2. +2 −22 lib/Jifty/Script.pm
  3. +0 −31 lib/Jifty/Script/Help.pm
View
35 bin/jifty
@@ -1,39 +1,16 @@
#!/usr/bin/env perl
use warnings;
use strict;
+use UNIVERSAL::require;
BEGIN {
-
- # `use Jifty::Everything' is time-consuming,
- # when people just want to read the help message, waiting sucks.
- # on my machine, this is 4.5x faster or so, from 0.7s to 0.15s
- require Jifty::Script;
- if (
- @ARGV == 0
- || ( $ARGV[0] eq 'help' )
- && (
- @ARGV == 1 || grep { lc $ARGV[1] eq lc $_ } @Jifty::Script::CORE_CMDS,
- @Jifty::Script::CORE_MAN,
- )
- )
- {
-
- # only_core is to tell Jifty::Script not to use Jifty::Everything to find all
- # the cmds
- Jifty::Script->import( only_core => 1 );
- }
- else {
- no warnings 'once';
- require UNIVERSAL::require;
- Jifty::Util->require or die $UNIVERSAL::require::ERROR;
- my $root = Jifty::Util->app_root( quiet => 1 );
- unshift @INC, "$root/lib" if ($root);
-
- require Jifty;
- Jifty::Script->import;
- }
+ Jifty::Util->require or die $UNIVERSAL::require::ERROR;
+ my $root = Jifty::Util->app_root(quiet => 1);
+ unshift @INC, "$root/lib" if ($root);
}
+use Jifty;
+use Jifty::Script;
local $SIG{INT} = sub { warn "Stopped\n"; exit; };
Jifty::Script->dispatch();
View
24 lib/Jifty/Script.pm
@@ -2,21 +2,10 @@ package Jifty::Script;
use App::CLI;
use base qw/App::CLI App::CLI::Command Jifty::Object/;
+use Jifty::Everything;
+Jifty::Everything->plugin_commands;
use Pod::Usage;
-our @CORE_CMDS = qw/action adopt app env fastcgi help modperl2 model
- plugin po schema script server/;
-our @CORE_MAN = qw/
- AccessControl Glossary Tutorial
- AccessControl_zhtw JavaScript TutorialRest
- Actions JavaScript_zhtw Tutorial_de
- Actions_zhtw Models Tutorial_ja
- Continuations ObjectModel Tutorial_zhtw
- Cookbook PageRegions Upgrading
- Deploying Preload UsingCSSandJS
- Deploying_zhtw RequestHandling jQueryMigrationGuide
- FAQ Style /;
-
=head1 NAME
Jifty::Script - Base class for all bin/jifty commands
@@ -116,13 +105,4 @@ sub print_help {
) if $self->{man};
}
-sub import {
- my $self = shift;
- my %args = @_;
- unless ( $args{only_core} ) {
- require Jifty::Everything;
- Jifty::Everything->plugin_commands;
- }
-}
-
1;
View
31 lib/Jifty/Script/Help.pm
@@ -3,37 +3,6 @@ use strict;
use base qw( App::CLI::Command::Help Jifty::Script );
use File::Find qw(find);
-sub run {
- my $self = shift;
- my @topics = @_;
-
- push @topics, 'commands' unless (@topics);
-
- foreach my $topic (@topics) {
- if ( $topic eq 'commands' ) {
- $self->brief_usage($_) for $self->app->files;
- }
- elsif ( grep { $topic eq $_ } @Jifty::Script::CORE_CMDS ) {
- # to find usage of a CMD, App::CLI will require the CMD.pm first
- # that's too heavy for us because some CMD.pm `use Jifty',
- # which `use Jifty::Everything'!
- my $file = $INC{'Jifty/Script/Help.pm'};
- $file =~ s/Help(?=\.pm$)/ucfirst $topic/e;
-
- open my $fh, '<:utf8', $file or die $!;
- require Pod::Simple::Text;
- my $parser = Pod::Simple::Text->new;
- my $buf;
- $parser->output_string( \$buf );
- $parser->parse_file($fh);
- print $self->loc_text($buf);
- }
- else {
- $self->SUPER::run($topic);
- }
- }
-}
-
sub help_base {
return "Jifty::Manual";
}
Please sign in to comment.
Something went wrong with that request. Please try again.