nephos-server 0.4.5 → 0.4.6

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: fafffc3b9fdd5ee491e7df8a1546d4a7cd016eae
4
- data.tar.gz: 65c935615e226cf314c77a2faa44bf59178657c2
3
+ metadata.gz: d3ad4cb71c886a6242547faa12b28596219c6fdb
4
+ data.tar.gz: b20d7a5730beaa95a57c2cd152a5c17ba667287d
5
5
  SHA512:
6
- metadata.gz: 7b64a9a8263f866929e5bb72af132dd52a74093ddbf048d06b6b441b23e725927be767bf252cea6ab8ff33be127ca4e186d4a9333bb4bd16ae1b80124ff70448
7
- data.tar.gz: 4d555a6a371e0afc3355121584ee20fa7e1e17c19b201c1b888aba3fbccd2ec095cda34552d25f49d2013afc583e2641cc90c47da6e7542407ac4bee4f9f171f
6
+ metadata.gz: 5b7a8b0309d2349f78cfe8c5dcf6c69dc6bd5b283454d2158e8f84eeaa41c4e9833c581444a2804ed44ad27e3c31c6782602b0abff8c30eff5952b3b2d438d7b
7
+ data.tar.gz: f655da539e649b07af61e63bfdeed956406fc1ed7ac88ade4db9ecac1866d0d5c9931b50dbba8bfa93f3a865f6173a0c8a534c9dded48746eda319d851192252
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ v0.4.6
2
+ * improve router errors
3
+ * improve documentation (production mode)
4
+ * add listen network parameter to run the server
5
+
1
6
  v0.4.5
2
7
  * fix server executable
3
8
 
data/README.md CHANGED
@@ -29,9 +29,15 @@ Features wich will not be provided by nephos-server:
29
29
  gem install nephos-server # download the server
30
30
  nephos-generator application MyApp # generate the application
31
31
  cd MyApp # go in
32
- nephos-server -p 8080 # start the server. port is not required
32
+ nephos-server -p 8080 -h 0.0.0.0 # start the server. port is not required, neither host
33
33
  ```
34
34
 
35
+ ``nephos-server`` is a binary designed to start the server easly. It can take few arguments, all optionnal:
36
+
37
+ - ``-p``: port to listen
38
+ - ``-h``: host to listen (network address)
39
+ - ``-e``: environment (default is development, can be set to production)
40
+
35
41
 
36
42
  # Documentation
37
43
 
@@ -45,6 +51,11 @@ Theses guides will provide you knowlegde about everything you can use in the app
45
51
 
46
52
  ## Examples
47
53
 
54
+ ### Production
55
+
56
+ To avoid information leaks from your application, set the environment variable ``export ENVIRONMENT=production``.
57
+ It will disable ruby error messages when an error occurs in the controller.
58
+
48
59
  ### Controller
49
60
 
50
61
  To create a controller, add a ruby file to ``app/``, with a class inherited by ``Nephos::Controller``
@@ -100,16 +111,24 @@ end
100
111
  ## TODO v0.4
101
112
  - improve generator with application status, tests, more generation (routing, ...)
102
113
  - improved render status
114
+ - improve executables (tests, arguments)
115
+ - improve documentation (bin)
116
+ - improve controller generator (names's case)
117
+ - environnementable
103
118
 
104
119
  ## TODO v0.5
105
- - improve documentation (bin)
106
120
  - executables with version
107
- - improve executables (tests, arguments)
121
+ - cookies, ...
122
+ - usage of rack parsers (Rack::Request.new(env) etc.)
123
+
124
+ ## TODO v0.6
125
+ - startable as daemon
126
+ - hooks for controller
108
127
 
109
- ## TODO v1
110
- - Improved Routing (more helper options)
111
- - Improved Rendering (more options)
112
- - Customisable errors (404 noticely, and 500)
128
+ ## v1 requierements
129
+ - Environement, Daemons, Port, Listen Host, Routables, Arguments
130
+ - Generator readables and powerfull
131
+ - At least 80% tests coverage
113
132
  - Guide about
114
133
  - Controllers
115
134
  - Routing
data/bin/nephos-server CHANGED
@@ -7,17 +7,21 @@ class RoutingError < StandardError; end
7
7
 
8
8
  begin
9
9
  OptionParser.new do |opts|
10
- opts.banner = "Usage: nephos-server [-p=port] [--debug]"
10
+ opts.banner = "Usage: nephos-server [-p=port] [-h=listen] [--debug]"
11
11
 
12
12
  $server_port = ENV["SERVER_PORT"] || 8080
13
13
  opts.on("-p=nb", "--port=nb", "Port") do |port|
14
14
  $server_port = Integer(port)
15
15
  end
16
16
 
17
+ $server_host = ENV["SERVER_HOST"] || "0.0.0.0"
18
+ opts.on("-h=listen", "--host=listen", "Listen on the network") do |host|
19
+ $server_host = host
20
+ end
21
+
17
22
  opts.on("--debug") do
18
23
  $debug = true
19
24
  end
20
-
21
25
  end.parse!
22
26
 
23
27
  if $debug
@@ -33,7 +37,7 @@ begin
33
37
  end
34
38
 
35
39
  puts "Running Nephos::Server version #{Nephos::VERSION}"
36
- Nephos::Server.start($server_port)
40
+ Nephos::Server.start($server_port, $server_host)
37
41
 
38
42
  rescue RoutingError => err
39
43
  puts "Routing Error: Check out the documentation and `routes.rb` file.".yellow
@@ -34,7 +34,7 @@ module Nephos
34
34
  return render(status: code)
35
35
  elsif err
36
36
  #TODO: improve this
37
- return render(status: code, content: err.is_a?(String) ? err : err.message)
37
+ return render(status: code, content: "Error: #{code}\n" + (err.is_a?(String) ? err : err.message))
38
38
  else
39
39
  return render(status: code)
40
40
  end
@@ -5,21 +5,22 @@ module Nephos
5
5
 
6
6
  SERVER = lambda {|env| return Router.execute(env)}
7
7
 
8
- attr_accessor :port
8
+ attr_accessor :port, :host
9
9
 
10
10
  # @param port [Integer] port to listen
11
- def initialize port
11
+ def initialize port="8080", host="0.0.0.0"
12
12
  @port = Integer(port)
13
+ @host = host.to_s
13
14
  end
14
15
 
15
16
  # start the Rack server
16
17
  def start
17
- Rack::Server.start :app => SERVER, :Port => @port
18
+ Rack::Server.start :app => SERVER, :Port => @port, :Host => @host
18
19
  end
19
20
 
20
21
  # start the Rack server on a instance of Nephos::Server
21
- def self.start port
22
- Server.new(port).start
22
+ def self.start port, host
23
+ Server.new(port, host).start
23
24
  end
24
25
 
25
26
  end
data/version CHANGED
@@ -1 +1 @@
1
- 0.4.5
1
+ 0.4.6
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.4.5
4
+ version: 0.4.6
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-09-08 00:00:00.000000000 Z
11
+ date: 2015-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nomorebeer
@@ -148,5 +148,6 @@ rubyforge_project:
148
148
  rubygems_version: 2.4.8
149
149
  signing_key:
150
150
  specification_version: 4
151
- summary: "* fix server executable"
151
+ summary: "* improve router errors * improve documentation (production mode) * add
152
+ listen network parameter to run the server"
152
153
  test_files: []