oneis 2.0.2-java → 2.0.3-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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b68f3277dbcaef02ed9fb1386d07890d556d5fa1
4
+ data.tar.gz: 9829008f1daebd4bc1dba87dde7d89adb2f29753
5
+ SHA512:
6
+ metadata.gz: c22f7f5300f2919e7b8b15f1715dc2c284cf3438edfb062fd2080201ddd80a67f3df21ebf4d4723fb9a05c20a3ea069c989d701055d75002d1d18df1eb3d3c89
7
+ data.tar.gz: 7c19c276060296924d354f26569d46a0fcd59164d6816172a46987b2005e0f8f621f3b9d008b66d4533d129beb76b75eead8f8a4c04f099009095c10e4a9d077
@@ -1,38 +1,3 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'java'
4
-
5
- require 'digest/sha1'
6
- require 'net/http'
7
- require 'net/https'
8
- require 'getoptlong'
9
- require 'fileutils'
10
- require 'thread'
11
-
12
- require 'rubygems'
13
- gem 'json'
14
- require 'json'
15
-
16
- ONEIS_PLUGIN_ROOT_DIR = "#{File.dirname(__FILE__)}/.."
17
-
18
- JS_JAR = "#{ONEIS_PLUGIN_ROOT_DIR}/lib/js.jar"
19
- unless File.exists? JS_JAR
20
- puts "Can't find JavaScript interpreter .jar file"
21
- exit 1
22
- end
23
- require JS_JAR
24
-
25
- require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/hmac.rb"
26
- require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/local_config.rb"
27
- require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/manifest.rb"
28
- require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/auth.rb"
29
- require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/server.rb"
30
- require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/syntax_checking.rb"
31
- require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/notifications.rb"
32
- require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/plugin.rb"
33
- require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/new_plugin.rb"
34
- require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/misc.rb"
35
- require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/watchers.rb"
36
- require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/minimise.rb"
37
- require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/check.rb"
38
- require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/plugin_tool.rb"
3
+ load "#{File.dirname(__FILE__)}/../lib/run.rb"
@@ -0,0 +1,73 @@
1
+
2
+ module PluginTool
3
+
4
+ LOCAL_CUSTOM_BEHAVIOUR_FILENAME = "server.behaviour.rb"
5
+
6
+ # Digests of trusted code are stored outside the source code repo, so it can't be written by the repo contents
7
+ TRUSTED_CODE_DIGESTS_FILENAME = "~/.haplo-plugin-tool-trusted.json"
8
+
9
+ class CustomBehaviour
10
+ def start(plugins, command, options, is_local_command)
11
+ end
12
+ def server_ready(plugins, command, options)
13
+ end
14
+ end
15
+
16
+ @@custom = CustomBehaviour.new
17
+
18
+ def self.set_custom_behaviour(custom)
19
+ @@custom = custom
20
+ end
21
+
22
+ def self.custom_behaviour
23
+ @@custom
24
+ end
25
+
26
+ def self.try_load_custom
27
+ return unless File.exist?(LOCAL_CUSTOM_BEHAVIOUR_FILENAME)
28
+
29
+ trusted_code = nil
30
+ untrusted_code = File.open(LOCAL_CUSTOM_BEHAVIOUR_FILENAME) { |f| f.read }
31
+ untrusted_code_digest = Digest::SHA256.hexdigest(untrusted_code)
32
+
33
+ trusted_code_digests = {"trust" => []}
34
+ trusted_code_filename = File.expand_path(TRUSTED_CODE_DIGESTS_FILENAME)
35
+ if File.exist?(trusted_code_filename)
36
+ trusted_code_digests = JSON.parse(File.open(trusted_code_filename) { |f| f.read })
37
+ end
38
+
39
+ unless trusted_code_digests["trust"].include?(untrusted_code_digest)
40
+ # Make sure the user wants to run this code. Otherwise running the plugin tool in a repo you've just
41
+ # downloaded could unexpectedly execute code on your local machine.
42
+ if ARGV.length == 2 && ARGV[0] == 'trust' && ARGV[1] =~ /\A[0-9a-z]{64}\z/ && ARGV[1] == untrusted_code_digest
43
+ trusted_code_digests["trust"].push(untrusted_code_digest)
44
+ File.open(trusted_code_filename,"w") { |f| f.write JSON.pretty_generate(trusted_code_digests) }
45
+ puts "Stored trust for #{LOCAL_CUSTOM_BEHAVIOUR_FILENAME} with contents #{untrusted_code_digest}."
46
+ exit 0
47
+ else
48
+ puts
49
+ puts "-------------------------------------------------------------------------------------------"
50
+ puts " Do you trust the code in #{LOCAL_CUSTOM_BEHAVIOUR_FILENAME} to be run every time you run the"
51
+ puts " plugin tool? If yes, run"
52
+ puts " oneis-plugin trust #{untrusted_code_digest}"
53
+ puts " to permanently trust this version of #{LOCAL_CUSTOM_BEHAVIOUR_FILENAME}"
54
+ puts "-------------------------------------------------------------------------------------------"
55
+ puts
56
+ PluginTool.beep
57
+ exit 1
58
+ end
59
+ end
60
+
61
+ if ARGV.length > 0 && ARGV[0] == "trust"
62
+ puts "Unexpected trust command."
63
+ exit 1
64
+ end
65
+
66
+ # User trusts the code, run it
67
+ # There is a race condition here, but we're trying to protect against code in repositories, not
68
+ # against software running on the local machine.
69
+ load LOCAL_CUSTOM_BEHAVIOUR_FILENAME
70
+
71
+ end
72
+
73
+ end
@@ -8,6 +8,8 @@ File.open("#{File.dirname(__FILE__)}/version.txt") do |f|
8
8
  puts "ONEIS Plugin Tool (#{f.read.chomp})"
