haplo 2.5.2-java → 2.5.3-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f505d46f7f3766ebd5d2504fd378696ff474a7548c92aec99e1e7f9203fb10ff
4
- data.tar.gz: ff8150dcb45f36c3063aa2dada681143400a35b4394ced5d3538d17fa216515a
3
+ metadata.gz: 9a85d1c5d29a836c427c9a6045622e964b626746ca6e6d14b1db57d8488e6a4d
4
+ data.tar.gz: 50ed9669ca59195140d415eddd50d559815e320d81bcb8b0cfddf87ff3244c87
5
5
  SHA512:
6
- metadata.gz: 1fd5e45d04bd5b63c3fdd3edeb1f7bec265bdd8b1d17ef33588baa6d58d8bac58e19689f1f448f76d8f977bd2399d0aff592da49f81f785e5c8d97ba3b4f6a8d
7
- data.tar.gz: 0aaa4154cea48097385dfd9e93f229284fd62736ccd35f9220e54b8f6eb944c5d27f6535bc508df86fb4fb5b9ed272f9c1bfd0730ca7956d82f7270fe43ace6b
6
+ metadata.gz: 5763f67233ec3bb7ad05bd016608cc211b6d339db362fb266d37a49486b73389367ab6f8717f3caa9bcb53f8a4714878c1699b4fa6c9c54a915c5955d577c9b0
7
+ data.tar.gz: '0278435b6a89f641b30fc80619604f7be2d56cb155f8496ef0e3969a645a61c35b1cd04cdec98d31e6d2421943aaf97c3bb16e6fce554924b8adadd9f9c93f45'
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.5.2'
7
- s.date = '2021-05-14'
6
+ s.version = '2.5.3'
7
+ s.date = '2021-07-13'
8
8
  s.summary = "Haplo Plugin Tool"
9
9
  s.description = "Development tools for developing Haplo plugins, see https://haplo.org"
10
10
  s.licenses = ["MPL-2.0"]
data/lib/debuggers.rb ADDED
@@ -0,0 +1,109 @@
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
+
7
+
8
+ module PluginTool
9
+
10
+ @@profile_output = nil
11
+
12
+ def self.request_profile(options)
13
+ output_file = $stdout
14
+ close_output_file = false
15
+ if options.profile_file
16
+ output_file = File.open(options.profile_file, "a")
17
+ close_output_file = true
18
+ end
19
+
20
+ formatter = nil
21
+ case options.profile_format || 'tree'
22
+ when 'tree'
23
+ @@profile_output = ProfilerFormatterTree.new(output_file)
24
+ when 'raw'
25
+ @@profile_output = ProfilerFormatterRaw.new(output_file)
26
+ else
27
+ puts "Unknown profiler format: #{options.profile_format}"
28
+ exit 1
29
+ end
30
+
31
+ if 'OK' == PluginTool.post("/api/development-plugin-loader/debugger-profile-start", {:min => options.profile})
32
+ puts "JavaScript profiler started."
33
+ else
34
+ puts "Error starting JavaScript profiler."
35
+ exit 1
36
+ end
37
+ at_exit do
38
+ puts
39
+ puts "Disabling JavaScript profiler..."
40
+ PluginTool.post("/api/development-plugin-loader/debugger-profile-stop")
41
+ puts "JavaScript profiler disabled."
42
+ output_file.close if close_output_file
43
+ end
44
+ end
45
+
46
+ class ProfilerFormatter
47
+ def initialize(output_file)
48
+ @output_file = output_file
49
+ end
50
+ def format(report)
51
+ _format(report, @output_file)
52
+ @output_file.flush
53
+ end
54
+ end
55
+
56
+ class ProfilerFormatterRaw < ProfilerFormatter
57
+ def _format(report, output_file)
58
+ output_file.write(report)
59
+ end
60
+ end
61
+
62
+ class ProfilerFormatterTree < ProfilerFormatter
63
+ def _format(report, output_file)
64
+ report.split("\n").each do |line|
65
+ depth, time, percent, count, position = line.split("\t")
66
+ if depth == 'REPORT'
67
+ output_file.write("PROFILE -- #{Time.new(time)}\n")
68
+ elsif depth == 'OMIT'
69
+ output_file.write((" "*time.to_i)+"... children omitted\n")
70
+ else
71
+ output_file.write((" "*depth.to_i)+"#{percent} #{count} #{time.to_i / 1000000} #{position}\n")
72
+ end
73
+ end
74
+ end
75
+ end
76
+
77
+ def self.profiler_handle_report(report)
78
+ if @@profile_output
79
+ @@profile_output.format(report)
80
+ end
81
+ end
82
+
83
+ # -------------------------------------------------------------------------
84
+
85
+ def self.request_coverage(options)
86
+
87
+ format = options.coverage_format || 'raw'
88
+ if format != 'raw'
89
+ puts "Unknown coverage format: #{format}"
90
+ exit 1
91
+ end
92
+
93
+ if 'OK' == PluginTool.post("/api/development-plugin-loader/debugger-coverage-start")
94
+ puts "Coverage capture started."
95
+ else
96
+ puts "Error starting coverage capture."
97
+ exit 1
98
+ end
99
+
100
+ at_exit do
101
+ coverage = PluginTool.post("/api/development-plugin-loader/debugger-coverage-stop")
102
+ # TODO: Check errors
103
+ File.open(options.coverage_file, "w") { |f| f.write coverage }
104
+ end
105
+
106
+ end
107
+
108
+ end
109
+
data/lib/notifications.rb CHANGED
@@ -69,6 +69,9 @@ module PluginTool
69
69
  when 'log '
