haplo 2.1.4-java → 2.1.5-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/haplo.gemspec +2 -2
- data/lib/haplo-templates.jar +0 -0
- data/lib/manifest.rb +8 -9
- data/lib/packing.rb +12 -17
- data/lib/plugin.rb +2 -6
- data/lib/plugin_tool.rb +6 -4
- data/lib/version.txt +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfa6979121ba2e2ed596e02f9faf5bac9d9aa8e7
|
4
|
+
data.tar.gz: 95c98823f92be457fa20021644be110f5812cd6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2109252a9deabcee929449ef4eaf98b19997f8891510a026391258d656967552aa6eb4b240c68200e9d1bb5a3403c6ed552e01b1c173ab1167566506ae80e821
|
7
|
+
data.tar.gz: c20f9a22838d355ec5ca08f90366416a0af904d0161ee865989345a271f7786f18096740bc23e00c62c5ee20aa75b113242b05ea9f6b30b770981537bf0aa833
|
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-
|
6
|
+
s.version = '2.1.5'
|
7
|
+
s.date = '2016-04-01'
|
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/haplo-templates.jar
CHANGED
Binary file
|
data/lib/manifest.rb
CHANGED
@@ -7,8 +7,11 @@
|
|
7
7
|
|
8
8
|
module PluginTool
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
PLUGIN_ACCEPTABLE_FILENAME = /\A(js|static|template|test|data)\/([A-Za-z0-9_-]+\/)*[A-Za-z0-9_-]+\.[A-Za-z0-9]+\z/
|
11
|
+
PLUGIN_ACCEPTABLE_FILENAME_EXCEPTIONS = ['plugin.json', 'requirements.schema', 'global.js', 'certificates-temp-http-api.pem', 'developer.json', 'readme.txt']
|
12
|
+
def self.plugin_filename_allowed?(filename)
|
13
|
+
(filename =~ PLUGIN_ACCEPTABLE_FILENAME) || (PLUGIN_ACCEPTABLE_FILENAME_EXCEPTIONS.include?(filename))
|
14
|
+
end
|
12
15
|
|
13
16
|
def self.generate_manifest(directory)
|
14
17
|
manifest = Hash.new
|
@@ -19,13 +22,9 @@ module PluginTool
|
|
19
22
|
next if pathname =~ /\~/
|
20
23
|
# Check file
|
21
24
|
filename = pathname.slice(directory.length + 1, pathname.length)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
if dir != nil
|
26
|
-
dir = dir.gsub(/\/\z/,'')
|
27
|
-
raise "Bad directory #{dir}" unless dir =~ /\A([a-zA-Z0-9_\-]+)[a-zA-Z0-9_\/\-]*\z/
|
28
|
-
raise "Bad root directory #{$1}" unless ALLOWED_PLUGIN_DIRS.include?($1)
|
25
|
+
unless plugin_filename_allowed?(filename)
|
26
|
+
puts "WARNING: Ignoring #{filename}"
|
27
|
+
next
|
29
28
|
end
|
30
29
|
# Get hash of file
|
31
30
|
digest = File.open(pathname) { |f| Digest::SHA256.hexdigest(f.read) }
|
data/lib/packing.rb
CHANGED
@@ -7,11 +7,10 @@
|
|
7
7
|
|
8
8
|
module PluginTool
|
9
9
|
|
10
|
-
|
11
|
-
PACKING_ACCEPTABLE_EXCEPTIONS = ['plugin.json', 'requirements.schema', 'global.js', 'certificates-temp-http-api.pem']
|
12
|
-
PACKING_EXCLUDE = ['developer.json']
|
10
|
+
PACKING_EXCLUDE = ['developer.json', 'readme.txt']
|
13
11
|
|
14
|
-
def self.pack_plugin(plugin_name, output_directory)
|
12
|
+
def self.pack_plugin(plugin_name, output_directory, errors = [])
|
13
|
+
STDOUT.write("#{plugin_name}: ")
|
15
14
|
# Get filenames and sort
|
16
15
|
files = Dir.glob("#{plugin_name}/**/*").map do |filename|
|
17
16
|
if File.file? filename
|
@@ -19,29 +18,26 @@ module PluginTool
|
|
19
18
|
else
|
20
19
|
nil
|
21
20
|
end
|
22
|
-
end .select
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
exit 1
|
21
|
+
end .compact.select do |filename|
|
22
|
+
ok = plugin_filename_allowed?(filename) && !PACKING_EXCLUDE.include?(filename)
|
23
|
+
unless ok || PACKING_EXCLUDE.include?(filename)
|
24
|
+
STDOUT.write("!")
|
25
|
+
errors.push("IGNORED: #{plugin_name}/#{filename}")
|
28
26
|
end
|
29
|
-
|
27
|
+
ok
|
28
|
+
end .sort
|
30
29
|
# Clean output directory
|
31
30
|
output_plugin_dir = "#{output_directory}/#{plugin_name}"
|
32
|
-
puts "Output directory: #{output_plugin_dir}"
|
33
31
|
if File.exist? output_plugin_dir
|
34
|
-
puts "Removing old output directory #{output_plugin_dir}"
|
35
32
|
FileUtils.rm_r(output_plugin_dir)
|
36
33
|
end
|
37
34
|
# Make file structure
|
38
35
|
FileUtils.mkdir(output_plugin_dir)
|
39
36
|
# Process each file, building a manifest
|
40
|
-
puts "Processing files:"
|
41
37
|
manifest = ''
|
42
38
|
minimiser = PluginTool::Minimiser.new
|
43
39
|
files.each do |filename|
|
44
|
-
|
40
|
+
STDOUT.write("."); STDOUT.flush
|
45
41
|
data = File.open("#{plugin_name}/#{filename}") { |f| f.read }
|
46
42
|
# Minimise file?
|
47
43
|
unless filename =~ /\Ajs\//
|
@@ -56,13 +52,12 @@ module PluginTool
|
|
56
52
|
# Filename entry in Manifest
|
57
53
|
manifest << "F #{hash} #{filename}\n"
|
58
54
|
end
|
55
|
+
STDOUT.write("\n")
|
59
56
|
minimiser.finish
|
60
57
|
# Write manifest and version
|
61
58
|
File.open("#{output_plugin_dir}/manifest", "w") { |f| f.write manifest }
|
62
59
|
version = Digest::SHA256.hexdigest(manifest)
|
63
60
|
File.open("#{output_plugin_dir}/version", "w") { |f| f.write "#{version}\n" }
|
64
|
-
# All done
|
65
|
-
puts "Version: #{version}\nPlugin packed."
|
66
61
|
end
|
67
62
|
|
68
63
|
end
|
data/lib/plugin.rb
CHANGED
@@ -40,10 +40,6 @@ module PluginTool
|
|
40
40
|
pj['loadPriority'] || DEFAULT_PLUGIN_LOAD_PRIORITY
|
41
41
|
end
|
42
42
|
|
43
|
-
def print_banner
|
44
|
-
puts "Plugin: #{@plugin_dir}"
|
45
|
-
end
|
46
|
-
|
47
43
|
def setup_for_server
|
48
44
|
# Make the first empty manifest (may be replaced from server)
|
49
45
|
@current_manifest = {}
|
@@ -96,7 +92,7 @@ module PluginTool
|
|
96
92
|
|
97
93
|
# ---------------------------------------------------------------------------------------------------------
|
98
94
|
|
99
|
-
def command(cmd)
|
95
|
+
def command(cmd, errors)
|
100
96
|
case cmd
|
101
97
|
when 'license-key'
|
102
98
|
application_id = @options.args.first
|
@@ -106,7 +102,7 @@ module PluginTool
|
|
106
102
|
generate_license_key(application_id)
|
107
103
|
|
108
104
|
when 'pack'
|
109
|
-
PluginTool.pack_plugin(@name, @options.output)
|
105
|
+
PluginTool.pack_plugin(@name, @options.output, errors)
|
110
106
|
|
111
107
|
when 'reset-db'
|
112
108
|
puts "Resetting database on server for #{@name}..."
|
data/lib/plugin_tool.rb
CHANGED
@@ -128,7 +128,7 @@ plugins.sort! do |a,b|
|
|
128
128
|
pri_b = b.plugin_load_priority
|
129
129
|
(pri_a == pri_b) ? (a.name <=> b.name) : (pri_a <=> pri_b)
|
130
130
|
end
|
131
|
-
plugins.
|
131
|
+
puts "#{plugins.length} plugin#{plugins.length != 1 ? 's' : ''}"
|
132
132
|
|
133
133
|
# Custom behaviour for this repo?
|
134
134
|
PluginTool.custom_behaviour.start(plugins, PLUGIN_TOOL_COMMAND, options, LOCAL_ONLY_COMMANDS[PLUGIN_TOOL_COMMAND])
|
@@ -166,11 +166,13 @@ unless LOCAL_ONLY_COMMANDS[PLUGIN_TOOL_COMMAND]
|
|
166
166
|
end
|
167
167
|
|
168
168
|
# Run the command
|
169
|
-
|
169
|
+
errors = []
|
170
|
+
plugins.each { |p| p.command(PLUGIN_TOOL_COMMAND, errors) }
|
170
171
|
|
171
|
-
# It this isn't the long-running develop command, stop now
|
172
|
+
# It this isn't the long-running develop command, output errors and stop now
|
172
173
|
if PLUGIN_TOOL_COMMAND != 'develop'
|
173
|
-
|
174
|
+
errors.each { |error| puts error }
|
175
|
+
exit(errors.empty? ? 0 : 1)
|
174
176
|
end
|
175
177
|
|
176
178
|
# Syntax checking in the background
|
data/lib/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
a8e1cfc
|
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.5
|
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-
|
11
|
+
date: 2016-04-01 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
|