9
9
  end
10
10
 
11
+ PluginTool.try_load_custom
12
+
11
13
  PluginTool::LocalConfig.load
12
14
 
13
15
  # Commands not needing server
@@ -122,6 +124,9 @@ plugins.sort! do |a,b|
122
124
  end
123
125
  plugins.each { |p| p.print_banner }
124
126
 
127
+ # Custom behaviour for this repo?
128
+ PluginTool.custom_behaviour.start(plugins, PLUGIN_TOOL_COMMAND, options, LOCAL_ONLY_COMMANDS[PLUGIN_TOOL_COMMAND])
129
+
125
130
  # Special handling for some commands
126
131
  case PLUGIN_TOOL_COMMAND
127
132
  when 'pack'
@@ -137,6 +142,8 @@ unless LOCAL_ONLY_COMMANDS[PLUGIN_TOOL_COMMAND]
137
142
  PluginTool.setup_auth(options)
138
143
  PluginTool.check_for_certificate_file
139
144
 
145
+ PluginTool.custom_behaviour.server_ready(plugins, PLUGIN_TOOL_COMMAND, options)
146
+
140
147
  if automatic_plugin_exclusion
141
148
  exclusions = PluginTool::LocalConfig.get_list("exclude")
142
149
  plugins = plugins.select do |plugin|
@@ -0,0 +1,38 @@
1
+
2
+ require 'java'
3
+
4
+ require 'digest/sha1'
5
+ require 'net/http'
6
+ require 'net/https'
7
+ require 'getoptlong'
8
+ require 'fileutils'
9
+ require 'thread'
10
+
11
+ require 'rubygems'
12
+ gem 'json'
13
+ require 'json'
14
+
15
+ ONEIS_PLUGIN_ROOT_DIR = "#{File.dirname(__FILE__)}/.."
16
+
17
+ JS_JAR = "#{ONEIS_PLUGIN_ROOT_DIR}/lib/js.jar"
18
+ unless File.exists? JS_JAR
19
+ puts "Can't find JavaScript interpreter .jar file"
20
+ exit 1
21
+ end
22
+ require JS_JAR
23
+
24
+ require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/hmac.rb"
25
+ require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/local_config.rb"
26
+ require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/manifest.rb"
27
+ require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/auth.rb"
28
+ require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/server.rb"
29
+ require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/syntax_checking.rb"
30
+ require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/notifications.rb"
31
+ require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/plugin.rb"
32
+ require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/new_plugin.rb"
33
+ require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/misc.rb"
34
+ require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/watchers.rb"
35
+ require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/minimise.rb"
36
+ require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/check.rb"
37
+ require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/custom.rb"
38
+ require "#{ONEIS_PLUGIN_ROOT_DIR}/lib/plugin_tool.rb"
@@ -136,4 +136,8 @@ EOF
136
136
  r
137
137
  end
138
138
 
139
+ def self.get_application_info
140
+ @@server_application_info ||= JSON.parse(get("/api/development-plugin-loader/application-info"))
141
+ end
142
+
139
143
  end
@@ -1 +1 @@
1
- 0aa65198b7
1
+ 6be56b5a02
@@ -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.2'
7
- s.date = '2015-01-09'
6
+ s.version = '2.0.3'
7
+ s.date = '2015-02-20'
8
8
  s.summary = "ONEIS Tools"
9
9
  s.description = "ONEIS Developer Tools"
