physique 0.3.10 → 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/FLUENT_MIGRATOR.md +300 -300
- data/Gemfile +3 -3
- data/Gemfile.lock +51 -11
- data/Guardfile +34 -0
- data/README.md +368 -368
- data/RUBY_SETUP.md +14 -14
- data/Rakefile +1 -1
- data/lib/physique.rb +22 -22
- data/lib/physique/config.rb +23 -23
- data/lib/physique/dsl.rb +46 -46
- data/lib/physique/project_path_resolver.rb +45 -45
- data/lib/physique/solution.rb +72 -72
- data/lib/physique/task_builders/build.rb +76 -69
- data/lib/physique/task_builders/default.rb +19 -19
- data/lib/physique/task_builders/fluent_migrator.rb +302 -299
- data/lib/physique/task_builders/nuget.rb +18 -6
- data/lib/physique/task_builders/octopus.rb +4 -2
- data/lib/physique/task_builders/publish_nugets.rb +5 -3
- data/lib/physique/task_builders/test.rb +4 -4
- data/lib/physique/tasks/fluent_migrator.rb +158 -158
- data/lib/physique/tasks/nugets_pack.rb +12 -12
- data/lib/physique/tasks/octopus_pack.rb +1 -1
- data/lib/physique/tasks/sqlcmd.rb +109 -109
- data/lib/physique/tasks/versionizer.rb +112 -112
- data/lib/physique/tasks_builder.rb +59 -59
- data/lib/physique/tool_locator.rb +50 -50
- data/lib/physique/version.rb +3 -3
- data/physique.gemspec +29 -28
- data/spec/fluent_migrator_config_spec.rb +39 -39
- data/spec/project_spec.rb +42 -42
- data/spec/publish_nugets_spec.rb +40 -40
- data/spec/solution_spec.rb +11 -11
- data/spec/sqlcmd_spec.rb +146 -146
- data/spec/support/shared_contexts/rake.rb +20 -21
- data/spec/task_builders/build_spec.rb +25 -25
- data/spec/task_builders/default_spec.rb +17 -17
- data/spec/task_builders/fluent_migrator_spec.rb +70 -68
- data/spec/task_builders/nspec_spec.rb +13 -13
- data/spec/task_builders/nuget_spec.rb +16 -16
- data/spec/test_data/solutions/.nuget/NuGet.Config +5 -5
- data/spec/test_data/solutions/.nuget/NuGet.exe +0 -0
- data/spec/test_data/solutions/.nuget/NuGet.targets +144 -144
- data/spec/test_data/solutions/.nuget/packages.config +3 -3
- data/spec/test_data/solutions/basic/.semver +6 -6
- data/spec/test_data/solutions/basic/Basic.Tests/Basic.Tests.csproj +58 -58
- data/spec/test_data/solutions/basic/Basic.Tests/Class1.cs +14 -14
- data/spec/test_data/solutions/basic/Basic.Tests/Properties/AssemblyInfo.cs +36 -36
- data/spec/test_data/solutions/basic/Basic.Tests/packages.config +3 -3
- data/spec/test_data/solutions/basic/Basic.sln +28 -28
- data/spec/test_data/solutions/basic/Basic/Basic.csproj +52 -52
- data/spec/test_data/solutions/basic/Basic/Class1.cs +12 -12
- data/spec/test_data/solutions/basic/Basic/Properties/AssemblyInfo.cs +36 -36
- data/spec/test_data/solutions/basic/Rakefile.rb +10 -10
- data/spec/test_data/solutions/basic/packages.config +3 -3
- data/spec/test_data/solutions/fluent-migrator/.semver +6 -6
- data/spec/test_data/solutions/fluent-migrator/Basic.Migrations/Migrations/.gitkeep +0 -0
- data/spec/test_data/solutions/fluent-migrator/Basic.Migrations/Properties/AssemblyInfo.cs +36 -36
- data/spec/test_data/solutions/fluent-migrator/Basic.Migrations/TestMigration.cs +19 -19
- data/spec/test_data/solutions/fluent-migrator/Basic.Migrations/_Scripts/create.sql +1 -1
- data/spec/test_data/solutions/fluent-migrator/Basic.Migrations/_Scripts/drop.sql +4 -4
- data/spec/test_data/solutions/fluent-migrator/Basic.Migrations/_Scripts/seed.sql +1 -1
- data/spec/test_data/solutions/fluent-migrator/Basic.Migrations/packages.config +3 -3
- data/spec/test_data/solutions/fluent-migrator/Basic.Specs/Basic.Specs.csproj +59 -59
- data/spec/test_data/solutions/fluent-migrator/Basic.Specs/Class1.cs +12 -12
- data/spec/test_data/solutions/fluent-migrator/Basic.Specs/DebuggerShim.cs +42 -42
- data/spec/test_data/solutions/fluent-migrator/Basic.Specs/Properties/AssemblyInfo.cs +36 -36
- data/spec/test_data/solutions/fluent-migrator/Basic.Specs/packages.config +3 -3
- data/spec/test_data/solutions/fluent-migrator/Basic.sln +39 -39
- data/spec/test_data/solutions/fluent-migrator/Basic/Basic.csproj +55 -55
- data/spec/test_data/solutions/fluent-migrator/Basic/Class1.cs +12 -12
- data/spec/test_data/solutions/fluent-migrator/Basic/Properties/AssemblyInfo.cs +36 -36
- data/spec/test_data/solutions/fluent-migrator/Basic/packages.config +2 -2
- data/spec/test_data/solutions/fluent-migrator/Rakefile.rb +20 -20
- data/spec/test_data/solutions/multiple-fluent-migrator/.semver +6 -6
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Migrations1/Basic.Migrations1.csproj +52 -52
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Migrations1/Class1.cs +12 -12
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Migrations1/Properties/AssemblyInfo.cs +36 -36
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Migrations2/Basic.Migrations2.csproj +52 -52
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Migrations2/Class1.cs +12 -12
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Migrations2/Properties/AssemblyInfo.cs +36 -36
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Specs/Basic.Specs.csproj +59 -59
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Specs/Class1.cs +12 -12
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Specs/DebuggerShim.cs +42 -42
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Specs/Properties/AssemblyInfo.cs +36 -36
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic.Specs/packages.config +3 -3
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic.sln +45 -45
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic/Basic.csproj +55 -55
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic/Class1.cs +12 -12
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic/Properties/AssemblyInfo.cs +36 -36
- data/spec/test_data/solutions/multiple-fluent-migrator/Basic/packages.config +2 -2
- data/spec/test_data/solutions/multiple-fluent-migrator/Rakefile.rb +28 -28
- data/spec/test_data/solutions/nspec/.semver +6 -6
- data/spec/test_data/solutions/nspec/Basic.Specs/Basic.Specs.csproj +59 -59
- data/spec/test_data/solutions/nspec/Basic.Specs/Class1.cs +12 -12
- data/spec/test_data/solutions/nspec/Basic.Specs/DebuggerShim.cs +42 -42
- data/spec/test_data/solutions/nspec/Basic.Specs/Properties/AssemblyInfo.cs +36 -36
- data/spec/test_data/solutions/nspec/Basic.Specs/packages.config +3 -3
- data/spec/test_data/solutions/nspec/Basic.sln +28 -28
- data/spec/test_data/solutions/nspec/Basic/Basic.csproj +55 -55
- data/spec/test_data/solutions/nspec/Basic/Class1.cs +12 -12
- data/spec/test_data/solutions/nspec/Basic/Properties/AssemblyInfo.cs +36 -36
- data/spec/test_data/solutions/nspec/Basic/packages.config +2 -2
- data/spec/test_data/solutions/nspec/Rakefile.rb +14 -14
- data/spec/test_data/tool_locator/Program Files/Microsoft SQL Server/110/Tools/Binn/SQLCMD.exe.txt b/data/spec/test_data/tool_locator/Program Files/Microsoft SQL → Server/110/Tools/Binn/SQLCMD.exe.txt +0 -0
- data/spec/test_data/tool_locator/Windows/Microsoft.NET/Framework/v3.5/MSBuild.exe.txt +0 -0
- data/spec/test_data/tool_locator/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe.txt +0 -0
- data/spec/tool_locator_spec.rb +27 -29
- metadata +33 -16
@@ -4,13 +4,18 @@ module Physique
|
|
4
4
|
|
5
5
|
attr_path :exe, # Path to nuget executable
|
6
6
|
:restore_location, # Path where nuget packages will be downloaded
|
7
|
-
:build_location
|
7
|
+
:build_location, # Path where nuget packages will be built
|
8
|
+
:disable_restore # Disable the restore step
|
8
9
|
|
9
10
|
# Disable metadata analysis (sets -NoPackageAnalysis flag)
|
10
11
|
def disable_package_analysis
|
11
12
|
@disable_package_analysis = true
|
12
13
|
end
|
13
14
|
|
15
|
+
def disable_restore
|
16
|
+
@disable_restore = true
|
17
|
+
end
|
18
|
+
|
14
19
|
def initialize
|
15
20
|
@exe = 'src/.nuget/NuGet.exe'
|
16
21
|
@restore_location = 'src/packages'
|
@@ -22,7 +27,8 @@ module Physique
|
|
22
27
|
exe: @exe,
|
23
28
|
restore_location: @restore_location,
|
24
29
|
build_location: @build_location,
|
25
|
-
disable_package_analysis: !!@disable_package_analysis
|
30
|
+
disable_package_analysis: !!@disable_package_analysis,
|
31
|
+
disable_restore: !!@disable_restore
|
26
32
|
})
|
27
33
|
end
|
28
34
|
end
|
@@ -36,10 +42,16 @@ module Physique
|
|
36
42
|
|
37
43
|
def add_restore_task
|
38
44
|
desc 'Restores all nugets as per the packages.config files'
|
39
|
-
|
40
|
-
|
41
|
-
|
45
|
+
if solution.nuget.disable_restore
|
46
|
+
task :restore do
|
47
|
+
puts 'Nuget package restore skipped via configuration.'
|
48
|
+
end
|
49
|
+
else
|
50
|
+
nugets_restore :restore do |r|
|
51
|
+
r.out = solution.nuget.restore_location
|
52
|
+
r.exe = solution.nuget.exe
|
53
|
+
end
|
42
54
|
end
|
43
55
|
end
|
44
56
|
end
|
45
|
-
end
|
57
|
+
end
|
@@ -116,10 +116,12 @@ module Physique
|
|
116
116
|
nuget = solution.nuget
|
117
117
|
|
118
118
|
@options.apps.each do |a|
|
119
|
+
project = Albacore::Project.new a.project_file
|
120
|
+
|
119
121
|
namespace a.name do
|
120
122
|
desc "Publish #{a.project} app to Octopus Server"
|
121
123
|
task :publish => [ "#{a.name}:package" ] do
|
122
|
-
package_location = Albacore::Paths.normalise_slashes "#{nuget.build_location}/#{
|
124
|
+
package_location = Albacore::Paths.normalise_slashes "#{nuget.build_location}/#{project.name}.#{a.metadata.version}.nupkg"
|
123
125
|
sh "#{nuget.exe} push #{package_location} -ApiKey #{@options.api_key} -Source #{@options.server}"
|
124
126
|
end
|
125
127
|
end
|
@@ -141,4 +143,4 @@ module Physique
|
|
141
143
|
task :publish => [ 'octo:publish' ]
|
142
144
|
end
|
143
145
|
end
|
144
|
-
end
|
146
|
+
end
|
@@ -36,7 +36,8 @@ module Physique
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def project_files_or_default
|
39
|
-
@project_files || 'src/**/*.{csproj,fsproj,nuspec}'
|
39
|
+
files = @project_files || 'src/**/*.{csproj,fsproj,nuspec}'
|
40
|
+
files.gsub('\\', '/')
|
40
41
|
end
|
41
42
|
|
42
43
|
def exclude_or_default
|
@@ -71,7 +72,7 @@ module Physique
|
|
71
72
|
|
72
73
|
def opts
|
73
74
|
raise ArgumentError, 'You must specify a name for all nuget feeds' if @name.blank?
|
74
|
-
raise ArgumentError, "You must specify a feed_url for feed #{name}" if @feed_url.blank?
|
75
|
+
raise ArgumentError, "You must specify a feed_url for feed #{@name}" if @feed_url.blank?
|
75
76
|
|
76
77
|
Map.new(
|
77
78
|
name: @name,
|
@@ -148,7 +149,8 @@ module Physique
|
|
148
149
|
desc 'Copy nuget packages to local path'
|
149
150
|
task :local => [ 'nuget:package' ] do
|
150
151
|
ensure_output_location local_path
|
151
|
-
|
152
|
+
build_location = solution.nuget.build_location.gsub('\\', '/')
|
153
|
+
FileUtils.cp FileList["#{build_location}/*"], local_path
|
152
154
|
end
|
153
155
|
end
|
154
156
|
end
|
@@ -65,14 +65,14 @@ module Physique
|
|
65
65
|
defaults = {
|
66
66
|
nunit: {
|
67
67
|
files: FileList["**/*.Tests/bin/#{configuration}/*.Tests.dll"],
|
68
|
-
exe: "#{package_dir}/NUnit.Runners
|
69
|
-
parameters: %w(
|
68
|
+
exe: "#{package_dir}/NUnit.Runners*/tools/nunit-console.exe",
|
69
|
+
parameters: %w(-labels -trace=Verbose)},
|
70
70
|
nspec: {
|
71
71
|
files: FileList["**/*.Specs/bin/#{configuration}/*.Specs.dll"],
|
72
|
-
exe: "#{package_dir}/nspec
|
72
|
+
exe: "#{package_dir}/nspec*/tools/NSpecRunner.exe",
|
73
73
|
parameters: []}}
|
74
74
|
|
75
75
|
defaults[options.runner]
|
76
76
|
end
|
77
77
|
end
|
78
|
-
end
|
78
|
+
end
|
@@ -1,159 +1,159 @@
|
|
1
|
-
require 'active_support/core_ext/string'
|
2
|
-
require 'map'
|
3
|
-
|
4
|
-
module Physique
|
5
|
-
module FluentMigrator
|
6
|
-
class Cmd
|
7
|
-
include Albacore::CrossPlatformCmd
|
8
|
-
|
9
|
-
attr_reader :parameters
|
10
|
-
|
11
|
-
def initialize(opts)
|
12
|
-
@work_dir = opts[:work_dir]
|
13
|
-
@executable = opts[:exe]
|
14
|
-
set_parameters opts
|
15
|
-
end
|
16
|
-
|
17
|
-
def execute
|
18
|
-
sh "#{@executable} #{@parameters.join(' ')}"
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
def set_parameters(opts)
|
24
|
-
@parameters = @parameters || []
|
25
|
-
@parameters << "--target #{opts.dll}"
|
26
|
-
@parameters << "--provider #{opts.dialect}"
|
27
|
-
@parameters << %Q{--connectionString "#{opts.connection_string}"}
|
28
|
-
@parameters << "--task #{opts.task}"
|
29
|
-
@parameters << "--namespace #{opts.namespace}" unless opts.namespace.blank?
|
30
|
-
@parameters << "--nested #{opts.nested}" unless opts.namespace.blank? # Modifies the namespace option
|
31
|
-
@parameters << "--output --outputFileName #{opts.output_file}" unless opts.output_file.blank?
|
32
|
-
@parameters << '--preview true' if opts.preview
|
33
|
-
@parameters << "--steps #{opts.steps}" if opts.task =~ /rollback/
|
34
|
-
@parameters << "--version #{opts.version}" if opts.task =~ /^migrate($|:up)|^rollback:toversion$/
|
35
|
-
@parameters << '--transaction-per-session' if opts.tps
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
class Config
|
40
|
-
include Albacore::CmdConfig
|
41
|
-
include Physique::ToolLocator
|
42
|
-
self.extend Albacore::ConfigDSL
|
43
|
-
|
44
|
-
# SQL Server instance
|
45
|
-
attr_path :instance
|
46
|
-
|
47
|
-
# SQL Server database
|
48
|
-
attr_writer :database
|
49
|
-
|
50
|
-
# SQL dialect
|
51
|
-
attr_writer :dialect
|
52
|
-
|
53
|
-
# Dll containing the migrations
|
54
|
-
attr_path :dll
|
55
|
-
|
56
|
-
# Namespace of migration to run
|
57
|
-
def namespace=(val)
|
58
|
-
@namespace = val
|
59
|
-
@nested = true
|
60
|
-
end
|
61
|
-
|
62
|
-
def shallow
|
63
|
-
@nested = false
|
64
|
-
end
|
65
|
-
|
66
|
-
def deep
|
67
|
-
@nested = true
|
68
|
-
end
|
69
|
-
|
70
|
-
# Migration task
|
71
|
-
attr_writer :task
|
72
|
-
|
73
|
-
# Version number to migrate to
|
74
|
-
attr_writer :version
|
75
|
-
|
76
|
-
# Number of steps to rollback
|
77
|
-
attr_writer :steps
|
78
|
-
|
79
|
-
# Verbosity
|
80
|
-
attr_writer :verbose
|
81
|
-
|
82
|
-
# Timeout
|
83
|
-
attr_writer :timeout
|
84
|
-
|
85
|
-
# Output file
|
86
|
-
attr_path :output_file
|
87
|
-
|
88
|
-
def output_to_file
|
89
|
-
# Set a default output file
|
90
|
-
@output_file = "#{@database}-output.sql"
|
91
|
-
end
|
92
|
-
|
93
|
-
def transaction_per_session
|
94
|
-
@tps = true
|
95
|
-
end
|
96
|
-
|
97
|
-
def preview
|
98
|
-
@preview = true
|
99
|
-
end
|
100
|
-
|
101
|
-
# Path Migrator executable
|
102
|
-
attr_path :exe
|
103
|
-
|
104
|
-
# Bin folder to look find the Migrate tool if :exe is not set
|
105
|
-
attr_path :bin_dir
|
106
|
-
|
107
|
-
def opts
|
108
|
-
raise ArgumentError, 'You must specify a server name' if @instance.blank?
|
109
|
-
raise ArgumentError, 'You must specify a database name' if @database.blank?
|
110
|
-
raise ArgumentError, 'You must specify the path to the migrator executable' if @exe.blank?
|
111
|
-
raise ArgumentError, 'You must specify a migration dll' if @dll.blank?
|
112
|
-
raise ArgumentError, 'You must specify a valid task' unless valid_tasks.include? @task
|
113
|
-
|
114
|
-
Map.new({
|
115
|
-
connection_string: connection_string,
|
116
|
-
dialect: @dialect,
|
117
|
-
dll: @dll,
|
118
|
-
namespace: @namespace,
|
119
|
-
nested: @nested,
|
120
|
-
task: @task,
|
121
|
-
version: @version,
|
122
|
-
steps: @steps,
|
123
|
-
verbose: @verbose,
|
124
|
-
output_file: @output_file,
|
125
|
-
exe: @exe,
|
126
|
-
tps: @tps,
|
127
|
-
preview: @preview,
|
128
|
-
timeout: @timeout,
|
129
|
-
}).apply(
|
130
|
-
dialect: 'SqlServer2008',
|
131
|
-
verbose: true,
|
132
|
-
version: 0,
|
133
|
-
steps: 1,
|
134
|
-
timeout: 30 # seconds
|
135
|
-
)
|
136
|
-
end
|
137
|
-
|
138
|
-
private
|
139
|
-
|
140
|
-
def connection_string
|
141
|
-
"Data Source=#{@instance};Initial Catalog=#{@database};Integrated Security=True;"
|
142
|
-
end
|
143
|
-
|
144
|
-
def valid_tasks
|
145
|
-
%w{migrate:up migrate migrate:down rollback rollback:toversion rollback:all validateversionorder listmigrations}
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
class Task
|
150
|
-
def initialize(opts)
|
151
|
-
@cmd = Physique::FluentMigrator::Cmd.new opts
|
152
|
-
end
|
153
|
-
|
154
|
-
def execute
|
155
|
-
@cmd.execute
|
156
|
-
end
|
157
|
-
end
|
158
|
-
end
|
1
|
+
require 'active_support/core_ext/string'
|
2
|
+
require 'map'
|
3
|
+
|
4
|
+
module Physique
|
5
|
+
module FluentMigrator
|
6
|
+
class Cmd
|
7
|
+
include Albacore::CrossPlatformCmd
|
8
|
+
|
9
|
+
attr_reader :parameters
|
10
|
+
|
11
|
+
def initialize(opts)
|
12
|
+
@work_dir = opts[:work_dir]
|
13
|
+
@executable = opts[:exe]
|
14
|
+
set_parameters opts
|
15
|
+
end
|
16
|
+
|
17
|
+
def execute
|
18
|
+
sh "#{@executable} #{@parameters.join(' ')}"
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def set_parameters(opts)
|
24
|
+
@parameters = @parameters || []
|
25
|
+
@parameters << "--target #{opts.dll}"
|
26
|
+
@parameters << "--provider #{opts.dialect}"
|
27
|
+
@parameters << %Q{--connectionString "#{opts.connection_string}"}
|
28
|
+
@parameters << "--task #{opts.task}"
|
29
|
+
@parameters << "--namespace #{opts.namespace}" unless opts.namespace.blank?
|
30
|
+
@parameters << "--nested #{opts.nested}" unless opts.namespace.blank? # Modifies the namespace option
|
31
|
+
@parameters << "--output --outputFileName #{opts.output_file}" unless opts.output_file.blank?
|
32
|
+
@parameters << '--preview true' if opts.preview
|
33
|
+
@parameters << "--steps #{opts.steps}" if opts.task =~ /rollback/
|
34
|
+
@parameters << "--version #{opts.version}" if opts.task =~ /^migrate($|:up)|^rollback:toversion$/
|
35
|
+
@parameters << '--transaction-per-session' if opts.tps
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
class Config
|
40
|
+
include Albacore::CmdConfig
|
41
|
+
include Physique::ToolLocator
|
42
|
+
self.extend Albacore::ConfigDSL
|
43
|
+
|
44
|
+
# SQL Server instance
|
45
|
+
attr_path :instance
|
46
|
+
|
47
|
+
# SQL Server database
|
48
|
+
attr_writer :database
|
49
|
+
|
50
|
+
# SQL dialect
|
51
|
+
attr_writer :dialect
|
52
|
+
|
53
|
+
# Dll containing the migrations
|
54
|
+
attr_path :dll
|
55
|
+
|
56
|
+
# Namespace of migration to run
|
57
|
+
def namespace=(val)
|
58
|
+
@namespace = val
|
59
|
+
@nested = true
|
60
|
+
end
|
61
|
+
|
62
|
+
def shallow
|
63
|
+
@nested = false
|
64
|
+
end
|
65
|
+
|
66
|
+
def deep
|
67
|
+
@nested = true
|
68
|
+
end
|
69
|
+
|
70
|
+
# Migration task
|
71
|
+
attr_writer :task
|
72
|
+
|
73
|
+
# Version number to migrate to
|
74
|
+
attr_writer :version
|
75
|
+
|
76
|
+
# Number of steps to rollback
|
77
|
+
attr_writer :steps
|
78
|
+
|
79
|
+
# Verbosity
|
80
|
+
attr_writer :verbose
|
81
|
+
|
82
|
+
# Timeout
|
83
|
+
attr_writer :timeout
|
84
|
+
|
85
|
+
# Output file
|
86
|
+
attr_path :output_file
|
87
|
+
|
88
|
+
def output_to_file
|
89
|
+
# Set a default output file
|
90
|
+
@output_file = "#{@database}-output.sql"
|
91
|
+
end
|
92
|
+
|
93
|
+
def transaction_per_session
|
94
|
+
@tps = true
|
95
|
+
end
|
96
|
+
|
97
|
+
def preview
|
98
|
+
@preview = true
|
99
|
+
end
|
100
|
+
|
101
|
+
# Path Migrator executable
|
102
|
+
attr_path :exe
|
103
|
+
|
104
|
+
# Bin folder to look find the Migrate tool if :exe is not set
|
105
|
+
attr_path :bin_dir
|
106
|
+
|
107
|
+
def opts
|
108
|
+
raise ArgumentError, 'You must specify a server name' if @instance.blank?
|
109
|
+
raise ArgumentError, 'You must specify a database name' if @database.blank?
|
110
|
+
raise ArgumentError, 'You must specify the path to the migrator executable' if @exe.blank?
|
111
|
+
raise ArgumentError, 'You must specify a migration dll' if @dll.blank?
|
112
|
+
raise ArgumentError, 'You must specify a valid task' unless valid_tasks.include? @task
|
113
|
+
|
114
|
+
Map.new({
|
115
|
+
connection_string: connection_string,
|
116
|
+
dialect: @dialect,
|
117
|
+
dll: @dll,
|
118
|
+
namespace: @namespace,
|
119
|
+
nested: @nested,
|
120
|
+
task: @task,
|
121
|
+
version: @version,
|
122
|
+
steps: @steps,
|
123
|
+
verbose: @verbose,
|
124
|
+
output_file: @output_file,
|
125
|
+
exe: @exe,
|
126
|
+
tps: @tps,
|
127
|
+
preview: @preview,
|
128
|
+
timeout: @timeout,
|
129
|
+
}).apply(
|
130
|
+
dialect: 'SqlServer2008',
|
131
|
+
verbose: true,
|
132
|
+
version: 0,
|
133
|
+
steps: 1,
|
134
|
+
timeout: 30 # seconds
|
135
|
+
)
|
136
|
+
end
|
137
|
+
|
138
|
+
private
|
139
|
+
|
140
|
+
def connection_string
|
141
|
+
"Data Source=#{@instance};Initial Catalog=#{@database};Integrated Security=True;"
|
142
|
+
end
|
143
|
+
|
144
|
+
def valid_tasks
|
145
|
+
%w{migrate:up migrate migrate:down rollback rollback:toversion rollback:all validateversionorder listmigrations}
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
class Task
|
150
|
+
def initialize(opts)
|
151
|
+
@cmd = Physique::FluentMigrator::Cmd.new opts
|
152
|
+
end
|
153
|
+
|
154
|
+
def execute
|
155
|
+
@cmd.execute
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
159
|
end
|
@@ -1,12 +1,12 @@
|
|
1
|
-
require 'albacore/task_types/nugets_pack'
|
2
|
-
|
3
|
-
module Albacore
|
4
|
-
module NugetsPack
|
5
|
-
# the nuget command
|
6
|
-
class Cmd
|
7
|
-
def disable_package_analysis
|
8
|
-
@parameters << '-NoPackageAnalysis'
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
1
|
+
require 'albacore/task_types/nugets_pack'
|
2
|
+
|
3
|
+
module Albacore
|
4
|
+
module NugetsPack
|
5
|
+
# the nuget command
|
6
|
+
class Cmd
|
7
|
+
def disable_package_analysis
|
8
|
+
@parameters << '-NoPackageAnalysis'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|