nephos-server 0.1.2 → 0.1.3

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: 874850432c525c3a1578fe7718c1e1152fbad5c1
4
- data.tar.gz: 0b3648125fcb43419799d9316eb1f61e12799e59
3
+ metadata.gz: 0198ab59046527552ad7b7f66c25dcd04ca3727f
4
+ data.tar.gz: aeb7527f299c85860b4941a528c15635ed6024a8
5
5
  SHA512:
6
- metadata.gz: eb03c24fd8928f00977dfebe013a7ca0e798f4c282d6729d9db6834a31946e5391b1aa291bee39069656003a742588980e7a07e22c64c1b51b581b5b9a12614a
7
- data.tar.gz: 1706413aa6c577391eb60a7a634a97c0255fbd6ed5fd6f7967f9bd62c7bdfd3d9fc1772767c8e51f3dae62c2b74ffefb39bb3fcb71011bd8e3183474c1c5a630
6
+ metadata.gz: b6aee265e6d6fb09239476dcb545c6ea282fea41ef548432cd28134d94bff3fdf6698399a933a8eca2411f30b08ae0452c9ec00301e8be989682d4feaa61b118
7
+ data.tar.gz: 66fc08b9fe7a964d87e34eb8e4113f0aa2d68eedc3127ef4f0374ff8a24fa6e5b96be526bd7ab78448fe87b39489e13bf68300b1c7818a1d4f38dd801b798ef6
data/bin/nephos-generator CHANGED
@@ -45,19 +45,28 @@ def initialize_application
45
45
  exec("bundle install")
46
46
  end
47
47
 
48
- case ARGV[0]
49
- when "c", "controller"
50
- if not ARGV[1].to_s.empty?
51
- generate_controller("#{ARGV[1]}Controller", "src/#{ARGV[1]}.rb")
52
- end
53
- when "a", "appli", "application"
54
- if not ARGV[1].to_s.empty?
55
- create_application_dir(ARGV[1])
56
- puts "Application #{ARGV[1]} created"
57
- move_to_application_dir(ARGV[1])
48
+ require 'optparse'
49
+
50
+ begin
51
+ OptionParser.new do |opts|
52
+ opts.banner = "Usage: nephos-generator [controller name] [appli [name]]"
53
+ end.parse!
54
+
55
+ case ARGV[0]
56
+ when "c", "controller"
57
+ if not ARGV[1].to_s.match(/[\w_\-\.]+/)
58
+ generate_controller("#{ARGV[1]}Controller", "src/#{ARGV[1]}.rb")
59
+ end
60
+ when "a", "appli", "application"
61
+ if not ARGV[1].to_s.empty?
62
+ create_application_dir(ARGV[1])
63
+ puts "Application #{ARGV[1]} created"
64
+ move_to_application_dir(ARGV[1])
65
+ end
66
+ initialize_application
67
+ puts "Application initialized"
58
68
  end
59
- initialize_application
60
- puts "Application initialized"
61
- else
62
- puts "help: generate c[ontroller] name"
69
+
70
+ rescue => err
71
+ puts "Error: #{err.message}"
63
72
  end
data/bin/nephos-server CHANGED
@@ -1,17 +1,36 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- # require_relative "../lib/nephos-server"
4
- require 'nephos-server'
5
-
6
3
  require 'optparse'
7
4
 
8
- OptionParser.new do |opts|
9
- opts.banner = "Usage: main.rb [update] [-t n] [-s n] [-i id]"
5
+ begin
6
+ OptionParser.new do |opts|
7
+ opts.banner = "Usage: nephos-server [-p=port] [--debug]"
8
+
9
+ $server_port = ENV["SERVER_PORT"] || 8080
10
+ opts.on("-p=nb", "--port=nb", "Port") do |port|
11
+ $server_port = Integer(port)
12
+ end
13
+
14
+ opts.on("--debug") do
15
+ $debug = true
16
+ end
17
+
18
+ end.parse!
10
19
 
11
- $server_port = ENV["SERVER_PORT"] || 8080
12
- opts.on("-p=nb", "--port=nb", "Port") do |port|
13
- $server_port = Integer(port)
20
+ if $debug
21
+ require_relative "../lib/nephos-server"
22
+ else
23
+ require 'nephos-server'
14
24
  end
15
- end.parse!
16
25
 
17
- Nephos::Server.start($server_port)
26
+ if not $debug and
27
+ (not File.exists? "Gemfile.lock" or
28
+ not File.read("Gemfile.lock").split.index("nephos-server"))
29
+ raise InvalidApplicationError
30
+ end
31
+
32
+ Nephos::Server.start($server_port)
33
+
34
+ rescue => err
35
+ puts "Error: #{err.message}"
36
+ end
data/lib/nephos-server.rb CHANGED
@@ -1 +1,8 @@
1
+ # coding: utf-8
2
+
3
+ # require 'yaml'
4
+ require 'json'
5
+ require 'open-uri'
6
+ require 'rack'
7
+
1
8
  require_relative 'nephos-server/server/main'
@@ -1,10 +1,4 @@
1
- #coding: utf-8
2
-
3
- # require 'json'
4
- # require 'yaml'
5
- require 'open-uri'
6
- require 'rack'
7
-
1
+ require_relative 'basic_errors'
8
2
  require_relative 'responder'
9
3
  require_relative '../routing/execute'
10
4
 
@@ -1,5 +1,3 @@
1
- require 'json'
2
-
3
1
  module Nephos
4
2
  module Responder
5
3
 
data/version CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
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.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - poulet_a