daddy 0.3.19 → 0.3.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/daddy/version.rb +1 -1
- data/lib/tasks/nginx.rake +9 -5
- data/lib/tasks/{nginx.app.conf.erb → nginx/app.conf.erb} +5 -5
- data/lib/tasks/task_helper.rb +17 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5e8dd983e1179051e585b3ac7ed0ea38d70fff4
|
4
|
+
data.tar.gz: 5649a648bee817b0efaa3e95a31c04871e8f47c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de63a0e8518b99343af0a7e98615e815c5af4d5e42df8b4c04da1e71da2510434507e6903fb44a8b74ab9c45bd06702054844786caead7c20c770f2e0a3250d8
|
7
|
+
data.tar.gz: 78881695c5e0838d904084364567dc684890130677d46e605a7daf5a8d02a8e093091868c9dae03efbb5dcf5725b86eb193558832f08bf185b6501db3236fb3a
|
data/lib/daddy/version.rb
CHANGED
data/lib/tasks/nginx.rake
CHANGED
@@ -6,8 +6,8 @@ namespace :dad do
|
|
6
6
|
desc 'Nginxをインストールします。'
|
7
7
|
task :install => :environment do
|
8
8
|
repo = File.join(File.dirname(__FILE__), 'nginx', 'nginx.repo')
|
9
|
-
|
10
|
-
|
9
|
+
run "sudo cp -f #{repo} /etc/yum.repos.d/",
|
10
|
+
"sudo yum install nginx"
|
11
11
|
|
12
12
|
default_config_files = [
|
13
13
|
'/etc/nginx/conf.d/default.conf',
|
@@ -31,9 +31,13 @@ namespace :dad do
|
|
31
31
|
|
32
32
|
desc 'Nginxにアプリケーションの設定ファイルをインストールします。'
|
33
33
|
task :config => :environment do
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
conf = File.join('tmp', 'nginx', "#{app_name}.conf")
|
35
|
+
render File.join(File.dirname(__FILE__), 'nginx', 'app.conf.erb'), :to => conf
|
36
|
+
|
37
|
+
unless dry_run?
|
38
|
+
run "sudo mkdir -p /etc/nginx/conf.d/servers",
|
39
|
+
"sudo cp -f #{conf} /etc/nginx/conf.d/servers/"
|
40
|
+
end
|
37
41
|
end
|
38
42
|
|
39
43
|
end
|
@@ -1,22 +1,22 @@
|
|
1
|
-
upstream <%=
|
2
|
-
server unix:/tmp/<%=
|
1
|
+
upstream <%= app_name %> {
|
2
|
+
server unix:/tmp/<%= app_name %>.sock;
|
3
3
|
}
|
4
4
|
|
5
5
|
server {
|
6
6
|
listen 80;
|
7
7
|
server_name localhost;
|
8
8
|
|
9
|
-
root <%=
|
9
|
+
root <%= rails_root %>/public;
|
10
10
|
try_files $uri/index.html $uri @app;
|
11
11
|
|
12
12
|
location @app {
|
13
|
-
proxy_pass http://<%=
|
13
|
+
proxy_pass http://<%= app_name %>;
|
14
14
|
proxy_set_header Host $http_host;
|
15
15
|
proxy_set_header X-Real-IP $remote_addr;
|
16
16
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
17
17
|
}
|
18
18
|
|
19
|
-
<% if
|
19
|
+
<% if rails_env == 'production' %>
|
20
20
|
location ~ ^/(assets)/ {
|
21
21
|
gzip_vary on;
|
22
22
|
gzip_static on;
|
data/lib/tasks/task_helper.rb
CHANGED
@@ -18,13 +18,27 @@ def self.template_dir
|
|
18
18
|
File.join(File.dirname(File.dirname(File.dirname(__FILE__))), 'templates')
|
19
19
|
end
|
20
20
|
|
21
|
+
def self.dry_run?
|
22
|
+
%w{ DRY_RUN DR }.each do |key|
|
23
|
+
return true if %w{ true t yes y 1 }.include?(ENV[key].to_s.downcase)
|
24
|
+
end
|
25
|
+
|
26
|
+
false
|
27
|
+
end
|
28
|
+
|
21
29
|
def self.task_file(*path)
|
22
30
|
File.join(File.dirname(__FILE__), *path)
|
23
31
|
end
|
24
32
|
|
25
33
|
def self.render(template, options = {})
|
26
|
-
|
27
|
-
|
34
|
+
text = ERB.new(File.read(template), 0, '-').result
|
35
|
+
|
36
|
+
if options[:to]
|
37
|
+
FileUtils.mkdir_p(File.dirname(options[:to]))
|
38
|
+
File.write(options[:to], text)
|
39
|
+
end
|
40
|
+
|
41
|
+
text
|
28
42
|
end
|
29
43
|
|
30
44
|
def self.ask(prompt, options = {})
|
@@ -61,4 +75,4 @@ def self.run(*commands)
|
|
61
75
|
puts c
|
62
76
|
fail unless system(c)
|
63
77
|
end
|
64
|
-
end
|
78
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: daddy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ichy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -346,8 +346,8 @@ files:
|
|
346
346
|
- lib/tasks/kibana/configure.sh
|
347
347
|
- lib/tasks/kibana/install.sh
|
348
348
|
- lib/tasks/kibana/nginx.conf.erb
|
349
|
-
- lib/tasks/nginx.app.conf.erb
|
350
349
|
- lib/tasks/nginx.rake
|
350
|
+
- lib/tasks/nginx/app.conf.erb
|
351
351
|
- lib/tasks/nginx/nginx.conf.erb
|
352
352
|
- lib/tasks/nginx/nginx.repo
|
353
353
|
- lib/tasks/phantomjs.rake
|