capistrano-benchmark 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,6 +29,10 @@ If you want this to happen always, you can set this variable yourself:
29
29
  # config/deploy.rb
30
30
  set :benchmark, true
31
31
 
32
+ If you want to see a summarized benchmark report printed at the end:
33
+
34
+ # config/deploy.rb
35
+ after "deploy", "benchmark:report"
32
36
 
33
37
  == Implementation notes
34
38
 
data/Rakefile CHANGED
@@ -21,7 +21,7 @@ Jeweler::Tasks.new do |gem|
21
21
  gem.description = %Q{Benchchmark cpaistrano-tasks like whoa}
22
22
  gem.email = "josh@technicalpickles.com"
23
23
  gem.authors = ["Josh Nichols"]
24
- gem.version = "0.0.1"
24
+ gem.version = "0.0.2"
25
25
  # dependencies defined in Gemfile
26
26
  end
27
27
  Jeweler::RubygemsDotOrgTasks.new
@@ -0,0 +1,62 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "capistrano-benchmark"
8
+ s.version = "0.0.2"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Josh Nichols"]
12
+ s.date = "2013-02-24"
13
+ s.description = "Benchchmark cpaistrano-tasks like whoa"
14
+ s.email = "josh@technicalpickles.com"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".rspec",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE.txt",
25
+ "README.rdoc",
26
+ "Rakefile",
27
+ "capistrano-benchmark.gemspec",
28
+ "lib/capistrano-benchmark.rb",
29
+ "spec/capistrano-benchmark_spec.rb",
30
+ "spec/spec_helper.rb"
31
+ ]
32
+ s.homepage = "http://github.com/technicalpickles/capistrano-benchmark"
33
+ s.licenses = ["MIT"]
34
+ s.require_paths = ["lib"]
35
+ s.rubygems_version = "1.8.23"
36
+ s.summary = "Benchmark capistrano-tasks"
37
+
38
+ if s.respond_to? :specification_version then
39
+ s.specification_version = 3
40
+
41
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
42
+ s.add_runtime_dependency(%q<capistrano>, [">= 0"])
43
+ s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
44
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
45
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
46
+ s.add_development_dependency(%q<rcov>, [">= 0"])
47
+ else
48
+ s.add_dependency(%q<capistrano>, [">= 0"])
49
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
50
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
51
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
52
+ s.add_dependency(%q<rcov>, [">= 0"])
53
+ end
54
+ else
55
+ s.add_dependency(%q<capistrano>, [">= 0"])
56
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
57
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
58
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
59
+ s.add_dependency(%q<rcov>, [">= 0"])
60
+ end
61
+ end
62
+
@@ -1,23 +1,49 @@
1
1
  require 'benchmark'
2
2
  Capistrano::Configuration.class_eval do
3
+ @@benchmarks = []
3
4
  def execute_task_with_benchmarking(task)
4
5
  if fetch(:benchmark, false)
6
+ name = task.fully_qualified_name
5
7
  realtime = Benchmark.realtime do
6
8
  execute_task_without_benchmarking(task)
7
9
  end
10
+ @@benchmarks << [name,realtime]
8
11
 
9
- logger.debug "Finished #{task.fully_qualified_name} in #{realtime}"
12
+ logger.debug "Finished #{name} in #{realtime}"
10
13
  else
11
14
  execute_task_without_benchmarking(task)
12
15
  end
13
16
  end
14
17
 
18
+ def self.benchmarks
19
+ @@benchmarks
20
+ end
21
+
15
22
  alias_method :execute_task_without_benchmarking, :execute_task
16
23
  alias_method :execute_task, :execute_task_with_benchmarking
17
24
  end
18
25
 
19
26
  Capistrano::Configuration.instance.load do
20
- task :benchmark do
21
- set :benchmark, true
27
+ namespace :benchmark do
28
+ task :default do
29
+ set :benchmark, true
30
+ end
31
+
32
+ task :report do
33
+ puts "Benchmark Report:"
34
+ benchmarks = Capistrano::Configuration.benchmarks
35
+ max = benchmarks.collect{|x| x[0]}.max_by{|a| a.length}.length
36
+ report_block = lambda do |data|
37
+ name,took = data
38
+ mins = '%.0f' % (took / 60)
39
+ secs = '%.0f' % (took % 60)
40
+ puts " %-#{max}s : %2s mins and %2s secs" % [name,mins,secs]
41
+ end
42
+
43
+ puts "Ordered by deploy sequence:"
44
+ benchmarks.each(&report_block)
45
+ puts "Ordered by slowest:"
46
+ benchmarks.sort_by {|x| x[1]}.reverse.each(&report_block)
47
+ end
22
48
  end
