Skip to content

Commit ceb5839

Browse files
authored
Merge pull request #1988 from idodeclare/feature/help_details
Feature/help details
2 parents 4f0537f + 85c0ace commit ceb5839

37 files changed

+1191
-273
lines changed

OpenGrok

Lines changed: 126 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -18,116 +18,13 @@
1818
# CDDL HEADER END
1919

2020
#
21-
# OpenGrok Wrapper (initial setup and cron job updating)
22-
#
23-
# Supported Operating Systems:
24-
# - Solaris 11 (SunOS 5.11)
25-
# - Debian (Linux)
26-
#
27-
# Supported Deployment Engines:
28-
# - Tomcat 8
29-
# - Glassfish
30-
# - Resin
31-
#
32-
# Supported Environment Variables:
33-
# - OPENGROK_NON_INTERACTIVE Suppress Progress and Warnings Messages (*)
34-
# - OPENGROK_STANDARD_ENV Run Time Shell Environment (Shell Script)
35-
# - OPENGROK_CONFIGURATION User Configuration (Shell Script)
36-
#
37-
# Supported Environment Variables for configuring the default setup:
38-
# - OPENGROK_DISTRIBUTION_BASE Base Directory of the OpenGrok Distribution
39-
# - OPENGROK_INSTANCE_BASE Base Directory of the OpenGrok User Data Area
40-
# - OPENGROK_SRC_ROOT directory with files to be indexed
41-
# - OPENGROK_DATA_ROOT directory where index and cache files are generated
42-
# - OPENGROK_CTAGS Full path to Exuberant or Universal CTags binary
43-
# - OPENGROK_CTAGS_OPTIONS_FILE Full path to file with extra command line
44-
# options for CTags program (for its --options
45-
# switch), default is DATA_ROOT/etc/ctags.config
46-
# - OPENGROK_MANDOC Full path to mandoc(1) binary
47-
# - OPENGROK_LOCKING Locking mode on|off|simple|native (default off)
48-
# ("on" is an alias for "simple")
49-
# - JAVA_HOME Full Path to Java Installation Root
50-
# - JAVA Full Path to java binary (to enable 64bit JDK)
51-
# - JAVA_OPTS Java options (e.g. for JVM memory increase
52-
# or enabling server JDK)
53-
# JAVA_OPTS=-Xmx2048m is the default!
54-
# - OPENGROK_APP_SERVER Application Server ("Tomcat", "Glassfish" or "Resin")
55-
# - OPENGROK_WAR_TARGET_TOMCAT Tomcat Specific WAR Target Directory
56-
# - OPENGROK_WAR_TARGET_GLASSFISH Glassfish Specific WAR Target Directory
57-
# - OPENGROK_WAR_TARGET_RESIN Resin Specific WAR Target Directory
58-
# - OPENGROK_WAR_TARGET Fallback WAR Target Directory
59-
# - OPENGROK_TOMCAT_BASE Base Directory for Tomcat (contains webapps)
60-
# - OPENGROK_GLASSFISH_BASE Base Directory for Glassfish
61-
# (contains domains)
62-
# - OPENGROK_GLASSFISH_DOMAIN Preferred Glassfish Domain Name
63-
# - OPENGROK_RESIN_BASE Base Directory for Resin (contains webapps)
64-
# - OPENGROK_VERBOSE Enable Verbose Mode in opengrok.jar (*)
65-
# - OPENGROK_PROGRESS Shows progress in %(percentage) of working
66-
# through project, it's good to have Verbose
67-
# Mode enabled too, cost of this is one more
68-
# traversal of the project before indexing it(*)
69-
# - OPENGROK_RENAMED_FILES_HISTORY If set to "on", get full history of
70-
# renamed files for SCMs that support it (Git,
71-
# Mercurial).
72-
# The default is off.
73-
# When set to on, the indexing is slower,
74-
# especially in the presence of
75-
# lots of renamed files in the repository.
76-
# - OPENGROK_GENERATE_HISTORY Influence history cache generation
77-
# Following values are recognized:
78-
# on - enabled (default)
79-
# off - disabled for indexing and UI
80-
# dirbased - indexing enabled only for repos
81-
# which can fetch history for
82-
# directory
83-
# local - for local repos only
84-
# uionly - enabled for UI only
85-
# - OPENGROK_ENABLE_PROJECTS Enable projects (set it to true or false)
86-
# Every directory in SRC_ROOT is
87-
# considered a separate project
88-
# - OPENGROK_IGNORE_PATTERNS Set ignored patterns for indexer to skip.
89-
# OPENGROK_IGNORE_PATTERNS="-i dummy"
90-
# OPENGROK_IGNORE_PATTERNS="-i f:dummy"
91-
# OPENGROK_IGNORE_PATTERNS="-i d:dummy"
92-
# Multiple entries can be joined together:
93-
# "-i dummy -i d:tmp -i f:dummy"
94-
# - OPENGROK_SCAN_REPOS Disable Scan for repositories (*)
95-
# - OPENGROK_SCAN_DEPTH how deep should scanning for repos go
96-
# (by default 3 directories from SRC_ROOT)
97-
# - OPENGROK_WEBAPP_CFGADDR Web app address to send configuration to
98-
# (use "none" to avoid sending it to web app)
99-
# - OPENGROK_WEBAPP_CONTEXT Context URL of the OpenGrok webapp
100-
# (by default /source)
101-
# - FULL reindex is needed once this is used
102-
# (old already indexed files won't be refreshed)
103-
# - OPENGROK_WPREFIX Disable wildcard prefix search query
104-
# support (*)
105-
# - OPENGROK_TAG Enable parsing of revision tags into the History
106-
# view
107-
# - OPENGROK_READ_XML_CONFIGURATION file with read only configuration
108-
# - temporary workaround for bug # 327
109-
# - OPENGROK_FLUSH_RAM_BUFFER_SIZE="-m 16" - set RAM buffer size for flushing,
110-
# default is 16MB per thread, you might try to
111-
# increase it to 256MB, but do increase JVM to
112-
# 4/8/16GB ! Lucene defaults to 8 threads.
113-
# Increase JVM memory as noted using JAVA_OPTS
114-
# - OPENGROK_PARALLELISM Default is 0, meaning that parallelism is
115-
# determined from available processors.
116-
# - OPENGROK_LOGGER_CONFIG_PATH Set path to custom logging.properties file.
117-
# - OPENGROK_SUBVERSION_USERNAME name of the user that should be used for
118-
# fetching the history from subversion
119-
# - OPENGROK_SUBVERSION_PASSWORD password of the user that should be used for
120-
# fetching the history from subversion
121-
#
122-
# - OPENGROK_PROFILER Pause to await user input for profiling.
123-
#
124-
# Notes:
125-
# (*) Any Non-Empty String will enable these options
21+
# Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
22+
# Portions Copyright (c) 2017-2018, Chris Fraire <[email protected]>.
12623
#
12724

