haplo 2.1.0-java → 2.1.1-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +37 -0
- data/haplo.gemspec +2 -2
- data/lib/auth.rb +6 -0
- data/lib/check.rb +13 -6
- data/lib/custom.rb +6 -0
- data/lib/haplo-templates.jar +0 -0
- data/lib/hmac.rb +7 -1
- data/lib/hsvt_parser_config.rb +6 -0
- data/lib/js_min.js +7 -1
- data/lib/js_syntax_test.js +10 -4
- data/lib/local_config.rb +6 -0
- data/lib/manifest.rb +10 -4
- data/lib/minimise.rb +8 -2
- data/lib/misc.rb +6 -0
- data/lib/new_plugin.rb +6 -0
- data/lib/notifications.rb +8 -2
- data/lib/packing.rb +7 -1
- data/lib/plugin.rb +10 -4
- data/lib/plugin_tool.rb +7 -1
- data/lib/run.rb +7 -0
- data/lib/schema_requirements.rb +6 -0
- data/lib/server.rb +10 -4
- data/lib/syntax_checking.rb +16 -9
- data/lib/version.txt +1 -1
- data/lib/watchers.rb +7 -1
- metadata +4 -3
- data/README.txt +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba5b410510d621172ca32206c2c4c15bbd7d6fff
|
4
|
+
data.tar.gz: fbc2d2e8c4158addb76ff4c30ffcfa538c8d0df8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bfdf8b57c961ee808a8f044eb3e4870408b29e1563d444894e32dc45b65d59b6aab5431695c0f50867e3408d53e2e9b1043aa90178ff98f1d504f3a60442179
|
7
|
+
data.tar.gz: 64e1d907f36779d0041611eadc98d3dc4842e4120a878cf439d5e48bc582a5b409161650ea7fd22b707b8551c7e9011bfe22fed5f43483cf74bd1dd76eb8b295
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
## Haplo Plugin Tool
|
2
|
+
|
3
|
+
The Haplo Plugin Tool helps developers to write and deploy plugins for the [Haplo Platform](http://haplo.org).
|
4
|
+
|
5
|
+
For more information please see the main [Haplo web site](http://haplo.org) and the [Plugin Tool documentation](http://docs.haplo.org/dev/tool/plugin).
|
6
|
+
|
7
|
+
|
8
|
+
### Get dependencies
|
9
|
+
|
10
|
+
Run the `fetch_rhino.sh` script.
|
11
|
+
|
12
|
+
Run the `build_haplo_templates.sh` with the location of a Haplo platform checkout as the first argument. You will need a Java 8 `javac` on your `PATH`.
|
13
|
+
|
14
|
+
|
15
|
+
### Run from checkout
|
16
|
+
|
17
|
+
`jruby bin/haplo-plugin <arguments>`
|
18
|
+
|
19
|
+
The Plugin Tool requires JRuby so it can use some Java libraries.
|
20
|
+
|
21
|
+
|
22
|
+
### Release as gem
|
23
|
+
|
24
|
+
Run `jruby make_distribution.rb` and publish the resulting gem. Note you must use JRuby.
|
25
|
+
|
26
|
+
|
27
|
+
### Copyright and License
|
28
|
+
|
29
|
+
Haplo Plugin Tool is copyright [Haplo Services Ltd](http://www.haplo-services.com). See the COPYRIGHT file for full details.
|
30
|
+
|
31
|
+
Haplo Plugin Tool is licensed under the Mozilla Public License Version 2.0. See the LICENSE file for full details.
|
32
|
+
|
33
|
+
Distributions contain a copy of the [Rhino JavaScript Interpreter](http://www.mozilla.org/rhino/), licensed under the Mozilla Public License.
|
34
|
+
|
35
|
+
This repository and distributions contain a copy of [JSHint](http://jshint.com/), licensed under a modified MIT license that prohibits use for Evil. See lib/jshint.js for details.
|
36
|
+
|
37
|
+
This repository and distributions contain a copy of [UglifyJS](https://github.com/mishoo/UglifyJS), licensed under the BSD license.
|
data/haplo.gemspec
CHANGED
@@ -3,8 +3,8 @@ Gem::Specification.new do |s|
|
|
3
3
|
files = Dir.glob("#{root_dir}/**/*.*").map { |x| x[root_dir.length + 1, x.length]}
|
4
4
|
|
5
5
|
s.name = 'haplo'
|
6
|
-
s.version = '2.1.
|
7
|
-
s.date = '2016-01-
|
6
|
+
s.version = '2.1.1'
|
7
|
+
s.date = '2016-01-14'
|
8
8
|
s.summary = "Haplo Plugin Tool"
|
9
9
|
s.description = "Development tools for developing Haplo plugins, see http://haplo.org"
|
10
10
|
s.licenses = ["MPL-2.0"]
|
data/lib/auth.rb
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# Haplo Plugin Tool http://docs.haplo.org/dev/tool/plugin
|
2
|
+
# (c) Haplo Services Ltd 2006 - 2016 http://www.haplo-services.com
|
3
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
4
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
5
|
+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
6
|
+
|
1
7
|
|
2
8
|
module PluginTool
|
3
9
|
|
data/lib/check.rb
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# Haplo Plugin Tool http://docs.haplo.org/dev/tool/plugin
|
2
|
+
# (c) Haplo Services Ltd 2006 - 2016 http://www.haplo-services.com
|
3
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
4
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
5
|
+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
6
|
+
|
1
7
|
|
2
8
|
module PluginTool
|
3
9
|
|
@@ -6,7 +12,8 @@ module PluginTool
|
|
6
12
|
@@check_report = ''
|
7
13
|
@@check_ok = true
|
8
14
|
@@check_warn = false
|
9
|
-
plugins.
|
15
|
+
max_plugin_name_length = plugins.map { |p| p.name.length } .max
|
16
|
+
plugins.each { |p| check_plugin(p, max_plugin_name_length) }
|
10
17
|
if @@check_warn || !(@@check_ok)
|
11
18
|
puts "\nFILES WITH ERRORS"
|
12
19
|
puts @@check_report
|
@@ -23,9 +30,9 @@ module PluginTool
|
|
23
30
|
end
|
24
31
|
end
|
25
32
|
|
26
|
-
def self.check_plugin(plugin)
|
33
|
+
def self.check_plugin(plugin, max_plugin_name_length)
|
27
34
|
plugin_dir = plugin.plugin_dir
|
28
|
-
STDOUT.write(plugin.name
|
35
|
+
STDOUT.write(sprintf("%#{max_plugin_name_length.to_i}s ", plugin.name))
|
29
36
|
Dir.glob("#{plugin_dir}/**/*").each do |pathname|
|
30
37
|
next unless File.file?(pathname)
|
31
38
|
next if plugin.exclude_files_from_syntax_check.include?(pathname)
|
@@ -38,16 +45,16 @@ module PluginTool
|
|
38
45
|
check_file_result(plugin, plugin_relative_name, :OK)
|
39
46
|
else
|
40
47
|
puts "\n**** #{plugin_relative_name} has errors:\n#{report}\n"
|
41
|
-
check_file_result(plugin, plugin_relative_name, (plugin_relative_name =~ /\
|
48
|
+
check_file_result(plugin, plugin_relative_name, (plugin_relative_name =~ /\A(js|template)\//) ? :FAIL : :WARN)
|
42
49
|
end
|
43
50
|
else
|
44
51
|
# TODO: Checks for other file types, including the plugin.json
|
45
|
-
check_file_result(plugin, plugin_relative_name, :OK)
|
52
|
+
check_file_result(plugin, plugin_relative_name, :OK)
|
46
53
|
end
|
47
54
|
end
|
48
55
|
STDOUT.write("\n"); STDOUT.flush
|
49
56
|
end
|
50
|
-
|
57
|
+
|
51
58
|
def self.check_file_result(plugin, name, result)
|
52
59
|
unless result == :OK
|
53
60
|
@@check_report << " #{plugin.plugin_dir}/#{name}: #{result}\n"
|
data/lib/custom.rb
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# Haplo Plugin Tool http://docs.haplo.org/dev/tool/plugin
|
2
|
+
# (c) Haplo Services Ltd 2006 - 2016 http://www.haplo-services.com
|
3
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
4
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
5
|
+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
6
|
+
|
1
7
|
|
2
8
|
module PluginTool
|
3
9
|
|
data/lib/haplo-templates.jar
CHANGED
Binary file
|
data/lib/hmac.rb
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# Haplo Plugin Tool http://docs.haplo.org/dev/tool/plugin
|
2
|
+
# (c) Haplo Services Ltd 2006 - 2016 http://www.haplo-services.com
|
3
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
4
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
5
|
+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
6
|
+
|
1
7
|
|
2
8
|
module HMAC
|
3
9
|
module SHA1
|
@@ -6,7 +12,7 @@ module HMAC
|
|
6
12
|
mac.init(javax.crypto.spec.SecretKeySpec.new(key.to_java_bytes, "HmacSHA1"))
|
7
13
|
result = mac.doFinal(message.to_java_bytes)
|
8
14
|
String.from_java_bytes(result).unpack('H*').join
|
9
|
-
end
|
15
|
+
end
|
10
16
|
end
|
11
17
|
end
|
12
18
|
|
data/lib/js_min.js
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
/* Haplo Plugin Tool http://docs.haplo.org/dev/tool/plugin
|
2
|
+
* (c) Haplo Services Ltd 2006 - 2016 http://www.haplo-services.com
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
5
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
6
|
+
|
1
7
|
|
2
8
|
// Emulate enough of CommonJS to load unmodified UglifyJS files
|
3
9
|
var exports = {};
|
@@ -34,5 +40,5 @@ function js_min(orig_code) {
|
|
34
40
|
var ast = jsp.parse(orig_code); // parse code and get the initial AST
|
35
41
|
ast = exports.ast_mangle(ast); // get a new AST with mangled names
|
36
42
|
ast = exports.ast_squeeze(ast); // get an AST with compression optimizations
|
37
|
-
return exports.gen_code(ast); // compressed code here
|
43
|
+
return exports.gen_code(ast); // compressed code here
|
38
44
|
}
|
data/lib/js_syntax_test.js
CHANGED
@@ -1,9 +1,15 @@
|
|
1
|
+
/* Haplo Plugin Tool http://docs.haplo.org/dev/tool/plugin
|
2
|
+
* (c) Haplo Services Ltd 2006 - 2016 http://www.haplo-services.com
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
5
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
6
|
+
|
1
7
|
|
2
8
|
(function() {
|
3
9
|
var root = this;
|
4
10
|
|
5
11
|
// Options for the syntax checking
|
6
|
-
|
12
|
+
|
7
13
|
var opts = function() {
|
8
14
|
return {
|
9
15
|
asi: false,
|
@@ -31,12 +37,12 @@
|
|
31
37
|
white: false
|
32
38
|
};
|
33
39
|
};
|
34
|
-
|
40
|
+
|
35
41
|
// Options
|
36
42
|
var optionsServer = opts();
|
37
43
|
var optionsBrowser = opts();
|
38
44
|
optionsBrowser.browser = true;
|
39
|
-
|
45
|
+
|
40
46
|
// Predefined globals
|
41
47
|
var globalsServer = [
|
42
48
|
'O',
|
@@ -47,7 +53,7 @@
|
|
47
53
|
];
|
48
54
|
var globalsBrowser = ['Haplo', 'ONEIS', 'jQuery', '_'];
|
49
55
|
var globalsTest = globalsServer.concat('T');
|
50
|
-
|
56
|
+
|
51
57
|
// Set globals
|
52
58
|
root.syntax_tester_globals = function(string) {
|
53
59
|
globals = eval("("+string+")");
|
data/lib/local_config.rb
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# Haplo Plugin Tool http://docs.haplo.org/dev/tool/plugin
|
2
|
+
# (c) Haplo Services Ltd 2006 - 2016 http://www.haplo-services.com
|
3
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
4
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
5
|
+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
6
|
+
|
1
7
|
|
2
8
|
module PluginTool
|
3
9
|
|
data/lib/manifest.rb
CHANGED
@@ -1,9 +1,15 @@
|
|
1
|
+
# Haplo Plugin Tool http://docs.haplo.org/dev/tool/plugin
|
2
|
+
# (c) Haplo Services Ltd 2006 - 2016 http://www.haplo-services.com
|
3
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
4
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
5
|
+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
6
|
+
|
1
7
|
|
2
8
|
module PluginTool
|
3
|
-
|
9
|
+
|
4
10
|
# NOTE: Also update packing.rb if this changes
|
5
11
|
ALLOWED_PLUGIN_DIRS = ['js', 'static', 'template', 'test', 'data']
|
6
|
-
|
12
|
+
|
7
13
|
def self.generate_manifest(directory)
|
8
14
|
manifest = Hash.new
|
9
15
|
Dir.glob("#{directory}/**/*").sort.each do |pathname|
|
@@ -28,7 +34,7 @@ module PluginTool
|
|
28
34
|
end
|
29
35
|
manifest
|
30
36
|
end
|
31
|
-
|
37
|
+
|
32
38
|
def self.determine_manifest_changes(from, to)
|
33
39
|
changes = []
|
34
40
|
from.each_key do |name|
|
@@ -39,6 +45,6 @@ module PluginTool
|
|
39
45
|
end
|
40
46
|
changes
|
41
47
|
end
|
42
|
-
|
48
|
+
|
43
49
|
end
|
44
50
|
|
data/lib/minimise.rb
CHANGED
@@ -1,9 +1,15 @@
|
|
1
|
+
# Haplo Plugin Tool http://docs.haplo.org/dev/tool/plugin
|
2
|
+
# (c) Haplo Services Ltd 2006 - 2016 http://www.haplo-services.com
|
3
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
4
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
5
|
+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
6
|
+
|
1
7
|
|
2
8
|
module PluginTool
|
3
9
|
|
4
10
|
class Minimiser
|
5
11
|
Context = Java::OrgMozillaJavascript::Context
|
6
|
-
|
12
|
+
|
7
13
|
def initialize
|
8
14
|
# Load UglifyJS into a JavaScript interpreter
|
9
15
|
raise "Another JS Context is active" unless nil == Context.getCurrentContext()
|
@@ -57,7 +63,7 @@ module PluginTool
|
|
57
63
|
data
|
58
64
|
end
|
59
65
|
end
|
60
|
-
|
66
|
+
|
61
67
|
def finish
|
62
68
|
Context.exit()
|
63
69
|
end
|
data/lib/misc.rb
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# Haplo Plugin Tool http://docs.haplo.org/dev/tool/plugin
|
2
|
+
# (c) Haplo Services Ltd 2006 - 2016 http://www.haplo-services.com
|
3
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
4
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
5
|
+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
6
|
+
|
1
7
|
|
2
8
|
module PluginTool
|
3
9
|
|
data/lib/new_plugin.rb
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# Haplo Plugin Tool http://docs.haplo.org/dev/tool/plugin
|
2
|
+
# (c) Haplo Services Ltd 2006 - 2016 http://www.haplo-services.com
|
3
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
4
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
5
|
+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
6
|
+
|
1
7
|
|
2
8
|
module PluginTool
|
3
9
|
|
data/lib/notifications.rb
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# Haplo Plugin Tool http://docs.haplo.org/dev/tool/plugin
|
2
|
+
# (c) Haplo Services Ltd 2006 - 2016 http://www.haplo-services.com
|
3
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
4
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
5
|
+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
6
|
+
|
1
7
|
|
2
8
|
module PluginTool
|
3
9
|
|
@@ -45,7 +51,7 @@ module PluginTool
|
|
45
51
|
end
|
46
52
|
end
|
47
53
|
end
|
48
|
-
|
54
|
+
|
49
55
|
def self.decode_and_handle_notifications(encoded)
|
50
56
|
size = encoded.length
|
51
57
|
pos = 0
|
@@ -57,7 +63,7 @@ module PluginTool
|
|
57
63
|
handle_notification(type, data)
|
58
64
|
end
|
59
65
|
end
|
60
|
-
|
66
|
+
|
61
67
|
def self.handle_notification(type, data)
|
62
68
|
case type
|
63
69
|
when 'log '
|
data/lib/packing.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
|
+
# Haplo Plugin Tool http://docs.haplo.org/dev/tool/plugin
|
2
|
+
# (c) Haplo Services Ltd 2006 - 2016 http://www.haplo-services.com
|
3
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
4
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
5
|
+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
6
|
+
|
1
7
|
|
2
8
|
module PluginTool
|
3
|
-
|
9
|
+
|
4
10
|
PACKING_ACCEPTABLE_FILENAME = /\A(js|static|template|test|data)\/([a-z0-9_-]+\/)*[a-z0-9_-]+\.[a-z0-9]+\z/
|
5
11
|
PACKING_ACCEPTABLE_EXCEPTIONS = ['plugin.json', 'requirements.schema', 'global.js', 'certificates-temp-http-api.pem']
|
6
12
|
PACKING_EXCLUDE = ['developer.json']
|
data/lib/plugin.rb
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# Haplo Plugin Tool http://docs.haplo.org/dev/tool/plugin
|
2
|
+
# (c) Haplo Services Ltd 2006 - 2016 http://www.haplo-services.com
|
3
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
4
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
5
|
+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
6
|
+
|
1
7
|
|
2
8
|
module PluginTool
|
3
9
|
|
@@ -17,7 +23,7 @@ module PluginTool
|
|
17
23
|
@@pending_apply = []
|
18
24
|
|
19
25
|
# ---------------------------------------------------------------------------------------------------------
|
20
|
-
|
26
|
+
|
21
27
|
def start
|
22
28
|
# Check to see if the plugin is valid
|
23
29
|
unless File.file?("#{@name}/plugin.json")
|
@@ -28,7 +34,7 @@ module PluginTool
|
|
28
34
|
end_on_error "logic error" unless @plugin_dir =~ /\A[a-zA-Z0-9_-]+\z/
|
29
35
|
@loaded_plugin_id = nil
|
30
36
|
end
|
31
|
-
|
37
|
+
|
32
38
|
def plugin_load_priority
|
33
39
|
pj = File.open("#{@plugin_dir}/plugin.json") { |f| JSON.parse(f.read) }
|
34
40
|
pj['loadPriority'] || DEFAULT_PLUGIN_LOAD_PRIORITY
|
@@ -121,7 +127,7 @@ module PluginTool
|
|
121
127
|
|
122
128
|
when 'develop'
|
123
129
|
# do nothing here
|
124
|
-
|
130
|
+
|
125
131
|
else
|
126
132
|
end_on_error "Unknown command '#{cmd}'"
|
127
133
|
|
@@ -217,7 +223,7 @@ Application: #{application_id}
|
|
217
223
|
License key: #{license_key}
|
218
224
|
__E
|
219
225
|
end
|
220
|
-
|
226
|
+
|
221
227
|
def end_on_error(err)
|
222
228
|
puts err
|
223
229
|
exit 1
|
data/lib/plugin_tool.rb
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# Haplo Plugin Tool http://docs.haplo.org/dev/tool/plugin
|
2
|
+
# (c) Haplo Services Ltd 2006 - 2016 http://www.haplo-services.com
|
3
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
4
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
5
|
+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
6
|
+
|
1
7
|
|
2
8
|
def end_on_error(err)
|
3
9
|
puts err
|
@@ -117,7 +123,7 @@ plugins = plugin_names.map do |name|
|
|
117
123
|
PluginTool::Plugin.new(name, options)
|
118
124
|
end
|
119
125
|
plugins.each { |p| p.start }
|
120
|
-
plugins.sort! do |a,b|
|
126
|
+
plugins.sort! do |a,b|
|
121
127
|
pri_a = a.plugin_load_priority
|
122
128
|
pri_b = b.plugin_load_priority
|
123
129
|
(pri_a == pri_b) ? (a.name <=> b.name) : (pri_a <=> pri_b)
|
data/lib/run.rb
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# Haplo Plugin Tool http://docs.haplo.org/dev/tool/plugin
|
2
|
+
# (c) Haplo Services Ltd 2006 - 2016 http://www.haplo-services.com
|
3
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
4
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
5
|
+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
6
|
+
|
1
7
|
|
2
8
|
# Make sure we use a JRuby which has been tested
|
3
9
|
PLUGIN_TOOL_JRUBY_REQUIREMENT = '9.0.4.0'
|
@@ -55,6 +61,7 @@ require "#{PLUGIN_TOOL_ROOT_DIR}/lib/manifest.rb"
|
|
55
61
|
require "#{PLUGIN_TOOL_ROOT_DIR}/lib/auth.rb"
|
56
62
|
require "#{PLUGIN_TOOL_ROOT_DIR}/lib/server.rb"
|
57
63
|
require "#{PLUGIN_TOOL_ROOT_DIR}/lib/schema_requirements.rb"
|
64
|
+
require "#{PLUGIN_TOOL_ROOT_DIR}/lib/hsvt_parser_config.rb"
|
58
65
|
require "#{PLUGIN_TOOL_ROOT_DIR}/lib/syntax_checking.rb"
|
59
66
|
require "#{PLUGIN_TOOL_ROOT_DIR}/lib/notifications.rb"
|
60
67
|
require "#{PLUGIN_TOOL_ROOT_DIR}/lib/plugin.rb"
|
data/lib/schema_requirements.rb
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# Haplo Plugin Tool http://docs.haplo.org/dev/tool/plugin
|
2
|
+
# (c) Haplo Services Ltd 2006 - 2016 http://www.haplo-services.com
|
3
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
4
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
5
|
+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
6
|
+
|
1
7
|
|
2
8
|
module PluginTool
|
3
9
|
|
data/lib/server.rb
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# Haplo Plugin Tool http://docs.haplo.org/dev/tool/plugin
|
2
|
+
# (c) Haplo Services Ltd 2006 - 2016 http://www.haplo-services.com
|
3
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
4
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
5
|
+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
6
|
+
|
1
7
|
|
2
8
|
module PluginTool
|
3
9
|
|
@@ -52,7 +58,7 @@ module PluginTool
|
|
52
58
|
def self.get_http
|
53
59
|
@@http ||= make_http_connection
|
54
60
|
end
|
55
|
-
|
61
|
+
|
56
62
|
def self.finish_with_connection
|
57
63
|
if @@http != nil
|
58
64
|
@@http.finish
|
@@ -71,11 +77,11 @@ module PluginTool
|
|
71
77
|
setup_request(request)
|
72
78
|
http.request(request).body
|
73
79
|
end
|
74
|
-
|
80
|
+
|
75
81
|
def self.get_with_json_response(path)
|
76
82
|
report_errors_from_server(JSON.parse(get(path)))
|
77
83
|
end
|
78
|
-
|
84
|
+
|
79
85
|
def self.post(path, params = nil, files = nil)
|
80
86
|
http = get_http
|
81
87
|
request = Net::HTTP::Post.new(path)
|
@@ -116,7 +122,7 @@ EOF
|
|
116
122
|
def self.post_with_json_response(path, params = nil, files = nil)
|
117
123
|
report_errors_from_server(JSON.parse(post(path, params, files)))
|
118
124
|
end
|
119
|
-
|
125
|
+
|
120
126
|
def self.report_errors_from_server(r)
|
121
127
|
unless r.kind_of? Hash
|
122
128
|
r = {
|
data/lib/syntax_checking.rb
CHANGED
@@ -1,13 +1,19 @@
|
|
1
|
+
# Haplo Plugin Tool http://docs.haplo.org/dev/tool/plugin
|
2
|
+
# (c) Haplo Services Ltd 2006 - 2016 http://www.haplo-services.com
|
3
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
4
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
5
|
+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
6
|
+
|
1
7
|
|
2
8
|
module PluginTool
|
3
|
-
|
9
|
+
|
4
10
|
@@syntax_check_queue = []
|
5
11
|
@@syntax_check_queue_lock = Mutex.new
|
6
12
|
@@syntax_check_queue_semaphore = Mutex.new
|
7
13
|
@@syntax_check_queue_semaphore_var = ConditionVariable.new
|
8
|
-
|
14
|
+
|
9
15
|
Context = Java::OrgMozillaJavascript::Context
|
10
|
-
|
16
|
+
|
11
17
|
def self.start_syntax_check
|
12
18
|
Thread.new do
|
13
19
|
begin
|
@@ -15,10 +21,10 @@ module PluginTool
|
|
15
21
|
rescue => e
|
16
22
|
puts "EXCEPTION IN SYNTAX CHECKER\n#{e.inspect}"
|
17
23
|
exit 1
|
18
|
-
end
|
24
|
+
end
|
19
25
|
end
|
20
26
|
end
|
21
|
-
|
27
|
+
|
22
28
|
def self.init_syntax_checking
|
23
29
|
# Set up interpreter and get a syntax checker function
|
24
30
|
raise "Another JS Context is active" unless nil == Context.getCurrentContext()
|
@@ -30,7 +36,7 @@ module PluginTool
|
|
30
36
|
@@cx.evaluateString(@@javascript_scope, testerfn, "<js_syntax_test.js>", 1, nil);
|
31
37
|
@@syntax_tester = @@javascript_scope.get("syntax_tester", @@javascript_scope);
|
32
38
|
end
|
33
|
-
|
39
|
+
|
34
40
|
def self.syntax_check_one_file(plugin, file)
|
35
41
|
# Is this file excluded from syntax checking?
|
36
42
|
return nil if plugin.exclude_files_from_syntax_check.include?(file)
|
@@ -79,15 +85,16 @@ module PluginTool
|
|
79
85
|
end
|
80
86
|
report
|
81
87
|
end
|
82
|
-
|
88
|
+
|
83
89
|
def self.syntax_check_haplo_template(plugin, file)
|
84
90
|
begin
|
85
|
-
Java::OrgHaploTemplateHtml::Parser.new(File.read("#{plugin.plugin_dir}/#{file}"), file).parse()
|
91
|
+
Java::OrgHaploTemplateHtml::Parser.new(File.read("#{plugin.plugin_dir}/#{file}"), file, PARSER_CONFIG).parse()
|
86
92
|
nil
|
87
93
|
rescue => e
|
88
94
|
" #{e.message}"
|
89
95
|
end
|
90
96
|
end
|
97
|
+
PARSER_CONFIG = TemplateParserConfiguration.new
|
91
98
|
|
92
99
|
def self.do_syntax_checking
|
93
100
|
init_syntax_checking
|
@@ -107,7 +114,7 @@ module PluginTool
|
|
107
114
|
end
|
108
115
|
end
|
109
116
|
end
|
110
|
-
|
117
|
+
|
111
118
|
def self.syntax_check(plugin, filename)
|
112
119
|
@@syntax_check_queue_lock.synchronize do
|
113
120
|
@@syntax_check_queue << [plugin, filename]
|
data/lib/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2a1adea
|
data/lib/watchers.rb
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# Haplo Plugin Tool http://docs.haplo.org/dev/tool/plugin
|
2
|
+
# (c) Haplo Services Ltd 2006 - 2016 http://www.haplo-services.com
|
3
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
4
|
+
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
5
|
+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
6
|
+
|
1
7
|
|
2
8
|
module PluginTool
|
3
9
|
|
@@ -28,7 +34,7 @@ module PluginTool
|
|
28
34
|
c
|
29
35
|
end
|
30
36
|
end
|
31
|
-
|
37
|
+
|
32
38
|
def self.make_watcher(dirs)
|
33
39
|
# TODO: Option to use external watcher task
|
34
40
|
# pipe = IO.popen(watcher_cmd)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haplo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Haplo Services
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Development tools for developing Haplo plugins, see http://haplo.org
|
14
14
|
email: client.services@haplo-services.com
|
@@ -17,7 +17,7 @@ executables:
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
-
- README.
|
20
|
+
- README.md
|
21
21
|
- bin/haplo-plugin
|
22
22
|
- haplo.gemspec
|
23
23
|
- lib/CertificateBundle.pem
|
@@ -26,6 +26,7 @@ files:
|
|
26
26
|
- lib/custom.rb
|
27
27
|
- lib/haplo-templates.jar
|
28
28
|
- lib/hmac.rb
|
29
|
+
- lib/hsvt_parser_config.rb
|
29
30
|
- lib/js.jar
|
30
31
|
- lib/js_min.js
|
31
32
|
- lib/js_syntax_test.js
|
data/README.txt
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
|
2
|
-
Haplo Plugin Tool, Copyright (c) ONEIS Ltd 2011 - 2016
|
3
|
-
|
4
|
-
|
5
|
-
This distribution contains a copy of the Rhino JavaScript Interpreter, licensed under the Mozilla Public License.
|
6
|
-
http://www.mozilla.org/rhino/
|
7
|
-
|
8
|
-
|
9
|
-
This distribution contains a copy of JSHint, licensed under a modified MIT license that prohibits use for Evil.
|
10
|
-
(see lib/jshint.js for details)
|
11
|
-
http://jshint.com/
|
12
|
-
|
13
|
-
|
14
|
-
For documentation on how to install and use this tool, see
|
15
|
-
|
16
|
-
http://docs.haplo.org/dev/tool/plugin
|
17
|
-
|