daddy 0.3.9 → 0.3.10

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: c9720014cfa7dd5f332770849e960b090002987e
4
- data.tar.gz: d4f6b781df48ee2156ea315ffb4b2d52ee01bf49
3
+ metadata.gz: 3000f6047db32d408b37cbbcceba7f157dab54a9
4
+ data.tar.gz: 2a403a22449f213ab1f72a54f2b105602b514f46
5
5
  SHA512:
6
- metadata.gz: 9ddfc1920cc0fb746e7b170558791ea652ab16f8147eeced3e0e6b0900658d9da7322072d8e83f86f7b2db508551d28f372523826e669c0be3d09c68345b160b
7
- data.tar.gz: 9ab329a43406bd785e3baff0a289fc504c718490c4c2b9716a72b55ca1a5037cabea18212a1006829fd7b9eaa6f251ce53f3598e620223558e9bef7e9be4930d
6
+ metadata.gz: 1f73867d54a606a381f352935aa371079e9dbe7b870a1ab35a6c727efee404a2064a2243255a176817802a9bcbb146dfbf0da5b6fd2ec457b442889457997310
7
+ data.tar.gz: 597222cfd692849485089f21de2af0cd025b5e1ce8a089863169c0dc30f02ca7db9b124ebbd04cc1543ddd7dc3f1669f2e80973ec8611f8fe538834c3a24e9c6
data/bin/dad CHANGED
@@ -7,7 +7,7 @@ DADDY_HOME = File.dirname(File.dirname(__FILE__))
7
7
  action = ARGV[0]
8
8
 
9
9
  if action == 'new'
10
- RAILS_VERSION = '4.0.9'
10
+ RAILS_VERSION = '4.0.10'
11
11
  puts "using rails #{RAILS_VERSION}"
12
12
 
13
13
  APP_NAME = ARGV[1]
@@ -1,3 +1,3 @@
1
1
  module Daddy
2
- VERSION = '0.3.9'.freeze
2
+ VERSION = '0.3.10'.freeze
3
3
  end
@@ -1,12 +1,15 @@
1
1
  require 'rake'
2
2
 
3
+ dependencies = ['environment', 'db:test:prepare']
3
4
  unless defined?(Rails)
4
- task :environment do; end
5
+ dependencies.each do |t|
6
+ task t do; end
7
+ end
5
8
  end
6
9
 
7
10
  namespace :dad do
8
11
 
9
- task :cucumber => ['environment', 'db:test:prepare'] do |t, args|
12
+ task :cucumber => dependencies do |t, args|
10
13
  format = ENV['FORMAT'] || 'Daddy::Formatter::Html'
11
14
 
