[Bps-public-commit] r15097 - in sd/trunk: . lib/App/SD/CLI/Command/Help t
sartak at bestpractical.com
sartak at bestpractical.com
Tue Aug 12 19:30:19 EDT 2008
Author: sartak
Date: Tue Aug 12 19:30:18 2008
New Revision: 15097
Added:
sd/trunk/lib/App/SD/CLI/Command/Help/
sd/trunk/lib/App/SD/CLI/Command/Help/About.pm
sd/trunk/lib/App/SD/CLI/Command/Help/Attachments.pm
sd/trunk/lib/App/SD/CLI/Command/Help/Authors.pm
sd/trunk/lib/App/SD/CLI/Command/Help/Comments.pm
sd/trunk/lib/App/SD/CLI/Command/Help/Copying.pm
sd/trunk/lib/App/SD/CLI/Command/Help/Environment.pm
sd/trunk/lib/App/SD/CLI/Command/Help/Search.pm
sd/trunk/lib/App/SD/CLI/Command/Help/Sync.pm
sd/trunk/lib/App/SD/CLI/Command/Help/Tickets.pm
sd/trunk/lib/App/SD/CLI/Command/Server.pm
sd/trunk/t/big-hm-rt.t
Modified:
sd/trunk/ (props changed)
Log:
r69431 at onn: sartak | 2008-08-12 19:30:08 -0400
Re-add strangely removed files
Added: sd/trunk/lib/App/SD/CLI/Command/Help/About.pm
==============================================================================
--- (empty file)
+++ sd/trunk/lib/App/SD/CLI/Command/Help/About.pm Tue Aug 12 19:30:18 2008
@@ -0,0 +1,39 @@
+package App::SD::CLI::Command::Help::About;
+use Moose;
+extends 'App::SD::CLI::Command::Help';
+
+sub run {
+ my $self = shift;
+ my $cmd = $self->_get_cmd_name;
+ $self->print_header('About SD');
+
+print <<EOF
+sd is a peer-to-peer replicated issue tracking system built on the
+Prophet dataabase and synchronization framework. sd is designed for
+inter-organization replication and sharing, as well as offline
+operation. For more information, join us at http://syncwith.us.
+
+AUTHORS: (in alphabetical order)
+
+sd was originally conceived and designed by Jesse Vincent and Chia-liang
+Kao at Best Practical Solutions. Many others have contributed to sd.
+For a full author list, type:
+ $cmd help authors
+
+sd is open-source software, distributed under the terms of the MIT
+license. You are free to use this software, modify it and redistribute
+your changed version. You are not required to share your changes
+to this software, however, the authors would appreciate it if you
+would contribute improvements so that they may be shared with the
+community. For license details, type:
+ $cmd help copying
+
+EOF
+
+}
+
+__PACKAGE__->meta->make_immutable;
+no Moose;
+
+1;
+
Added: sd/trunk/lib/App/SD/CLI/Command/Help/Attachments.pm
==============================================================================
--- (empty file)
+++ sd/trunk/lib/App/SD/CLI/Command/Help/Attachments.pm Tue Aug 12 19:30:18 2008
@@ -0,0 +1,29 @@
+package App::SD::CLI::Command::Help::Attachments;
+use Moose;
+extends 'App::SD::CLI::Command::Help';
+
+sub run {
+ my $self = shift;
+ $self->print_header('Working with ticket attachments');
+ my $cmd = $self->_get_cmd_name;
+
+print <<EOF
+== Working with ticket attachments
+
+ $cmd ticket attachment create 456 --file bugfix.patch
+ Create a new attachment on this ticket from the file 'bugfix.patch'.
+
+ $cmd ticket attachment list 456
+ Show all attachemnts on ticket 456
+
+ $cmd ticket attachment content 567
+ Send the content of attachment 567 to STDOUT
+EOF
+
+}
+
+__PACKAGE__->meta->make_immutable;
+no Moose;
+
+1;
+
Added: sd/trunk/lib/App/SD/CLI/Command/Help/Authors.pm
==============================================================================
--- (empty file)
+++ sd/trunk/lib/App/SD/CLI/Command/Help/Authors.pm Tue Aug 12 19:30:18 2008
@@ -0,0 +1,28 @@
+package App::SD::CLI::Command::Help::Authors;
+use Moose;
+extends 'App::SD::CLI::Command::Help';
+
+sub run {
+ my $self = shift;
+ my $cmd = $self->_get_cmd_name;
+ $self->print_header("Authors");
+
+print <<EOF
+(in alphabetical order)
+
+Chia-liang Kao <clkao\@clkao.org>
+Shawn Moore <sartak\@sartak.org>
+Christine Spang <spang\@mit.edu>
+Jesse Vincent <jesse\@fsck.com>
+Casey West <casey\@geeknest.com>
+Simon Wistow <simon\@thegestalt.org>
+
+EOF
+
+}
+
+__PACKAGE__->meta->make_immutable;
+no Moose;
+
+1;
+
Added: sd/trunk/lib/App/SD/CLI/Command/Help/Comments.pm
==============================================================================
--- (empty file)
+++ sd/trunk/lib/App/SD/CLI/Command/Help/Comments.pm Tue Aug 12 19:30:18 2008
@@ -0,0 +1,30 @@
+package App::SD::CLI::Command::Help::Comments;
+use Moose;
+extends 'App::SD::CLI::Command::Help';
+
+sub run {
+ my $self = shift;
+ $self->print_header('Working with ticket comments');
+ my $cmd = $self->_get_cmd_name;
+
+print <<EOF
+ $cmd ticket comment 456
+ Add a comment to the ticket with id 456, popping up a text editor
+
+ $cmd ticket comment 456 --file=myfile
+ Add a comment to the ticket with id 456, using the content of 'myfile'
+
+ $cmd ticket comment list
+ List all ticket comments
+
+ $cmd ticket comment show 4
+ Show ticket comment 4 and all metadata
+EOF
+
+}
+
+__PACKAGE__->meta->make_immutable;
+no Moose;
+
+1;
+
Added: sd/trunk/lib/App/SD/CLI/Command/Help/Copying.pm
==============================================================================
--- (empty file)
+++ sd/trunk/lib/App/SD/CLI/Command/Help/Copying.pm Tue Aug 12 19:30:18 2008
@@ -0,0 +1,36 @@
+package App::SD::CLI::Command::Help::Copying;
+use Moose;
+extends 'App::SD::CLI::Command::Help';
+
+sub run {
+ my $self = shift;
+ $self->print_header('License Terms (The MIT license)');
+
+print <<EOF
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+EOF
+
+}
+
+__PACKAGE__->meta->make_immutable;
+no Moose;
+
+1;
+
Added: sd/trunk/lib/App/SD/CLI/Command/Help/Environment.pm
==============================================================================
--- (empty file)
+++ sd/trunk/lib/App/SD/CLI/Command/Help/Environment.pm Tue Aug 12 19:30:18 2008
@@ -0,0 +1,20 @@
+package App::SD::CLI::Command::Help::Environment;
+use Moose;
+extends 'App::SD::CLI::Command::Help';
+
+sub run {
+ my $self = shift;
+ $self->print_header('Environment variables');
+
+print <<EOF
+ export SD_REPO=/path/to/sd/replica
+ Specify where the ticket database SD is using should reside
+EOF
+
+}
+
+__PACKAGE__->meta->make_immutable;
+no Moose;
+
+1;
+
Added: sd/trunk/lib/App/SD/CLI/Command/Help/Search.pm
==============================================================================
--- (empty file)
+++ sd/trunk/lib/App/SD/CLI/Command/Help/Search.pm Tue Aug 12 19:30:18 2008
@@ -0,0 +1,40 @@
+package App::SD::CLI::Command::Help::Search;
+use Moose;
+extends 'App::SD::CLI::Command::Help';
+
+sub run {
+ my $self = shift;
+ $self->print_header('Searching for and displaying tickets');
+ my $cmd = $self->_get_cmd_name;
+
+print <<EOF
+ $cmd ticket search
+ Lists all tickets with a status that does not match 'closed'
+
+ $cmd ticket search --regex abc
+ Lists all tickets with content matching 'abc'
+
+ $cmd ticket search -- status!=closed summary =~ http
+ Lists all tickets with a status that does match closed
+ and a summary matching 'http'
+
+ $cmd ticket show 1234
+ Show basic information for the ticket with local id 1234
+
+ $cmd ticket details 1234
+ Show basic information and history for the ticket with local id 1234
+
+ $cmd ticket history 1234
+ Show history for the ticket with local id 1234
+
+ $cmd ticket delete 1234
+ Deletes ticket with local id 1234
+EOF
+
+}
+
+__PACKAGE__->meta->make_immutable;
+no Moose;
+
+1;
+
Added: sd/trunk/lib/App/SD/CLI/Command/Help/Sync.pm
==============================================================================
--- (empty file)
+++ sd/trunk/lib/App/SD/CLI/Command/Help/Sync.pm Tue Aug 12 19:30:18 2008
@@ -0,0 +1,51 @@
+
+package App::SD::CLI::Command::Help::Sync;
+use Moose;
+extends 'App::SD::CLI::Command::Help';
+
+sub run {
+ my $self = shift;
+ $self->print_header('Sharing ticket databases');
+ my $cmd = $self->_get_cmd_name;
+
+print <<EOF
+ $cmd pull --from http://example.com/path/to/sd
+ Integrate changes from a published SD replica over http, ftp or
+ file URL schemes.
+
+ $cmd pull --all
+ Integrate changes from all replicas this replica has pulled from
+ before
+
+ $cmd pull --local
+ Integrate changes from all replicas currently announcing themselves
+ on the local network using Bonjour
+
+ $cmd publish --to jesse\@server:path/to/destination
+ Publish a copy of this replica to a remote server using rsync over
+ ssh.
+
+ $cmd publish --html --replica --to jesse\@server:path/to/destination
+ Publish a copy of this replica, including a static html representation,
+ to a remote server using rsync over ssh.
+
+ $comd server --port 9876
+ Start an sd replica server on port 9876. This command will make your
+ replica browsable and pullable by anyone with remote access to your
+ computer.
+
+ $comd server --writable --port 9876
+ Start an sd replica server on port 9876, with UNAUTHENTICATED,
+ PUBLIC WRITE ACCESS via HTTP POST. This command will make your
+ replica modifiable, browsable and pullable by ANYONE with remote
+ access to your computer.
+
+EOF
+
+}
+
+__PACKAGE__->meta->make_immutable;
+no Moose;
+
+1;
+
Added: sd/trunk/lib/App/SD/CLI/Command/Help/Tickets.pm
==============================================================================
--- (empty file)
+++ sd/trunk/lib/App/SD/CLI/Command/Help/Tickets.pm Tue Aug 12 19:30:18 2008
@@ -0,0 +1,34 @@
+package App::SD::CLI::Command::Help::Tickets;
+use Moose;
+extends 'App::SD::CLI::Command::Help';
+
+sub run {
+ my $self = shift;
+ $self->print_header('Working with tickets');
+ my $cmd = $self->_get_cmd_name;
+
+print <<EOF
+ $cmd ticket create
+ Invokes a text editor with a ticket creation template
+
+ $cmd ticket create --summary="This is a summary" status=open
+ Create a new ticket non-interactively
+
+ $cmd ticket update 123 -- status=closed
+ Sets the status of the ticket with local id 123 to closed
+
+ $cmd ticket resolve 123
+ Sets the status of the ticket with local id 123 to closed
+
+ $cmd ticket update fad5849a-67f1-11dd-bde1-5b33d3ff2799 -- status=closed
+ Sets the status of the ticket with uuid
+ fad5849a-67f1-11dd-bde1-5b33d3ff2799 to closed
+EOF
+
+}
+
+__PACKAGE__->meta->make_immutable;
+no Moose;
+
+1;
+
Added: sd/trunk/lib/App/SD/CLI/Command/Server.pm
==============================================================================
--- (empty file)
+++ sd/trunk/lib/App/SD/CLI/Command/Server.pm Tue Aug 12 19:30:18 2008
@@ -0,0 +1,13 @@
+package App::SD::CLI::Command::Server;
+use Moose;
+extends 'Prophet::CLI::Command::Server';
+
+sub run {
+ my $self = shift;
+ my $server = $self->_setup_server();
+ $server->read_only(1) unless ($self->has_arg('writable'));
+ $server->run;
+}
+
+1;
+
Added: sd/trunk/t/big-hm-rt.t
==============================================================================
--- (empty file)
+++ sd/trunk/t/big-hm-rt.t Tue Aug 12 19:30:18 2008
@@ -0,0 +1,131 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+
+# to run:
+# RT_DBA_USER=root RT_DBA_PASSWORD= prove -lv -I/Users/clkao/work/bps/rt-3.7/lib t/sd-rt.t
+
+use Prophet::Test;
+use App::SD::Test;
+
+# dramatis personae {{{
+our (%USERS, @USERS, $CURRENT_USER_DATA);
+BEGIN {
+ %USERS = map { $_ => {} } qw(
+ alex
+ clkao
+ jesse
+ kevin
+ shawn
+ );
+ @USERS = sort keys %USERS;
+
+ # generate "as_person" methods which will perform acts on behalf of that
+ # person, such as pull from HM or push to RT
+ for my $user (@USERS) {
+ my $data = $USERS{$user};
+ my $function = "as_$user";
+
+ no strict 'refs';
+ *$function = sub (&) {
+ my $code = shift;
+
+ local $CURRENT_USER_DATA = $data;
+ Jifty->web->current_user($data->{hm_current_user});
+
+ $code->();
+ };
+ }
+}
+# }}}
+# do we have HM and RT? {{{
+BEGIN {
+ unless (eval 'use RT::Test (); 1') {
+ diag $@;
+ plan skip_all => 'requires 3.7 to run tests.';
+ }
+}
+
+BEGIN {
+ require File::Temp;
+
+ my $skip_all = sub {
+ my $reason = shift;
+ plan skip_all => "You must define a JIFTY_APP_ROOT environment variable which points to your Hiveminder source tree. I was unable to $reason."
+ };
+
+ $skip_all->("find JIFTY_APP_ROOT") unless $ENV{'JIFTY_APP_ROOT'};
+ $skip_all->("load Jifty") unless eval "use Jifty; 1";
+
+ push @INC, File::Spec->catdir(Jifty::Util->app_root, "lib");
+
+ $skip_all->("load BTDT::Test") unless eval "use BTDT::Test; 1";
+}
+# }}}
+
+plan tests => 17;
+
+# setup the servers {{{
+RT::Test->import;
+no warnings 'once';
+RT::Handle->InsertData( $RT::EtcPath . '/initialdata' );
+
+my ($RT_URL) = RT::Test->started_ok;
+diag("RT server started at $RT_URL");
+
+my $HM_SERVER = BTDT::Test->make_server;
+my $HM_URL = $HM_SERVER->started_ok;
+# }}}
+# create users {{{
+for my $username (@USERS) {
+ my $email = "$username\@example.com";
+ diag "Creating $username\'s accounts";
+# hiveminder {{{
+ do {
+ my $user_obj = BTDT::Model::User->new(
+ current_user => BTDT::CurrentUser->superuser,
+ );
+ my ($ok, $msg) = $user_obj->create(
+ name => $username,
+ email => $email,
+ password => 'password',
+ email_confirmed => 1,
+ access_level => 'guest',
+ accepted_eula_version => Jifty->config->app('EULAVersion'),
+ );
+ $msg ||= 'ok';
+ ok($ok, "Created $username HM user: $msg");
+
+ my $current_user = BTDT::CurrentUser->new(email => $email);
+
+ $USERS{$username} = {
+ %{ $USERS{$username} },
+ hm_user => $user_obj,
+ hm_current_user => $current_user,
+ };
+ };
+# }}}
+# RT {{{
+ do {
+ my $user_obj = RT::User->new($RT::SystemUser);
+ my ($ok, $msg) = $user_obj->Create(
+ Name => $username,
+ EmailAddress => $email,
+ );
+ $msg ||= 'ok';
+ ok($ok, "Created $username HM user: $msg");
+
+ ($ok, $msg) = $user_obj->PrincipalObj->GrantRight(
+ Right => 'SuperUser',
+ );
+ ok($ok, "Granted $username SuperUser right: $msg");
+
+ $USERS{$username} = {
+ %{ $USERS{$username} },
+ rt_user => $user_obj,
+ };
+ };
+# }}}
+}
+# }}}
+
More information about the Bps-public-commit
mailing list