brynary-testjour 0.2.0 → 0.2.1
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.
- data/lib/testjour.rb +1 -1
- data/lib/testjour/commands.rb +2 -0
- data/lib/testjour/commands/base_command.rb +4 -0
- data/lib/testjour/commands/local_run.rb +12 -6
- data/lib/testjour/commands/mysql_create.rb +34 -0
- data/lib/testjour/commands/mysql_drop.rb +31 -0
- data/lib/testjour/mysql.rb +2 -21
- metadata +4 -2
data/lib/testjour.rb
CHANGED
data/lib/testjour/commands.rb
CHANGED
@@ -6,5 +6,7 @@ require "testjour/commands/slave_start"
|
|
6
6
|
require "testjour/commands/slave_stop"
|
7
7
|
require "testjour/commands/slave_run"
|
8
8
|
require "testjour/commands/slave_warm"
|
9
|
+
require "testjour/commands/mysql_create"
|
10
|
+
require "testjour/commands/mysql_drop"
|
9
11
|
require "testjour/commands/warm"
|
10
12
|
require "testjour/commands/local_run"
|
@@ -1,15 +1,16 @@
|
|
1
1
|
require "drb"
|
2
2
|
require "uri"
|
3
|
+
require "systemu"
|
3
4
|
|
4
5
|
require "testjour/commands/base_command"
|
5
6
|
require "testjour/queue_server"
|
6
7
|
require "testjour/cucumber_extensions/drb_formatter"
|
7
|
-
require "testjour/mysql"
|
8
8
|
|
9
9
|
module Testjour
|
10
10
|
module CLI
|
11
11
|
|
12
12
|
class LocalRun < BaseCommand
|
13
|
+
|
13
14
|
def self.command
|
14
15
|
"local:run"
|
15
16
|
end
|
@@ -24,11 +25,16 @@ module Testjour
|
|
24
25
|
ARGV.clear # Don't pass along args to RSpec
|
25
26
|
Testjour.load_cucumber
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
status, stdout, stderr = systemu("#{testjour_bin_path} mysql:create")
|
29
|
+
database_name = stdout.split.last.strip
|
30
|
+
Testjour.logger.info "MySQL db name: #{database_name.inspect}"
|
31
|
+
|
32
|
+
Cucumber::CLI.executor.formatters = Testjour::DRbFormatter.new(queue_server)
|
33
|
+
require_files
|
34
|
+
work
|
35
|
+
|
36
|
+
status, stdout, stderr = systemu("#{testjour_bin_path} mysql:drop #{database_name}")
|
37
|
+
Testjour.logger.info "Dropped MySQL db: #{status.inspect}, #{stdout.inspect}, #{stderr.inspect}"
|
32
38
|
end
|
33
39
|
|
34
40
|
def work
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require "testjour/commands/base_command"
|
2
|
+
require "testjour/mysql"
|
3
|
+
|
4
|
+
module Testjour
|
5
|
+
module CLI
|
6
|
+
|
7
|
+
class MysqlCreate < BaseCommand
|
8
|
+
|
9
|
+
def self.command
|
10
|
+
"mysql:create"
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize(*args)
|
14
|
+
super
|
15
|
+
Testjour.logger.debug "Runner command #{self.class}..."
|
16
|
+
|
17
|
+
ENV["RAILS_ENV"] ||= "test"
|
18
|
+
require File.expand_path("./config/environment")
|
19
|
+
end
|
20
|
+
|
21
|
+
def run
|
22
|
+
mysql = MysqlDatabaseSetup.new
|
23
|
+
mysql.create_database
|
24
|
+
mysql.connect
|
25
|
+
mysql.load_schema
|
26
|
+
|
27
|
+
ENV["TESTJOUR_DB"] = mysql.runner_database_name
|
28
|
+
puts mysql.runner_database_name
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require "testjour/commands/base_command"
|
2
|
+
require "testjour/mysql"
|
3
|
+
|
4
|
+
module Testjour
|
5
|
+
module CLI
|
6
|
+
|
7
|
+
class MysqlDrop < BaseCommand
|
8
|
+
|
9
|
+
def self.command
|
10
|
+
"mysql:drop"
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize(*args)
|
14
|
+
super
|
15
|
+
Testjour.logger.debug "Runner command #{self.class}..."
|
16
|
+
|
17
|
+
ENV["RAILS_ENV"] ||= "test"
|
18
|
+
require File.expand_path("./config/environment")
|
19
|
+
end
|
20
|
+
|
21
|
+
def run
|
22
|
+
database_name = @non_options.shift
|
23
|
+
mysql = MysqlDatabaseSetup.new(database_name)
|
24
|
+
mysql.connect
|
25
|
+
mysql.drop_database
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
data/lib/testjour/mysql.rb
CHANGED
@@ -22,27 +22,8 @@ module Testjour
|
|
22
22
|
:database => "information_schema"
|
23
23
|
}
|
24
24
|
|
25
|
-
def
|
26
|
-
|
27
|
-
require File.expand_path("./vendor/rails/railties/lib/initializer")
|
28
|
-
Rails::Initializer.run(:set_load_path)
|
29
|
-
|
30
|
-
require "active_record"
|
31
|
-
require "active_record/connection_adapters/mysql_adapter"
|
32
|
-
|
33
|
-
mysql = self.new
|
34
|
-
mysql.create_database
|
35
|
-
|
36
|
-
ENV["TESTJOUR_DB"] = mysql.runner_database_name
|
37
|
-
|
38
|
-
at_exit do
|
39
|
-
mysql.drop_database
|
40
|
-
end
|
41
|
-
|
42
|
-
mysql.connect
|
43
|
-
mysql.load_schema
|
44
|
-
|
45
|
-
yield
|
25
|
+
def initialize(runner_database_name = nil)
|
26
|
+
@runner_database_name = runner_database_name
|
46
27
|
end
|
47
28
|
|
48
29
|
def grant_privileges(connection)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brynary-testjour
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Helmkamp
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-01-28 00:00:00 -08:00
|
13
13
|
default_executable: testjour
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -53,6 +53,8 @@ files:
|
|
53
53
|
- lib/testjour/commands/help.rb
|
54
54
|
- lib/testjour/commands/list.rb
|
55
55
|
- lib/testjour/commands/local_run.rb
|
56
|
+
- lib/testjour/commands/mysql_create.rb
|
57
|
+
- lib/testjour/commands/mysql_drop.rb
|
56
58
|
- lib/testjour/commands/run.rb
|
57
59
|
- lib/testjour/commands/slave_run.rb
|
58
60
|
- lib/testjour/commands/slave_start.rb
|