12825
#
129-
# Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
130-
# Portions Copyright (c) 2017-2018, Chris Fraire <[email protected]>.
26+
# opengrok.jar wrapper for initial setup and cron job updating.
27+
# Please see the Usage() function below for supported environment variables.
13128
#
13229

13330
#
@@ -139,22 +36,132 @@ Usage()
13936

14037
exec >&2
14138
echo ""
142-
echo "Usage: ${progname} <bootstrap|deploy|update|updateQuietly|updateDesc|usage|help>"
39+
echo "Usage: ${progname} <bootstrap|deploy|update|updateQuietly|updateDesc>"
14340
echo " ${progname} index [<directory>]"
14441
echo " ${progname} indexpart <directory_1> [<directory_2> ..]"
14542
echo " ${progname} clearHistory <src_root> <repository_name>"
43+
echo " ${progname} usage|help [--detailed]"
14644
echo ""
14745
echo " The \"indexpart\" assumes that it will be run with configuration"
14846
echo " pointed to via the OPENGROK_READ_XML_CONFIGURATION environment"
14947
echo " variable."
15048
echo ""
151-
echo " Optional environment variables:"
152-
echo " OPENGROK_CONFIGURATION - location of your configuration"
153-
echo " e.g. $ OPENGROK_CONFIGURATION=/var/opengrok/myog.conf ${0} ... "
154-
echo ""
155-
echo " See the code for more information on configuration options /" \
156-
"variables"
157-
echo ""
49+
if [ "$1" != "--detailed" ]; then
50+
echo " Optional environment variables:"
51+
echo " OPENGROK_CONFIGURATION - location of your configuration"
52+
echo " e.g. $ OPENGROK_CONFIGURATION=/var/opengrok/myog.conf \\"
53+
echo " ${0} ... "
54+
echo ""
55+
echo " Use help --detailed, or see the code for more information on"
56+
echo " configuration options and variables."
57+
else
58+
cat <<END
59+
Supported Environment Variables:
60+
- OPENGROK_CONFIGURATION User Configuration (Shell Script)
61+
- OPENGROK_NON_INTERACTIVE Suppress Progress and Warnings Messages (*)
62+
- OPENGROK_STANDARD_ENV Run Time Shell Environment (Shell Script)
63+
64+
Supported Environment Variables for configuring the default setup:
65+
- OPENGROK_DISTRIBUTION_BASE Base Directory of the OpenGrok Distribution
66+
- OPENGROK_INSTANCE_BASE Base Directory of the OpenGrok User Data Area
67+
- OPENGROK_SRC_ROOT directory with files to be indexed
68+
- OPENGROK_DATA_ROOT Base Directory where index and cache files are
69+
generated
70+
- OPENGROK_CTAGS Full path to Exuberant or Universal CTags binary
71+
- OPENGROK_CTAGS_OPTIONS_FILE Full path to file with extra command line
72+
options for CTags program (for its --options
73+
switch), default is DATA_ROOT/etc/ctags.config
74+
- OPENGROK_MANDOC Full path to mandoc(1) binary
75+
- OPENGROK_LOCKING Locking mode on|off|simple|native (default off)
76+
("on" is an alias for "simple")
77+
- JAVA_HOME Full Path to Java Installation Root
78+
- JAVA Full Path to java binary (to enable 64bit JDK)
79+
- JAVA_OPTS Java options (e.g. for JVM memory increase
80+
or enabling server JDK)
81+
JAVA_OPTS=-Xmx2048m is the default!
82+
- OPENGROK_APP_SERVER Application Server ("Tomcat", "Glassfish" or
83+
"Resin")
84+
- OPENGROK_WAR_TARGET_TOMCAT Tomcat Specific WAR Target Directory
85+
- OPENGROK_WAR_TARGET_GLASSFISH Glassfish Specific WAR Target Directory
86+
- OPENGROK_WAR_TARGET_RESIN Resin Specific WAR Target Directory
87+
- OPENGROK_WAR_TARGET Fallback WAR Target Directory
88+
- OPENGROK_TOMCAT_BASE Base Directory for Tomcat (contains webapps)
89+
- OPENGROK_GLASSFISH_BASE Base Directory for Glassfish
90+
(contains domains)
91+
- OPENGROK_GLASSFISH_DOMAIN Preferred Glassfish Domain Name
92+
- OPENGROK_RESIN_BASE Base Directory for Resin (contains webapps)
93+
- OPENGROK_VERBOSE Enable Verbose Mode in opengrok.jar (*)
94+
- OPENGROK_PROGRESS Shows progress in %(percentage) of working
95+
through project, it's good to have Verbose
96+
Mode enabled too, cost of this is one more
97+
traversal of the project before indexing it(*)
98+
- OPENGROK_RENAMED_FILES_HISTORY If set to "on", get full history of
99+
renamed files for SCMs that support it (Git,
100+
Mercurial).
101+
The default is off.
102+
When set to on, the indexing is slower,
103+
especially in the presence of
104+
lots of renamed files in the repository.
105+
- OPENGROK_GENERATE_HISTORY Influence history cache generation
106+
Following values are recognized:
107+
on - enabled (default)
108+
off - disabled for indexing and UI
109+
dirbased - indexing enabled only for
110+
repos which can fetch history
111+
for directory
112+
local - for local repos only
113+
uionly - enabled for UI only
114+
- OPENGROK_ENABLE_PROJECTS Enable projects (set it to true or false)
115+
Every directory in SRC_ROOT is
116+
considered a separate project
117+
- OPENGROK_IGNORE_PATTERNS Set ignored patterns for indexer to skip.
118+
OPENGROK_IGNORE_PATTERNS="-i dummy"
119+
OPENGROK_IGNORE_PATTERNS="-i f:dummy"
120+
OPENGROK_IGNORE_PATTERNS="-i d:dummy"
121+
Multiple entries can be joined together:
122+
"-i dummy -i d:tmp -i f:dummy"
123+
- OPENGROK_SCAN_REPOS Disable Scan for repositories (*)
124+
- OPENGROK_SCAN_DEPTH how deep should scanning for repos go
125+
(by default 3 directories from SRC_ROOT)
126+
- OPENGROK_WEBAPP_CFGADDR Web app address to send configuration to
127+
(use "none" to avoid sending it to web app)
128+
- OPENGROK_WEBAPP_CONTEXT Context URL of the OpenGrok webapp
129+
(by default /source)
130+
- FULL reindex is needed once this is used
131+
(old already indexed files won't be refreshed)
132+
- OPENGROK_WPREFIX Disable wildcard prefix search query
133+
support (*)
134+
- OPENGROK_TAG Enable parsing of revision tags into the History
135+
view
136+
- OPENGROK_READ_XML_CONFIGURATION file with read only configuration
137+
- temporary workaround for bug # 327
138+
- OPENGROK_FLUSH_RAM_BUFFER_SIZE="-m 16" - set RAM buffer size for flushing,
139+
default is 16MB per thread, you might try to
140+
increase it to 256MB, but do increase JVM to
141+
4/8/16GB ! Lucene defaults to 8 threads.
142+
Increase JVM memory as noted using JAVA_OPTS
143+
- OPENGROK_PARALLELISM Default is 0, meaning that parallelism is
144+
determined from available processors.
145+
- OPENGROK_LOGGER_CONFIG_PATH Set path to custom logging.properties file.
146+
- OPENGROK_SUBVERSION_USERNAME name of the user that should be used for
147+
fetching the history from subversion
148+
- OPENGROK_SUBVERSION_PASSWORD password of the user that should be used for
149+
fetching the history from subversion
150+
- OPENGROK_PROFILER Pause to await user input for profiling.
151+
152+
Notes:
153+
(*) Any Non-Empty String will enable these options
154+
155+
Supported Operating Systems:
156+
- Solaris 11 (SunOS 5.11)
157+
- Debian (Linux)
158+
159+
Supported Deployment Engines:
160+
- Tomcat 8
161+
- Glassfish
162+
- Resin
163+
END
164+
fi
158165
exit 1
159166
}
160167

