magic_recipes_two 0.0.77 → 0.0.78

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OWExNzJkMGUwNTBlODUyNDRjMzQ5NDRjYTBmYTg3Yzg2NWU1MGU2YQ==
4
+ YzI3NmM5NDQxMzY5ZGU3NGM2MzcyOTczZjZiNmMwZDYyZDhiNDNiMA==
5
5
  data.tar.gz: !binary |-
6
- MDBlMjQyOTJkOTJmMmYyOTIyMzg0NTkzNDk4YmM1YWIwOGUxZWZhZQ==
6
+ NWJkMWU3ZjMzZDkxNGIyZmI2MjEzMmM4ODIyMmZjYzhjZDJkOWM5OA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NzA0Nzc5YmYxNmMzMGM3ODE2ZDJlYTZhOWM4NmY1NTFhYzBhZjIxNGM1YmQ2
10
- ZWY0MzdmNGFhZmYxM2YxOGM5NTRlM2NmYzk2YjZjMDA3MWY3OGY5OTA0NDA1
11
- MmJjYTM5MGExZmNiMzUwMjFiMzc1MzU2NWI5NzcwY2I3ZjljNGU=
9
+ ZDdmNGMxOTM2YzMwZGEzNWI3MzUwN2M1ZTkxMjcwNWQwOThmMGY1ZTlmOTRj
10
+ YTM3ZjQ1M2IzNzkxMTA1Y2JmM2UzNzBjNmNjZDQwNWUwZTU3ZGY2NDJiYjc3
11
+ ZmQ3ZGI3YmExZDUyNzA0OTEwYWMxNjg2NzYwMzBiODQ0Nzk3MTE=
12
12
  data.tar.gz: !binary |-
13
- NzA3NDcyNDI5ZmE4YjAzMzc0OTVmYjc5OTBlNmE1MjRkYzFkOGNkMzM5ZmU0
14
- YmU5NzI2ZmVhZDY0ZjAzYzk1YmExMzBjYjk4MDE3MmVmMzI1NjAyY2U2MDhl
15
- YjNhMGZkYzZlZmM4ZTA3YjkzYTJmYjdiMTFjN2QzNjE3MjZkYzU=
13
+ ZDAzOGU5Y2VhM2FiNzE1OWI2ZThjNzUyY2NhYWVmYzkwZTY4YTVmYzJkZDM5
14
+ NDNkNTA4ODcyZjUwM2RiZGE4OTI4MDA2YjFiZDgzYjIwM2FjZGJjNmUzNzhi
15
+ NzQ3MTVkYjJiY2Q5ODhjY2JiNzc5NzlmNjFlNWVjYmMyMGMxODk=
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module MagicRecipes
3
- VERSION = "0.0.77"
3
+ VERSION = "0.0.78"
4
4
  end
5
5
  end
@@ -7,6 +7,7 @@ namespace :load do
7
7
  set :nginx_domains, -> { [] }
8
8
  set :nginx_major_domain, -> { false }
9
9
  set :nginx_domain_wildcard, -> { false }
10
+ set :nginx_redirect_subdomains, -> { false }
10
11
  set :nginx_remove_www, -> { true }
11
12
  set :default_site, -> { false }
12
13
  set :app_instances, -> { 1 }
@@ -162,6 +163,21 @@ namespace :nginx do
162
163
  fetch(:nginx_major_domain, false) ? clear_domain( fetch(:nginx_major_domain) ) : false
163
164
  end
164
165
 
166
+ def nginx_all_domains_with_www
167
+ domains = []
168
+ nginx_domains.each do |domain|
169
+ domains << domain
170
+ domains << "www.#{domain}" unless domain =~ /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/
171
+ domains << ".#{domain}" if fetch(:nginx_domain_wildcard, false)
172
+ end
173
+ if nginx_major_domain
174
+ domains << nginx_major_domain
175
+ domains << "www.#{nginx_major_domain}" unless nginx_major_domain =~ /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/
176
+ domains << ".#{nginx_major_domain}" if fetch(:nginx_domain_wildcard, false)
177
+ end
178
+ domains
179
+ end
180
+
165
181
 
166
182
  desc 'Creates the site configuration and upload it to the available folder'
167
183
  task :add => ['nginx:load_vars'] do
@@ -17,23 +17,27 @@ upstream thin_<%= fetch(:application) %>_<%= fetch(:stage) %>_cluster {
17
17
  <% if fetch(:nginx_major_domain) %>
18
18
  server {
19
19
  listen 80<%= ' default_server' if fetch(:default_site) %>;
20
- server_name <%= nginx_domains_with_www.join(joiner) %>
21
- <%= nginx_major_domain %>;
20
+ server_name <%= nginx_all_domains_with_www.join(joiner) %>;
22
21
  return 301 https://<%= nginx_major_domain %>$request_uri;
23
22
 
24
23
  }
24
+ <% if fetch(:nginx_redirect_subdomains, false) %>
25
+ # server with subdomain
25
26
  server {
26
27
  listen 80;
27
28
  server_name <%= nginx_domains.map{ |d| subdomain_regex(d) }.join(joiner) %>
28
29
  <%= subdomain_regex( nginx_major_domain ) %>;
29
30
  return 301 https://$sub.<%= nginx_major_domain %>$request_uri;
30
31
  }
32
+ <% end %>
31
33
  <% else %>
32
34
  server {
33
35
  listen 80;
34
- server_name <%= nginx_domains_with_www.join(joiner) %>;
36
+ server_name <%= nginx_all_domains_with_www.join(joiner) %>;
35
37
  return 301 https://$host$request_uri;
36
38
  }
39
+ <% if fetch(:nginx_redirect_subdomains, false) %>
40
+ # server with subdomain
37
41
  server {
38
42
  listen 80;
39
43
  server_name <%= nginx_domains.map{ |d| subdomain_regex(d) }.join(joiner) %>
@@ -41,6 +45,7 @@ server {
41
45
  }
42
46
  <% end %>
43
47
  <% end %>
48
+ <% end %>
44
49
 
45
50
  <% if fetch(:nginx_major_domain) %>
46
51
  <% if fetch(:nginx_use_ssl) %>
@@ -55,6 +60,7 @@ server {
55
60
 
56
61
  return 301 https://<%= nginx_major_domain %>$request_uri;
57
62
  }
63
+ <% if fetch(:nginx_redirect_subdomains, false) %>
58
64
  # ssl-with-subdomain
59
65
  server {
60
66
  listen 443;
@@ -66,12 +72,14 @@ server {
66
72
 
67
73
  return 301 https://$sub.<%= nginx_major_domain %>$request_uri;
68
74
  }
75
+ <% end %>
69
76
  <% else %>
70
77
  server {
71
78
  listen 80;
72
79
  server_name <%= nginx_domains_with_www.join(joiner) %>;
73
80
  return 301 http://<%= nginx_major_domain %>$request_uri;
74
81
  }
82
+ <% if fetch(:nginx_redirect_subdomains, false) %>
75
83
  server {
76
84
  listen 80;
77
85
  server_name <%= nginx_domains.map{ |d| subdomain_regex(d) }.join(joiner) %>;
@@ -79,6 +87,7 @@ server {
79
87
  }
80
88
  <% end %>
81
89
  <% end %>
90
+ <% end %>
82
91
 
83
92
 
84
93
  server {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: magic_recipes_two
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.77
4
+ version: 0.0.78
5
5
  platform: ruby
6
6
  authors:
7
7
  - Torsten Wetzel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-14 00:00:00.000000000 Z
11
+ date: 2018-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails