nephos-server 0.7.1 → 0.7.2

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: dda8b2aff3bcd63e224fd94a549e7ef48f33b45c
4
- data.tar.gz: b0a237328c6d87541f701a9c92be51b9c2db530c
3
+ metadata.gz: 10540f776d9a5acd8ff72ca285a8e44162950e21
4
+ data.tar.gz: fda28610fc278e8dd86019a6e82158e50f4bed67
5
5
  SHA512:
6
- metadata.gz: 9b3a480600d63c246e4ac7c5dea3bddeb08804cc1de2f87422d5560a9616beda491ee2c69e06f73f56738c083c6672375bc4b192747e80943b0bf34678aaa128
7
- data.tar.gz: 4b091120e2389ab476928d801c7b68e7cd858b63868cb504e06b1627305ebc2ca970e50ca94b8baa7cc69fcb4afaeae885dbc7c841e50335a9d82ee655304b3d
6
+ metadata.gz: 86bf3706de8ccddc30940377de8d7b367c980765185e200b0957e959a9eb332717d9d6449c6387e177d86c1e7a9eb6b69ad2ff3380101e189ef6392d4a1d6d3d
7
+ data.tar.gz: 2bf5fe5135a715057d1828ad87eea7c2354641d76afd3dc3280e14cf72a9e31784d81b5a19f85a814f2d2a6b3795f87747cb9ba0301fb65afb835a5ce4183ea7
Binary file
data.tar.gz.sig CHANGED
Binary file
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ v0.7.2
2
+ * add verbosity option
3
+
1
4
  v0.7.1
2
5
  * Fix cookies
3
6
  * Remove puma requirement
data/README.md CHANGED
@@ -107,9 +107,6 @@ end
107
107
 
108
108
  # Developers: Roadmap
109
109
 
110
- ## TODO v0.6
111
- - functionnal tests
112
-
113
110
  ## TODO v0.7
114
111
  - feature to change HTTP header from controller
115
112
  - Documentation on architecture (UML)
@@ -105,7 +105,7 @@ EOF
105
105
 
106
106
  module Application
107
107
  def self.create_application_dir dir
108
- raise BinError, "Directory #{dir} already exists" if Dir.exists? dir and dir != "."
108
+ raise BinError, "Directory #{dir} already exists" if Dir.exist? dir and dir != "."
109
109
  Dir.mkdir dir
110
110
  end
111
111
 
@@ -31,6 +31,10 @@ begin
31
31
  $debug = true
32
32
  end
33
33
 
34
+ opt.on("--verbose=mode", "Enable verbosity [output|none=default]") do |mode|
35
+ $verbose = mode
36
+ end
37
+
34
38
  opt.on("--test", "Enable testing mode (for nephos developpers)") do
35
39
  $test = true
36
40
  end
@@ -22,7 +22,7 @@ end.parse!
22
22
  $dir = opt[0] || "."
23
23
 
24
24
  begin
25
- if Dir.exists? $dir
25
+ if Dir.exist? $dir
26
26
  $gfl = File.expand_path "Gemfile.lock", $dir
27
27
  if not File.exist? $gfl or
28
28
  not File.read($gfl).split.index("nephos-server")
@@ -12,7 +12,7 @@ module Nephos
12
12
  # note: if the Gemfile includes nephos and not nephos-server,
13
13
  # it will work anyway, because nephos require nephos-server
14
14
  def self.is_a_valid_application? dir="."
15
- return false if not Dir.exists? dir
15
+ return false if not Dir.exist? dir
16
16
  gfl = File.expand_path "Gemfile.lock", dir
17
17
  return false if not File.exist? gfl
18
18
  return false if not File.read(gfl).split.index("nephos-server")
@@ -18,7 +18,6 @@ module Nephos
18
18
 
19
19
  def method_missing m, *a
20
20
  @hash.send(m, *(a.map(&:to_s)))
21
- @hash.send(m, *a)
22
21
  end
23
22
 
24
23
  def [] i
@@ -22,10 +22,13 @@ module Nephos
22
22
  # render the return of a call to Controller.new.method.
23
23
  # Controller and method are stored on call via the keys :controller and :method
24
24
  def render_controller req, call