@@ -920,8 +927,9 @@ UpdateDescriptionCache()
920927

921928
OpenGrokUsage()
922929
{
930+
[ "$1" == "--detailed" ] && helpargs=$1
923931
echo "Options for opengrok.jar:" 1>&2
924-
${DO} ${JAVA} ${JAVA_OPTS} -jar "${OPENGROK_JAR}" '-?'
932+
${DO} ${JAVA} ${JAVA_OPTS} -jar "${OPENGROK_JAR}" '-?' $helpargs
925933
}
926934

927935
DeployWar()
@@ -1108,8 +1116,8 @@ case "${1}" in
11081116
;;
11091117

11101118
usage|help)
1111-
OpenGrokUsage
1112-
Usage
1119+
OpenGrokUsage $2
1120+
Usage $2
11131121
;;
11141122
*)
11151123
Usage

opengrok-indexer/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ Portions Copyright (c) 2017, Chris Fraire <[email protected]>.
9595
<exclude>*.java</exclude>
9696
</excludes>
9797
</testResource>
98+
<testResource>
99+
<targetPath>org/opensolaris/opengrok/analysis/archive/</targetPath>
100+
<directory>../test/org/opensolaris/opengrok/analysis/archive/</directory>
101+
<excludes>
102+
<exclude>*.java</exclude>
103+
</excludes>
104+
</testResource>
98105
<testResource>
99106
<targetPath>org/opensolaris/opengrok/analysis/clojure/</targetPath>
100107
<directory>../test/org/opensolaris/opengrok/analysis/clojure/</directory>

