oneis 1.0.1-java → 1.0.4-java
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/notifications.rb +22 -2
- data/lib/plugin.rb +14 -38
- data/lib/plugin_tool.rb +5 -2
- data/lib/version.txt +1 -1
- data/oneis.gemspec +3 -3
- metadata +3 -3
data/lib/notifications.rb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
|
2
2
|
module PluginTool
|
3
3
|
|
4
|
+
@@notification_options = nil
|
5
|
+
@@notification_have_suppressed_first_system_audit_entry = false
|
4
6
|
@@notification_announce_reconnect = false
|
5
7
|
|
6
|
-
def self.start_notifications
|
8
|
+
def self.start_notifications(options)
|
9
|
+
@@notification_options = options
|
7
10
|
@@notification_queue_name = nil
|
8
11
|
Thread.new do
|
9
12
|
while true
|
@@ -60,8 +63,25 @@ module PluginTool
|
|
60
63
|
when 'log '
|
61
64
|
# Output from console.log()
|
62
65
|
puts "LOG:#{data}"
|
66
|
+
when 'audt'
|
67
|
+
decoded = JSON.parse(data)
|
68
|
+
kind = decoded.find { |name,value| name == 'auditEntryType' }.last
|
69
|
+
if kind =~ /\A[A-Z\-]+\z/
|
70
|
+
# System audit entry - suppressed by default
|
71
|
+
unless @@notification_options.show_system_audit
|
72
|
+
unless @@notification_have_suppressed_first_system_audit_entry
|
73
|
+
@@notification_have_suppressed_first_system_audit_entry = true
|
74
|
+
puts "NOTICE: System audit trail entries are not being shown. Run with --show-system-audit to display."
|
75
|
+
end
|
76
|
+
return
|
77
|
+
end
|
78
|
+
end
|
79
|
+
puts "AUDIT -------------------------------------------"
|
80
|
+
decoded.each do |key, value|
|
81
|
+
puts sprintf("%22s: %s", key, value.to_s)
|
82
|
+
end
|
63
83
|
else
|
64
|
-
puts "WARNING: Unknown notification received from server. Upgrade the plugin tool."
|
84
|
+
puts "WARNING: Unknown notification received from server. Upgrade the plugin tool using 'jgem update oneis'."
|
65
85
|
sleep(5) # throttle problematic responses
|
66
86
|
end
|
67
87
|
end
|
data/lib/plugin.rb
CHANGED
@@ -19,50 +19,32 @@ module PluginTool
|
|
19
19
|
# Setup for using the plugin
|
20
20
|
@plugin_dir = @name
|
21
21
|
end_on_error "logic error" unless @plugin_dir =~ /\A[a-zA-Z0-9_-]+\z/
|
22
|
-
@
|
22
|
+
@loaded_plugin_id = nil
|
23
23
|
puts "Plugin: #{@plugin_dir}"
|
24
24
|
end
|
25
25
|
|
26
26
|
def setup_for_server
|
27
|
+
# Delete any legacy registration file for this plugin
|
28
|
+
registration_file = "registration.#{@plugin_dir}.yaml"
|
29
|
+
if File.exists? registration_file
|
30
|
+
puts "NOTICE: Deleting legacy registration file for #{@plugin_dir}"
|
31
|
+
File.delete(registration_file)
|
32
|
+
end
|
33
|
+
|
27
34
|
# Make the first empty manifest (may be replaced from server)
|
28
35
|
@current_manifest = {}
|
29
36
|
|
30
|
-
# Get info about the current plugin
|
31
|
-
@loaded_plugin_id = nil
|
32
|
-
if File.exists? @registration_file
|
33
|
-
reg_info = YAML::load(File.open(@registration_file) { |f| f.read })
|
34
|
-
@loaded_plugin_id = reg_info[:plugin_id]
|
35
|
-
if @loaded_plugin_id != nil
|
36
|
-
# Check with server to see if this is still registered, and if so, what files it has on the server
|
37
|
-
s_reg_info = PluginTool.get_yaml("/api/development_plugin_loader/manifest/#{@loaded_plugin_id}")
|
38
|
-
end_on_error "Couldn't communicate successfully with server." if s_reg_info[:protocol_error]
|
39
|
-
if s_reg_info[:result] == 'success'
|
40
|
-
@current_manifest = s_reg_info[:manifest]
|
41
|
-
else
|
42
|
-
puts "NOTICE: Discarding registration information from #{@registration_file}"
|
43
|
-
@loaded_plugin_id = nil
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
37
|
# If minimisation is active, clear the current manifest so all files are uploaded again.
|
49
38
|
if @options.minimiser != nil
|
50
39
|
@current_manifest = {}
|
51
40
|
end
|
52
41
|
|
53
|
-
#
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
if s_found_info[:found]
|
60
|
-
# Store info returned by the server
|
61
|
-
puts "NOTICE: Found existing registration for #{@name} on server. Using it."
|
62
|
-
@loaded_plugin_id = s_found_info[:plugin_id]
|
63
|
-
@current_manifest = s_found_info[:manifest]
|
64
|
-
registration_file_needs_update = true
|
65
|
-
end
|
42
|
+
# See if the plugin has already been registered with the server
|
43
|
+
s_found_info = PluginTool.post_yaml("/api/development_plugin_loader/find_registration", {:name => @name})
|
44
|
+
if s_found_info[:found]
|
45
|
+
# Store info returned by the server
|
46
|
+
@loaded_plugin_id = s_found_info[:plugin_id]
|
47
|
+
@current_manifest = s_found_info[:manifest]
|
66
48
|
end
|
67
49
|
|
68
50
|
# If there isn't an existing plugin registered, create a new one
|
@@ -71,12 +53,6 @@ module PluginTool
|
|
71
53
|
end_on_error "Couldn't communicate successfully with server." if s_create_info[:protocol_error]
|
72
54
|
end_on_error "Failed to create plugin on server" unless s_create_info[:plugin_id] != nil
|
73
55
|
@loaded_plugin_id = s_create_info[:plugin_id]
|
74
|
-
registration_file_needs_update = true
|
75
|
-
end
|
76
|
-
|
77
|
-
# Update registration file for next run?
|
78
|
-
if registration_file_needs_update
|
79
|
-
File.open(@registration_file, 'w') { |f| f.write YAML::dump(:plugin_id => @loaded_plugin_id) }
|
80
56
|
end
|
81
57
|
end
|
82
58
|
|
data/lib/plugin_tool.rb
CHANGED
@@ -15,7 +15,7 @@ LOCAL_ONLY_COMMANDS = {"license-key" => true, "pack" => true, "check" => true}
|
|
15
15
|
plugin_names = []
|
16
16
|
|
17
17
|
# Options for passing to plugin objects
|
18
|
-
options = Struct.new(:output, :minimiser, :no_console, :args).new
|
18
|
+
options = Struct.new(:output, :minimiser, :no_console, :show_system_audit, :args).new
|
19
19
|
|
20
20
|
# Parse arguments
|
21
21
|
show_help = false
|
@@ -24,6 +24,7 @@ opts = GetoptLong.new(
|
|
24
24
|
['--plugin', '-p', GetoptLong::OPTIONAL_ARGUMENT],
|
25
25
|
['--output', GetoptLong::REQUIRED_ARGUMENT],
|
26
26
|
['--no-console', '-n', GetoptLong::NO_ARGUMENT],
|
27
|
+
['--show-system-audit', '-s', GetoptLong::NO_ARGUMENT],
|
27
28
|
['--minimise', '--minimize', '-m', GetoptLong::NO_ARGUMENT]
|
28
29
|
)
|
29
30
|
option_output = nil
|
@@ -37,6 +38,8 @@ opts.each do |opt, argument|
|
|
37
38
|
options.output = argument
|
38
39
|
when '--no-console'
|
39
40
|
options.no_console = true
|
41
|
+
when '--show-system-audit'
|
42
|
+
options.show_system_audit = true
|
40
43
|
when '--minimise', '--minimize'
|
41
44
|
options.minimiser = PluginTool::Minimiser.new
|
42
45
|
end
|
@@ -135,7 +138,7 @@ end
|
|
135
138
|
PluginTool.start_syntax_check
|
136
139
|
|
137
140
|
# Notifications support (including console)
|
138
|
-
PluginTool.start_notifications unless options.no_console
|
141
|
+
PluginTool.start_notifications(options) unless options.no_console
|
139
142
|
|
140
143
|
# Open watcher
|
141
144
|
watcher = PluginTool.make_watcher(plugins.map { |p| p.plugin_dir })
|
data/lib/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
30ba1d4d14
|
data/oneis.gemspec
CHANGED
@@ -3,14 +3,14 @@ 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 = '1.0.
|
7
|
-
s.date = '2013-
|
6
|
+
s.version = '1.0.4'
|
7
|
+
s.date = '2013-03-30'
|
8
8
|
s.summary = "ONEIS Tools"
|
9
9
|
s.description = "ONEIS Developer Tools"
|
10
10
|
s.authors = ["ONEIS"]
|
11
11
|
s.email = 'client.services@oneis.co.uk'
|
12
12
|
s.platform = "java"
|
13
|
-
s.add_dependency('jruby-openssl', '>= 0.
|
13
|
+
s.add_dependency('jruby-openssl', '>= 0.8.7')
|
14
14
|
s.add_dependency('json', '>= 1.7.7')
|
15
15
|
s.files = files
|
16
16
|
s.executables = ['oneis-plugin']
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: oneis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.0.
|
5
|
+
version: 1.0.4
|
6
6
|
platform: java
|
7
7
|
authors:
|
8
8
|
- ONEIS
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-03-30 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: jruby-openssl
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.
|
23
|
+
version: 0.8.7
|
24
24
|
type: :runtime
|
25
25
|
version_requirements: *id001
|
26
26
|
- !ruby/object:Gem::Dependency
|