daddy 0.0.20 → 0.0.21

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
- NmU2ZGRlYjZiOThiY2Q2NDQwOTBlM2FjNTZhMjdjMDE5MDY5YmRlZQ==
4
+ NWRjNDQxMTAwNDZhOTg3MjRhZWNlOWVmNTFjNzNkNjg5NjU0MWNlNg==
5
5
  data.tar.gz: !binary |-
6
- NzgzZGEzYzRmY2Q2YzczMzY1ZGFkNWU0ODQ2MDBkN2NlYjBiZDU1NA==
6
+ NDFlNTIwZjUzODVjZTBkYTU2MTAwMGNmMDg2OTc4NjhkMjk3ZDQ2OA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NTI3ZjMwM2VkYmMyZWIxYjNmODU4MzNmOGU1M2RkMGY5Mzg1NGM1YTg4NWZj
10
- MmI3MDA1MTkwNDE0ZmEzNjIxZjY0MGZlNDZiZTIzYjMyNzgyODc1Yjg2YmY3
11
- MmJiMDYzNTJiZjdlOTliOThkY2Y0NGVhOGIxMDdjNjllMzQ0ZWU=
9
+ MDdmMTdmN2JmZGQ1ZTFlMTc0YjAzZWE1YzEzMTMyYTE4MjIxZGNkZDI0NWU3
10
+ N2MwYzg0Y2Q4NzBiMDNkMzczOGRjYWYwYWVlOTI5MTZlNWE1ZmFjYmEyZjgy
11
+ ZDk0Yjc2NzAwMDNjZDA5Njk0MzUyZTZlMWI4ZDBhYjczODMyZTI=
12
12
  data.tar.gz: !binary |-
13
- MTRjNzZjZDRlYjVkYzRjOTBhNGY5NjVjZTRjYzMyODJmMDRkN2U1ZTFhNjM5
14
- Y2JhYmYyODgyNTQ3MGQ2MjhjYzcxNTIxODFmMGU4YzFlYmRjNGRkODZlMzM1
15
- ZTA2N2U3MjQ2NTYyZDVkYmVjNTRiMWQ5NDI0YmRkY2JiOTZmZWE=
13
+ ZjkwODIyZGYyMDA2NmEyODQ2ZjQ0NzI5ZWZiZDYxMTE4YzU0OWJiNTY2Mzhj
14
+ YWI0YWIwY2VhZjUwZjA1YjA2NmNjYTcyMDVlNjJhNWUwODk5M2U5MDk5OGEx
15
+ N2QxNzk5ODlkN2E4NDZmMDBiZTRkNTJmYTU3ZjA2ZDZlYTk0YmU=
@@ -1,6 +1,7 @@
1
1
  # coding: UTF-8
2
2
 
3
3
  require 'cucumber/rails'
4
+ require 'capybara/poltergeist'
4
5
  require 'capybara/webkit'
5
6
  require 'daddy/git'
6
7
  require 'differ'
@@ -17,15 +17,15 @@ module Daddy
17
17
 
18
18
  image = "#{@@_screen_count}.png"
19
19
 
20
- if Capybara.current_driver == :webkit
21
- page.driver.render("#{SCREENSHOT_DIR}/#{image}")
22
- else
20
+ if Capybara.current_driver == :selenium
23
21
  page.driver.browser.save_screenshot("#{SCREENSHOT_DIR}/#{image}")
22
+ else
23
+ page.driver.render("#{SCREENSHOT_DIR}/#{image}")
24
24
  end
25
25
 
26
26
  puts %{
27
- <div style="margin: 5px 0;">#{url}</div>
28
- <div style="padding-right: 20px;"><img src="screenshots/#{image}" width="60%" height="60%"/></div>
27
+ <div>#{url}</div>
28
+ <img style="margin: 5px 0; background: #ffffff;" src="screenshots/#{image}"/>
29
29
  }
30
30
  end
31
31
  end
@@ -4,15 +4,13 @@ module Daddy
4
4
  module Cucumber
