nephos-server 0.6.2 → 0.6.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 837711f9cdfb6dbb77a5c9c5a0964bd3f603c0c5
4
- data.tar.gz: 1d69471c358c7a4e042dcabbbeb6d2002f55c1ed
3
+ metadata.gz: fd4f2176f42e827ebb36ac19f651e3adb12e7609
4
+ data.tar.gz: 99677cc04947d8c967c358d8e2cc8dab847e5879
5
5
  SHA512:
6
- metadata.gz: 807f30fb29bdc799e41180f9af31357aaae7c62118a551ff0e674419e6a6431b994e2a02c241a2e187d102dc3e5fea4349408c95fda63431f81f13dc62f0f4a9
7
- data.tar.gz: 69442d3daba27976f008181bfaa7bff0746d0278267e24749962fae8320ee1961ed0a3ac5ec610021b8416e50ae45db67a7213a37551d4160a8243589f25b22a
6
+ metadata.gz: 4d609afb7b502b5ab9831f289b0029cecfbe0ea3ccf8c8c86686df86e575eb1021a8b73b7f39fc4449ce00cecd0c018b264f322d5cfcbce8977345bc65e67824
7
+ data.tar.gz: 1db01ad58ca2bec79883ca541b8e6d6bd436fea5622b4f0fe193fdcecc1864a917ea3595fe7c8347d0678be3d5d30e4168f5d462ecfdbda00f85886f78b3f291
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ v0.6.3
2
+ * Add customisable default error page
3
+
1
4
  v0.6.2
2
5
  * Fix generator (bug when --application on current directory)
3
6
  * Improve hooks (add the :only option)
data/README.md CHANGED
@@ -46,6 +46,7 @@ Theses guides will provide you knowlegde about everything you can use in the app
46
46
  - [Render API](DOCUMENTATION/API_RENDER.md)
47
47
  - [Router GUIDE](DOCUMENTATION/GUIDE_ROUTER.md)
48
48
  - [Controller GUIDE](DOCUMENTATION/GUIDE_CONTROLLER.md)
49
+ - [Customisable errors GUIDE](DOCUMENTATION/GUIDE_ERRORS.md)
49
50
  - [Code documentation on RubyDoc.info](http://www.rubydoc.info/gems/nephos-server/toplevel) -> **Note: you can also generate local documentation via yard**
50
51
 
51
52
  ## Examples
@@ -109,24 +110,28 @@ end
109
110
 
110
111
  # Developers: Roadmap
111
112
 
112
- ## TODO v0.5
113
-
114
113
  ## TODO v0.6
115
- - startable as daemon
116
114
  - feature to change HTTP header from controller
117
- - customisable default 404 errors and 500 errors
118
115
  - functionnal tests
119
116
 
117
+ ## TODO v0.7
118
+ - Documentation on architecture (UML)
119
+ - Improved documentation (Tutorial, Improved guides)
120
+ - Alias for routing
121
+
120
122
  ## v1 requierements
121
123
  - Environement, Daemons, Port, Listen Host, Routables, Arguments
124
+ - Clear architecture
122
125
  - Generator readables and powerfull
123
126
  - At least 80% tests coverage
127
+ - Performances benchmark
124
128
  - Guide about
125
129
  - Controllers
126
130
  - Routing
127
131
  - Api Creation
128
132
  - Database creation
129
133
  - Web HTML with templating
134
+ - Clear documentation on the features using regexp, options, ...
130
135
 
131
136
  Gitlab Continuous Integration:
132
137
  [![Gitlab Tests](https://gitlab.com/ci/projects/8973/status.png?ref=master)](https://gitlab.com/ci/projects/8973?ref=master)
@@ -22,7 +22,6 @@ module Nephos
22
22
  @params.merge! Hash[callpath[:params].zip(params)]
23
23
  @params.select!{|k,v| not k.to_s.empty?}
24
24
 
25
-
26
25
  @params = Params.new(@params)
27
26
  @cookies = Params.new(@req.cookies)
28
27
  end
@@ -40,6 +40,20 @@ module Nephos
40
40
  end
41
41
  end
42
42
 
43
+ def error_custom(req, code, default=nil)
44
+ if File.exists? "app/#{code}.html"
45
+ @responder.render(status: code, html: File.read("app/#{code}.html"))
46
+ else
47
+ render_error(req, code, default || "Error: #{req.status}")
48
+ end
49
+ end
50
+
51
+ def error_404(req)
52
+ out = error_custom(req, 404, "404 not found \"#{req.path}\"")
53
+ out.body[0].gsub!("INJECT_REQ_PATH", req.path)
54
+ return out
55
+ end
56
+
43
57
  # @param path [Array]
44
58
  #
45
59
  # Find the right route to use from the url
@@ -53,13 +67,13 @@ module Nephos
53
67
  env = req.env
54
68
  puts "#{req.env["REMOTE_ADDR"]} [#{req.request_method}] \t ---> \t #{req.path}" unless @silent
55
69
  call = find_route(req)
56
- return render_error(req, 404, "404 not found \"#{req.path}\"") if call.nil?
70
+ return error_404(req) if call.nil?
57
71
  begin
58
72
  return render_controller(req, call)
59
73
  rescue => err
60
74
  STDERR.puts "Error: #{err.message}"
61
75
  STDERR.puts err.backtrace
62
- return render_error(req, 500, err)
76
+ return error_custom(req, 500, "Error: 500\n#{err.message}\n---Backtrace---\n#{err.backtrace.join("\n")}\n")
63
77
  end
64
78
  end
65
79
 
data/version CHANGED
@@ -1 +1 @@
1
- 0.6.2
1
+ 0.6.3
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nephos-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - poulet_a
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-01 00:00:00.000000000 Z
11
+ date: 2015-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nomorebeer