haplo 2.3.6-java → 2.4.0-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: 37d7dc8a7f2805538445aaf8f1395f7c12f2f0e5175622109faefd25b52ea918
4
- data.tar.gz: 9416b8519d66169b4bad95aa0c657251e73af33135cd1e29a3a0897e2945188e
3
+ metadata.gz: 46492c3a4a0a11361880fca6b8867f92519a1c22d18dd2d45622f63614243606
4
+ data.tar.gz: 1f53526404acf0d48d5b83dc8bd0a5507c1485469db009b94f895319eedfac70
5
5
  SHA512:
6
- metadata.gz: 2b9f4f2ff2b553c9b60eb260659d6f2c82396290b77e61c9be3177024efd3c1d76c2eefbdc722a7e26bd70c61e1cd5a26d7ade503c36ea3b1228941c465cef54
7
- data.tar.gz: 16bb2d85c8d9fd2104f9a7e0f5f575960eed30ee99b25d9196a00b58068e3fc8180914ade6da1f9111625f50672b9768b15e239579569369ec106e9e5965ca33
6
+ metadata.gz: 5756f22e3b507f021755eebde4d5eb7f7cb3bf28d52c6c0118132fe78a76cd1a8b17aa561cde910877013839cea9f2033d83c74e1117280759395cc7f0594405
7
+ data.tar.gz: add428a9a6c3cd65ed391cde852fd073570c13f1750147062935f922d669f6f849899856538c0ca2adf08a167a09fb499820f7667ed605c26522f7106ca5ccfd
@@ -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.3.6'
7
- s.date = '2018-03-12'
6
+ s.version = '2.4.0'
7
+ s.date = '2018-06-15'
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"]
@@ -27,7 +27,7 @@ module PluginTool
27
27
  next
28
28
  end
29
29
  # Get hash of file
30
- digest = File.open(pathname) { |f| Digest::SHA256.hexdigest(f.read) }
30
+ digest = File.open(pathname, "rb") { |f| Digest::SHA256.hexdigest(f.read) }
31
31
  # And add to manifest
32
32
  manifest[filename] = digest
33
33
  end
@@ -9,7 +9,7 @@ module PluginTool
9
9
 
10
10
  PACKING_EXCLUDE = ['developer.json', 'readme.txt']
11
11
 
12
- def self.pack_plugin(plugin, output_directory, errors = [])
12
+ def self.pack_plugin(plugin, output_directory, restrict_to_app_id, errors = [])
13
13
  STDOUT.write("#{plugin.name}: ")
14
14
  raise "Bad plugin name when packing" unless plugin.name =~ /\A[a-zA-Z0-9_]+\z/
15
15
  # Get filenames and sort
@@ -29,7 +29,7 @@ module PluginTool
29
29
  ok
30
30
  end .sort
31
31
  # Clean output directory
32
- output_plugin_dir = "#{output_directory}/#{plugin.name}"
32
+ output_plugin_dir = "#{output_directory}/#{restrict_to_app_id ? "#{restrict_to_app_id}." : ''}#{plugin.name}"
33
33
  if File.exist? output_plugin_dir
34
34
  FileUtils.rm_r(output_plugin_dir)
35
35
  end
@@ -40,7 +40,13 @@ module PluginTool
40
40
  minimiser = PluginTool::Minimiser.new
41
41
  files.each do |filename|
42
42
  STDOUT.write("."); STDOUT.flush
43
- data = File.open("#{plugin_dir}/#{filename}") { |f| f.read }
43
+ data = File.open("#{plugin_dir}/#{filename}", "rb") { |f| f.read }
44
+ # Rewrite plugin.json?
45
+ if filename == 'plugin.json' && restrict_to_app_id
46
+ plugin_json = JSON.parse(data)
47
+ plugin_json['restrictToApplicationId'] = restrict_to_app_id
48
+ data = JSON.pretty_generate(plugin_json)
49
+ end
44
50
  # Minimise file?
45
51
  unless filename =~ /\A(js|test)\//
46
52
  data = minimiser.process(data, filename)
@@ -109,7 +109,7 @@ module PluginTool
109
109
  generate_license_key(application_id)
110
110
 
111
111
  when 'pack'
112
- PluginTool.pack_plugin(self, @options.output, errors)
112
+ PluginTool.pack_plugin(self, @options.output, @options.restrict_to_app_id, errors)
113
113
 
