hyperloop-config 0.9.7 → 0.9.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/hyperloop-config.gemspec +1 -1
- data/lib/hyperloop-loader-application.rb.erb +1 -0
- data/lib/hyperloop-loader-system-code.rb.erb +1 -0
- data/lib/hyperloop-loader-system.js.erb +1 -0
- data/lib/hyperloop-loader.js +4 -2
- data/lib/hyperloop-prerender-loader-application.rb.erb +1 -0
- data/lib/hyperloop-prerender-loader-system-code.rb.erb +1 -0
- data/lib/hyperloop-prerender-loader-system.js.erb +1 -0
- data/lib/hyperloop-prerender-loader.js +4 -0
- data/lib/hyperloop/imports.rb +32 -4
- metadata +9 -4
- data/lib/hyperloop-loader2.rb.erb +0 -1
- data/lib/hyperloop-prerender-loader.rb.erb +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2872a3f9d6a90ec66a9369ce75e5360b96395caf
|
4
|
+
data.tar.gz: 1b383039726c4f07ffcad90fcb5675af5b4cfa34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 769dc1d55d1713c217d7b23d52bcfe195914594af58364fdf4bded13ff8a6fc1883c6e0f864266cd799c6a11335a126afd045e663c84279bbeae0a2e65bce2dd
|
7
|
+
data.tar.gz: 905757403f027995677d6d42f3deb1f741fd672ca4ef61d3037999974ab2ffa6dd19e44dd1178af1add9dd64164e220ed835b43bf2831cd0e3d791b4e571b725
|
data/hyperloop-config.gemspec
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
<%= Hyperloop.generate_requires(:client, false, __FILE__) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= Hyperloop.generate_requires(:client, true, __FILE__) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= Hyperloop.compile_and_compress('hyperloop-loader-system-code') %>
|
data/lib/hyperloop-loader.js
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
<%= Hyperloop.generate_requires(:server, false, __FILE__) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= Hyperloop.generate_requires(:server, true, __FILE__) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= Hyperloop.compile_and_compress('hyperloop-prerender-loader-system-code', never_compress: true) %>
|
data/lib/hyperloop/imports.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
module Hyperloop
|
2
|
+
|
2
3
|
class << self
|
3
4
|
def import_list
|
4
5
|
@import_list ||= []
|
@@ -36,17 +37,18 @@ module Hyperloop
|
|
36
37
|
import(nil, instead_of: value)
|
37
38
|
end
|
38
39
|
|
39
|
-
def generate_requires(mode, file)
|
40
|
+
def generate_requires(mode, sys, file)
|
40
41
|
puts "***** generating requires for #{mode} - #{file}"
|
41
42
|
import_list.collect do |value, render_on_server, render_on_client, kind|
|
42
43
|
next unless value
|
44
|
+
next if (sys && kind == :tree) || (!sys && kind != :tree)
|
43
45
|
next if mode == :client && !render_on_client
|
44
46
|
next if mode == :server && !render_on_server
|
45
47
|
if kind == :tree
|
46
48
|
generate_require_tree(value, render_on_server, render_on_client)
|
47
49
|
elsif kind == :gem
|
48
50
|
r = "require '#{value}' #{client_guard(render_on_server, render_on_client)}"
|
49
|
-
puts r
|
51
|
+
puts " #{r}"
|
50
52
|
"puts \"#{r}\"; #{r}"
|
51
53
|
else
|
52
54
|
generate_directive(:require, value, file, render_on_server, render_on_client)
|
@@ -62,7 +64,7 @@ module Hyperloop
|
|
62
64
|
comp_path.shift
|
63
65
|
end
|
64
66
|
r = "#{directive} '#{(['.'] + ['..'] * gem_path.length + comp_path).join('/')}' #{client_guard(render_on_server, render_on_client)}"
|
65
|
-
puts r
|
67
|
+
puts " #{r}"
|
66
68
|
"puts \"#{r}\"; #{r}"
|
67
69
|
end
|
68
70
|
|
@@ -74,7 +76,7 @@ module Hyperloop
|
|
74
76
|
if fname =~ /(\.js$)|(\.rb$)/
|
75
77
|
fname = fname.gsub(/(\.js$)|(\.rb$)/, '')
|
76
78
|
r = "require '#{fname}' #{client_guard(render_on_server, render_on_client)}"
|
77
|
-
puts r
|
79
|
+
puts " #{r}"
|
78
80
|
"puts \"#{r}\"; #{r}"
|
79
81
|
end
|
80
82
|
end.compact.join("\n")
|
@@ -88,5 +90,31 @@ module Hyperloop
|
|
88
90
|
end
|
89
91
|
end
|
90
92
|
|
93
|
+
Hyperloop.define_setting :compress_system_assets, true
|
94
|
+
|
95
|
+
def compile_and_compress(name, never_compress: false)
|
96
|
+
start_time = Time.now
|
97
|
+
|
98
|
+
Rails.logger.info "\n\n##########################################################################\n"
|
99
|
+
Rails.logger.info " HYPERLOOP LIBRARIES PRECOMPILING AND MINIFYING\n"
|
100
|
+
Rails.logger.info " FIRST TIME BOOTING YOUR APP IT CAN TAKE 1 OR 2 MINUTES\n"
|
101
|
+
Rails.logger.info " NB: You can force precompiling again by cleaning cache: rm -rf tmp/cache \n"
|
102
|
+
Rails.logger.info "##########################################################################\n\n"
|
103
|
+
|
104
|
+
Rails.logger.info "Compiling the system assets for #{name}"
|
105
|
+
|
106
|
+
compiled_code = Rails.application.assets[name].to_s
|
107
|
+
compilation_time = Time.now
|
108
|
+
compiled_code_length = compiled_code.length
|
109
|
+
Rails.logger.info " compiled - length: #{compiled_code_length}"
|
110
|
+
if Hyperloop.compress_system_assets && !never_compress
|
111
|
+
compiled_code = Uglifier.new.compile(compiled_code)
|
112
|
+
Rails.logger.info " minimized - length: #{compiled_code.length}"
|
113
|
+
Rails.logger.info " minification ratio #{(compiled_code.length*100.0/compiled_code_length).round}%"
|
114
|
+
end
|
115
|
+
Rails.logger.info " total time: #{(Time.now-start_time).to_f.round(2)} seconds"
|
116
|
+
compiled_code
|
117
|
+
end
|
118
|
+
|
91
119
|
end
|
92
120
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hyperloop-config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- catmando
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|
@@ -193,9 +193,14 @@ files:
|
|
193
193
|
- Rakefile
|
194
194
|
- hyperloop-config.gemspec
|
195
195
|
- lib/hyperloop-config.rb
|
196
|
+
- lib/hyperloop-loader-application.rb.erb
|
197
|
+
- lib/hyperloop-loader-system-code.rb.erb
|
198
|
+
- lib/hyperloop-loader-system.js.erb
|
196
199
|
- lib/hyperloop-loader.js
|
197
|
-
- lib/hyperloop-
|
198
|
-
- lib/hyperloop-prerender-loader.rb.erb
|
200
|
+
- lib/hyperloop-prerender-loader-application.rb.erb
|
201
|
+
- lib/hyperloop-prerender-loader-system-code.rb.erb
|
202
|
+
- lib/hyperloop-prerender-loader-system.js.erb
|
203
|
+
- lib/hyperloop-prerender-loader.js
|
199
204
|
- lib/hyperloop/client_readers.rb
|
200
205
|
- lib/hyperloop/client_stubs.rb
|
201
206
|
- lib/hyperloop/config_settings.rb
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= Hyperloop.generate_requires(:client, __FILE__) %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= Hyperloop.generate_requires(:server, __FILE__) %>
|