Skip to content

Commit 91d0e02

Browse files
idodeclareVladimir Kotal
authored andcommitted
Add Ruby magics and pathless magic for Escript, Perl, PHP, Python
Also: - Remove empty MAGICS for e.g. CSharp, Haskell, etc.
1 parent 17fd030 commit 91d0e02

File tree

9 files changed

+28
-20
lines changed

9 files changed

+28
-20
lines changed

src/org/opensolaris/opengrok/analysis/csharp/CSharpAnalyzerFactory.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
/*
2121
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
22+
* Portions Copyright (c) 2017, Chris Fraire <[email protected]>.
2223
*/
2324

2425
package org.opensolaris.opengrok.analysis.csharp;
@@ -35,11 +36,8 @@ public class CSharpAnalyzerFactory extends FileAnalyzerFactory {
3536
"CS"
3637
};
3738

38-
private static final String[] MAGICS = {
39-
};
40-
4139
public CSharpAnalyzerFactory() {
42-
super(null, null, SUFFIXES, MAGICS, null, "text/plain", Genre.PLAIN, name);
40+
super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN, name);
4341
}
4442

4543
@Override

src/org/opensolaris/opengrok/analysis/erlang/ErlangAnalyzerFactory.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
/*
2121
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
22+
* Portions Copyright (c) 2017, Chris Fraire <[email protected]>.
2223
*/
2324

2425
package org.opensolaris.opengrok.analysis.erlang;
@@ -35,7 +36,8 @@ public class ErlangAnalyzerFactory extends FileAnalyzerFactory {
3536
"ERL", "HRL", "ESCRIPT"
3637
};
3738
private static final String[] MAGICS = {
38-
"#!/usr/bin/env escript"
39+
"#!/usr/bin/env escript",
40+
"#!escript"
3941
};
4042

4143
public ErlangAnalyzerFactory() {

src/org/opensolaris/opengrok/analysis/haskell/HaskellAnalyzerFactory.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
/*
2121
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
22+
* Portions Copyright (c) 2017, Chris Fraire <[email protected]>.
2223
*/
2324

2425
package org.opensolaris.opengrok.analysis.haskell;
@@ -39,11 +40,9 @@ public class HaskellAnalyzerFactory extends FileAnalyzerFactory {
3940
"HS",
4041
"HSC"
4142
};
42-
private static final String[] MAGICS = {
43-
};
4443

4544
public HaskellAnalyzerFactory() {
46-
super(null, null, SUFFIXES, MAGICS, null, "text/plain", Genre.PLAIN, name);
45+
super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN, name);
4746
}
4847

4948
@Override

src/org/opensolaris/opengrok/analysis/javascript/JavaScriptAnalyzerFactory.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
/*
2121
* Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
22+
* Portions Copyright (c) 2017, Chris Fraire <[email protected]>.
2223
*/
2324

2425
package org.opensolaris.opengrok.analysis.javascript;
@@ -36,11 +37,8 @@ public class JavaScriptAnalyzerFactory extends FileAnalyzerFactory {
3637
"TS"
3738
};
3839

39-
private static final String[] MAGICS = {
40-
};
41-
4240
public JavaScriptAnalyzerFactory() {
43-
super(null, null, SUFFIXES, MAGICS, null, "text/plain", Genre.PLAIN, name);
41+
super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN, name);
4442
}
4543

4644
@Override

src/org/opensolaris/opengrok/analysis/json/JsonAnalyzerFactory.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
/*
2121
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
22+
* Portions Copyright (c) 2017, Chris Fraire <[email protected]>.
2223
*/
2324

2425
package org.opensolaris.opengrok.analysis.json;
@@ -35,11 +36,8 @@ public class JsonAnalyzerFactory extends FileAnalyzerFactory {
3536
"JSON"
3637
};
3738

38-
private static final String[] MAGICS = {
39-
};
40-
4139
public JsonAnalyzerFactory() {
42-
super(null, null, SUFFIXES, MAGICS, null, "text/plain", Genre.PLAIN, name);
40+
super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN, name);
4341
}
4442

4543
@Override

src/org/opensolaris/opengrok/analysis/perl/PerlAnalyzerFactory.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ public class PerlAnalyzerFactory extends FileAnalyzerFactory {
4848
"#!/usr/bin/env perl",
4949
"#!/usr/bin/perl",
5050
"#!/usr/local/bin/perl",
51-
"#!/bin/perl"
51+
"#!/bin/perl",
52+
"#!perl",
5253
};
5354

5455
public PerlAnalyzerFactory() {

src/org/opensolaris/opengrok/analysis/php/PhpAnalyzerFactory.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
/*
2121
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
22+
* Portions Copyright (c) 2017, Chris Fraire <[email protected]>.
2223
*/
2324

2425
package org.opensolaris.opengrok.analysis.php;
@@ -41,7 +42,8 @@ public class PhpAnalyzerFactory extends FileAnalyzerFactory {
4142
private static final String[] MAGICS = {
4243
"#!/usr/bin/env php",
4344
"#!/usr/bin/php",
44-
"#!/bin/php"
45+
"#!/bin/php",
46+
"#!php"
4547
};
4648

4749
public PhpAnalyzerFactory() {

src/org/opensolaris/opengrok/analysis/python/PythonAnalyzerFactory.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
/*
2121
* Copyright (c) 2010, 2015 Oracle and/or its affiliates. All rights reserved.
22+
* Portions Copyright (c) 2017, Chris Fraire <[email protected]>.
2223
*/
2324

2425
package org.opensolaris.opengrok.analysis.python;
@@ -45,7 +46,8 @@ public class PythonAnalyzerFactory extends FileAnalyzerFactory {
4546
private static final String[] MAGICS = {
4647
"#!/usr/bin/env python",
4748
"#!/usr/bin/python",
48-
"#!/bin/python"
49+
"#!/bin/python",
50+
"#!python"
4951
};
5052

5153
public PythonAnalyzerFactory() {

src/org/opensolaris/opengrok/analysis/ruby/RubyAnalyzerFactory.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,20 @@ public class RubyAnalyzerFactory extends FileAnalyzerFactory {
4040
"RB",
4141
"RUBY"
4242
};
43+
private static final String[] MAGICS = {
44+
"#!/usr/bin/env ruby",
45+
"#!/usr/bin/ruby",
46+
"#!/usr/local/bin/ruby",
47+
"#!/bin/ruby",
48+
"#!ruby",
49+
};
4350

4451
/**
4552
* Creates a new instance of {@link RubyAnalyzerFactory}.
4653
*/
4754
public RubyAnalyzerFactory() {
48-
super(null, null, SUFFIXES, null, null, "text/plain", Genre.PLAIN, name);
55+
super(null, null, SUFFIXES, MAGICS, null, "text/plain", Genre.PLAIN,
56+
name);
4957
}
5058

5159
/**

0 commit comments

Comments
 (0)