src/org/opensolaris/opengrok/analysis/AnalyzerGuru.java

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import java.lang.reflect.InvocationTargetException;
3535
import java.util.ArrayList;
3636
import java.util.Arrays;
37+
import java.util.Collections;
3738
import java.util.Comparator;
3839
import java.util.HashMap;
3940
import java.util.List;
@@ -54,6 +55,7 @@
5455
import org.apache.lucene.document.TextField;
5556
import org.apache.lucene.util.BytesRef;
5657
import org.opensolaris.opengrok.analysis.FileAnalyzer.Genre;
58+
import org.opensolaris.opengrok.analysis.FileAnalyzerFactory.Matcher;
5759
import org.opensolaris.opengrok.analysis.ada.AdaAnalyzerFactory;
5860
import org.opensolaris.opengrok.analysis.archive.BZip2AnalyzerFactory;
5961
import org.opensolaris.opengrok.analysis.archive.GZIPAnalyzerFactory;
@@ -280,12 +282,28 @@ public class AnalyzerGuru {
280282

281283
}
282284

285+
public static Map<String, FileAnalyzerFactory> getExtensionsMap() {
286+
return Collections.unmodifiableMap(ext);
287+
}
288+
289+
public static Map<String, FileAnalyzerFactory> getPrefixesMap() {
290+
return Collections.unmodifiableMap(pre);
291+
}
292+
293+
public static Map<String, FileAnalyzerFactory> getMagicsMap() {
294+
return Collections.unmodifiableMap(magics);
295+
}
296+
297+
public static List<Matcher> getAnalyzerFactoryMatchers() {
298+
return Collections.unmodifiableList(matchers);
299+
}
300+
283301
public static Map<String, String> getfileTypeDescriptions() {
284-
return fileTypeDescriptions;
302+
return Collections.unmodifiableMap(fileTypeDescriptions);
285303
}
286304

287305
public List<FileAnalyzerFactory> getAnalyzerFactories() {
288-
return factories;
306+
return Collections.unmodifiableList(factories);
289307
}
290308

291309
/**

0 commit comments

Comments
 (0)