12
15
  options = [
@@ -28,9 +31,6 @@ namespace :dad do
28
31
  output = "features/reports/index.html"
29
32
  output = "test/reports" if format == 'junit'
30
33
 
31
- command = "bundle exec cucumber --guess --quiet --no-multiline -r features --format pretty --format #{format} --out #{output} #{features.join(' ')} #{options}"
32
- puts command
33
- ret = system(command)
34
- fail unless ret
34
+ run "bundle exec cucumber --guess --quiet --no-multiline -r features --format pretty --format #{format} --out #{output} #{features.join(' ')} #{options}"
35
35
  end
36
36
  end
@@ -1,49 +1,49 @@
1
- require 'rake'
1
+ require_relative 'task_helper'
2
2
 
3
3
  namespace :dad do
4
4
  namespace :jenkins do
5
5
 
6
6
  desc 'Jenkinsをインストールします。'
7
7
  task :install do
8
- commands = [
9
- "sudo yum install httpd-devel libxslt-devel libxml2-devel java-1.7.0-openjdk qt-webkit-devel Xvfb firefox",
10
- "sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo",
11
- "sudo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key",
12
- "sudo yum install jenkins",
13
- "sudo cp -f #{File.dirname(__FILE__)}/jenkins.conf /etc/httpd/conf.d",
14
- "sudo cp -f #{File.dirname(__FILE__)}/jenkins /etc/sysconfig",
15
- "sudo chown root:root /etc/sysconfig/jenkins",
16
- "sudo chmod 600 /etc/sysconfig/jenkins",
17
- "sudo mkdir -p /var/lib/jenkins/plugins",
18
- "sudo chown jenkins:jenkins /var/lib/jenkins/plugins",
19
- ]
20
- commands.each do |command|
21
- puts command
22
- system(command)
23
- end
8
+ FileUtils.mkdir_p 'tmp'
9
+
10
+ script = File.join(File.dirname(__FILE__), 'jenkins', 'install.sh')
11
+ run "bash -ex #{script}"
24
12
 
25
13
  plugins = [
26
- {:name => 'build-pipeline-plugin', :version => '1.3.5'},
27
- {:name => 'git', :version => '1.4.0'},
28
- {:name => 'rake', :version => '1.7.7'},
29
- {:name => 'rubyMetrics', :version => '1.5.0'},
30
- {:name => 'htmlpublisher', :version => '1.2'},
14
+ {:name => 'build-pipeline-plugin', :version => '1.4.3'},
15
+ {:name => 'git', :version => '2.2.5'},
16
+ {:name => 'git-client', :version => '1.10.2'},
17
+ {:name => 'rake', :version => '1.8.0'},
18
+ {:name => 'rubyMetrics', :version => '1.6.2'},
19
+ {:name => 'htmlpublisher', :version => '1.3'},
20
+ {:name => 'reverse-proxy-auth-plugin', :version => '1.4.0'},
21
+ {:name => 'thinBackup', :version => '1.7.4'}
31
22
  ]
32
23
  plugins.each do |p|
33
- download_path = "tmp/#{p[:name]}.hpi"
34
-
24
+ download_path = "tmp/#{p[:name]}-#{p[:version]}.hpi"
35
25
  unless File.exist?(download_path)
36
- command = "sudo wget http://updates.jenkins-ci.org/download/plugins/#{p[:name]}/#{p[:version]}/#{p[:name]}.hpi -O #{download_path}"
37
- puts command
38
- system(command)
26
+ run "sudo wget http://updates.jenkins-ci.org/download/plugins/#{p[:name]}/#{p[:version]}/#{p[:name]}.hpi -O #{download_path}"
39
27
  end
40
28
 
41
- command = "sudo cp -f #{download_path} /var/lib/jenkins/plugins/#{p[:name]}.hpi"
42
- puts command
43
- system(command)
29
+ run "sudo cp -f #{download_path} /var/lib/jenkins/plugins/#{p[:name]}.hpi"
44
30
  end
45
31
  end
46
32
 
47
- end
33
+ namespace :nginx do
34
+ desc 'Nginxの設定を行います。'
35
+ task :config do
36
+ @server_name = ask('server_name', :required => true)
37
+ @ssl_certificate = ask('ssl_certificate')
38
+ @ssl_certificate_key = ask('ssl_certificate_key')
48
39
 
40
+ FileUtils.mkdir_p 'tmp'
41
+ template = File.join(File.dirname(__FILE__), 'jenkins', 'nginx.conf.erb')
42
+ render template, :to => 'tmp/jenkins_nginx.conf'
43
+
44
+ run "sudo cp -f tmp/jenkins_nginx.conf /etc/nginx/conf.d/servers/jenkins.conf"
45
+ end
46
+ end
47
+
48
+ end
49
49
  end
@@ -0,0 +1,13 @@
1
+ #!/bin/bash
2
+
3
+ SCRIPT_BASE=`dirname $0`
4
+
5
+ sudo yum install java-1.7.0-openjdk
6
+ sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
7
+ sudo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
8
+ sudo yum install jenkins
9
+ sudo cp -f ${SCRIPT_BASE}/jenkins /etc/sysconfig/jenkins
10
+ sudo chown root:root /etc/sysconfig/jenkins
11
+ sudo chmod 600 /etc/sysconfig/jenkins
12
+ sudo mkdir -p /var/lib/jenkins/plugins
13
+ sudo chown jenkins:jenkins /var/lib/jenkins/plugins
@@ -43,7 +43,52 @@ JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true"
43
43
  # Port Jenkins is listening on.
44
44
  # Set to -1 to disable
45
45
  #
46
- JENKINS_PORT="8081"
46
+ JENKINS_PORT="8080"
47
+
48
+ ## Type: string
49
+ ## Default: ""
50
+ ## ServiceRestart: jenkins
51
+ #
52
+ # IP address Jenkins listens on for HTTP requests.
53
+ # Default is all interfaces (0.0.0.0).
54
+ #
55
+ JENKINS_LISTEN_ADDRESS=""
56
+
57
+ ## Type: integer(0:65535)
58
+ ## Default: ""
59
+ ## ServiceRestart: jenkins
60
+ #
61
+ # HTTPS port Jenkins is listening on.
62
+ # Default is disabled.
63
+ #
64
+ JENKINS_HTTPS_PORT=""
65
+
66
+ ## Type: string
67
+ ## Default: ""
68
+ ## ServiceRestart: jenkins
69
+ #
70
+ # Path to the keystore in JKS format (as created by the JDK 'keytool').
71
+ # Default is disabled.
72
+ #
73
+ JENKINS_HTTPS_KEYSTORE=""
74
+
75
+ ## Type: string
76
+ ## Default: ""
77
+ ## ServiceRestart: jenkins
78
+ #
79
+ # Password to access the keystore defined in JENKINS_HTTPS_KEYSTORE.
80
+ # Default is disabled.
81
+ #
82
+ JENKINS_HTTPS_KEYSTORE_PASSWORD=""
83
+
84
+ ## Type: string
85
+ ## Default: ""
86
+ ## ServiceRestart: jenkins
87
+ #
88
+ # IP address Jenkins listens on for HTTPS requests.
89
+ # Default is disabled.
90
+ #
91
+ JENKINS_HTTPS_LISTEN_ADDRESS=""
47
92
 
48
93
  ## Type: integer(0:65535)
49
94
  ## Default: 8009
@@ -54,6 +99,15 @@ JENKINS_PORT="8081"
54
99
  #
55
100
  JENKINS_AJP_PORT="-1"
56
101
 
102
+ ## Type: string
103
+ ## Default: ""
104
+ ## ServiceRestart: jenkins
105
+ #
106
+ # IP address Jenkins listens on for Ajp13 requests.
107
+ # Default is all interfaces (0.0.0.0).
108
+ #
109
+ JENKINS_AJP_LISTEN_ADDRESS=""
110
+
57
111
  ## Type: integer(1:9)
58
112
  ## Default: 5
59
113
  ## ServiceRestart: jenkins
@@ -94,8 +148,6 @@ JENKINS_HANDLER_IDLE="20"
94
148
  # Pass arbitrary arguments to Jenkins.
95
149
  # Full option list: java -jar jenkins.war --help
96
150
  #
97
- JENKINS_ARGS="--prefix=/jenkins"
151
+ JENKINS_ARGS=""
98
152
 
99
153
  export PATH="${PATH}":/usr/local/bin
100
- export PATH=/opt/rh/qt48/root/usr/bin${PATH:+:${PATH}}
101
- export LD_LIBRARY_PATH=/opt/rh/qt48/root/usr/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
@@ -0,0 +1,27 @@
1
+ upstream jenkins {
2
+ server localhost:8080;
3
+ }
4
+
5
+ server {
6
+ listen 80;
7
+ listen 443 ssl;
8
+ server_name <%= @server_name %>;
9
+ #access_log /var/log/nginx/jenkins_access.log ltsv;
10
+ <% if @ssl_certificate and @ssl_certificate_key -%>
11
+ ssl_certificate <%= @ssl_certificate %>;
12
+ ssl_certificate_key <%= @ssl_certificate_key %>;
13
+ <% end -%>
14
+ root /var/cache/jenkins/war;
15
+
16
+ location / {
17
+ #auth_basic "Jenkins";
18
+ #auth_basic_user_file conf.d/.htpasswd;
19
+ proxy_pass http://jenkins;
20
+ proxy_redirect http:// https://;
21
+ proxy_set_header Host $http_host;
22
+ proxy_set_header X-Forwarded-Proto https;
23
+ proxy_set_header X-Real-IP $remote_addr;
24
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
25
+ proxy_set_header X-Forwarded-User $remote_user;
26
+ }
27
+ }
@@ -1,6 +1,3 @@
1
- # coding: UTF-8
2
-
3
- require 'rake'
4
1
  require_relative 'task_helper'
5
2
 
6
3
  namespace :dad do
@@ -8,27 +5,24 @@ namespace :dad do
8
5
 
9
6
  desc 'Nginxをインストールします。'
10
7
  task :install => :environment do
11
- repo = File.dirname(__FILE__) + '/nginx.repo'
8
+ repo = File.join(File.dirname(__FILE__), 'nginx', 'nginx.repo')
12
9
  fail unless system("sudo cp -f #{repo} /etc/yum.repos.d/")
13
-
14
- ret = system("sudo yum install nginx")
15
- fail unless ret
10
+ fail unless system("sudo yum install nginx")
16
11
 
17
- if File.exist?('/etc/nginx/conf.d/default.conf')
18
- system("sudo mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.org")
19
- end
20
- if File.exist?('/etc/nginx/conf.d/example_ssl.conf')
21
- system("sudo mv /etc/nginx/conf.d/example_ssl.conf /etc/nginx/conf.d/example_ssl.conf.org")
12
+ default_config_files = [
13
+ '/etc/nginx/conf.d/default.conf',
14
+ '/etc/nginx/conf.d/example_ssl.conf'
15
+ ]
16
+ default_config_files.each do |conf|
17
+ run "sudo mv #{conf} #{conf}.org" if File.exist?(conf)
22
18
  end
23
19
 
24
- rails_root = ENV['RAILS_ROOT'] || Rails.root
25
- jenkins = ENV['JENKINS'] || false
26
- publish = ENV['PUBLISH'] || false
27
-
28
- fail unless system("RAILS_ROOT=#{rails_root} RAILS_ENV=#{Rails.env} erb -T - #{File.dirname(__FILE__)}/nginx.conf.erb > tmp/nginx.conf")
20
+ template = File.join(File.dirname(__FILE__), 'nginx', 'nginx.conf.erb')
21
+ render template, :to => 'tmp/nginx.conf'
22
+ run "sudo cp -f tmp/nginx.conf /etc/nginx/conf.d/nginx.conf"
23
+ run "sudo mkdir -p /etc/nginx/conf.d/servers"
29
24
 
30
- system("sudo cp -f tmp/nginx.conf /etc/nginx/conf.d/nginx.conf")
31
-
25
+ publish = ENV['PUBLISH'] || false
32
26
  if publish
33
27
  system("sudo mkdir -p /var/lib/daddy")
34
28
  system("sudo chown -R #{ENV['USER']}:#{ENV['USER']} /var/lib/daddy")
@@ -42,12 +36,5 @@ namespace :dad do
42
36
  system("sudo cp -f tmp/nginx.#{app_name}.conf /etc/nginx/conf.d/servers/#{app_name}.conf")
43
37
  end
44
38
 
45
- desc 'NginxにJenkinsの設定ファイルをインストールします。'
46
- task :jenkins => :environment do
47
- fail unless system("erb -T - #{File.dirname(__FILE__)}/nginx.jenkins.conf.erb > tmp/nginx.jenkins.conf")
48
- system("sudo mkdir -p /etc/nginx/conf.d/servers")
49
- system("sudo cp -f tmp/nginx.jenkins.conf /etc/nginx/conf.d/servers/jenkins.conf")
50
- end
51
-
52
39
  end
53
40
  end
@@ -0,0 +1,5 @@
1
+ [nginx]
2
+ name=nginx repo
3
+ baseurl=http://nginx.org/packages/centos/6/$basearch/
4
+ gpgcheck=0
5
+ enabled=1
@@ -1,5 +1,3 @@
1
- # coding: UTF-8
2
-
3
1
  require 'rake'
4
2
 
5
3
  namespace :dad do
@@ -1,3 +1,4 @@
1
+ require 'rake'
1
2
  require 'erb'
2
3
  require 'yaml'
3
4
 
@@ -19,4 +20,40 @@ end
19
20
 
20
21
  def self.render(template, options = {})
21
22
  File.write(options[:to], ERB.new(File.read(template), 0, '-').result)
23
+ end
24
+
25
+ def self.ask(prompt, options = {})
26
+ if options[:default]
27
+ print prompt + "[#{options[:default]}]: "
28
+ else
29
+ print prompt + ": "
30
+ end
31
+
32
+ if options[:password]
33
+ system("stty -echo")
34
+ at_exit do
35
+ system("stty echo")
36
+ end
37
+ end
38
+
39
+ answer = STDIN.gets.strip
40
+ answer = options[:default] if answer.blank?
41
+
42
+ if options[:password]
43
+ system("stty echo")
44
+ puts
45
+ end
46
+
47
+ if options[:required] and answer.blank?
48
+ raise "必須です。処理を中止します。"
49
+ end
50
+
51
+ answer.blank? ? nil : answer
52
+ end
53
+
54
+ def self.run(*commands)
55
+ commands.each do |c|
56
+ puts c
57
+ fail unless system(c)
58
+ end
22
59
  end
@@ -1,6 +1,4 @@
1
- # coding: UTF-8
2
-
3
- require 'rake'
1
+ require_relative 'task_helper'
4
2
 
5
3
  namespace :dad do
6
4
 
@@ -17,8 +15,6 @@ namespace :dad do
17
15
  args << arg
18
16
  end
19
17
 
20
- command = "bundle exec rake dad:cucumber #{args.join(' ')}"
21
- puts command
22
- fail unless system(command)
18
+ run "bundle exec rake dad:cucumber #{args.join(' ')}"
23
19
  end
24
20
  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.9
4
+ version: 0.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - ichy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-13 00:00:00.000000000 Z
11
+ date: 2014-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -336,17 +336,17 @@ files:
336
336
  - lib/tasks/god/install.sh
337
337
  - lib/tasks/god/logrotate
338
338
  - lib/tasks/god/master.conf
339
- - lib/tasks/jenkins
340
- - lib/tasks/jenkins.conf
341
339
  - lib/tasks/jenkins.rake
340
+ - lib/tasks/jenkins/install.sh
341
+ - lib/tasks/jenkins/jenkins
342
+ - lib/tasks/jenkins/nginx.conf.erb
342
343
  - lib/tasks/kibana.rake
343
344
  - lib/tasks/kibana/config.js
344
345
  - lib/tasks/kibana/install.sh
345
346
  - lib/tasks/nginx.app.conf.erb
346
- - lib/tasks/nginx.conf.erb
347
- - lib/tasks/nginx.jenkins.conf.erb
348
347
  - lib/tasks/nginx.rake
349
- - lib/tasks/nginx.repo
348
+ - lib/tasks/nginx/nginx.conf.erb
349
+ - lib/tasks/nginx/nginx.repo
350
350
  - lib/tasks/phantomjs.rake
351
351
  - lib/tasks/publish.rake
352
352
  - lib/tasks/redis.rake
@@ -390,8 +390,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
390
390
  version: '0'
391
391
  requirements: []
392
392
  rubyforge_project:
393
- rubygems_version: 2.2.2
393
+ rubygems_version: 2.4.1
394
394
  signing_key:
395
395
  specification_version: 4
396
396
  summary: My rails dad
397
397
  test_files: []
398
+ has_rdoc:
@@ -1,3 +0,0 @@
1
- ProxyPass /jenkins http://localhost:8081/jenkins
2
- ProxyPassReverse /jenkins http://localhost:8081/jenkins
3
- ProxyRequests Off
@@ -1,12 +0,0 @@
1
- server {
2
- listen 80;
3
- server_name localhost;
4
-
5
- location /jenkins/ {
6
- root /var/cache/jenkins/war;
7
- proxy_pass http://localhost:8081/jenkins/;
8
- proxy_set_header Host $http_host;
9
- proxy_set_header X-Real-IP $remote_addr;
10
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
11
- }
12
- }
@@ -1,5 +0,0 @@
1
- [nginx]
2
- name=nginx repo
3
- baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
4
- gpgcheck=0
5
- enabled=1