daddy 0.1.9 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YTU1N2FjNjMwNzYxNjU4N2VmOTg5YjhmYWI2ZmZlNDlhNzgxNTM1MA==
5
+ data.tar.gz: !binary |-
6
+ ODg0ZTRmMjM3MjlmZWRkMjQ2MTgxZGQzODZiZDBkMTRmNTRlN2NhNw==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ ZjA2YWRlOWM4MmIzMTFhZWNmNDE1ZjBiOTlhNmFmNDRjNDhiMjkyNjA5M2Yy
10
+ NTE4MGEwMzJiMWU5ZDY1MmE0NzA2NGQyOTY3OTg3M2JlZjg2M2YzN2YxYjI0
11
+ YjUwNmM5ZTEyZWMxMjU2ZjNiZmY4N2ViYmY2NjViYzg5NTQxYTU=
12
+ data.tar.gz: !binary |-
13
+ NGZlZDcyZTM0Y2MwODNkMGUwNmU0OTlhNzBjOWM1MzFmNzhjMjM0NDgyOTE3
14
+ ODA1ZjgxNDg1NmQ5N2ViOTRhMWEwMmQzMGVhMTUzNTA5MzBkMWEwMjkzOTU4
15
+ ZDhhOTNkZmYzN2IwNWU1MzZlMDg2Mzg2OTI5N2MwZmE3Y2QxZWM=
@@ -1,7 +1,14 @@
1
1
  # coding: UTF-8
2
2
 
3
- module Daddy
4
- require "daddy/railtie" if defined?(Rails)
3
+ if defined?(Rails)
4
+ require "daddy/railtie"
5
+ else
6
+ Dir[File.join(File.dirname(__FILE__), 'tasks', '*.rake')].each do |f|
7
+ load f
8
+ end
5
9
  end
6
10
 
7
- require 'sql_builder'
11
+ require 'sql_builder'
12
+
13
+ module Daddy
14
+ end
@@ -1,19 +1,23 @@
1
1
  # coding: UTF-8
2
2
 
3
- require 'cucumber/rails'
3
+ require 'daddy'
4
+
5
+ if defined?(Rails)
6
+ ActionController::Base.allow_rescue = false
7
+ end
8
+
4
9
  require 'daddy/git'
5
10
  require 'differ'
6
11
 
7
12
  Differ.format = :html
8
13
 
14
+ require 'capybara/cucumber'
9
15
  require 'capybara/webkit' if ENV['DRIVER'] == 'webkit'
10
16
  require 'capybara/poltergeist' if ENV['DRIVER'] == 'poltergeist'
11
17
 
12
18
  Capybara.default_driver = (ENV['DRIVER'] || :selenium).to_sym
13
19
  Capybara.default_selector = :css
14
20
 
15
- ActionController::Base.allow_rescue = false
16
-
17
21
  Dir::glob(File.dirname(__FILE__) + '/cucumber/*.rb').each do |file|
18
22
  require file
19
23
  end
@@ -50,31 +54,7 @@ AfterConfiguration do |configuration|
50
54
  }
51
55
  end
52
56
 
53
- begin
54
- require 'database_cleaner'
55
- require 'database_cleaner/cucumber'
56
-
57
- DatabaseCleaner.strategy = :truncation
58
- rescue NameError
59
- raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
60
- end
61
-
62
- Before do
63
- DatabaseCleaner.start
64
-
65
- ActiveRecord::Fixtures.reset_cache
66
- fixtures_folder = File.join(Rails.root, 'test', 'fixtures')
67
- fixtures = Dir[File.join(fixtures_folder, '*.yml')].map {|f| File.basename(f, '.yml') }
68
- ActiveRecord::Fixtures.create_fixtures(fixtures_folder, fixtures)
69
- if defined? RailsCsvFixtures
70
- fixtures = Dir[File.join(fixtures_folder, '*.csv')].map {|f| File.basename(f, '.csv') }
71
- ActiveRecord::Fixtures.create_fixtures(fixtures_folder, fixtures)
72
- end
73
- end
74
-
75
- After do |scenario|
76
- DatabaseCleaner.clean
77
- end
57
+ require_relative 'rails/hooks' if defined?(Rails)
78
58
 
79
59
  Before do
80
60
  resize_window(1280, 720)
@@ -22,7 +22,7 @@ module Daddy
22
22
  def assert_visit(path, params = {})
23
23
  query_string = ''
24
24
  params.each do |key, value|
25
- if query_string.blank?
25
+ if query_string.empty?
26
26
  query_string += '?'
27
27
  else
28
28
  query_string += '&'
@@ -10,7 +10,7 @@ module Daddy
10
10
  git = Daddy::Git.new
11
11
  a = File.read(file).gsub(/[<>]/, '<' => '&lt;', '>' => '&gt;')
12
12
  b = git.show_previous(file, true).gsub(/[<>]/, '<' => '&lt;', '>' => '&gt;')