5
5
  module Diff
6
6
 
7
- def git_diff(local_file, git_path = nil)
7
+ def git_diff(file, options = {})
8
8
  git = Daddy::Git.new
9
- git_path ||= local_file
10
-
11
- a = File.read(local_file).gsub(/[<>]/, '<' => '&lt;', '>' => '&gt;')
12
- b = git.show_previous(git_path, true).gsub(/[<>]/, '<' => '&lt;', '>' => '&gt;')
9
+ a = File.read(file).gsub(/[<>]/, '<' => '&lt;', '>' => '&gt;')
10
+ b = git.show_previous(file, true).gsub(/[<>]/, '<' => '&lt;', '>' => '&gt;')
13
11
  diff = format_diff(Differ.diff(a, b))
14
12
 
15
- puts local_file
13
+ puts file
16
14
  puts "<pre>#{diff}</pre>"
17
15
  end
18
16
 
@@ -7,6 +7,7 @@
7
7
  float: left;
8
8
  background: #FFFFFF;
9
9
  color: #000000;
10
+ margin-top: -10px;
10
11
  }
11
12
 
12
13
  #menu ol {
@@ -46,6 +47,11 @@
46
47
  font-weight: bold;
47
48
  }
48
49
 
50
+ .cucumber ol li.step, td ol li.step, th ol li.step {
51
+ padding: 3px 3px 3px 10px;
52
+ margin: 5px 0px 5px 0px;
53
+ }
54
+
49
55
  .cucumber ol li.passed, td ol li.passed, th ol li.passed {
50
56
  border-left: 5px solid #999999;
51
57
  border-bottom: 1px solid #999999;
@@ -76,10 +82,30 @@
76
82
  display: none;
77
83
  background: #FFFFFF;
78
84
  border: solid 1px #999999;
79
- margin-left: 10px;
85
+ margin-left: 15px;
80
86
  padding: 10px;
81
87
  }
82
88
 
89
+ div.background {
90
+ margin-left: 20px;
91
+ }
92
+
93
+ div.feature .narrative {
94
+ margin-left: 10px;
95
+ }
96
+
97
+ div.scenario .narrative {
98
+ margin-left: 20px;
99
+ }
100
+
101
+ div.scenario {
102
+ margin: 20px;
103
+ }
104
+
105
+ div.scenario ol {
106
+ margin-left: 20px;
107
+ }
108
+
83
109
  div.scenario table {
84
110
  margin: 10px 0;
85
111
  }
@@ -207,15 +207,31 @@ module Daddy
207
207
 
208
208
  def scenario_name(keyword, name, file_colon_line, source_indent)
209
209
  @step_number_in_scenario = 0
210
-
211
- @builder.span(:class => 'scenario_file') do
210
+
211
+ @builder.span(:class => 'scenario_file', :style => 'display: none;') do
212
212
  @builder << file_colon_line
213
213
  end
214
214
  @listing_background = false
215
+
216
+ lines = name.split("\n")
215
217
  @builder.h3(:id => "scenario_#{@scenario_number}") do
216
218
  @builder.span(keyword + ':', :class => 'keyword')
217
219
  @builder.text!(' ')
218
- @builder.span(name, :class => 'val')
220
+ @builder.span(lines[0], :class => 'val')
221
+ end
222
+
223
+ if lines.size > 1
224
+ @builder.div(:class => 'narrative', :style => 'display: none;') do
225
+ @builder.pre do
226
+ text = ''
227
+ lines[1..-1].each_with_index do |line, i|
228
+ next if i == 0 and line.strip.empty?
229
+ text << '<br/>' unless text.empty?
230
+ text << line
231
+ end
232
+ @builder << text
233
+ end
234
+ end
219
235
  end
220
236
  end
221
237
 
@@ -247,7 +263,7 @@ module Daddy
247
263
 
248
264
  def before_steps(steps)
249
265
  @step_count_in_scenario = steps.count