70
70
  # Output from console.log()
71
71
  puts "LOG:#{data}"
72
+ when 'prof'
73
+ # Profiler report
74
+ PluginTool.profiler_handle_report(data)
72
75
  when 'audt'
73
76
  decoded = JSON.parse(data)
74
77
  kind = decoded.find { |name,value| name == 'auditEntryType' }.last
data/lib/plugin_tool.rb CHANGED
@@ -23,7 +23,7 @@ NO_DEPENDENCY_COMMANDS.delete('list')
23
23
  PLUGIN_SEARCH_PATH = ['.']
24
24
 
25
25
  # Options for passing to plugin objects
26
- options = Struct.new(:output, :minimiser, :no_dependency, :with_dependency, :exclude_with_prefix, :no_console, :show_system_audit, :args, :force, :turbo, :server_substring, :restrict_to_app_id).new
26
+ options = Struct.new(:output, :minimiser, :no_dependency, :with_dependency, :exclude_with_prefix, :no_console, :show_system_audit, :args, :force, :turbo, :profile, :profile_file, :profile_format, :coverage_file, :coverage_format, :server_substring, :restrict_to_app_id).new
27
27
 
28
28
  # Parse arguments
29
29
  show_help = false
@@ -37,6 +37,11 @@ opts = GetoptLong.new(
37
37
  ['--server', '-s', GetoptLong::REQUIRED_ARGUMENT],
38
38
  ['--force', GetoptLong::NO_ARGUMENT],
39
39
  ['--turbo', GetoptLong::NO_ARGUMENT],
40
+ ['--profile', GetoptLong::REQUIRED_ARGUMENT],
41
+ ['--profile-file', GetoptLong::REQUIRED_ARGUMENT],
42
+ ['--profile-format', GetoptLong::REQUIRED_ARGUMENT],
43
+ ['--coverage-file', GetoptLong::REQUIRED_ARGUMENT],
44
+ ['--coverage-format', GetoptLong::REQUIRED_ARGUMENT],
40
45
  ['--output', GetoptLong::REQUIRED_ARGUMENT],
41
46
  ['--pack-restrict-to-app-id', GetoptLong::REQUIRED_ARGUMENT],
42
47
  ['--no-console', '-n', GetoptLong::NO_ARGUMENT],
@@ -72,6 +77,16 @@ opts.each do |opt, argument|
72
77
  options.force = true
73
78
  when '--turbo'
74
79
  options.turbo = true
80
+ when '--profile'
81
+ options.profile = argument.to_f
82
+ when '--profile-file'
83
+ options.profile_file = argument
84
+ when '--profile-format'
85
+ options.profile_format = argument
86
+ when '--coverage-file'
87
+ options.coverage_file = argument
88
+ when '--coverage-format'
89
+ options.coverage_format = argument
75
90
  end
76
91
  end
77
92
  # Handle rest of command line -- first arg is the command, the rest are passed on
@@ -325,6 +340,13 @@ end
325
340
  unless LOCAL_ONLY_COMMANDS[PLUGIN_TOOL_COMMAND]
326
341
  PluginTool.custom_behaviour.server_ready(plugins, PLUGIN_TOOL_COMMAND, options)
327
342
  plugins.each { |p| p.setup_for_server }
343
+
344
+ if options.profile
345
+ PluginTool.request_profile(options)
346
+ end
347
+ if options.coverage_file
348
+ PluginTool.request_coverage(options)
349
+ end
328
350
  end
329
351
 
330
352
  # Run the command
data/lib/run.rb CHANGED
@@ -65,6 +65,7 @@ require "#{PLUGIN_TOOL_ROOT_DIR}/lib/syntax_checking.rb"
65
65
  require "#{PLUGIN_TOOL_ROOT_DIR}/lib/notifications.rb"
66
66
  require "#{PLUGIN_TOOL_ROOT_DIR}/lib/plugin.rb"
67
67
  require "#{PLUGIN_TOOL_ROOT_DIR}/lib/new_plugin.rb"
68
+ require "#{PLUGIN_TOOL_ROOT_DIR}/lib/debuggers.rb"
68
69
  require "#{PLUGIN_TOOL_ROOT_DIR}/lib/misc.rb"
69
70
  require "#{PLUGIN_TOOL_ROOT_DIR}/lib/watchers.rb"
70
71
  require "#{PLUGIN_TOOL_ROOT_DIR}/lib/minimise.rb"
data/lib/version.txt CHANGED
@@ -1 +1 @@
1
- 8864920
1
+ a60e0f9
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.5.2
4
+ version: 2.5.3
5
5
  platform: java
6
6
  authors:
7
7
  - Haplo Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-14 00:00:00.000000000 Z
11
+ date: 2021-07-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Development tools for developing Haplo plugins, see https://haplo.org
14
14
  email: client.services@haplo-services.com
@@ -24,6 +24,7 @@ files:
24
24
  - lib/auth.rb
25
25
  - lib/check.rb
26
26
  - lib/custom.rb
27
+ - lib/debuggers.rb
27
28
  - lib/haplo-templates.jar
28
29
  - lib/hmac.rb
29
30
  - lib/hsvt_parser_config.rb
@@ -70,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
71
  version: '0'
71
72
  requirements: []
72
73
  rubyforge_project:
73
- rubygems_version: 2.7.6
74
+ rubygems_version: 2.7.9
74
75
  signing_key:
75
76
  specification_version: 4
76
77
  summary: Haplo Plugin Tool