13
- diff = format_diff(Differ.diff(a, b))
13
+ diff = format_diff(Differ.diff(a, b), options)
14
14
 
15
15
  show_filename(file, options)
16
16
  puts "<pre>#{diff}</pre>"
@@ -38,21 +38,48 @@ module Daddy
38
38
  private
39
39
 
40
40
  def show_filename(filename, options = {})
41
- if options[:as] == 'new'
42
- puts "<span class=\"new\">[新規作成] #{filename}</span>"
43
- elsif options[:as] == 'auto'
44
- puts "<span class=\"auto\">[自動生成] #{filename}</span>"
45
- elsif options[:as] == 'edit'
46
- puts "<span class=\"edit\">[編集] #{filename}</span>"
47
- else
48
- puts filename
41
+ labels = []
42
+ if options[:as].is_a?(String) or options[:as].is_a?(Symbol)
43
+ labels << options[:as]
44
+ elsif options[:as].is_a?(Array)
45
+ labels += options[:as]
49
46
  end
47
+
48
+ html = "<span class=\"#{labels.join(' ')}\">"
49
+ labels.each do |label|
50
+ case label.to_s
51
+ when 'auto'
52
+ html << '[自動生成] '
53
+ when 'new'
54
+ html << '[新規作成] '
55
+ when 'edit'
56
+ html << '[編集] '
57
+ end
58
+ end
59
+
60
+ html << filename
61
+ html << "</span>"
62
+
63
+ puts html
50
64
  end
51
65
 
52
- def format_diff(diff)
66
+ def format_diff(diff, options = {})
53
67
  lines = []
54
68
 
55
69
  diff_lines = diff.to_s.split("\n")
70
+
71
+ if options[:from] and options[:to]
72
+ from = options[:from] - 1
73
+ to = options[:to] - 1
74
+ diff_lines = diff_lines[from..to]
75
+ elsif options[:from]
76
+ from = options[:from] - 1
77
+ diff_lines = diff_lines[from..-1]
78
+ elsif options[:to]
79
+ to = options[:to] - 1
80
+ diff_lines = diff_lines[0..to]
81
+ end
82
+
56
83
  diff_lines.each_with_index do |line, i|
57
84
  if line.index('</del><ins class="differ">')
58
85
  split = line.split('</del><ins class="differ">')
@@ -0,0 +1,15 @@
1
+ # coding: UTF-8
2
+
3
+ module Daddy
4
+ module Cucumber
5
+ module Formatting
6
+
7
+ def pre(string)
8
+ puts "<pre>#{string}</pre>"
9
+ end
10
+
11
+ end
12
+ end
13
+ end
14
+
15
+ World(Daddy::Cucumber::Formatting)
@@ -4,6 +4,10 @@ module Daddy
4
4
  module Formatter
5
5
  module DaddyHtml
6
6
 
7
+ def title
8
+ ENV['TITLE'] || 'Daddy'
9
+ end
10
+
7
11
  def before_menu
8
12
  if ENV['PUBLISH']
9
13
  @builder << "<div>"
@@ -24,7 +28,8 @@ module Daddy
24
28
  end
25
29
 
26
30
  def make_menu_for_publish
27
- menu = Rails.root + '/tmp/menu.html'
31
+ FileUtils.mkdir_p('tmp')
32
+ menu = File.join('tmp', 'menu.html')
28
33
  system("erb -T - #{File.dirname(__FILE__)}/menu.html.erb > #{menu}")
29
34
  File.readlines(menu).join
30
35
  end
@@ -32,7 +37,7 @@ module Daddy
32
37
  def feature_dir(feature, short = false)
33
38
  ret = ''
34
39
 
35
- split = feature.file.split('/')
40
+ split = feature.file.split(File::SEPARATOR)
36
41
  split.reverse[1..-2].each_with_index do |dir, i|
37
42
  break if dir == '仕様書' or dir == '開発日記'
38
43
 
@@ -61,7 +61,7 @@ module Daddy
61
61
  @builder << '<html>'
62
62
  @builder.head do
63
63
  @builder.meta('http-equiv' => 'Content-Type', :content => 'text/html;charset=utf-8')
64
- @builder.title 'Cucumber'
64
+ @builder.title title
65
65
  inline_css
66
66
  inline_js
67
67
  end
@@ -70,7 +70,7 @@ module Daddy
70
70
  @builder << '<div class="cucumber">'
71
71
  @builder.div(:id => 'cucumber-header') do
72
72
  @builder.div(:id => 'label') do
73
- @builder.h1(ENV['TITLE'] || 'Daddy')
73
+ @builder.h1(title)
74
74
  end
75
75
  @builder.div(:id => 'summary') do
76
76
  @builder.p('',:id => 'totals')
@@ -95,7 +95,7 @@ module Daddy
95
95
 
96
96
  def before_feature(feature)
97
97
  dir = feature_dir(feature)
98
- if dir.present?
98
+ unless dir.empty?
99
99
  if @feature_dir != dir