114
114
  when 'reset-db'
115
115
  puts "Resetting database on server for #{@name}..."
@@ -171,7 +171,7 @@ module PluginTool
171
171
  PluginTool.post_with_json_response("/api/development-plugin-loader/delete-file/#{@loaded_plugin_id}", params)
172
172
  else
173
173
  puts " #{@name}: Uploading #{filename}"
174
- data = File.open("#{@plugin_dir}/#{filename}") { |f| f.read }
174
+ data = File.open("#{@plugin_dir}/#{filename}", "rb") { |f| f.read }
175
175
  hash = action
176
176
  # Minimise file before uploading?
177
177
  if @options.minimiser != nil && filename =~ /\A(static|template)\//
@@ -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, :no_console, :show_system_audit, :args, :force, :turbo, :server_substring).new
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
27
27
 
28
28
  # Parse arguments
29
29
  show_help = false
@@ -32,10 +32,13 @@ opts = GetoptLong.new(
32
32
  ['--help', '-h', GetoptLong::NO_ARGUMENT],
33
33
  ['--plugin', '-p', GetoptLong::OPTIONAL_ARGUMENT],
34
34
  ['--no-dependency', GetoptLong::NO_ARGUMENT],
35
+ ['--with-dependency', GetoptLong::NO_ARGUMENT],
36
+ ['--exclude-with-prefix', GetoptLong::REQUIRED_ARGUMENT],
35
37
  ['--server', '-s', GetoptLong::REQUIRED_ARGUMENT],
36
38
  ['--force', GetoptLong::NO_ARGUMENT],
37
39
  ['--turbo', GetoptLong::NO_ARGUMENT],
38
40
  ['--output', GetoptLong::REQUIRED_ARGUMENT],
41
+ ['--pack-restrict-to-app-id', GetoptLong::REQUIRED_ARGUMENT],
39
42
  ['--no-console', '-n', GetoptLong::NO_ARGUMENT],
40
43
  ['--show-system-audit', GetoptLong::NO_ARGUMENT],
41
44
  ['--minimise', '--minimize', '-m', GetoptLong::NO_ARGUMENT]
@@ -49,10 +52,16 @@ opts.each do |opt, argument|
49
52
  requested_plugins = argument.split(',').map {|n| n.gsub(/[\/\\]+\z/,'')} # remove trailing dir separators
50
53
  when '--no-dependency'
51
54
  options.no_dependency = true
55
+ when '--with-dependency'
56
+ options.with_dependency = true
57
+ when '--exclude-with-prefix'
58
+ options.exclude_with_prefix = argument
52
59
  when '--server'
53
60
  options.server_substring = argument
54
61
  when '--output'
55
62
  options.output = argument
63
+ when '--pack-restrict-to-app-id'
64
+ options.restrict_to_app_id = argument.to_i
56
65
  when '--no-console'
57
66
  options.no_console = true
58
67
  when '--show-system-audit'
@@ -199,7 +208,13 @@ end
199
208
  if requested_plugins == ["ALL"]
200
209
  plugins = ALL_PLUGINS.dup
201
210
  else
202
- plugins = plugins_with_dependencies(requested_plugins, options.no_dependency || NO_DEPENDENCY_COMMANDS[PLUGIN_TOOL_COMMAND])
211
+ no_dependency = options.no_dependency || NO_DEPENDENCY_COMMANDS[PLUGIN_TOOL_COMMAND]
212
+ no_dependency = false if options.with_dependency
213
+ plugins = plugins_with_dependencies(requested_plugins, no_dependency)
214
+ end
215
+ if options.exclude_with_prefix
216
+ exclude_regexp = Regexp.new("\\A(#{options.exclude_with_prefix.split(',').join('|')})")
217
+ plugins = plugins.select { |plugin| plugin.name !~ exclude_regexp }
203
218
  end
204
219
  if plugins.length == 0
205
220
  end_on_error "No plugins selected, check -p option (requested: #{requested_plugins.join(',')})"
@@ -1 +1 @@
1
- 1e1d187
1
+ 8fc7036
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.3.6
4
+ version: 2.4.0
5
5
  platform: java
6
6
  authors:
7
7
  - Haplo Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-12 00:00:00.000000000 Z
11
+ date: 2018-06-15 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