oneis 2.0.3-java → 2.0.4-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/new_plugin.rb +8 -5
- data/lib/run.rb +1 -0
- data/lib/schema_requirements.rb +63 -0
- data/lib/syntax_checking.rb +10 -6
- data/lib/version.txt +1 -1
- data/oneis.gemspec +2 -2
- metadata +12 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d1ef4ecef67240a4415a9b2b4f7b621454e9b98
|
4
|
+
data.tar.gz: fd3413e5f159e192bb2ccd4aea7f5965bdb1bd82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77535631e1bf9d948766c4e3e4910bd63160cfe12c7f400dcb7d182348978a5e4a13b59e65918dec2a6044f17d434e41a3015e4270acafe874f684fc24f9fd53
|
7
|
+
data.tar.gz: 60078eeca4ffd2bf63d9c8e95506c402ceac322044e993072d50a58ed37fb742151e57b7475e7b5a0fdce388928e955c77d94b17ef2afa018aaea42fed6f68e6
|
data/lib/new_plugin.rb
CHANGED
@@ -26,7 +26,7 @@ module PluginTool
|
|
26
26
|
"displayName": "#{plugin_name.split('_').map {|e| e.capitalize} .join(' ')}",
|
27
27
|
"displayDescription": "TODO Longer description of plugin",
|
28
28
|
"installSecret": "#{install_secret}",
|
29
|
-
"apiVersion":
|
29
|
+
"apiVersion": 4,
|
30
30
|
"load": [
|
31
31
|
"js/#{plugin_name}.js"
|
32
32
|
],
|
@@ -54,17 +54,20 @@ __E
|
|
54
54
|
File.open("#{plugin_name}/test/#{plugin_name}_test1.js",'w') do |file|
|
55
55
|
file.write(<<__E)
|
56
56
|
|
57
|
-
|
57
|
+
t.test(function() {
|
58
58
|
|
59
59
|
// For documentation, see
|
60
60
|
// http://docs.oneis.co.uk/dev/plugin/tests
|
61
|
-
|
62
|
-
|
63
|
-
|
61
|
+
|
62
|
+
t.assert(true);
|
63
|
+
|
64
64
|
});
|
65
65
|
|
66
66
|
__E
|
67
67
|
end
|
68
|
+
File.open("#{plugin_name}/requirements.schema",'w') do |file|
|
69
|
+
file.write("\n\n\n")
|
70
|
+
end
|
68
71
|
puts <<__E
|
69
72
|
|
70
73
|
Plugin #{plugin_name} has been created. Run
|
data/lib/run.rb
CHANGED
@@ -26,6 +26,7 @@ require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/local_config.rb"
|
|
26
26
|
require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/manifest.rb"
|
27
27
|
require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/auth.rb"
|
28
28
|
require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/server.rb"
|
29
|
+
require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/schema_requirements.rb"
|
29
30
|
require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/syntax_checking.rb"
|
30
31
|
require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/notifications.rb"
|
31
32
|
require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/plugin.rb"
|
@@ -0,0 +1,63 @@
|
|
1
|
+
|
2
|
+
module PluginTool
|
3
|
+
|
4
|
+
class SchemaRequirements
|
5
|
+
IGNORE_LINE = /\A\s*(\#.+)?\z/m # comment or blank line
|
6
|
+
OBJECT_FORMAT = /\A(?<kind>\S+)\s+(?<code>[a-zA-Z0-9_:-]+)\s*(as\s+(?<name>[a-zA-Z0-9_]+))?\s*\z/m
|
7
|
+
|
8
|
+
SCHEMA_LOCALS = {
|
9
|
+
"type" => "T",
|
10
|
+
"attribute" => "A",
|
11
|
+
"aliased-attribute" => "AA",
|
12
|
+
"qualifier" => "Q",
|
13
|
+
"label" => "Label",
|
14
|
+
"group" => "Group"
|
15
|
+
}
|
16
|
+
|
17
|
+
def initialize(filename)
|
18
|
+
# Define the special attributes by default
|
19
|
+
@schema_names = {"A" => {
|
20
|
+
"Parent" => true,
|
21
|
+
"Type" => true,
|
22
|
+
"Title" => true
|
23
|
+
}}
|
24
|
+
return unless File.exist?(filename)
|
25
|
+
File.open(filename) do |file|
|
26
|
+
file.each do |line|
|
27
|
+
if (line !~ IGNORE_LINE) && (match = OBJECT_FORMAT.match(line))
|
28
|
+
kind = SCHEMA_LOCALS[match[:kind]] || 'UNUSED'
|
29
|
+
@schema_names[kind] ||= {}
|
30
|
+
name = match[:name]
|
31
|
+
if name && !name.empty?
|
32
|
+
@schema_names[kind][name] = true
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
@schema_names.delete('UNUSED')
|
38
|
+
end
|
39
|
+
|
40
|
+
def locals
|
41
|
+
@schema_names.keys.dup
|
42
|
+
end
|
43
|
+
|
44
|
+
FIND_USE_REGEXP = Regexp.new("\\b(#{SCHEMA_LOCALS.values.join('|')})\\.([a-zA-Z0-9]+)\\b")
|
45
|
+
|
46
|
+
def report_usage(js)
|
47
|
+
report = []
|
48
|
+
js.split(/\r?\n/).each_with_index do |line, index|
|
49
|
+
line.scan(FIND_USE_REGEXP) do
|
50
|
+
kind = $1
|
51
|
+
name = $2
|
52
|
+
lookup = @schema_names[kind]
|
53
|
+
unless lookup && lookup.has_key?(name)
|
54
|
+
report << "line #{index+1}: Schema name #{kind}.#{name} isn't declared in requirements.schema\n\n"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
report.empty? ? nil : report.join
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
data/lib/syntax_checking.rb
CHANGED
@@ -40,11 +40,12 @@ module PluginTool
|
|
40
40
|
kind = (file =~ /\A(\w+)\//) ? $1 : file
|
41
41
|
# Is this file referenced?
|
42
42
|
report = nil
|
43
|
-
extra_globals = []
|
44
43
|
unless kind != 'js' || plugin_json['load'].include?(file)
|
45
44
|
puts "\nWARNING: #{plugin_dir}/plugin.json doesn't mention #{file} in the load directive.\n"
|
46
45
|
report = "Couldn't check file - not mentioned in plugin.json"
|
47
46
|
else
|
47
|
+
schema_requirements = (api_version < 4) ? nil : SchemaRequirements.new("#{plugin_dir}/requirements.schema")
|
48
|
+
extra_globals = schema_requirements ? schema_requirements.locals.dup : []
|
48
49
|
# Load the file
|
49
50
|
js = File.open("#{plugin_dir}/#{file}") { |f| f.read }
|
50
51
|
if api_version < 3
|
@@ -53,22 +54,25 @@ module PluginTool
|
|
53
54
|
extra_globals << plugin_json["pluginName"];
|
54
55
|
end
|
55
56
|
else
|
56
|
-
if kind == 'js'
|
57
|
+
if kind == 'js' || kind == 'test'
|
57
58
|
extra_globals << plugin_json["pluginName"]
|
58
59
|
extra_globals << 'P'
|
59
60
|
locals = plugin_json["locals"]
|
60
61
|
if locals
|
61
62
|
locals.each_key { |local| extra_globals << local }
|
62
63
|
end
|
63
|
-
|
64
|
-
|
65
|
-
extra_globals << '
|
64
|
+
end
|
65
|
+
if kind == 'test'
|
66
|
+
extra_globals << 't'
|
66
67
|
end
|
67
68
|
# global.js requires server side syntax checking, but doesn't have any extra globals, not even the plugin name.
|
68
69
|
kind = 'js' if kind == 'global.js'
|
69
70
|
end
|
70
71
|
# Do syntax checking
|
71
|
-
|
72
|
+
lint_report = @@syntax_tester.call(@@cx, @@javascript_scope, @@javascript_scope, [js, kind, JSON.generate(extra_globals)])
|
73
|
+
schema_report = schema_requirements ? schema_requirements.report_usage(js) : nil
|
74
|
+
report = [lint_report, schema_report].compact.join("\n\n")
|
75
|
+
report = nil if report.empty?
|
72
76
|
end
|
73
77
|
report
|
74
78
|
end
|
data/lib/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
e96173eff2
|
data/oneis.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 = 'oneis'
|
6
|
-
s.version = '2.0.
|
7
|
-
s.date = '2015-
|
6
|
+
s.version = '2.0.4'
|
7
|
+
s.date = '2015-04-10'
|
8
8
|
s.summary = "ONEIS Tools"
|
9
9
|
s.description = "ONEIS Developer Tools"
|
10
10
|
s.authors = ["ONEIS"]
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oneis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- ONEIS
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: jruby-openssl
|
15
|
-
version_requirements: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - '>='
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 0.8.7
|
20
14
|
requirement: !ruby/object:Gem::Requirement
|
21
15
|
requirements:
|
22
16
|
- - '>='
|
23
17
|
- !ruby/object:Gem::Version
|
24
18
|
version: 0.8.7
|
19
|
+
name: jruby-openssl
|
25
20
|
prerelease: false
|
26
21
|
type: :runtime
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: json
|
29
22
|
version_requirements: !ruby/object:Gem::Requirement
|
30
23
|
requirements:
|
31
24
|
- - '>='
|
32
25
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
26
|
+
version: 0.8.7
|
27
|
+
- !ruby/object:Gem::Dependency
|
34
28
|
requirement: !ruby/object:Gem::Requirement
|
35
29
|
requirements:
|
36
30
|
- - '>='
|
37
31
|
- !ruby/object:Gem::Version
|
38
32
|
version: 1.7.7
|
33
|
+
name: json
|
39
34
|
prerelease: false
|
40
35
|
type: :runtime
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.7.7
|
41
41
|
description: ONEIS Developer Tools
|
42
42
|
email: client.services@oneis.co.uk
|
43
43
|
executables:
|
@@ -66,6 +66,7 @@ files:
|
|
66
66
|
- lib/plugin.rb
|
67
67
|
- lib/plugin_tool.rb
|
68
68
|
- lib/run.rb
|
69
|
+
- lib/schema_requirements.rb
|
69
70
|
- lib/server.rb
|
70
71
|
- lib/syntax_checking.rb
|
71
72
|
- lib/uglifyjs/parse-js.js
|