100
100
  @builder << '<div class="feature_dir"><span class="val" onclick="toggle_feature_dir(this);">'
101
101
  @builder << dir
@@ -320,7 +320,7 @@ module Daddy
320
320
  end
321
321
  end
322
322
  step_contents << "</pre></div>"
323
- @builder << step_contents
323
+ @builder << step_contents.force_encoding('UTF-8')
324
324
  end
325
325
 
326
326
  print_messages
@@ -361,7 +361,7 @@ module Daddy
361
361
  def doc_string(string)
362
362
  return if @hide_this_step
363
363
  @builder.pre(:class => 'val') do |pre|
364
- @builder << h(string).gsub("\n", '&#x000A;')
364
+ @builder << string
365
365
  end
366
366
  end
367
367
 
@@ -0,0 +1,25 @@
1
+ begin
2
+ require 'database_cleaner'
3
+ require 'database_cleaner/cucumber'
4
+
5
+ DatabaseCleaner.strategy = :truncation
6
+ rescue NameError
7
+ raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
8
+ end
9
+
10
+ Before do
11
+ DatabaseCleaner.start
12
+
13
+ ActiveRecord::Fixtures.reset_cache
14
+ fixtures_folder = File.join(Rails.root, 'test', 'fixtures')
15
+ fixtures = Dir[File.join(fixtures_folder, '*.yml')].map {|f| File.basename(f, '.yml') }
16
+ ActiveRecord::Fixtures.create_fixtures(fixtures_folder, fixtures)
17
+ if defined? RailsCsvFixtures
18
+ fixtures = Dir[File.join(fixtures_folder, '*.csv')].map {|f| File.basename(f, '.csv') }
19
+ ActiveRecord::Fixtures.create_fixtures(fixtures_folder, fixtures)
20
+ end
21
+ end
22
+
23
+ After do |scenario|
24
+ DatabaseCleaner.clean
25
+ end
@@ -1,9 +1,8 @@
1
1
  # coding: UTF-8
2
2
 
3
- require 'rails'
4
3
  require 'rails_i18n'
5
4
 
6
- if ENV["COVERAGE"]
5
+ if ENV["COVERAGE"].to_s.downcase == 'true'
7
6
  require 'simplecov'
8
7
  require 'simplecov-rcov'
9
8
  SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
@@ -2,6 +2,10 @@
2
2
 
3
3
  require 'rake'
4
4
 
5
+ unless defined?(Rails)
6
+ task :environment do; end
7
+ end
8
+
5
9
  namespace :dad do
6
10
 
7
11
  task :cucumber => :environment do |t, args|
@@ -5,28 +5,30 @@ require 'rake'
5
5
  namespace :dad do
6
6
  namespace :cucumber do
7
7
  task :install do
8
- system("mkdir -p features")
8
+ FileUtils.mkdir_p("features")
9
9
 
10
- system("mkdir -p features/step_definitions")
11
- system("touch features/step_definitions/.gitkeep")
12
- system("mkdir -p features/step_definitions/開発日記")
13
- system("touch features/step_definitions/開発日記/.gitkeep")
14
- system("mkdir -p features/step_definitions/仕様書")
15
- system("touch features/step_definitions/仕様書/.gitkeep")
10
+ FileUtils.mkdir_p("features/step_definitions")
11
+ FileUtils.touch("features/step_definitions/.gitkeep")
12
+ FileUtils.mkdir_p("features/step_definitions/開発日記")
13
+ FileUtils.touch("features/step_definitions/開発日記/.gitkeep")
14
+ FileUtils.mkdir_p("features/step_definitions/仕様書")
15
+ FileUtils.touch("features/step_definitions/仕様書/.gitkeep")
16
16
 
17
- system("mkdir -p features/support")
17
+ FileUtils.mkdir_p("features/support")
18
18
  system("touch features/support/.gitkeep")
19
19
 
20
- system("mkdir -p features/開発日記")
21
- system("touch features/開発日記/.gitkeep")
22
- system("mkdir -p features/仕様書")
23
- system("touch features/仕様書/.gitkeep")
20
+ FileUtils.mkdir_p("features/開発日記")
21
+ FileUtils.touch("features/開発日記/.gitkeep")
22
+ FileUtils.mkdir_p("features/仕様書")
23
+ FileUtils.touch("features/仕様書/.gitkeep")
24
24
 
25
25
  if File.exist?("features/support/env.rb")
26
26
  puts "すでに features/support/env.rb が存在します。上書きはしません。"
27
27
  else
28
- system("echo '# coding: UTF-8' > features/support/env.rb")
29
- system("echo \"require 'daddy/cucumber'\" >> features/support/env.rb")
28
+ File.write "features/support/env.rb", <<-EOF
29
+ # coding: UTF-8
30
+ require 'daddy/cucumber'
31
+ EOF
30
32
  end
31
33
  end
32
34
  end
@@ -3,11 +3,15 @@
3
3
  require 'rake'
4
4
 
5
5
  task :dad do