25
- return @responder.render_from_controller(req, call)
25
+ out = @responder.render_from_controller(req, call)
26
+ STDERR.puts "<--- #{out.body}" if $verbose == "output"
27
+ return out
26
28
  end
27
29
 
28
30
  def render_error(req, code, err=nil)
31
+ STDERR.puts "Error #{code}" if $verbose == "output"
29
32
  if Nephos.env == "production"
30
33
  return @responder.render(status: code)
31
34
  elsif err
@@ -41,6 +44,7 @@ module Nephos
41
44
  end
42
45
 
43
46
  def error_custom(req, code, default=nil)
47
+ STDERR.puts "Error #{code}" if $verbose == "output"
44
48
  if File.exist? "app/#{code}.html"
45
49
  @responder.render(status: code, html: File.read("app/#{code}.html"))
46
50
  else
@@ -49,6 +53,7 @@ module Nephos
49
53
  end
50
54
 
51
55
  def error_404(req)
56
+ STDERR.puts "Error 404" if $verbose == "output"
52
57
  out = error_custom(req, 404, "404 not found \"#{req.path}\"")
53
58
  out.body[0].gsub!("INJECT_REQ_PATH", req.path)
54
59
  return out
@@ -64,7 +69,7 @@ module Nephos
64
69
  # Interface which handle the client query (stored in env), create a new
65
70
  # {Controller} instance, and call the render on it
66
71
  def execute(req)
67
- env = req.env
72
+ #env = req.env
68
73
  puts "#{req.env["REMOTE_ADDR"]} [#{req.request_method}] \t ---> \t #{req.path}" unless @silent
69
74
  call = find_route(req)
70
75
  # require 'pry'
@@ -4,10 +4,10 @@ class TestNephosServerGenerator < Test::Unit::TestCase
4
4
  `rm -rf /tmp/nephos-server-test 2> /tmp/null`
5
5
 
6
6
  `./bin/nephos-generator --test -a /tmp/nephos-server-test --no-build --no-git`
7
- assert(Dir.exists? "/tmp/nephos-server-test")
7
+ assert(Dir.exist? "/tmp/nephos-server-test")
8
8
  assert(File.exist? "/tmp/nephos-server-test/Gemfile")
9
9
  assert(File.exist? "/tmp/nephos-server-test/routes.rb")
10
- assert(Dir.exists? "/tmp/nephos-server-test/app")
10
+ assert(Dir.exist? "/tmp/nephos-server-test/app")
11
11
  gemfile_data = File.read("/tmp/nephos-server-test/Gemfile").split("\n")
12
12
  assert(gemfile_data.include? "gem 'nephos'")
13
13
  `rm -rf /tmp/nephos-server-test 2> /tmp/null`
@@ -17,10 +17,10 @@ class TestNephosServerGenerator < Test::Unit::TestCase
17
17
  `rm -rf /tmp/nephos-server-test 2> /tmp/null`
18
18
 
19
19
  `./bin/nephos-generator --test -a /tmp/nephos-server-test --no-git`
20
- assert(Dir.exists? "/tmp/nephos-server-test")
20
+ assert(Dir.exist? "/tmp/nephos-server-test")
21
21
  assert(File.exist? "/tmp/nephos-server-test/Gemfile")
22
22
  assert(File.exist? "/tmp/nephos-server-test/routes.rb")
23
- assert(Dir.exists? "/tmp/nephos-server-test/app")
23
+ assert(Dir.exist? "/tmp/nephos-server-test/app")
24
24
  gemfile_data = File.read("/tmp/nephos-server-test/Gemfile").split("\n")
25
25
  assert(gemfile_data.include? "gem 'nephos'")
26
26
 
data/version CHANGED
@@ -1 +1 @@
1
- 0.7.1
1
+ 0.7.2
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nephos-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - poulet_a
@@ -31,7 +31,7 @@ cert_chain:
31
31
  tcYkgfqUJPitIJx1RvWZpIyH5uJhRUYK3+vU9nMOxez5WbIlC1TtpByKAPMX+sht
32
32
  gib3AoIT8jh/2w==
33
33
  -----END CERTIFICATE-----
34
- date: 2015-11-07 00:00:00.000000000 Z
34
+ date: 2015-11-09 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: nomorebeer
metadata.gz.sig CHANGED
Binary file