oneis 1.0.0-java → 1.0.1-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.
- data/lib/check.rb +1 -1
- data/lib/manifest.rb +4 -3
- data/lib/minimise.rb +3 -3
- data/lib/new_plugin.rb +1 -1
- data/lib/packing.rb +7 -5
- data/lib/plugin.rb +6 -6
- data/lib/plugin_tool.rb +2 -2
- data/lib/version.txt +1 -1
- data/oneis.gemspec +3 -3
- metadata +3 -3
data/lib/check.rb
CHANGED
@@ -29,7 +29,7 @@ module PluginTool
|
|
29
29
|
Dir.glob("#{plugin_dir}/**/*").each do |pathname|
|
30
30
|
next unless File.file?(pathname)
|
31
31
|
plugin_relative_name = pathname[plugin_dir.length+1, pathname.length]
|
32
|
-
if pathname =~ /\.js\
|
32
|
+
if pathname =~ /\.js\z/
|
33
33
|
# Check JavaScript
|
34
34
|
report = syntax_check_one_file(plugin, plugin_relative_name)
|
35
35
|
if report == nil
|
data/lib/manifest.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
|
2
2
|
module PluginTool
|
3
3
|
|
4
|
+
# NOTE: Also update packing.rb if this changes
|
4
5
|
ALLOWED_PLUGIN_DIRS = ['js', 'static', 'template', 'test', 'data']
|
5
6
|
|
6
7
|
def self.generate_manifest(directory)
|
@@ -10,12 +11,12 @@ module PluginTool
|
|
10
11
|
next unless File.file? pathname
|
11
12
|
# Check file
|
12
13
|
filename = pathname.slice(directory.length + 1, pathname.length)
|
13
|
-
raise "Bad filename for #{filename}" unless filename =~ /\A([a-zA-Z0-9_\/\-]+\/)?([a-z0-9_-]+\.[a-z0-9]+)\
|
14
|
+
raise "Bad filename for #{filename}" unless filename =~ /\A([a-zA-Z0-9_\/\-]+\/)?([a-z0-9_-]+\.[a-z0-9]+)\z/
|
14
15
|
dir = $1
|
15
16
|
name = $2
|
16
17
|
if dir != nil
|
17
|
-
dir = dir.gsub(/\/\
|
18
|
-
raise "Bad directory #{dir}" unless dir =~ /\A([a-zA-Z0-9_\-]+)[a-zA-Z0-9_\/\-]*\
|
18
|
+
dir = dir.gsub(/\/\z/,'')
|
19
|
+
raise "Bad directory #{dir}" unless dir =~ /\A([a-zA-Z0-9_\-]+)[a-zA-Z0-9_\/\-]*\z/
|
19
20
|
raise "Bad root directory #{$1}" unless ALLOWED_PLUGIN_DIRS.include?($1)
|
20
21
|
end
|
21
22
|
# Get hash of file
|
data/lib/minimise.rb
CHANGED
@@ -18,11 +18,11 @@ module PluginTool
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def process(data, filename)
|
21
|
-
if filename =~ /\.js\
|
21
|
+
if filename =~ /\.js\z/
|
22
22
|
# JavaScript - use UglifyJS loaded into the JavaScript interpreter
|
23
23
|
@js_min.call(@cx, @javascript_scope, @javascript_scope, [data])
|
24
24
|
|
25
|
-
elsif filename =~ /\.html\
|
25
|
+
elsif filename =~ /\.html\z/
|
26
26
|
# Simple processing of HTML
|
27
27
|
# Remove HTML comments
|
28
28
|
html = data.gsub(/\<\!\-\-.+?\-\-\>/m,'')
|
@@ -33,7 +33,7 @@ module PluginTool
|
|
33
33
|
html.gsub!(/([\>}])[\r\n]+([\<{])/m,'\1\2')
|
34
34
|
html
|
35
35
|
|
36
|
-
elsif filename =~ /\.css\
|
36
|
+
elsif filename =~ /\.css\z/
|
37
37
|
# Simple processing of CSS
|
38
38
|
css = data.gsub(/(^|\s)\/\*.+?\*\/($|\s)/m,'') # remove C style comments
|
39
39
|
out = []
|
data/lib/new_plugin.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
module PluginTool
|
3
3
|
|
4
4
|
def self.make_new_plugin(plugin_name)
|
5
|
-
unless plugin_name =~ /\A[a-z0-9_]+\
|
5
|
+
unless plugin_name =~ /\A[a-z0-9_]+\z/ && plugin_name.length > 8
|
6
6
|
end_on_error "Bad plugin name - must use a-z0-9_ only, and more than 8 characters."
|
7
7
|
end
|
8
8
|
if File.exist?(plugin_name)
|
data/lib/packing.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
module PluginTool
|
3
3
|
|
4
|
-
PACKING_ACCEPTABLE_FILENAME = /\A(plugin\.json|(js|static|template)\/[a-z0-9_-]+\.[a-z0-9]+)\
|
4
|
+
PACKING_ACCEPTABLE_FILENAME = /\A(plugin\.json|(js|static|template|test|data)\/([a-z0-9_-]+\/)*[a-z0-9_-]+\.[a-z0-9]+)\z/
|
5
5
|
PACKING_ACCEPTABLE_EXCEPTIONS = ['certificates-temp-http-api.pem']
|
6
6
|
|
7
7
|
def self.pack_plugin(plugin_name, output_directory)
|
@@ -29,9 +29,6 @@ module PluginTool
|
|
29
29
|
end
|
30
30
|
# Make file structure
|
31
31
|
FileUtils.mkdir(output_plugin_dir)
|
32
|
-
['js','static','template'].each do |subdir|
|
33
|
-
FileUtils.mkdir("#{output_plugin_dir}/#{subdir}")
|
34
|
-
end
|
35
32
|
# Process each file, building a manifest
|
36
33
|
puts "Processing files:"
|
37
34
|
manifest = ''
|
@@ -44,7 +41,12 @@ module PluginTool
|
|
44
41
|
data = minimiser.process(data, filename)
|
45
42
|
end
|
46
43
|
hash = Digest::SHA1.hexdigest(data)
|
47
|
-
|
44
|
+
# Make sure output directory exists, write file
|
45
|
+
output_pathname = "#{output_plugin_dir}/#{filename}"
|
46
|
+
output_directory = File.dirname(output_pathname)
|
47
|
+
FileUtils.mkdir_p(output_directory) unless File.directory?(output_directory)
|
48
|
+
File.open(output_pathname, "w") { |f| f.write data }
|
49
|
+
# Filename entry in Manifest
|
48
50
|
manifest << "F #{hash} #{filename}\n"
|
49
51
|
end
|
50
52
|
minimiser.finish
|
data/lib/plugin.rb
CHANGED
@@ -18,7 +18,7 @@ module PluginTool
|
|
18
18
|
end
|
19
19
|
# Setup for using the plugin
|
20
20
|
@plugin_dir = @name
|
21
|
-
end_on_error "logic error" unless @plugin_dir =~ /\A[a-zA-Z0-9_-]+\
|
21
|
+
end_on_error "logic error" unless @plugin_dir =~ /\A[a-zA-Z0-9_-]+\z/
|
22
22
|
@registration_file = "registration.#{@plugin_dir}.yaml"
|
23
23
|
puts "Plugin: #{@plugin_dir}"
|
24
24
|
end
|
@@ -86,7 +86,7 @@ module PluginTool
|
|
86
86
|
case cmd
|
87
87
|
when 'license-key'
|
88
88
|
application_id = @options.args.first
|
89
|
-
if application_id == nil || application_id !~ /\A\d+\
|
89
|
+
if application_id == nil || application_id !~ /\A\d+\z/
|
90
90
|
end_on_error "Numeric application ID must be specified"
|
91
91
|
end
|
92
92
|
generate_license_key(application_id)
|
@@ -137,9 +137,9 @@ module PluginTool
|
|
137
137
|
changes = PluginTool.determine_manifest_changes(@current_manifest, next_manifest)
|
138
138
|
upload_failed = false
|
139
139
|
changes.each do |filename, action|
|
140
|
-
filename =~ /\A(.*?\/)?([^\/]+)\
|
140
|
+
filename =~ /\A(.*?\/)?([^\/]+)\z/
|
141
141
|
params = {:filename => $2}
|
142
|
-
params[:directory] = $1.gsub(/\/\
|
142
|
+
params[:directory] = $1.gsub(/\/\z/,'') if $1
|
143
143
|
if action == :delete
|
144
144
|
puts " #{@name}: Deleting #{filename}"
|
145
145
|
PluginTool.post_yaml("/api/development_plugin_loader/delete_file/#{@loaded_plugin_id}", params)
|
@@ -163,7 +163,7 @@ module PluginTool
|
|
163
163
|
# Otherwise mark as a failed upload to stop an apply operation which will fail
|
164
164
|
upload_failed = true
|
165
165
|
end
|
166
|
-
PluginTool.syntax_check(self, filename) if filename =~ /\.js\
|
166
|
+
PluginTool.syntax_check(self, filename) if filename =~ /\.js\z/
|
167
167
|
end
|
168
168
|
end
|
169
169
|
if upload_failed
|
@@ -189,7 +189,7 @@ module PluginTool
|
|
189
189
|
if info["installSecret"] == nil
|
190
190
|
end_on_error "#{@name}: No installSecret specified in plugin.json"
|
191
191
|
end
|
192
|
-
license_key = HMAC::SHA1.sign(info["installSecret"], "application:#{
|
192
|
+
license_key = HMAC::SHA1.sign(info["installSecret"], "application:#{application_id}")
|
193
193
|
puts <<__E
|
194
194
|
|
195
195
|
Plugin: #{@name}
|
data/lib/plugin_tool.rb
CHANGED
@@ -32,7 +32,7 @@ opts.each do |opt, argument|
|
|
32
32
|
when '--help'
|
33
33
|
show_help = true
|
34
34
|
when '--plugin'
|
35
|
-
plugin_names = argument.split(',').map {|n| n.gsub(/[\/\\]+\
|
35
|
+
plugin_names = argument.split(',').map {|n| n.gsub(/[\/\\]+\z/,'')} # remove trailing dir separators
|
36
36
|
when '--output'
|
37
37
|
options.output = argument
|
38
38
|
when '--no-console'
|
@@ -55,7 +55,7 @@ end
|
|
55
55
|
def find_all_plugins()
|
56
56
|
all_plugins = []
|
57
57
|
Dir.glob("**/plugin.json").each do |p|
|
58
|
-
if p =~ /\A([a-zA-Z0-9_]+)\/plugin\.json\
|
58
|
+
if p =~ /\A([a-zA-Z0-9_]+)\/plugin\.json\z/
|
59
59
|
all_plugins << $1
|
60
60
|
end
|
61
61
|
end
|
data/lib/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
71e32da87b
|
data/oneis.gemspec
CHANGED
@@ -3,15 +3,15 @@ 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 = '
|
6
|
+
s.version = '1.0.1'
|
7
|
+
s.date = '2013-02-13'
|
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
13
|
s.add_dependency('jruby-openssl', '>= 0.7.7')
|
14
|
-
s.add_dependency('json', '>= 1.
|
14
|
+
s.add_dependency('json', '>= 1.7.7')
|
15
15
|
s.files = files
|
16
16
|
s.executables = ['oneis-plugin']
|
17
17
|
s.default_executable = '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.1
|
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:
|
13
|
+
date: 2013-02-13 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: jruby-openssl
|
@@ -31,7 +31,7 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 1.
|
34
|
+
version: 1.7.7
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id002
|
37
37
|
description: ONEIS Developer Tools
|