6
- system('rake -aT | grep dad:')
6
+ `rake -aT`.force_encoding('UTF-8').split("\n").each do |line|
7
+ if /rake dad(:.*)?/ =~ line
8
+ puts line
9
+ end
10
+ end
7
11
  end
8
12
 
9
13
  namespace :dad do
10
14
  task :install do
11
15
  system('rake dad:cucumber:install')
12
16
  end
13
- end
17
+ end
@@ -7,8 +7,7 @@ namespace :dad do
7
7
 
8
8
  desc 'database.yml を生成します。'
9
9
  task :config do
10
- pwd = `pwd`.strip
11
- command = "APP_NAME=#{File.basename(pwd)} erb -T - #{File.dirname(__FILE__)}/database.yml.erb > config/database.yml"
10
+ command = "APP_NAME=#{File.basename(Rails.root)} erb -T - #{File.dirname(__FILE__)}/database.yml.erb > config/database.yml"
12
11
  puts command
13
12
  system("#{command}")
14
13
  end
@@ -9,7 +9,7 @@ namespace :dad do
9
9
  task :create do
10
10
  config = YAML.load_file("#{Rails.root}/config/database.yml")
11
11
 
12
- system("mkdir -p tmp")
12
+ FileUtils.mkdir_p("tmp")
13
13
  system("echo '# mysql ddl' > tmp/create_databases.sql")
14
14
 
15
15
  config.each do |env, props|
@@ -6,7 +6,9 @@ namespace :dad do
6
6
 
7
7
  desc '開発日記を実行します。'
8
8
  task :diary do
9
- system("bundle exec rake dad:cucumber features/開発日記")
9
+ features_path = File.join('features', '開発日記')
10
+ driver = ENV['DRIVER'] || 'poltergeist'
11
+ system("bundle exec rake dad:cucumber DRIVER=#{driver} COVERAGE=false #{features_path}")
10
12
  end
11
13
 
12
14
  namespace :diary do
@@ -16,20 +18,22 @@ namespace :dad do
16
18
 
17
19
  system("rake dad:cucumber:install")
18
20
 
19
- today = Date.today.strftime('%Y-%m-%d')
20
-
21
21
  feature = "features/開発日記/#{today}.feature"
22
22
  unless File.exist?(feature)
23
- system("echo '# language: ja' > #{feature}")
24
- system("echo >> #{feature}")
25
- system("echo '機能:' >> #{feature}")
26
- system("echo >> #{feature}")
23
+ File.write feature, <<-EOF
24
+ # language: ja
25
+
26
+ 機能:
27
+
28
+ EOF
27
29
  end
28
30
 
29
31
  step = "features/step_definitions/開発日記/#{today}.rb"
30
32
  unless File.exist?(step)
31
- system("echo '# coding: UTF-8' > #{step}")
32
- system("echo >> #{step}")
33
+ File.write step, <<-EOF
34
+ # coding: UTF-8
35
+
36
+ EOF
33
37
  end
34
38
  end
35
39
  end
@@ -0,0 +1,25 @@
1
+ upstream <%= ENV['APP_NAME'] %> {
2
+ server unix:/tmp/<%= ENV['APP_NAME'] %>.sock;
3
+ }
4
+
5
+ server {
6
+ listen 80;
7
+ server_name localhost;
8
+
9
+ root <%= ENV['RAILS_ROOT'] %>/public;
10
+ try_files $uri/index.html $uri @app;
11
+
12
+ location @app {
13
+ proxy_pass http://<%= ENV['APP_NAME'] %>;
14
+ }
15
+
16
+ <% if ENV['RAILS_ENV'] == 'production' %>
17
+ location ~ ^/(assets)/ {
18
+ gzip_vary on;
19
+ gzip_static on;
20
+ expires 1y;
21
+ add_header Cache-Control public;
22
+ add_header ETag "";
23
+ }
24
+ <% end -%>
25
+ }
@@ -1,46 +1,7 @@
1
- upstream unicorn {
2
- server unix:/tmp/unicorn.sock;
3
- }
4
-
5
1
  server {
6
2
  listen 80 default_server;
7
3
  server_name _;
8
4
  deny all;
9
5
  }
10
6
 