10
10
  s.authors = ["ONEIS"]
metadata CHANGED
@@ -1,102 +1,101 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: oneis
3
- version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 2.0.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.3
6
5
  platform: java
7
- authors:
8
- - ONEIS
9
- autorequire:
6
+ authors:
7
+ - ONEIS
8
+ autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
-
13
- date: 2015-01-09 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: jruby-openssl
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
19
- none: false
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 0.8.7
24
- type: :runtime
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
27
- name: json
28
- prerelease: false
29
- requirement: &id002 !ruby/object:Gem::Requirement
30
- none: false
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: 1.7.7
35
- type: :runtime
36
- version_requirements: *id002
11
+ date: 2015-02-20 00:00:00.000000000 Z
12
+ dependencies:
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
+ requirement: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - '>='
23
+ - !ruby/object:Gem::Version
24
+ version: 0.8.7
25
+ prerelease: false
26
+ type: :runtime
27
+ - !ruby/object:Gem::Dependency
28
+ name: json
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: 1.7.7
34
+ requirement: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - '>='
37
+ - !ruby/object:Gem::Version
38
+ version: 1.7.7
39
+ prerelease: false
40
+ type: :runtime
37
41
  description: ONEIS Developer Tools
38
42
  email: client.services@oneis.co.uk
39
- executables:
40
- - oneis-plugin
43
+ executables:
44
+ - oneis-plugin
41
45
  extensions: []
42
-
43
46
  extra_rdoc_files: []
44
-
45
- files:
46
- - oneis.gemspec
47
- - README.txt
48
- - lib/auth.rb
49
- - lib/CertificateBundle.pem
50
- - lib/check.rb
51
- - lib/hmac.rb
52
- - lib/js.jar
53
- - lib/js_min.js
54
- - lib/js_syntax_test.js
55
- - lib/jshint.js
56
- - lib/local_config.rb
57
- - lib/manifest.rb
58
- - lib/minimise.rb
59
- - lib/misc.rb
60
- - lib/new_plugin.rb
61
- - lib/notifications.rb
62
- - lib/packing.rb
63
- - lib/plugin.rb
64
- - lib/plugin_tool.rb
65
- - lib/server.rb
66
- - lib/syntax_checking.rb
67
- - lib/usage.txt
68
- - lib/version.txt
69
- - lib/watchers.rb
70
- - lib/uglifyjs/parse-js.js
71
- - lib/uglifyjs/process.js
72
- - lib/uglifyjs/squeeze-more.js
73
- - bin/oneis-plugin
47
+ files:
48
+ - README.txt
49
+ - bin/oneis-plugin
50
+ - lib/CertificateBundle.pem
51
+ - lib/auth.rb
52
+ - lib/check.rb
53
+ - lib/custom.rb
54
+ - lib/hmac.rb
55
+ - lib/js.jar
56
+ - lib/js_min.js
57
+ - lib/js_syntax_test.js
58
+ - lib/jshint.js
59
+ - lib/local_config.rb
60
+ - lib/manifest.rb
61
+ - lib/minimise.rb
62
+ - lib/misc.rb
63
+ - lib/new_plugin.rb
64
+ - lib/notifications.rb
65
+ - lib/packing.rb
66
+ - lib/plugin.rb
67
+ - lib/plugin_tool.rb
68
+ - lib/run.rb
69
+ - lib/server.rb
70
+ - lib/syntax_checking.rb
71
+ - lib/uglifyjs/parse-js.js
72
+ - lib/uglifyjs/process.js
73
+ - lib/uglifyjs/squeeze-more.js
74
+ - lib/usage.txt
75
+ - lib/version.txt
76
+ - lib/watchers.rb
77
+ - oneis.gemspec
74
78
  homepage: http://docs.oneis.co.uk/dev/tool/plugin
75
79
  licenses: []
76
-
77
- post_install_message:
80
+ metadata: {}
81
+ post_install_message:
78
82
  rdoc_options: []
79
-
80
- require_paths:
81
- - lib
82
- required_ruby_version: !ruby/object:Gem::Requirement
83
- none: false
84
- requirements:
85
- - - ">="
86
- - !ruby/object:Gem::Version
87
- version: "0"
88
- required_rubygems_version: !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- version: "0"
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
94
95
  requirements: []
95
-
96
- rubyforge_project:
97
- rubygems_version: 1.8.15
98
- signing_key:
99
- specification_version: 3
96
+ rubyforge_project:
97
+ rubygems_version: 2.4.5
98
+ signing_key:
99
+ specification_version: 4
100
100
  summary: ONEIS Tools
101
101
  test_files: []
102
-