perf_check 0.3.0 → 0.4.0
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/perf_check/config.rb +4 -0
- data/lib/perf_check/git.rb +13 -0
- data/lib/perf_check.rb +16 -0
- 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: f8cdfcd06c215cfa05e4267afa28abf9f8d8efba
|
4
|
+
data.tar.gz: a895cac67e5622ea31c997239f7371aac08fce8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9c4c040e1d5e27d2f21b59f527efe287ebdfdacd794c447ada57c08c85c725406695f6759c2a305474875688fb7f6c6f13c4f0e10db4fc2094cc9e984564ea6
|
7
|
+
data.tar.gz: eba0557a4d74c324892cf01a9a4c2a5abbf6f6b0c7cb78df3be9289f1d7fa0342900c43569b101d55d8b9e09b31ca661856275817794ac0daa06588377bb6dbc
|
data/lib/perf_check/config.rb
CHANGED
@@ -44,6 +44,10 @@ class PerfCheck
|
|
44
44
|
config.caching = false
|
45
45
|
end
|
46
46
|
|
47
|
+
opts.on('--run-migrations', 'Run migrations on the branch and unmigrate at the end') do
|
48
|
+
config[:run_migrations?] = true
|
49
|
+
end
|
50
|
+
|
47
51
|
opts.on('--fail-fast', '-f', 'Bail immediately on non-200 HTTP response') do
|
48
52
|
config[:fail_fast?] = true
|
49
53
|
end
|
data/lib/perf_check/git.rb
CHANGED
@@ -67,5 +67,18 @@ class PerfCheck
|
|
67
67
|
logger.fatal("Problem with git stash! Bailing...") && abort
|
68
68
|
end
|
69
69
|
end
|
70
|
+
|
71
|
+
def self.migrations_to_run_down
|
72
|
+
current_migrations_not_on_master.map { |filename| File.basename(filename, '.rb').split('_').first }
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.current_migrations_not_on_master
|
76
|
+
%x{git diff origin/master --name-only --diff-filter=A db/migrate/}.split.reverse
|
77
|
+
end
|
78
|
+
private_class_method :current_migrations_not_on_master
|
79
|
+
|
80
|
+
def self.clean_db
|
81
|
+
`git checkout db`
|
82
|
+
end
|
70
83
|
end
|
71
84
|
end
|
data/lib/perf_check.rb
CHANGED
@@ -49,6 +49,8 @@ class PerfCheck
|
|
49
49
|
private
|
50
50
|
|
51
51
|
def profile_requests
|
52
|
+
run_migrations_up if options.run_migrations?
|
53
|
+
|
52
54
|
server.restart
|
53
55
|
test_cases.each_with_index do |test, i|
|
54
56
|
trigger_before_start_callbacks(test)
|
@@ -65,6 +67,20 @@ class PerfCheck
|
|
65
67
|
|
66
68
|
test.run(server, options)
|
67
69
|
end
|
70
|
+
ensure
|
71
|
+
run_migrations_down if options.run_migrations?
|
72
|
+
end
|
73
|
+
|
74
|
+
def run_migrations_up
|
75
|
+
Bundler.with_clean_env{ puts `bundle exec rake db:migrate` }
|
76
|
+
Git.clean_db
|
77
|
+
end
|
78
|
+
|
79
|
+
def run_migrations_down
|
80
|
+
Git.migrations_to_run_down.each do |version|
|
81
|
+
Bundler.with_clean_env{ puts `bundle exec rake db:migrate:down VERSION=#{version}` }
|
82
|
+
end
|
83
|
+
Git.clean_db
|
68
84
|
end
|
69
85
|
end
|
70
86
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: perf_check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- rubytune
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
76
|
version: '0'
|
77
77
|
requirements: []
|
78
78
|
rubyforge_project:
|
79
|
-
rubygems_version: 2.
|
79
|
+
rubygems_version: 2.4.5
|
80
80
|
signing_key:
|
81
81
|
specification_version: 4
|
82
82
|
summary: PERF CHECKKK!
|