11
- server {
12
- listen 80;
13
- server_name localhost;
14
-
15
- root <%= ENV['RAILS_ROOT'] %>/public;
16
- try_files $uri/index.html $uri @app;
17
-
18
- location @app {
19
- proxy_pass http://unicorn;
20
- }
21
-
22
- <% if ENV['RAILS_ENV'] == 'production' %>
23
- location ~ ^/(assets)/ {
24
- gzip_vary on;
25
- gzip_static on;
26
- expires 1y;
27
- add_header Cache-Control public;
28
- add_header ETag "";
29
- }
30
- <% end -%>
31
- <% if ENV['JENKINS'].to_s.downcase == 'true' %>
32
- location /jenkins/ {
33
- root /var/cache/jenkins/war;
34
- proxy_pass http://localhost:8081/jenkins/;
35
- proxy_set_header Host $http_host;
36
- proxy_set_header X-Real-IP $remote_addr;
37
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
38
- }
39
- <% end -%>
40
- <% if ENV['PUBLISH'].to_s.downcase == 'true' %>
41
- location /spec/ {
42
- root /var/lib/daddy;
43
- }
44
- <% end -%>
45
-
46
- }
7
+ include conf.d/servers/*.conf;
@@ -0,0 +1,12 @@
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,6 +1,7 @@
1
1
  # coding: UTF-8
2
2
 
3
3
  require 'rake'
4
+ require 'yaml'
4
5
 
5
6
  namespace :dad do
6
7
  namespace :nginx do
@@ -8,8 +9,7 @@ namespace :dad do
8
9
  desc 'Nginxをインストールします。'
9
10
  task :install => :environment do
10
11
  repo = File.dirname(__FILE__) + '/nginx.repo'
11
- ret = system("sudo cp -f #{repo} /etc/yum.repos.d/")
12
- fail unless ret
12
+ fail unless system("sudo cp -f #{repo} /etc/yum.repos.d/")
13
13
 
14
14
  ret = system("sudo yum install nginx")
15
15
  fail unless ret
@@ -25,15 +25,36 @@ namespace :dad do
25
25
  jenkins = ENV['JENKINS'] || false
26
26
  publish = ENV['PUBLISH'] || false
27
27
 
28
- ret = system("RAILS_ROOT=#{rails_root} RAILS_ENV=#{Rails.env} erb -T - #{File.dirname(__FILE__)}/nginx.conf.erb > tmp/nginx.conf")
29
- fail unless ret
28
+ fail unless system("RAILS_ROOT=#{rails_root} RAILS_ENV=#{Rails.env} erb -T - #{File.dirname(__FILE__)}/nginx.conf.erb > tmp/nginx.conf")
29
+
30
30
  system("sudo cp -f tmp/nginx.conf /etc/nginx/conf.d/nginx.conf")
31
31
 
32
+
32
33
  if publish
33
34
  system("sudo mkdir -p /var/lib/daddy")
34
35
  system("sudo chown -R #{ENV['USER']}:#{ENV['USER']} /var/lib/daddy")
35
36
  end
36
- end
37
+ end
38
+
39
+ namespace :app do
40
+ desc 'Nginxにアプリケーションの設定ファイルをインストールします。'
41
+ task :config => :environment do
42
+ rails_root = ENV['RAILS_ROOT'] || Rails.root
43
+ app_name = YAML.load_file("#{rails_root}/config/database.yml")[Rails.env]['database']
44
+ fail unless system("RAILS_ROOT=#{rails_root} RAILS_ENV=#{Rails.env} APP_NAME=#{app_name} erb -T - #{File.dirname(__FILE__)}/nginx.app.conf.erb > tmp/nginx.#{app_name}.conf")
45
+ system("sudo mkdir -p /etc/nginx/conf.d/servers")
46
+ system("sudo cp -f tmp/nginx.#{app_name}.conf /etc/nginx/conf.d/servers/#{app_name}.conf")
47
+ end
48
+ end
49
+
50
+ namespace :jenkins do
51
+ desc 'NginxにJenkinsの設定ファイルをインストールします。'
52
+ task :config => :environment do
53
+ fail unless system("erb -T - #{File.dirname(__FILE__)}/nginx.jenkins.conf.erb > tmp/nginx.jenkins.conf")
54
+ system("sudo mkdir -p /etc/nginx/conf.d/servers")
55
+ system("sudo cp -f tmp/nginx.jenkins.conf /etc/nginx/conf.d/servers/jenkins.conf")
56
+ end
57
+ end
37
58
 
38
59
  end
39
60
  end
@@ -4,9 +4,9 @@ require 'daddy/git'
4
4
 
5
5
  namespace :dad do
6
6
  task :publish do
7
- fail('環境編集 TITLE を指定してください。') unless ENV['TITLE'] and not ENV['TITLE'].blank?
7
+ fail('環境編集 TITLE を指定してください。') unless ENV['TITLE'] and not ENV['TITLE'].empty?
8
8
 
9
- if File.exist?("#{Rails.root}/db/schema.rb")
9
+ if File.exist?("db/schema.rb")
10
10
  fail unless system("bundle exec rake db:schema:load RAILS_ENV=test")
11
11
  end
12
12
 
@@ -37,7 +37,9 @@ namespace :dad do
37
37
  system("mkdir -p #{dir}/#{current_branch}")
38
38
  system("rm -Rf #{dir}/#{current_branch}/*")
39
39
  system("cp -Rf features/reports/* #{dir}/#{current_branch}/")
40
- system("cp -Rf coverage #{dir}/#{current_branch}/")
40
+ if File.exist? 'coverage'
41
+ system("cp -Rf coverage #{dir}/#{current_branch}/")
42
+ end
41
43
  end
42
44
 
43
45
  end
@@ -9,15 +9,22 @@ namespace :dad do
9
9
  task :install => :environment do
10
10
  rails_env = ENV['RAILS_ENV'] || Rails.env
11
11
  rails_root = ENV['RAILS_ROOT'] || Rails.root
12
- ret = system("RAILS_ENV=#{rails_env} RAILS_ROOT=#{rails_root} erb -T - #{File.dirname(__FILE__)}/unicorn.erb > tmp/unicorn")
13
- fail unless ret
12
+ init_script = 'unicorn_' + YAML.load_file("config/database.yml")[Rails.env]['database']
14
13
 
15
- system("sudo cp -f #{File.dirname(__FILE__)}/unicorn.rb config/unicorn.rb")
14
+ commands = [
15
+ "RAILS_ENV=#{rails_env} RAILS_ROOT=#{rails_root} erb -T - #{File.dirname(__FILE__)}/unicorn.erb > tmp/#{init_script}",
16
+ "RAILS_ENV=#{rails_env} RAILS_ROOT=#{rails_root} erb -T - #{File.dirname(__FILE__)}/unicorn.rb.erb > config/unicorn.rb",
16
17
 
17
- system("sudo cp -f tmp/unicorn /etc/init.d/unicorn")
18
- system("sudo chown root:root /etc/init.d/unicorn")
19
- system("sudo chmod 755 /etc/init.d/unicorn")
20
- system("sudo /sbin/chkconfig unicorn on")
18
+ "sudo cp -f tmp/#{init_script} /etc/init.d/#{init_script}",
19
+ "sudo chown root:root /etc/init.d/#{init_script}",
20
+ "sudo chmod 755 /etc/init.d/#{init_script}",
21
+ "sudo /sbin/chkconfig #{init_script} on",
22
+ ]
23
+
24
+ commands.each do |c|
25
+ puts c
26
+ fail unless system(c)
27
+ end
21
28
  end
22
29
 
23
30
  end
@@ -1,11 +1,15 @@
1
1
  # coding: UTF-8
2
2
 
3
+ require 'yaml'
4
+
3
5
  rails_root = "#{File.dirname(File.expand_path(__FILE__))}/.."
6
+ rails_env = ENV['RAILS_ENV'] || 'development'
4
7
 
5
8
  worker_processes 2
6
9
  working_directory rails_root
7
10
 
8
- listen '/tmp/unicorn.sock'
11
+ database = YAML.load_file("#{File.dirname(__FILE__)}/database.yml")[rails_env]['database']
12
+ listen "/tmp/#{database}.sock"
9
13
 
10
14
  stdout_path rails_root + '/log/unicorn.log'
11
15
  stderr_path rails_root + '/log/unicorn.log'
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daddy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
5
- prerelease:
4
+ version: 0.1.11
6
5
  platform: ruby
7
6
  authors:
8
7
  - ichy
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-08-22 00:00:00.000000000 Z
11
+ date: 2013-08-30 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: capybara
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: cucumber
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: cucumber-rails
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ! '>='
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ! '>='
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: ci_reporter
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ! '>='
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ! '>='
76
67
  - !ruby/object:Gem::Version
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: database_cleaner
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ! '>='
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - ! '>='
92
81
  - !ruby/object:Gem::Version
@@ -94,7 +83,6 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: differ
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
87
  - - ! '>='
100
88
  - !ruby/object:Gem::Version
@@ -102,7 +90,6 @@ dependencies:
102
90
  type: :runtime
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
94
  - - ! '>='
108
95
  - !ruby/object:Gem::Version
@@ -110,7 +97,6 @@ dependencies:
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: execjs
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
101
  - - ! '>='
116
102
  - !ruby/object:Gem::Version
@@ -118,7 +104,6 @@ dependencies:
118
104
  type: :runtime
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
108
  - - ! '>='
124
109
  - !ruby/object:Gem::Version
@@ -126,7 +111,6 @@ dependencies:
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: poltergeist
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
115
  - - ! '>='
132
116
  - !ruby/object:Gem::Version
@@ -134,7 +118,6 @@ dependencies:
134
118
  type: :runtime
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
122
  - - ! '>='
140
123
  - !ruby/object:Gem::Version
@@ -142,7 +125,6 @@ dependencies:
142
125
  - !ruby/object:Gem::Dependency
143
126
  name: rails
144
127
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
128
  requirements:
147
129
  - - ~>
148
130
  - !ruby/object:Gem::Version
@@ -150,7 +132,6 @@ dependencies:
150
132
  type: :runtime
151
133
  prerelease: false
152
134
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
135
  requirements:
155
136
  - - ~>
156
137
  - !ruby/object:Gem::Version
@@ -158,7 +139,6 @@ dependencies:
158
139
  - !ruby/object:Gem::Dependency
159
140
  name: rails-i18n
160
141
  requirement: !ruby/object:Gem::Requirement
161
- none: false
162
142
  requirements:
163
143
  - - ! '>='
164
144
  - !ruby/object:Gem::Version
@@ -166,7 +146,6 @@ dependencies:
166
146
  type: :runtime
167
147
  prerelease: false
168
148
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
149
  requirements:
171
150
  - - ! '>='
172
151
  - !ruby/object:Gem::Version
@@ -174,7 +153,6 @@ dependencies:
174
153
  - !ruby/object:Gem::Dependency
175
154
  name: selenium-webdriver
176
155
  requirement: !ruby/object:Gem::Requirement
177
- none: false
178
156
  requirements:
179
157
  - - ! '>='
180
158
  - !ruby/object:Gem::Version
@@ -182,7 +160,6 @@ dependencies:
182
160
  type: :runtime
183
161
  prerelease: false
184
162
  version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
163
  requirements:
187
164
  - - ! '>='
188
165
  - !ruby/object:Gem::Version
@@ -190,7 +167,6 @@ dependencies:
190
167
  - !ruby/object:Gem::Dependency
191
168
  name: simplecov
192
169
  requirement: !ruby/object:Gem::Requirement
193
- none: false
194
170
  requirements:
195
171
  - - ! '>='
196
172
  - !ruby/object:Gem::Version
@@ -198,7 +174,6 @@ dependencies:
198
174
  type: :runtime
199
175
  prerelease: false
200
176
  version_requirements: !ruby/object:Gem::Requirement
201
- none: false
202
177
  requirements:
203
178
  - - ! '>='
204
179
  - !ruby/object:Gem::Version
@@ -206,7 +181,6 @@ dependencies:
206
181
  - !ruby/object:Gem::Dependency
207
182
  name: simplecov-rcov
208
183
  requirement: !ruby/object:Gem::Requirement
209
- none: false
210
184
  requirements:
211
185
  - - ! '>='
212
186
  - !ruby/object:Gem::Version
@@ -214,7 +188,6 @@ dependencies:
214
188
  type: :runtime
215
189
  prerelease: false
216
190
  version_requirements: !ruby/object:Gem::Requirement
217
- none: false
218
191
  requirements:
219
192
  - - ! '>='
220
193
  - !ruby/object:Gem::Version
@@ -222,7 +195,6 @@ dependencies:
222
195
  - !ruby/object:Gem::Dependency
223
196
  name: term-ansicolor
224
197
  requirement: !ruby/object:Gem::Requirement
225
- none: false
226
198
  requirements:
227
199
  - - ! '>='
228
200
  - !ruby/object:Gem::Version
@@ -230,7 +202,6 @@ dependencies:
230
202
  type: :runtime
231
203
  prerelease: false
232
204
  version_requirements: !ruby/object:Gem::Requirement
233
- none: false
234
205
  requirements:
235
206
  - - ! '>='
236
207
  - !ruby/object:Gem::Version
@@ -238,7 +209,6 @@ dependencies:
238
209
  - !ruby/object:Gem::Dependency
239
210
  name: capybara-webkit
240
211
  requirement: !ruby/object:Gem::Requirement
241
- none: false
242
212
  requirements:
243
213
  - - ! '>='
244
214
  - !ruby/object:Gem::Version
@@ -246,7 +216,6 @@ dependencies:
246
216
  type: :development
247
217
  prerelease: false
248
218
  version_requirements: !ruby/object:Gem::Requirement
249
- none: false
250
219
  requirements:
251
220
  - - ! '>='
252
221
  - !ruby/object:Gem::Version
@@ -254,7 +223,6 @@ dependencies:
254
223
  - !ruby/object:Gem::Dependency
255
224
  name: rails-csv-fixtures
256
225
  requirement: !ruby/object:Gem::Requirement
257
- none: false
258
226
  requirements:
259
227
  - - ! '>='
260
228
  - !ruby/object:Gem::Version
@@ -262,7 +230,6 @@ dependencies:
262
230
  type: :development
263
231
  prerelease: false
264
232
  version_requirements: !ruby/object:Gem::Requirement
265
- none: false
266
233
  requirements:
267
234
  - - ! '>='
268
235
  - !ruby/object:Gem::Version
@@ -273,79 +240,82 @@ executables: []
273
240
  extensions: []
274
241
  extra_rdoc_files: []
275
242
  files:
276
- - lib/tasks/dad.rake
277
- - lib/tasks/db_config.rake
278
- - lib/tasks/unicorn.erb
279
- - lib/tasks/jenkins
280
- - lib/tasks/nginx.rake
281
- - lib/tasks/db_fixtures.rake
282
- - lib/tasks/cucumber.rake
283
- - lib/tasks/jenkins.conf
284
- - lib/tasks/unicorn.rb
285
- - lib/tasks/cucumber_install.rake
286
- - lib/tasks/database.yml.erb
287
- - lib/tasks/nginx.repo
288
- - lib/tasks/phantomjs.rake
289
- - lib/tasks/test.rake
290
- - lib/tasks/nginx.conf.erb
291
- - lib/tasks/db_create.rake
292
- - lib/tasks/publish.rake
293
- - lib/tasks/jenkins.rake
294
- - lib/tasks/cucumber_steps.rake
295
- - lib/tasks/unicorn.rake
296
- - lib/tasks/diary.rake
297
- - lib/daddy/railtie.rb
243
+ - lib/daddy/capistrano/remote_cache_subdir.rb
244
+ - lib/daddy/cucumber/assert.rb
245
+ - lib/daddy/cucumber/capture.rb
298
246
  - lib/daddy/cucumber/diff.rb
247
+ - lib/daddy/cucumber/formatting.rb
299
248
  - lib/daddy/cucumber/html.rb
300
- - lib/daddy/cucumber/capture.rb
301
- - lib/daddy/cucumber/assert.rb
302
249
  - lib/daddy/cucumber/pause.rb
303
250
  - lib/daddy/cucumber/step_definitions/click.rb
304
- - lib/daddy/cucumber/step_definitions/select.rb
305
- - lib/daddy/cucumber/step_definitions/fill_in.rb
306
251
  - lib/daddy/cucumber/step_definitions/common.rb
252
+ - lib/daddy/cucumber/step_definitions/fill_in.rb
253
+ - lib/daddy/cucumber/step_definitions/select.rb
307
254
  - lib/daddy/cucumber/table.rb
308
- - lib/daddy/formatter/daddy.js
255
+ - lib/daddy/cucumber.rb
309
256
  - lib/daddy/formatter/cucumber.css
310
- - lib/daddy/formatter/html.rb
311
257
  - lib/daddy/formatter/daddy.css
312
- - lib/daddy/formatter/menu.html.erb
258
+ - lib/daddy/formatter/daddy.js
313
259
  - lib/daddy/formatter/daddy_html.rb
260
+ - lib/daddy/formatter/html.rb
314
261
  - lib/daddy/formatter/jquery-min.js
315
- - lib/daddy/rails/quiet_assets.rb
316
- - lib/daddy/models/crud_extension.rb
317
- - lib/daddy/models/query_extension.rb
262
+ - lib/daddy/formatter/menu.html.erb
318
263
  - lib/daddy/git.rb
319
- - lib/daddy/capistrano/remote_cache_subdir.rb
320
264
  - lib/daddy/helpers/html_helper.rb
321
- - lib/daddy/utils/sql_utils.rb
322
265
  - lib/daddy/model.rb
323
- - lib/daddy/cucumber.rb
266
+ - lib/daddy/models/crud_extension.rb
267
+ - lib/daddy/models/query_extension.rb
268
+ - lib/daddy/rails/hooks.rb
269
+ - lib/daddy/rails/quiet_assets.rb
270
+ - lib/daddy/railtie.rb
271
+ - lib/daddy/utils/sql_utils.rb
324
272
  - lib/daddy.rb
325
273
  - lib/sql_builder.rb
274
+ - lib/tasks/cucumber.rake
275
+ - lib/tasks/cucumber_install.rake
276
+ - lib/tasks/cucumber_steps.rake
277
+ - lib/tasks/dad.rake
278
+ - lib/tasks/database.yml.erb
279
+ - lib/tasks/db_config.rake
280
+ - lib/tasks/db_create.rake
281
+ - lib/tasks/db_fixtures.rake
282
+ - lib/tasks/diary.rake
283
+ - lib/tasks/jenkins
284
+ - lib/tasks/jenkins.conf
285
+ - lib/tasks/jenkins.rake
286
+ - lib/tasks/nginx.app.conf.erb
287
+ - lib/tasks/nginx.conf.erb
288
+ - lib/tasks/nginx.jenkins.conf.erb
289
+ - lib/tasks/nginx.rake
290
+ - lib/tasks/nginx.repo
291
+ - lib/tasks/phantomjs.rake
292
+ - lib/tasks/publish.rake
293
+ - lib/tasks/test.rake
294
+ - lib/tasks/unicorn.erb
295
+ - lib/tasks/unicorn.rake
296
+ - lib/tasks/unicorn.rb.erb
326
297
  homepage: https://github.com/ichylinux/daddy
327
298
  licenses:
328
299
  - MIT
300
+ metadata: {}
329
301
  post_install_message:
330
302
  rdoc_options: []
331
303
  require_paths:
332
304
  - lib
333
305
  required_ruby_version: !ruby/object:Gem::Requirement
334
- none: false
335
306
  requirements:
336
307
  - - ! '>='
337
308
  - !ruby/object:Gem::Version
338
309
  version: '0'
339
310
  required_rubygems_version: !ruby/object:Gem::Requirement
340
- none: false
341
311
  requirements:
342
312
  - - ! '>='
343
313
  - !ruby/object:Gem::Version
344
314
  version: '0'
345
315
  requirements: []
346
316
  rubyforge_project:
347
- rubygems_version: 1.8.24
317
+ rubygems_version: 2.0.7
348
318
  signing_key:
349
- specification_version: 3
319
+ specification_version: 4
350
320
  summary: My rails dad
351
321
  test_files: []