23
49
  end
metadata CHANGED
@@ -1,109 +1,104 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: capistrano-benchmark
3
- version: !ruby/object:Gem::Version
4
- hash: 29
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 1
10
- version: 0.0.1
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Josh Nichols
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-10-19 00:00:00 -04:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- type: :runtime
12
+ date: 2013-02-24 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
23
15
  name: capistrano
24
- version_requirements: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
33
23
  prerelease: false
34
- requirement: *id001
35
- - !ruby/object:Gem::Dependency
36
- type: :development
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
37
31
  name: rspec
38
- version_requirements: &id002 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
39
33
  none: false
40
- requirements:
34
+ requirements:
41
35
  - - ~>
42
- - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 2
46
- - 3
47
- - 0
36
+ - !ruby/object:Gem::Version
48
37
  version: 2.3.0
49
- prerelease: false
50
- requirement: *id002
51
- - !ruby/object:Gem::Dependency
52
38
  type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 2.3.0
46
+ - !ruby/object:Gem::Dependency
53
47
  name: bundler
54
- version_requirements: &id003 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
55
49
  none: false
56
- requirements:
50
+ requirements:
57
51
  - - ~>
58
- - !ruby/object:Gem::Version
59
- hash: 23
60
- segments:
61
- - 1
62
- - 0
63
- - 0
52
+ - !ruby/object:Gem::Version
64
53
  version: 1.0.0
65
- prerelease: false
66
- requirement: *id003
67
- - !ruby/object:Gem::Dependency
68
54
  type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 1.0.0
62
+ - !ruby/object:Gem::Dependency
69
63
  name: jeweler
70
- version_requirements: &id004 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
71
65
  none: false
72
- requirements:
66
+ requirements:
73
67
  - - ~>
74
- - !ruby/object:Gem::Version
75
- hash: 7
76
- segments:
77
- - 1
78
- - 6
79
- - 4
68
+ - !ruby/object:Gem::Version
80
69
  version: 1.6.4
81
- prerelease: false
82
- requirement: *id004
83
- - !ruby/object:Gem::Dependency
84
70
  type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 1.6.4
78
+ - !ruby/object:Gem::Dependency
85
79
  name: rcov
86
- version_requirements: &id005 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
87
81
  none: false
88
- requirements:
89
- - - ">="
90
- - !ruby/object:Gem::Version
91
- hash: 3
92
- segments:
93
- - 0
94
- version: "0"
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
95
87
  prerelease: false
96
- requirement: *id005
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
97
94
  description: Benchchmark cpaistrano-tasks like whoa
98
95
  email: josh@technicalpickles.com
99
96
  executables: []
100
-
101
97
  extensions: []
102
-
103
- extra_rdoc_files:
98
+ extra_rdoc_files:
104
99
  - LICENSE.txt
105
100
  - README.rdoc
106
- files:
101
+ files:
107
102
  - .document
108
103
  - .rspec
109
104
  - Gemfile
@@ -111,42 +106,36 @@ files:
111
106
  - LICENSE.txt
112
107
  - README.rdoc
113
108
  - Rakefile
109
+ - capistrano-benchmark.gemspec
114
110
  - lib/capistrano-benchmark.rb
115
111
  - spec/capistrano-benchmark_spec.rb
116
112
  - spec/spec_helper.rb
117
- has_rdoc: true
118
113
  homepage: http://github.com/technicalpickles/capistrano-benchmark
119
- licenses:
114
+ licenses:
120
115
  - MIT
121
116
  post_install_message:
122
117
  rdoc_options: []
123
-
124
- require_paths:
118
+ require_paths:
125
119
  - lib
126
- required_ruby_version: !ruby/object:Gem::Requirement
120
+ required_ruby_version: !ruby/object:Gem::Requirement
127
121
  none: false
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- hash: 3
132
- segments:
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ segments:
133
127
  - 0
134
- version: "0"
135
- required_rubygems_version: !ruby/object:Gem::Requirement
128
+ hash: 2507806162531207113
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
136
130
  none: false
137
- requirements:
138
- - - ">="
139
- - !ruby/object:Gem::Version
140
- hash: 3
141
- segments:
142
- - 0
143
- version: "0"
131
+ requirements:
132
+ - - ! '>='
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
144
135
  requirements: []
145
-
146
136
  rubyforge_project:
147
- rubygems_version: 1.4.2
137
+ rubygems_version: 1.8.23
148
138
  signing_key:
149
139
  specification_version: 3
150
140
  summary: Benchmark capistrano-tasks
151
141
  test_files: []
152
-