250
- @builder << '<ol>'
266
+ @builder << '<ol style="display: none;">'
251
267
  end
252
268
 
253
269
  def after_steps(steps)
@@ -538,12 +554,20 @@ module Daddy
538
554
  end
539
555
 
540
556
  def build_step(keyword, step_match, status)
541
- @step_number_in_scenario += 1
542
- formatted_step_number = sprintf("%0#{@step_count_in_scenario.to_s.size}d", @step_number_in_scenario)
557
+ if @in_background
558
+ display_keyword = keyword.strip + ' '
559
+ else
560
+ if keyword.strip == '*'
561
+ @step_number_in_scenario += 1
562
+ display_keyword = sprintf("%0#{@step_count_in_scenario.to_s.size}d", @step_number_in_scenario) + '. '
563
+ else
564
+ display_keyword = keyword.strip + ' '
565
+ end
566
+ end
543
567
 
544
568
  step_name = step_match.format_args(lambda{|param| %{<span class="param">#{param}</span>}})
545
569
  @builder.div(:class => 'step_name') do |div|
546
- @builder.span("#{formatted_step_number}. ", :class => 'keyword')
570
+ @builder.span(display_keyword, :class => 'keyword')
547
571
  @builder.span(:class => 'step val') do |name|
548
572
  name << h(step_name).gsub(/&lt;span class=&quot;(.*?)&quot;&gt;/, '<span class="\1">').gsub(/&lt;\/span&gt;/, '</span>')
549
573
  end
@@ -602,7 +626,6 @@ module Daddy
602
626
  else
603
627
  @builder << %w{
604
628
  $(document).ready(function() {
605
- $(SCENARIOS).siblings().hide();
606
629
  $('li.message').hide();
607
630
  });
608
631
  }.join
data/lib/daddy/git.rb CHANGED
@@ -12,7 +12,7 @@ module Daddy
12
12
  def self.sub_dir=(sub_dir)
13
13
  @@sub_dir = sub_dir
14
14
  end
15
-
15
+
16
16
  def branches(remote = false)
17
17
  branches = []
18
18
  `git branch -a`.split("\n").each do |b|
@@ -13,16 +13,32 @@ namespace :dad do
13
13
  "sudo cp -f #{File.dirname(__FILE__)}/jenkins /etc/sysconfig",
14
14
  "sudo chown root:root /etc/sysconfig/jenkins",
15
15
  "sudo chmod 600 /etc/sysconfig/jenkins",
16
- "sudo mkdir /var/lib/jenkins/plugins",
16
+ "sudo mkdir -p /var/lib/jenkins/plugins",
17
17
  "sudo chown jenkins:jenkins /var/lib/jenkins/plugins",
18
- "sudo wget http://updates.jenkins-ci.org/download/plugins/build-pipeline-plugin/1.3.3/build-pipeline-plugin.hpi -O /var/lib/jenkins/plugins/build-pipeline-plugin.hpi",
19
- "sudo wget http://updates.jenkins-ci.org/download/plugins/git/1.1.26/git.hpi -O /var/lib/jenkins/plugins/git.hpi",
20
- "sudo wget http://updates.jenkins-ci.org/download/plugins/rake/1.7.7/rake.hpi -O /var/lib/jenkins/plugins/rake.hpi",
21
- "sudo wget http://updates.jenkins-ci.org/download/plugins/rubyMetrics/1.5.0/rubyMetrics.hpi -O /var/lib/jenkins/plugins/rubyMetrics.hpi",
22
18
  ].each do |command|
23
19
  puts command
24
20
  system(command)
25
21
  end
22
+
23
+ plugins = [
24
+ {:name => 'build-pipeline-plugin', :version => '1.3.3'},
25
+ {:name => 'git', :version => '1.1.26'},
26
+ {:name => 'rake', :version => '1.7.7'},
27
+ {:name => 'rubyMetrics', :version => '1.5.0'},
28
+ {:name => 'htmlpublisher', :version => '1.2'},
29
+ ]
30
+ plugins.each do |p|
31
+ download_path = "tmp/#{p[:name]}.hpi"
32
+
33
+ unless File.exist?(download_path)
34
+ command = "sudo wget http://updates.jenkins-ci.org/download/plugins/#{p[:name]}/#{p[:version]}/#{p[:name]}.hpi -O #{download_path}"
35
+ puts command
36
+ system command
37
+ end
38
+
39
+ plugin_path = "/var/lib/jenkins/plugins/#{p[:name]}.hpi"
40
+ system("sudo cp -f #{download_path} #{plugin_path}")
41
+ end
26
42
  end
27
43
 
28
44
  end
@@ -1,7 +1,3 @@
1
- upstream jenkins {
2
- server localhost:8081;
3
- }
4
-
5
1
  upstream unicorn {
6
2
  server unix:/tmp/unicorn.sock;
7
3
  }
@@ -17,14 +13,34 @@ server {
17
13
  server_name localhost;
18
14
 
19
15
  root <%= ENV['RAILS_ROOT'] %>/public;
20
-
21
16
  try_files $uri/index.html $uri @app;
22
17
 
23
18
  location @app {
24
19
  proxy_pass http://unicorn;
25
20
  }
26
-
27
- location /jenkins {
28
- proxy_pass http://jenkins;
21
+
22
+ location ~ ^/(assets)/ {
23
+ gzip_vary on;
24
+ gzip_static on;
25
+ expires 1y;
26
+ add_header Cache-Control public;
27
+ add_header ETag "";
29
28
  }
29
+
30
+ <% if ENV['JENKINS'].to_s.downcase == 'true' %>
31
+ location /jenkins/ {
32
+ root /var/cache/jenkins/war;
33
+ proxy_pass http://localhost:8081/jenkins/;
34
+ proxy_set_header Host $http_host;
35
+ proxy_set_header X-Real-IP $remote_addr;
36
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
37
+ }
38
+ <% end -%>
39
+
40
+ <% if ENV['PUBLISH'].to_s.downcase == 'true' %>
41
+ location /spec/ {
42
+ root /var/lib/daddy;
43
+ }
44
+ <% end -%>
45
+
30
46
  }
data/lib/tasks/nginx.rake CHANGED
@@ -22,9 +22,17 @@ namespace :dad do
22
22
  end
23
23
 
24
24
  rails_root = ENV['RAILS_ROOT'] || Rails.root
25
+ jenkins = ENV['JENKINS'] || false
26
+ publish = ENV['PUBLISH'] || false
27
+
25
28
  ret = system("RAILS_ROOT=#{rails_root} erb -T - #{File.dirname(__FILE__)}/nginx.conf.erb > tmp/nginx.conf")
26
29
  fail unless ret
27
30
  system("sudo cp -f tmp/nginx.conf /etc/nginx/conf.d/nginx.conf")
31
+
32
+ if publish
33
+ system("sudo mkdir -p /var/lib/daddy")
34
+ system("sudo chown -R #{ENV['USER']}:#{ENV['USER']} /var/lib/daddy")
35
+ end
28
36
  end
29
37
 
30
38
  end
@@ -0,0 +1,24 @@
1
+ # coding: UTF-8
2
+
3
+ require 'rake'
4
+
5
+ namespace :dad do
6
+ namespace :phantomjs do
7
+
8
+ desc "PhantomJSをインストールします。"
9
+ task :install do
10
+ name = 'phantomjs-1.9.0-linux-x86_64'
11
+ file = "#{name}.tar.bz2"
12
+ unless File.exist?("tmp/#{file}")
13
+ system("wget https://phantomjs.googlecode.com/files/#{file} -O tmp/#{file}")
14
+ end
15
+ system("rm -Rf tmp/#{name}")
16
+ system("cd tmp && tar jxf #{file}")
17
+
18
+ system("sudo cp -f tmp/#{name}/bin/phantomjs /usr/local/bin/phantomjs")
19
+ system("sudo chown root:root /usr/local/bin/phantomjs")
20
+ system("sudo chmod 755 /usr/local/bin/phantomjs")
21
+ end
22
+
23
+ end
24
+ end
@@ -12,8 +12,6 @@ namespace :dad do
12
12
  system("bundle exec rake dad:cucumber PUBLISH=true EXPAND=false OUTPUT_FILE=diary.html features/開発日記")
13
13
  system("bundle exec rake dad:cucumber PUBLISH=true EXPAND=false OUTPUT_FILE=index.html features/仕様書")
14
14
 
15
- system("mkdir -p tmp")
16
-
17
15
  if ENV['BRANCH']
18
16
  current_branch = ENV['BRANCH']
19
17
  else
@@ -21,22 +19,17 @@ namespace :dad do
21
19
  current_branch = git.current_branch
22
20
  end
23
21
 
24
- unless File.exist?('tmp/gh-pages')
25
- system("cd tmp && git clone -b gh-pages git@github.com:ichylinux/daddy.git gh-pages")
26
- else
27
- system("cd tmp/gh-pages && git pull")
28
- end
29
- system("mkdir -p tmp/gh-pages/#{current_branch}")
22
+ dir = '/var/lib/daddy/spec'
23
+ system("sudo mkdir -p #{dir}")
24
+ system("sudo chown -R #{ENV['USER']}:#{ENV['USER']} #{dir}")
30
25
 
31
- system("cd tmp/gh-pages && git rm -r #{current_branch}/screenshots")
32
- system("cp -Rf features/reports/* tmp/gh-pages/#{current_branch}/")
26
+ system("mkdir -p #{dir}/#{current_branch}")
33
27
 
34
- system("cd tmp/gh-pages && git rm -r #{current_branch}/coverage")
35
- system("cp -Rf coverage tmp/gh-pages/#{current_branch}/")
28
+ system("rm -Rf #{dir}/#{current_branch}/screenshots")
29
+ system("cp -Rf features/reports/* #{dir}/#{current_branch}/")
36
30
 
37
- system("cd tmp/gh-pages && git add .")
38
- system("cd tmp/gh-pages && git commit -m 'publish'")
39
- system("cd tmp/gh-pages && git push")
31
+ system("rm -Rf #{dir}/#{current_branch}/coverage")
32
+ system("cp -Rf coverage #{dir}/#{current_branch}/")
40
33
  end
41
34
 
42
35
  end
@@ -5,17 +5,9 @@
5
5
 
6
6
  . /etc/rc.d/init.d/functions
7
7
 
8
- if [ -z ${RAILS_USER} ]; then
9
- RAILS_USER=<%= ENV['USER'] %>
10
- fi
11
-
12
- if [ -z ${RAILS_ENV} ]; then
13
- RAILS_ENV=<%= ENV['RAILS_ENV'] %>
14
- fi
15
-
16
- if [ -z ${RAILS_ROOT} ]; then
17
- RAILS_ROOT=<%= ENV['RAILS_ROOT'] %>
18
- fi
8
+ RAILS_USER=<%= ENV['USER'] %>
9
+ RAILS_ENV=<%= ENV['RAILS_ENV'] %>
10
+ RAILS_ROOT=<%= ENV['RAILS_ROOT'] %>
19
11
 
20
12
  PID=${RAILS_ROOT}/tmp/pids/unicorn.pid
21
13
  CONFIG=${RAILS_ROOT}/config/unicorn.rb
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.0.20
4
+ version: 0.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - ichy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-28 00:00:00.000000000 Z
11
+ date: 2013-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ! '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: poltergeist
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: rails
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -193,6 +207,7 @@ files:
193
207
  - lib/tasks/db_create.rake
194
208
  - lib/tasks/unicorn.erb
195
209
  - lib/tasks/test.rake
210
+ - lib/tasks/phantomjs.rake
196
211
  - lib/tasks/database.yml.erb
197
212
  - lib/tasks/nginx.conf.erb
198
213
  homepage: https://github.com/ichylinux/daddy