xmigra 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/xmigra/access_artifact.rb +44 -0
- data/lib/xmigra/access_artifact_collection.rb +50 -0
- data/lib/xmigra/branch_upgrade.rb +62 -0
- data/lib/xmigra/db_support/mssql.rb +1070 -0
- data/lib/xmigra/function.rb +17 -0
- data/lib/xmigra/index.rb +21 -0
- data/lib/xmigra/index_collection.rb +38 -0
- data/lib/xmigra/migration.rb +27 -0
- data/lib/xmigra/migration_chain.rb +63 -0
- data/lib/xmigra/migration_conflict.rb +68 -0
- data/lib/xmigra/new_file.rb +4 -0
- data/lib/xmigra/new_migration_adder.rb +74 -0
- data/lib/xmigra/permission_script_writer.rb +67 -0
- data/lib/xmigra/program.rb +927 -0
- data/lib/xmigra/schema_manipulator.rb +39 -0
- data/lib/xmigra/schema_updater.rb +183 -0
- data/lib/xmigra/stored_procedure.rb +20 -0
- data/lib/xmigra/vcs_support/git.rb +275 -0
- data/lib/xmigra/vcs_support/svn.rb +213 -0
- data/lib/xmigra/version.rb +1 -1
- data/lib/xmigra/view.rb +17 -0
- data/lib/xmigra.rb +47 -3222
- data/test/runner.rb +53 -4
- metadata +22 -2
data/test/runner.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'fileutils'
|
3
|
+
require 'ostruct'
|
3
4
|
require 'pathname'
|
4
5
|
require 'stringio'
|
5
6
|
require 'tmpdir'
|
@@ -8,6 +9,7 @@ TESTS = %w[
|
|
8
9
|
git_vcs
|
9
10
|
]
|
10
11
|
|
12
|
+
$:.unshift Pathname(__FILE__).expand_path.dirname.dirname + 'lib'
|
11
13
|
$:.unshift Pathname(__FILE__).expand_path.dirname.dirname
|
12
14
|
require 'xmigra'
|
13
15
|
|
@@ -17,7 +19,21 @@ $tests_failed = []
|
|
17
19
|
|
18
20
|
$xmigra_test_system = 'Microsoft SQL Server'
|
19
21
|
|
22
|
+
class AssertionFailure < Exception; end
|
23
|
+
|
24
|
+
class UnexpectedExceptionFailure < AssertionFailure
|
25
|
+
def initialize(msg, original=nil)
|
26
|
+
super(msg)
|
27
|
+
@original = original
|
28
|
+
set_backtrace(original.backtrace) if original
|
29
|
+
end
|
30
|
+
|
31
|
+
attr_reader :original
|
32
|
+
end
|
33
|
+
|
20
34
|
def run_test(name, &block)
|
35
|
+
return unless $test_selectors.empty? || $test_selectors.any? {|selector| selector === name}
|
36
|
+
|
21
37
|
$test_count += 1
|
22
38
|
|
23
39
|
if child_pid = Process.fork
|
@@ -34,6 +50,8 @@ def run_test(name, &block)
|
|
34
50
|
begin
|
35
51
|
block.call
|
36
52
|
exit! 0
|
53
|
+
rescue AssertionFailure
|
54
|
+
exit! 2
|
37
55
|
rescue
|
38
56
|
puts
|
39
57
|
puts "Exception: #{$!}"
|
@@ -77,8 +95,6 @@ def initialize_xmigra_schema(path='.', options={})
|
|
77
95
|
end
|
78
96
|
end
|
79
97
|
|
80
|
-
class AssertionFailure < Exception; end
|
81
|
-
|
82
98
|
def assert(message=nil, &block)
|
83
99
|
get_message = proc {
|
84
100
|
if !message and File.exist?(block.source_location[0])
|
@@ -120,10 +136,43 @@ def assert_noraises
|
|
120
136
|
yield
|
121
137
|
end
|
122
138
|
|
139
|
+
class TestNamePrinter
|
140
|
+
def ===(v)
|
141
|
+
puts " #{v}"
|
142
|
+
return false
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
$test_options = OpenStruct.new
|
147
|
+
$test_options.show_counts = true
|
148
|
+
$test_selectors = (if __FILE__ == $0
|
149
|
+
[].tap do |selectors|
|
150
|
+
|
151
|
+
args = ARGV.dup
|
152
|
+
until args.empty? do
|
153
|
+
case
|
154
|
+
when args[0] == '--list'
|
155
|
+
$test_options.list_tests = true
|
156
|
+
$test_options.show_counts = false
|
157
|
+
args.shift
|
158
|
+
when args[0].start_with?('re:')
|
159
|
+
selectors << Regexp.new(args.shift[3..-1])
|
160
|
+
else
|
161
|
+
selectors << args.shift
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
if $test_options.list_tests
|
166
|
+
selectors.replace [TestNamePrinter.new]
|
167
|
+
end
|
168
|
+
end
|
169
|
+
else
|
170
|
+
[Object]
|
171
|
+
end)
|
172
|
+
|
123
173
|
TESTS.each {|t| require "test/#{t}"}
|
124
174
|
|
125
175
|
puts
|
126
|
-
puts "#{$test_successes}/#{$test_count} succeeded"
|
176
|
+
puts "#{$test_successes}/#{$test_count} succeeded" if $test_options.show_counts
|
127
177
|
puts "Failed tests:" unless $tests_failed.empty?
|
128
178
|
$tests_failed.each {|name| puts " #{name}"}
|
129
|
-
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xmigra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Next IT Corporation
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-11-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -58,7 +58,27 @@ files:
|
|
58
58
|
- Rakefile
|
59
59
|
- bin/xmigra
|
60
60
|
- lib/xmigra.rb
|
61
|
+
- lib/xmigra/access_artifact.rb
|
62
|
+
- lib/xmigra/access_artifact_collection.rb
|
63
|
+
- lib/xmigra/branch_upgrade.rb
|
64
|
+
- lib/xmigra/db_support/mssql.rb
|
65
|
+
- lib/xmigra/function.rb
|
66
|
+
- lib/xmigra/index.rb
|
67
|
+
- lib/xmigra/index_collection.rb
|
68
|
+
- lib/xmigra/migration.rb
|
69
|
+
- lib/xmigra/migration_chain.rb
|
70
|
+
- lib/xmigra/migration_conflict.rb
|
71
|
+
- lib/xmigra/new_file.rb
|
72
|
+
- lib/xmigra/new_migration_adder.rb
|
73
|
+
- lib/xmigra/permission_script_writer.rb
|
74
|
+
- lib/xmigra/program.rb
|
75
|
+
- lib/xmigra/schema_manipulator.rb
|
76
|
+
- lib/xmigra/schema_updater.rb
|
77
|
+
- lib/xmigra/stored_procedure.rb
|
78
|
+
- lib/xmigra/vcs_support/git.rb
|
79
|
+
- lib/xmigra/vcs_support/svn.rb
|
61
80
|
- lib/xmigra/version.rb
|
81
|
+
- lib/xmigra/view.rb
|
62
82
|
- test/git_vcs.rb
|
63
83
|
- test/runner.rb
|
64
84
|
- xmigra.gemspec
|