Thin_Upstreams 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.version = Thin_Upstreams::VERSION
9
9
  s.authors = ["da99"]
10
10
  s.email = ["i-hate-spam-45671204@mailinator.com"]
11
- s.homepage = ""
11
+ s.homepage = "https://github.com/da99/Thin_Upstreams"
12
12
  s.summary = %q{ Create upstreams conf file for Nginx. }
13
13
  s.description = %q{
14
14
  A Ruby gem to generate .conf files with upstreams
@@ -1,3 +1,3 @@
1
1
  class Thin_Upstreams
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -15,7 +15,7 @@ def Thin_Upstreams glob = "./*/config/thin.yml"
15
15
  ports = Thin_Upstreams.port_to_array(o["port"], o["servers"])
16
16
  str << %~
17
17
  upstream #{app_name} {
18
- #{ ports.map { |i| "server 127.0.0.1:#{i}" }.join("\n") }
18
+ #{ ports.map { |i| "server 127.0.0.1:#{i}" }.join(";\n") };
19
19
  }
20
20
  ~
21
21
  }
data/spec/main.rb CHANGED
@@ -28,7 +28,9 @@ end
28
28
  def reset_file
29
29
  chdir {
30
30
  file = "upstreams.conf"
31
+ nginx = "nginx.conf"
31
32
  Exit_Zero "rm #{file}" if File.exists?(file)
33
+ Exit_Zero "rm #{nginx}" if File.exists?(nginx)
32
34
  }
33
35
  end
34
36
 
data/spec/tests/create.rb CHANGED
@@ -10,6 +10,43 @@ describe "Thin_Upstreams" do
10
10
  }
11
11
  end
12
12
 
13
+ unless `which nginx`.strip.empty?
14
+ it "creates upstreams.conf file that validates when included in NGIX conf." do
15
+ chdir {
16
+ Thin_Upstreams()
17
+ path = File.expand_path("upstreams.conf")
18
+ nginx = File.expand_path("nginx.conf")
19
+ File.write "nginx.conf", %!
20
+ user www-data;
21
+ worker_processes 4;
22
+ pid /var/run/nginx.pid;
23
+
24
+ events {
25
+ worker_connections 768;
26
+ # multi_accept on;
27
+ }
28
+
29
+ http {
30
+ error_log #{File.dirname(path) + "/error.log"};
31
+ sendfile on;
32
+ tcp_nopush on;
33
+ tcp_nodelay on;
34
+ keepalive_timeout 65;
35
+ types_hash_max_size 2048;
36
+ include #{path};
37
+ server {
38
+ location / {
39
+ proxy_pass http://Hi;
40
+ }
41
+ }
42
+ }
43
+ !
44
+ `nginx -t -c #{nginx} 2>&1`
45
+ .should.match %r!the configuration file /tmp/Thin_Upstreams/nginx.conf syntax is ok!
46
+ }
47
+ end
48
+ end
49
+
13
50
  it "generates content based on: */config/thin.yml" do
14
51
  target = "upstream Hi"
15
52
  chdir {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Thin_Upstreams
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -129,7 +129,7 @@ files:
129
129
  - spec/main.rb
130
130
  - spec/tests/bin.rb
131
131
  - spec/tests/create.rb
132
- homepage: ''
132
+ homepage: https://github.com/da99/Thin_Upstreams
133
133
  licenses: []
134
134
  post_install_message:
135
135
  rdoc_options: []