summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2017-07-21 21:03:16 +0200
committerGitHub <noreply@github.com>2017-07-21 21:03:16 +0200
commit87fed0b46b4b7868f0c15a9f6fb7a4291b4bbc1f (patch)
treedc6c164fd7332848808375fc21d09dd1799b34f5
parentaed295eb4dd4f78d358a46b7aff61f31e2056f67 (diff)
downloadbugzilla-87fed0b46b4b7868f0c15a9f6fb7a4291b4bbc1f.tar.gz
bugzilla-87fed0b46b4b7868f0c15a9f6fb7a4291b4bbc1f.tar.xz
better defaults for re.pl
-rw-r--r--README.rst50
-rw-r--r--vagrant_support/devtools.yml11
-rw-r--r--vagrant_support/repl.rc28
3 files changed, 89 insertions, 0 deletions
diff --git a/README.rst b/README.rst
index c1f3f8bfe..5db4c9954 100644
--- a/README.rst
+++ b/README.rst
@@ -10,6 +10,7 @@ BMO is Mozilla's highly customized version of Bugzilla.
1.1 Setup Vagrant VMs
1.2 Making Changes and Seeing them
1.3 Technical Details
+ 1.4 Perl Shell (re.pl, repl)
2 Docker Container
2.1 Container Arguments
2.2 Environmental Variables
@@ -95,6 +96,55 @@ configured to use memcached.
The push connector is not currently configured, nor is the Pulse publisher.
+Perl Shell (re.pl, repl)
+------------------------
+
+Installed on the vagrant vm is also a program called re.pl.
+
+re.pl an interactive perl shell (somtimes called a REPL (short for Read-Eval-Print-Loop)).
+It loads Bugzilla.pm and you can call Bugzilla internal API methods from it, an example session is reproduced below:
+
+.. code-block:: plain
+
+ re.pl
+ $ my $product = Bugzilla::Product->new({name => "Firefox"});
+ Took 0.0262260437011719 seconds.
+
+ $Bugzilla_Product1 = Bugzilla::Product=HASH(0x7e3c950);
+
+ $ $product->name
+ Took 0.000483036041259766 seconds.
+
+ Firefox
+
+It supports tab completion for file names, method names and so on. For more information see `Devel::REPL`_.
+
+You can use the 'p' command (provided by `Data::Printer`_) to inspect variables as well.
+
+.. code-block:: plain
+
+ $ p @INC
+ [
+ [0] ".",
+ [1] "lib",
+ [2] "local/lib/perl5/x86_64-linux-thread-multi",
+ [3] "local/lib/perl5",
+ [4] "/home/vagrant/perl/lib/perl5/x86_64-linux-thread-multi",
+ [5] "/home/vagrant/perl/lib/perl5",
+ [6] "/vagrant/local/lib/perl5/x86_64-linux-thread-multi",
+ [7] "/vagrant/local/lib/perl5",
+ [8] "/usr/local/lib64/perl5",
+ [9] "/usr/local/share/perl5",
+ [10] "/usr/lib64/perl5/vendor_perl",
+ [11] "/usr/share/perl5/vendor_perl",
+ [12] "/usr/lib64/perl5",
+ [13] "/usr/share/perl5",
+ [14] sub { ... }
+ ]
+
+.. _`Devel::REPL`: https://metacpan.org/pod/Devel::REPL
+.. _`Data::Printer`: https://metacpan.org/pod/Data::Printer
+
Docker Container
================
diff --git a/vagrant_support/devtools.yml b/vagrant_support/devtools.yml
index f9fb3e94f..fa554ce3c 100644
--- a/vagrant_support/devtools.yml
+++ b/vagrant_support/devtools.yml
@@ -9,7 +9,18 @@
- cpanm: name=File::Next notest=true locallib=/home/vagrant/perl executable=/usr/local/bin/cpanm
- cpanm: name=Sys::SigAction notest=true locallib=/home/vagrant/perl executable=/usr/local/bin/cpanm
- cpanm: name=Lexical::Persistence notest=true locallib=/home/vagrant/perl executable=/usr/local/bin/cpanm
+- cpanm: name=Data::Printer notest=true locallib=/home/vagrant/perl executable=/usr/local/bin/cpanm
+- cpanm: name=Devel::REPL::Plugin::ReadLineHistory::WithoutExpansion notest=true locallib=/home/vagrant/perl executable=/usr/local/bin/cpanm
+
+- name: fix ownership of repl stuff
+ file: path=/home/vagrant/perl owner=vagrant group=vagrant recurse=true
- name: copy re.pl
copy: src=re.pl dest=/usr/local/bin/re.pl mode=0755
+- name: mkdir .re.pl
+ file: path=/home/vagrant/.re.pl state=directory owner=vagrant group=vagrant mode=0775
+
+- name: copy .re.pl/repl.rc
+ copy: src=repl.rc dest=/home/vagrant/.re.pl/repl.rc mode=0644
+
diff --git a/vagrant_support/repl.rc b/vagrant_support/repl.rc
new file mode 100644
index 000000000..89ad089a5
--- /dev/null
+++ b/vagrant_support/repl.rc
@@ -0,0 +1,28 @@
+#!perl
+# vim: set ft=perl:
+use Bugzilla;
+use Bugzilla::Constants;
+Bugzilla->usage_mode(USAGE_MODE_CMDLINE);
+Bugzilla->extensions;
+use DDP return_value => 'void', colored => 1;
+
+my @plugins = qw(
+ Colors
+ Timing
+ Completion
+ CompletionDriver::INC
+ CompletionDriver::LexEnv
+ CompletionDriver::Keywords
+ CompletionDriver::Methods
+ History
+ LexEnv
+ DDS
+ Packages
+ Commands
+ MultiLine::PPI
+ ReadLineHistory::WithoutExpansion
+ Peek
+);
+
+$_REPL->load_plugin($_) for @plugins;
+