plezi 0.14.7 → 0.14.8

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
  SHA1:
3
- metadata.gz: 4a8e174219fac070cbd73f2fa53f858edeab9aa8
4
- data.tar.gz: 9ac861a092def65bb48ae3c86fc1491d1c47a51e
3
+ metadata.gz: b3b1d2338244ebc62934748459ced4b8b62d8d4a
4
+ data.tar.gz: bcba37cd0ab457806d6b9ef030febf53a2df0858
5
5
  SHA512:
6
- metadata.gz: 2033fbcdcae672753ad07ff8c0c80688728766ab1da4e6b35326f21318051124cf6f12429362ec80644211628c2231ff34e7d0a65667c2043842904db7a99e17
7
- data.tar.gz: 342cf32db1bc7233b5f55ee8308b93af181646dc9804414b95e221470684b57d1b97185b156d5c032d25bbf63cae5c3a5d2930c105fe43e1b2cceab64b72612c
6
+ metadata.gz: 6f98ca9e09b22ead936b7cf0444d0a24582c259aa13c7b93758164e8b0c08065bdf12a181d2dda3ac97a5c74a020daa8bf2edddfbdb6c82b477324edf2b4ec7a
7
+ data.tar.gz: baf7735fe15051377f236bfb6513d87ac0065f651bed1e4901bd691cf558cec304d36eee402767bf88e96a2bc17ee613e004c2e064091a6a5eb73d676096547a
data/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  ***
4
4
 
5
+ Change log v.0.14.8 (next)
6
+
7
+ **Fix**: Asset Sass rendering will now only save the output to a file in production mode, allowing development mode to hot-load the assets and re-render them when changes occur.
8
+
9
+ **Feature**: (experimental) The `params` hash will now search for a String alternative, if a Symbol is provided... in other words, the `params#[]` accessor can now be used with both symbols and Strings.
10
+
11
+ **Changes**: Changed the default Iodine workers to dynamically adjust to Redis scaling availability.
12
+
13
+ ***
14
+
5
15
  Change log v.0.14.7
6
16
 
7
17
  **Fix**: Tested against Iodine 0.3.0.
@@ -14,8 +14,15 @@ module Plezi
14
14
  def self.plezi_initialize
15
15
  if @plezi_initialize.nil?
16
16
  @plezi_initialize = true
17
+ self.hash_proc_4symstr # crerate the Proc object used for request params
17
18
  @plezi_autostart = true if @plezi_autostart.nil?
18
- puts "WARNNING: auto-scaling with redis is set using ENV['PL_REDIS_URL'.freeze]\r\n but the Redis gem isn't included! - SCALING IS IGNORED!" if ENV['PL_REDIS_URL'.freeze] && !defined?(::Redis)
19
+ if ENV['PL_REDIS_URL'.freeze] && !defined?(::Redis)
20
+ puts "WARNNING: auto-scaling with redis is set using ENV['PL_REDIS_URL'.freeze]\r\n but the Redis gem isn't included! - SCALING IS IGNORED!"
21
+ ::Iodine.processes ||= 1
22
+ elsif !ENV['PL_REDIS_URL'.freeze]
23
+ ::Iodine.processes ||= 1
24
+ end
25
+ ::Iodine.processes ||= 4
19
26
  at_exit do
20
27
  next if @plezi_autostart == false
21
28
  ::Iodine::Rack.app = ::Plezi.app
@@ -27,5 +34,5 @@ module Plezi
27
34
  end
28
35
 
29
36
  ::Iodine.threads ||= 16
30
- ::Iodine.processes ||= 1 unless ENV['PL_REDIS_URL'.freeze]
37
+ # ::Iodine.processes ||= (ENV['PL_REDIS_URL'.freeze] ? 4 : 1)
31
38
  ::Iodine.run { ::Plezi::Base::MessageDispatch._init }
@@ -244,17 +244,15 @@ module Plezi
244
244
  # @private
245
245
  # This function is used internally by Plezi, do not call.
246
246
  def _pl_ad_review(data)
247
- if self.class._pl_is_ad?
248
- case data
249
- when Hash
250
- write data.to_json
251
- when String
252
- write data
253
- # when Array
254
- # write ret
255
- end
256
- end
257
- data
247
+ return data unless self.class._pl_is_ad?
248
+ case data
249
+ when Hash
250
+ write data.to_json
251
+ when String
252
+ write data
253
+ # when Array
254
+ # write data.to_json
255
+ end
258
256
  end
259
257
 
260
258
  # @private
@@ -29,7 +29,7 @@ if defined?(::Sass)
29
29
  def review_cache(filename, target)
30
30
  return nil unless File.exist?(filename)
31
31
  eng = self[filename]
32
- return true unless eng.nil? || refresh_sass?(filename)
32
+ return self[target] unless eng.nil? || refresh_sass?(filename)
33
33
  self[filename] = (eng = Sass::Engine.for_file(filename, SASS_OPTIONS)).dependencies
34
34
  map_name = "#{target}.map".freeze
35
35
  css, map = eng.render_with_sourcemap(File.basename(map_name))
@@ -19,12 +19,13 @@ module Plezi
19
19
  def index
20
20
  name = File.join(Plezi.assets, *params['*'.freeze]).freeze
21
21
  data = ::Plezi::AssetBaker.bake(name)
22
- IO.binwrite(name, data) if data.is_a?(String)
23
- if File.exist? name
24
- response['X-Sendfile'.freeze] = name
25
- response.body = File.open(name)
26
- return true
27
- end
22
+ return data if data.is_a?(String)
23
+ # IO.binwrite(name, data) if data.is_a?(String)
24
+ # if File.exist? name
25
+ # response['X-Sendfile'.freeze] = name
26
+ # response.body = File.open(name)
27
+ # return true
28
+ # end
28
29
  false
29
30
  end
30
31
  end
@@ -33,13 +33,15 @@ module Plezi
33
33
  end
34
34
 
35
35
  def call(request, response)
36
- return nil unless match(request.path_info, request)
36
+ params = match(request.path_info, request)
37
+ return nil unless params
37
38
  c = @controller.new
38
- c._pl_respond(request, response, Thread.current[@route_id])
39
+ c._pl_respond(request, response, params)
39
40
  end
40
41
 
41
42
  def fits_params(path, request)
42
43
  params = (Thread.current[@route_id] ||= {}).clear
44
+ params.default_proc = Plezi.hash_proc_4symstr
43
45
  params.update request.params.to_h if request && request.params
44
46
  # puts "cutting: #{path[(@prefix_length)..-1] ? path[(@prefix_length + 1)..-1] : 'nil'}"
45
47
  pa = (path[@prefix_length..-1] || ''.freeze).split('/'.freeze)
@@ -51,7 +53,7 @@ module Plezi
51
53
  Plezi.try_utf8!(Rack::Utils.unescape(pa.shift)), 100)
52
54
  end
53
55
  params['*'.freeze] = pa unless pa.empty?
54
- true
56
+ params
55
57
  end
56
58
 
57
59
  def match(req_path, request = nil)
data/lib/plezi/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Plezi
2
- VERSION = '0.14.7'.freeze
2
+ VERSION = '0.14.8'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plezi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.7
4
+ version: 0.14.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boaz Segev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-23 00:00:00.000000000 Z
11
+ date: 2017-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iodine