nephos-server 0.4.6 → 0.4.7

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: d3ad4cb71c886a6242547faa12b28596219c6fdb
4
- data.tar.gz: b20d7a5730beaa95a57c2cd152a5c17ba667287d
3
+ metadata.gz: c19caddb625aa364f4db457946e82f11c9677cad
4
+ data.tar.gz: cfbda59dc9b76f3127738802b8fa5e32c7195daa
5
5
  SHA512:
6
- metadata.gz: 5b7a8b0309d2349f78cfe8c5dcf6c69dc6bd5b283454d2158e8f84eeaa41c4e9833c581444a2804ed44ad27e3c31c6782602b0abff8c30eff5952b3b2d438d7b
7
- data.tar.gz: f655da539e649b07af61e63bfdeed956406fc1ed7ac88ade4db9ecac1866d0d5c9931b50dbba8bfa93f3a865f6173a0c8a534c9dded48746eda319d851192252
6
+ metadata.gz: 976ab4a4c50704d349a41c47bc2d62f8d2ce8c358ad27ad6812dc122d3cbe09cbd375d22725a6002f524f616a9557e3484b54a69655ec747df4fd57858a9972c
7
+ data.tar.gz: 976677fcea7eee326490ef4811b6087e8d7403fed10952566370c29703dc8fc616c4abf0d73f65cd84151845e79efe4d12e68f15c3eda3bc4152120e3a4839b3
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ v0.4.7
2
+ * improve controller generator (names)
3
+ * add puma to change the default web server
4
+ * add environments
5
+
1
6
  v0.4.6
2
7
  * improve router errors
3
8
  * improve documentation (production mode)
data/Gemfile CHANGED
@@ -2,6 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  # web server
4
4
  gem 'rack'
5
+ gem 'puma'
5
6
 
6
7
  # colorize messages
7
8
  gem 'colorize'
data/Gemfile.lock CHANGED
@@ -3,6 +3,7 @@ GEM
3
3
  specs:
4
4
  colorize (0.7.7)
5
5
  nomorebeer (1.1)
6
+ puma (2.13.4)
6
7
  rack (1.6.4)
7
8
 
8
9
  PLATFORMS
@@ -11,6 +12,7 @@ PLATFORMS
11
12
  DEPENDENCIES
12
13
  colorize
13
14
  nomorebeer
15
+ puma
14
16
  rack
15
17
 
16
18
  BUNDLED WITH
data/README.md CHANGED
@@ -109,12 +109,9 @@ end
109
109
  # Developers: Roadmap
110
110
 
111
111
  ## TODO v0.4
112
- - improve generator with application status, tests, more generation (routing, ...)
113
- - improved render status
112
+ - improve generator with application tests
114
113
  - improve executables (tests, arguments)
115
114
  - improve documentation (bin)
116
- - improve controller generator (names's case)
117
- - environnementable
118
115
 
119
116
  ## TODO v0.5
120
117
  - executables with version
data/bin/nephos-generator CHANGED
@@ -70,7 +70,10 @@ module Nephos
70
70
  end
71
71
 
72
72
  module Controller
73
- def self.generate!(name, file)
73
+ def self.generate!(ctr)
74
+ uname = "#{ctr[0].upcase}#{ctr[1..-1]}Controller".gsub(/ControllerController$/, "Controller")
75
+ lname = uname.gsub(/([A-Z])/, '_\1')[1..-1].downcase
76
+ file = "app/#{lname}.rb"
74
77
  raise_invalid_appli
75
78
  if File.exists? file
76
79
  print "The file #{file} already exists. Are you sure to erase it ? (y/N)"
@@ -79,7 +82,7 @@ module Nephos
79
82
  end
80
83
  f = File.open(file, 'w')
81
84
  f << <<EOF
82
- class #{name} < Nephos::Controller
85
+ class #{uname} < Nephos::Controller
83
86
  def root
84
87
  return {plain: "index"}
85
88
  end
@@ -120,7 +123,7 @@ EOF
120
123
  case opt[0]
121
124
  when "c", "controller"
122
125
  if opt[1].to_s.match(/[\w\-\.]+/)
123
- Controller.generate!("#{opt[1].capitalize}Controller", "app/#{opt[1].downcase}_controller.rb")
126
+ Controller.generate!(opt[1])
124
127
  else
125
128
  puts "error"
126
129
  end
data/bin/nephos-server CHANGED
@@ -19,6 +19,11 @@ begin
19
19
  $server_host = host
20
20
  end
21
21
 
22
+ $server_env = ENV["ENVIRONMENT"] || "development"
23
+ opts.on("-e=env", "--env=env", "Environment") do |env|
24
+ $server_env = env
25
+ end
26
+
22
27
  opts.on("--debug") do
23
28
  $debug = true
24
29
  end
@@ -36,7 +41,7 @@ begin
36
41
  raise InvalidApplication
37
42
  end
38
43
 
39
- puts "Running Nephos::Server version #{Nephos::VERSION}"
44
+ puts "Running Nephos::Server version #{Nephos::VERSION} (#{Nephos.env})"
40
45
  Nephos::Server.start($server_port, $server_host)
41
46
 
42
47
  rescue RoutingError => err
data/lib/nephos-server.rb CHANGED
@@ -17,4 +17,9 @@ require_relative 'nephos-server/server/main'
17
17
  module Nephos
18
18
  VERSION_FILE = __FILE__.split("/")[0..-3].join("/") + "/version"
19
19
  VERSION = File.read(VERSION_FILE).strip
20
+
21
+ @@env = $server_env
22
+ def self.env
23
+ @@env
24
+ end
20
25
  end
@@ -54,5 +54,6 @@ nephos-status
54
54
  s.add_dependency 'nomorebeer', '~> 1.1'
55
55
  s.add_dependency 'rack', '~> 1.6'
56
56
  s.add_dependency 'colorize', '~> 0.7'
57
+ s.add_dependency 'puma', '~> 2.13'
57
58
 
58
59
  end
data/test/generator.rb CHANGED
@@ -17,6 +17,11 @@ class TestNephosServerGenerator < Test::Unit::TestCase
17
17
  `nephos-generator c test --debug`
18
18
  assert File.exists? "app/test_controller.rb"
19
19
  assert_equal "class TestController < Nephos::Controller", File.read("app/test_controller.rb").split("\n").first
20
+ `rm -f app/test_controller.rb`
21
+
22
+ `nephos-generator c testController --debug`
23
+ assert File.exists? "app/test_controller.rb"
24
+ assert_equal "class TestController < Nephos::Controller", File.read("app/test_controller.rb").split("\n").first
20
25
  `rm -f app/test_controller.rb`
21
26
  end
22
27
 
data/version CHANGED
@@ -1 +1 @@
1
- 0.4.6
1
+ 0.4.7
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.4.6
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - poulet_a
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: puma
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.13'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.13'
55
69
  description: " a minimalist server, based on rack/puma, with routing, rendering, and
56
70
  controllers. Designed for quick api."
57
71
  email:
@@ -148,6 +162,6 @@ rubyforge_project:
148
162
  rubygems_version: 2.4.8
149
163
  signing_key:
150
164
  specification_version: 4
151
- summary: "* improve router errors * improve documentation (production mode) * add
152
- listen network parameter to run the server"
165
+ summary: "* improve controller generator (names) * add puma to change the default
166
+ web server * add environments"
153
167
  test_files: []