Repository: bokeh/bokeh

Issue:
"bokeh static" command
Should be a command to report the location of static assets (e.g, to help with configuring `nginx`, etc)



Discussion:

Resolving patch:
diff --git a/bokeh/command/subcommands/info.py b/bokeh/command/subcommands/info.py
new file mode 100644
--- /dev/null
+++ b/bokeh/command/subcommands/info.py
@@ -0,0 +1,74 @@
+'''
+
+To display information about Bokeh and Bokeh server configuration,
+type ``bokeh info`` on the command line.
+
+.. code-block:: sh
+
+    bokeh info
+
+This will print general information to standard output, such as Python and Bokeh versions:
+
+.. code-block:: none
+
+    Python version      :  2.7.11
+    IPython version     :  4.0.1
+    Bokeh version       :  0.11.0
+    BokehJS static path :  /opt/anaconda/lib/python3.4/site-packages/bokeh/server/static
+
+Sometimes it can be useful to get just paths to the BokehJS static files in order
+to configure other servers or processes. To do this, use the ``--static`` option
+
+.. code-block:: sh
+
+    bokeh info --static
+
+This will produce output like what is shown below
+
+.. code-block:: none
+
+    /opt/anaconda/lib/python3.4/site-packages/bokeh/server/static
+
+
+
+'''
+from __future__ import absolute_import
+
+import sys
+
+from bokeh import __version__
+from bokeh.settings import settings
+
+from ..subcommand import Subcommand
+
+class Info(Subcommand):
+    ''' Subcommand to print information about Bokeh and Bokeh server configuration.
+
+    '''
+
+    name = "info"
+
+    help = "print information about Bokeh and Bokeh server configuration"
+
+    args = (
+
+        ('--static', dict(
+            action='store_true',
+            help="Print the locations of BokehJS static files",
+        )),
+
+    )
+
+    def invoke(self, args):
+        if args.static:
+            print(settings.bokehjsdir())
+        else:
+            try:
+                import IPython
+                ipy_version = IPython.__version__
+            except ImportError:
+                ipy_version = "Not installed"
+            print("Python version      :  %s" % sys.version.split('\n')[0])
+            print("IPython version     :  %s" % ipy_version)
+            print("Bokeh version       :  %s" % __version__)
+            print("BokehJS static path :  %s" % settings.bokehjsdir())


Test patch:
diff --git a/bokeh/command/subcommands/tests/test_info.py b/bokeh/command/subcommands/tests/test_info.py
new file mode 100644
--- /dev/null
+++ b/bokeh/command/subcommands/tests/test_info.py
@@ -0,0 +1,43 @@
+from __future__ import absolute_import
+
+import bokeh.command.subcommands.info as scinfo
+from bokeh.command.bootstrap import main
+
+def test_create():
+    import argparse
+    from bokeh.command.subcommand import Subcommand
+
+    obj = scinfo.Info(parser=argparse.ArgumentParser())
+    assert isinstance(obj, Subcommand)
+
+def test_name():
+    assert scinfo.Info.name == "info"
+
+def test_help():
+    assert scinfo.Info.help == "print information about Bokeh and Bokeh server configuration"
+
+def test_args():
+    assert scinfo.Info.args == (
+        ('--static', dict(
+            action='store_true',
+            help="Print the locations of BokehJS static files",
+        )),
+    )
+
+def test_run(capsys):
+    main(["bokeh", "info"])
+    out, err = capsys.readouterr()
+    lines = out.split("\n")
+    assert len(lines) == 5
+    assert lines[0].startswith("Python version")
+    assert lines[1].startswith("IPython version")
+    assert lines[2].startswith("Bokeh version")
+    assert lines[3].startswith("BokehJS static")
+    assert lines[4] == ""
+    assert err == ""
+
+def test_run_static(capsys):
+    main(["bokeh", "info", "--static"])
+    out, err = capsys.readouterr()
+    assert err == ""
+    assert out.endswith('/bokeh/server/static\n')
diff --git a/bokeh/command/tests/test_bootstrap.py b/bokeh/command/tests/test_bootstrap.py
--- a/bokeh/command/tests/test_bootstrap.py
+++ b/bokeh/command/tests/test_bootstrap.py
@@ -11,7 +11,7 @@ def test_no_subcommand(capsys):
     with pytest.raises(SystemExit):
         main(["bokeh"])
     out, err = capsys.readouterr()
-    assert err == "ERROR: Must specify subcommand, one of: html, json, secret or serve\n"
+    assert err == "ERROR: Must specify subcommand, one of: html, info, json, secret or serve\n"
     assert out == ""
 
 def _assert_version_output(capsys):