albacore 2.5.9 → 2.5.10
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/albacore/dsl.rb +41 -0
- data/lib/albacore/task_types/is_package.rb +89 -0
- data/lib/albacore/task_types/sql_cmd.rb +143 -0
- data/lib/albacore/task_types/sql_package.rb +123 -0
- data/lib/albacore/task_types/test_runner.rb +10 -1
- data/lib/albacore/version.rb +1 -1
- data/spec/is_package_spec.rb +93 -0
- data/spec/sql_cmd_spec.rb +84 -0
- data/spec/sql_package_spec.rb +84 -0
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cbc700a8168d45b49e19d09acbbd784d954dfe5
|
4
|
+
data.tar.gz: 7921d1d7237ada811a6a76587a1507da1d20d90b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d36aa082a7b7d2b988afae4c017e1c1d0e546d7c594160d218d705122fcf47ddb7bb6a43ab0c149c348a77411d7e4f749b58fe92e2640b29bfc088a4407b6845
|
7
|
+
data.tar.gz: b54b440e500bf7069357a1a496c515bf45e5639e5ac1fc178f6f535a421492404828c0a94d56c5cd73de1f12969aad7ac58e0f1401143e89b78e3f31e34ca979
|
data/lib/albacore/dsl.rb
CHANGED
@@ -113,6 +113,47 @@ module Albacore
|
|
113
113
|
end
|
114
114
|
end
|
115
115
|
end
|
116
|
+
|
117
|
+
# a task for publishing sql databases
|
118
|
+
# with SqlPackage
|
119
|
+
def sql_package *args, &block
|
120
|
+
require 'albacore/task_types/sql_package'
|
121
|
+
Albacore.define_task *args do
|
122
|
+
c = Albacore::SqlPackage::Config.new
|
123
|
+
yield c
|
124
|
+
|
125
|
+
fail "SqlPackage.exe is not installed.\nPlease download and install Microsoft SSDT: https://msdn.microsoft.com/en-us/library/mt204009.aspx\nAnd add the location of SqlPackage.exe to the PATH system varible." unless c.exe
|
126
|
+
|
127
|
+
command = Albacore::SqlPackage::Cmd.new(c.work_dir, c.exe, c.parameters)
|
128
|
+
Albacore::SqlPackage::Task.new(command).execute
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
# a task for publishing sql scripts
|
133
|
+
# with Sql
|
134
|
+
def sql_cmd *args, &block
|
135
|
+
require 'albacore/task_types/sql_cmd'
|
136
|
+
Albacore.define_task *args do
|
137
|
+
c = Albacore::Sql::Config.new
|
138
|
+
yield c
|
139
|
+
Albacore::Sql::SqlTask.new(c.work_dir, c.opts).execute
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
# a task for publishing Integration Services Packages
|
144
|
+
# with IsPackage
|
145
|
+
def is_package *args, &block
|
146
|
+
require 'albacore/task_types/is_package'
|
147
|
+
Albacore.define_task *args do
|
148
|
+
c = Albacore::IsPackage::Config.new
|
149
|
+
yield c
|
150
|
+
|
151
|
+
fail "IsPackage.exe is not installed.\nPlease download and install Microsoft SSDT-BI: https://msdn.microsoft.com/en-us/library/mt674919.aspx\nAnd add the location of IsPackage.exe to the PATH system varible." unless c.exe
|
152
|
+
|
153
|
+
command = Albacore::IsPackage::Cmd.new(c.work_dir, c.exe, c.get_parameters)
|
154
|
+
Albacore::IsPackage::Task.new(command).execute
|
155
|
+
end
|
156
|
+
end
|
116
157
|
end
|
117
158
|
end
|
118
159
|
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rake'
|
4
|
+
require 'albacore/paths'
|
5
|
+
require 'albacore/cmd_config'
|
6
|
+
require 'albacore/cross_platform_cmd'
|
7
|
+
require 'albacore/logging'
|
8
|
+
require 'albacore/facts'
|
9
|
+
|
10
|
+
module Albacore
|
11
|
+
module IsPackage
|
12
|
+
class Cmd
|
13
|
+
include CrossPlatformCmd
|
14
|
+
def initialize work_dir, executable, parameters
|
15
|
+
@work_dir = work_dir
|
16
|
+
@executable = executable
|
17
|
+
@parameters = (parameters === Array) ? parameters : parameters.to_a
|
18
|
+
end
|
19
|
+
def execute
|
20
|
+
system @executable, @parameters, :work_dir => @work_dir
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# The configuration class for ISDeploymentWizard. MSDN docs at: https://msdn.microsoft.com/en-gb/library/hh213373.aspx
|
25
|
+
class Config
|
26
|
+
include CmdConfig
|
27
|
+
self.extend ConfigDSL
|
28
|
+
include Logging
|
29
|
+
|
30
|
+
# this is the is_package of ISDeploymentWizard
|
31
|
+
attr_reader :is_package
|
32
|
+
|
33
|
+
# this is the server of ISDeploymentWizard
|
34
|
+
attr_reader :server
|
35
|
+
|
36
|
+
# this is the database of ISDeploymentWizard
|
37
|
+
attr_accessor :database
|
38
|
+
|
39
|
+
# this is the folder_name of ISDeploymentWizard
|
40
|
+
attr_accessor :folder_name
|
41
|
+
|
42
|
+
# this is the project_name of ISDeploymentWizard
|
43
|
+
attr_accessor :project_name
|
44
|
+
|
45
|
+
|
46
|
+
def initialize
|
47
|
+
@parameters = Set.new
|
48
|
+
|
49
|
+
w = lambda { |e| CrossPlatformCmd.which(e) ? e : nil }
|
50
|
+
|
51
|
+
@exe = w.call( "ISDeploymentWizard" )
|
52
|
+
|
53
|
+
debug { "ISDeploymentWizard using '#{@exe}'" }
|
54
|
+
end
|
55
|
+
|
56
|
+
def be_quiet
|
57
|
+
@parameters.add "/Silent"
|
58
|
+
end
|
59
|
+
|
60
|
+
attr_path_accessor :is_package do |s|
|
61
|
+
@parameters.add "/SourcePath:#{s}"
|
62
|
+
end
|
63
|
+
|
64
|
+
attr_path_accessor :server do |ds|
|
65
|
+
@parameters.add "/DestinationServer:#{ds}"
|
66
|
+
end
|
67
|
+
|
68
|
+
def get_parameters
|
69
|
+
make_folder
|
70
|
+
@parameters
|
71
|
+
end
|
72
|
+
|
73
|
+
private
|
74
|
+
|
75
|
+
def make_folder
|
76
|
+
@parameters.add "/DestinationPath:/#{database}/#{folder_name}/#{project_name}"
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
class Task
|
81
|
+
def initialize command_line
|
82
|
+
@command_line = command_line
|
83
|
+
end
|
84
|
+
def execute
|
85
|
+
@command_line.execute
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,143 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rake'
|
4
|
+
require 'albacore/paths'
|
5
|
+
require 'albacore/cmd_config'
|
6
|
+
require 'albacore/cross_platform_cmd'
|
7
|
+
require 'albacore/logging'
|
8
|
+
require 'albacore/facts'
|
9
|
+
|
10
|
+
module Albacore
|
11
|
+
module Sql
|
12
|
+
class Cmd
|
13
|
+
include CrossPlatformCmd
|
14
|
+
def initialize work_dir, executable, parameters
|
15
|
+
@work_dir = work_dir
|
16
|
+
@executable = executable
|
17
|
+
@parameters = (parameters === Array) ? parameters : parameters.to_a
|
18
|
+
end
|
19
|
+
def execute
|
20
|
+
system @executable, @parameters, :work_dir => @work_dir
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# The configuration class for SqlCmd. MSDN docs at: https://msdn.microsoft.com/en-us/library/ms162773.aspx
|
25
|
+
class Config
|
26
|
+
include CmdConfig
|
27
|
+
self.extend ConfigDSL
|
28
|
+
include Logging
|
29
|
+
|
30
|
+
# this is the server for SqlCmd
|
31
|
+
attr_writer :server
|
32
|
+
|
33
|
+
# this is the database for SqlCmd
|
34
|
+
attr_writer :database
|
35
|
+
|
36
|
+
# this is the username for SqlCmd
|
37
|
+
attr_writer :username
|
38
|
+
|
39
|
+
# this is the password for SqlCmd
|
40
|
+
attr_writer :password
|
41
|
+
|
42
|
+
# this is the scripts for SqlCmd
|
43
|
+
attr_writer :scripts
|
44
|
+
|
45
|
+
def initialize
|
46
|
+
@parameters = Set.new
|
47
|
+
|
48
|
+
w = lambda { |e| CrossPlatformCmd.which(e) ? e : nil }
|
49
|
+
|
50
|
+
@exe = w.call( "SqlCmd" )
|
51
|
+
|
52
|
+
debug { "SqlCmd using '#{@exe}'" }
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
def trusted_connection
|
57
|
+
@parameters.add('-E')
|
58
|
+
end
|
59
|
+
|
60
|
+
attr_path_accessor :server do |s|
|
61
|
+
@parameters.add("-S#{s}")
|
62
|
+
end
|
63
|
+
|
64
|
+
attr_path_accessor :database do |d|
|
65
|
+
@parameters.add("-d#{d}")
|
66
|
+
end
|
67
|
+
|
68
|
+
attr_path_accessor :username do |u|
|
69
|
+
@parameters.add("-U#{u}")
|
70
|
+
@parameters.delete('-E')
|
71
|
+
end
|
72
|
+
|
73
|
+
attr_path_accessor :password do |p|
|
74
|
+
@parameters.add("-P#{p}")
|
75
|
+
@parameters.delete('-E')
|
76
|
+
end
|
77
|
+
|
78
|
+
# gets the options specified for the task, used from the task
|
79
|
+
def opts
|
80
|
+
|
81
|
+
Map.new({
|
82
|
+
:exe => @exe,
|
83
|
+
:parameters => @parameters,
|
84
|
+
:scripts => @scripts,
|
85
|
+
:original_path => FileUtils.pwd
|
86
|
+
})
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
# a task that handles the execution of sql scripts.
|
92
|
+
class SqlTask
|
93
|
+
include Logging
|
94
|
+
|
95
|
+
def initialize work_dir, opts
|
96
|
+
raise ArgumentError, 'opts is not a map' unless opts.is_a? Map
|
97
|
+
raise ArgumentError, 'no scripts given' unless opts.get(:scripts).length > 0
|
98
|
+
raise ArgumentError, 'no parameters given' unless opts.get(:parameters).length > 0
|
99
|
+
|
100
|
+
@opts = opts.apply :work_dir => work_dir
|
101
|
+
@scripts = opts.get :scripts
|
102
|
+
end
|
103
|
+
|
104
|
+
def execute
|
105
|
+
@scripts.each do |s|
|
106
|
+
execute_inner! @opts.get(:work_dir), s
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
# execute, for each sql script
|
111
|
+
def execute_inner! work_dir, script
|
112
|
+
|
113
|
+
exe = path_to(@opts.get(:exe), work_dir)
|
114
|
+
parameters = @opts.get(:parameters)
|
115
|
+
parameters.add("-i#{script.gsub('/','\\')}")
|
116
|
+
|
117
|
+
cmd = Albacore::Sql::Cmd.new(work_dir, exe, parameters)
|
118
|
+
|
119
|
+
cmd.execute
|
120
|
+
|
121
|
+
fail "SqlCmd.exe is not installed.\nPlease download and install Microsoft SQL Server 2012 Command Line Utilities: https://www.microsoft.com/en-gb/download/confirmation.aspx?id=29065\nAnd add the location of SqlCmd.exe to the PATH system varible." unless exe
|
122
|
+
|
123
|
+
end
|
124
|
+
|
125
|
+
def path_to path, work_dir
|
126
|
+
if (Pathname.new path).absolute?
|
127
|
+
return path
|
128
|
+
else
|
129
|
+
return File.expand_path( File.join(@opts.get(:original_path), path), work_dir )
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
class Task
|
135
|
+
def initialize command_line
|
136
|
+
@command_line = command_line
|
137
|
+
end
|
138
|
+
def execute
|
139
|
+
@command_line.execute
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rake'
|
4
|
+
require 'albacore/paths'
|
5
|
+
require 'albacore/cmd_config'
|
6
|
+
require 'albacore/cross_platform_cmd'
|
7
|
+
require 'albacore/logging'
|
8
|
+
require 'albacore/facts'
|
9
|
+
|
10
|
+
module Albacore
|
11
|
+
module SqlPackage
|
12
|
+
class Cmd
|
13
|
+
include CrossPlatformCmd
|
14
|
+
def initialize work_dir, executable, parameters
|
15
|
+
@work_dir = work_dir
|
16
|
+
@executable = executable
|
17
|
+
@parameters = (parameters === Array) ? parameters : parameters.to_a
|
18
|
+
end
|
19
|
+
def execute
|
20
|
+
system @executable, @parameters, :work_dir => @work_dir
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# The configuration class for SqlPackage. MSDN docs at: https://msdn.microsoft.com/en-us/library/hh550080(vs.103).aspx
|
25
|
+
class Config
|
26
|
+
include CmdConfig
|
27
|
+
self.extend ConfigDSL
|
28
|
+
include Logging
|
29
|
+
|
30
|
+
# TODO: move towards #opts() for all task types rather than
|
31
|
+
# reading these public properties.
|
32
|
+
|
33
|
+
# this is the action of SqlPackage
|
34
|
+
attr_reader :action
|
35
|
+
|
36
|
+
# this is the sql_package of SqlPackage
|
37
|
+
attr_reader :sql_package
|
38
|
+
|
39
|
+
# this is the profile of SqlPackage
|
40
|
+
attr_reader :profile
|
41
|
+
|
42
|
+
# any properties you want to set
|
43
|
+
attr_accessor :properties
|
44
|
+
|
45
|
+
def initialize
|
46
|
+
@parameters = Set.new
|
47
|
+
|
48
|
+
w = lambda { |e| CrossPlatformCmd.which(e) ? e : nil }
|
49
|
+
|
50
|
+
@exe = w.call( "SqlPackage" )
|
51
|
+
|
52
|
+
debug { "SqlPackage using '#{@exe}'" }
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
# Allows you to add properties to MsBuild; example:
|
57
|
+
#
|
58
|
+
# b.prop 'CommandTimeout', 60
|
59
|
+
# b.prop 'DacMajorVersion', 1
|
60
|
+
#
|
61
|
+
# The properties will be automatically converted to the correct syntax
|
62
|
+
def prop k, v
|
63
|
+
@properties ||= Hash.new
|
64
|
+
@parameters.delete "/p:#{make_props}" if @properties.any?
|
65
|
+
@properties[k] = v
|
66
|
+
@parameters.add "/p:#{make_props}"
|
67
|
+
end
|
68
|
+
|
69
|
+
# Specifies the action to be performed.
|
70
|
+
attr_path_accessor :action do |a|
|
71
|
+
set_action a
|
72
|
+
end
|
73
|
+
|
74
|
+
# Specifies whether checks should be performed before publishing that will stop the
|
75
|
+
# publish action if issues are present that might block successful publishing.
|
76
|
+
# For example, your publish action might stop if you have foreign keys on the
|
77
|
+
# target database that do not exist in the database project, and that will
|
78
|
+
# cause errors when you publish.
|
79
|
+
def verify_deployment
|
80
|
+
@parameters.add "/p:VerifyDeployment:True"
|
81
|
+
end
|
82
|
+
|
83
|
+
# Specifies whether detailed feedback is suppressed. Defaults to False.
|
84
|
+
def be_quiet
|
85
|
+
@parameters.add "/Quiet:True"
|
86
|
+
end
|
87
|
+
|
88
|
+
# Specifies a sql_package file to be used as the sql_package of action instead of database.
|
89
|
+
# If this parameter is used, no other sql_package parameter shall be valid.
|
90
|
+
attr_path_accessor :sql_package do |s|
|
91
|
+
@parameters.add "/SourceFile:#{s}"
|
92
|
+
end
|
93
|
+
|
94
|
+
# Specifies the file path to a DAC Publish Profile. The profile defines a
|
95
|
+
# collection of properties and variables to use when generating outputs.
|
96
|
+
attr_path_accessor :profile do |p|
|
97
|
+
@parameters.add "/Profile:#{p}"
|
98
|
+
end
|
99
|
+
|
100
|
+
private
|
101
|
+
def set_action action
|
102
|
+
actions = %w{Extract DeployReport DriftReport Publish Script Export Import Pipe}.collect{ |a| "/Action:#{a}" }
|
103
|
+
@parameters.subtract actions
|
104
|
+
@parameters.add "/Action:#{action}"
|
105
|
+
end
|
106
|
+
|
107
|
+
def make_props
|
108
|
+
@properties.collect { |k, v|
|
109
|
+
"#{k}=#{v}"
|
110
|
+
}.join(';')
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
class Task
|
115
|
+
def initialize command_line
|
116
|
+
@command_line = command_line
|
117
|
+
end
|
118
|
+
def execute
|
119
|
+
@command_line.execute
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
@@ -11,12 +11,17 @@ module Albacore
|
|
11
11
|
# the configuration object for the test runner
|
12
12
|
class Config
|
13
13
|
include CmdConfig
|
14
|
+
self.extend ConfigDSL
|
14
15
|
|
15
16
|
# give this property the list of dlls you want to test
|
16
17
|
attr_writer :files
|
17
18
|
|
19
|
+
# give this property the settings file for the dlls you want to test
|
20
|
+
attr_writer :settings
|
21
|
+
|
18
22
|
# constructor, no parameters
|
19
23
|
def initialize
|
24
|
+
@parameters = Set.new
|
20
25
|
@copy_local = false
|
21
26
|
@is_ms_test = false
|
22
27
|
@clr_command = true
|
@@ -35,6 +40,10 @@ module Albacore
|
|
35
40
|
:clr_command => @clr_command)
|
36
41
|
end
|
37
42
|
|
43
|
+
attr_path_accessor :settings do |s|
|
44
|
+
@parameters.add("/testsettings:#{s}")
|
45
|
+
end
|
46
|
+
|
38
47
|
# Mark that it should be possible to copy the test files local
|
39
48
|
# -- this is great if you are running a VM and the host disk is
|
40
49
|
# mapped as a network drive, which crashes some test runners
|
@@ -142,7 +151,7 @@ module Albacore
|
|
142
151
|
[Pathname.new(File.absolute_path(dll)), Pathname.new(File.absolute_path(exe))]
|
143
152
|
else
|
144
153
|
# otherwise, please continue with the basics
|
145
|
-
[Pathname.new(File.dirname(dll)), Pathname.new(exe)]
|
154
|
+
[Pathname.new(File.dirname(dll)).sub("/", "\\"), Pathname.new(exe)]
|
146
155
|
end
|
147
156
|
|
148
157
|
exe_rel = exe.relative_path_from dir
|
data/lib/albacore/version.rb
CHANGED
@@ -0,0 +1,93 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'shared_contexts'
|
5
|
+
require 'support/sh_interceptor'
|
6
|
+
require 'albacore'
|
7
|
+
require 'albacore/task_types/is_package'
|
8
|
+
|
9
|
+
describe 'build config' do
|
10
|
+
subject do
|
11
|
+
Albacore::IsPackage::Config.new
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'when setting #is_package' do
|
15
|
+
it 'should be set to a string' do
|
16
|
+
subject.is_package = 'testdata/test.ispac'
|
17
|
+
expect(subject.is_package).to be_a String
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe 'when setting #server' do
|
22
|
+
it 'should be set to a string' do
|
23
|
+
subject.server = '.'
|
24
|
+
expect(subject.server).to be_a String
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe 'when setting #database' do
|
29
|
+
it 'should be set to a string' do
|
30
|
+
subject.database = '.'
|
31
|
+
expect(subject.database).to be_a String
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe 'when setting #folder_name' do
|
36
|
+
it 'should be set to a string' do
|
37
|
+
subject.folder_name = '.'
|
38
|
+
expect(subject.folder_name).to be_a String
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe 'when setting #project_name' do
|
43
|
+
it 'should be set to a string' do
|
44
|
+
subject.project_name = 'test'
|
45
|
+
expect(subject.project_name).to be_a String
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe 'when setting #be_quiet' do
|
50
|
+
it 'should be set to a Set' do
|
51
|
+
subject.be_quiet
|
52
|
+
expect(subject.be_quiet).to be_a Set
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
describe 'when running with sql' do
|
58
|
+
let :cfg do
|
59
|
+
Albacore::IsPackage::Config.new
|
60
|
+
end
|
61
|
+
|
62
|
+
include_context 'path testing'
|
63
|
+
|
64
|
+
let(:cmd) do
|
65
|
+
cmd = Albacore::IsPackage::Cmd.new cfg.work_dir, 'ISDeploymentWizard', cfg.parameters
|
66
|
+
cmd.extend ShInterceptor
|
67
|
+
end
|
68
|
+
|
69
|
+
before do
|
70
|
+
cfg.be_quiet
|
71
|
+
cfg.is_package = 'testdata/test.ispac'
|
72
|
+
cfg.server = '.'
|
73
|
+
cfg.database = 'SSISDB'
|
74
|
+
cfg.folder_name = 'test'
|
75
|
+
cfg.project_name = 'test'
|
76
|
+
cfg.get_parameters
|
77
|
+
cmd.execute
|
78
|
+
end
|
79
|
+
|
80
|
+
subject do
|
81
|
+
cmd
|
82
|
+
end
|
83
|
+
|
84
|
+
it do
|
85
|
+
expect(subject.executable).to eq('ISDeploymentWizard')
|
86
|
+
end
|
87
|
+
it do
|
88
|
+
expect(subject.parameters).to eq(%W|/Silent /SourcePath:testdata/test.ispac /DestinationServer:. /DestinationPath:/SSISDB/test/test|)
|
89
|
+
end
|
90
|
+
it do
|
91
|
+
expect(subject.is_mono_command?).to be false
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'shared_contexts'
|
5
|
+
require 'support/sh_interceptor'
|
6
|
+
require 'albacore'
|
7
|
+
require 'albacore/task_types/sql_cmd'
|
8
|
+
|
9
|
+
describe 'build config' do
|
10
|
+
subject do
|
11
|
+
Albacore::Sql::Config.new
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'when setting #server' do
|
15
|
+
it 'should be set to a string' do
|
16
|
+
subject.server = '.'
|
17
|
+
expect(subject.server).to be_a String
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe 'when setting #database' do
|
22
|
+
it 'should be set to a string' do
|
23
|
+
subject.database = 'msdb'
|
24
|
+
expect(subject.database).to be_a String
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe 'when setting #trusted_connection' do
|
29
|
+
it 'should be set to a Set' do
|
30
|
+
subject.trusted_connection
|
31
|
+
expect(subject.trusted_connection).to be_a Set
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe 'when setting #username' do
|
36
|
+
it 'should be set to a string' do
|
37
|
+
subject.username = 'test'
|
38
|
+
expect(subject.username).to be_a String
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe 'when setting #password' do
|
43
|
+
it 'should be set to a string' do
|
44
|
+
subject.password = 'test'
|
45
|
+
expect(subject.password).to be_a String
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe 'when running with sql' do
|
51
|
+
let :cfg do
|
52
|
+
Albacore::Sql::Config.new
|
53
|
+
end
|
54
|
+
|
55
|
+
include_context 'path testing'
|
56
|
+
|
57
|
+
let(:cmd) do
|
58
|
+
cmd = Albacore::Sql::Cmd.new cfg.work_dir, 'sqlcmd', cfg.parameters
|
59
|
+
cmd.extend ShInterceptor
|
60
|
+
end
|
61
|
+
|
62
|
+
before do
|
63
|
+
cfg.server = '.'
|
64
|
+
cfg.database = 'master'
|
65
|
+
cfg.trusted_connection
|
66
|
+
cfg.scripts = ["testdata/sqlscript.sql"]
|
67
|
+
cfg.exe = "testdata/sqlcmd/sqlcmd.exe"
|
68
|
+
cmd.execute
|
69
|
+
end
|
70
|
+
|
71
|
+
subject do
|
72
|
+
cmd
|
73
|
+
end
|
74
|
+
|
75
|
+
it do
|
76
|
+
expect(subject.executable).to eq('sqlcmd')
|
77
|
+
end
|
78
|
+
it do
|
79
|
+
expect(subject.parameters).to eq(%W|-S. -dmaster -E|)
|
80
|
+
end
|
81
|
+
it do
|
82
|
+
expect(subject.is_mono_command?).to be false
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'shared_contexts'
|
5
|
+
require 'support/sh_interceptor'
|
6
|
+
require 'albacore'
|
7
|
+
require 'albacore/task_types/sql_package'
|
8
|
+
|
9
|
+
describe 'build config' do
|
10
|
+
subject do
|
11
|
+
Albacore::SqlPackage::Config.new
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'when setting #action' do
|
15
|
+
it 'should be set to a string' do
|
16
|
+
subject.action = 'Publish'
|
17
|
+
expect(subject.action).to be_a String
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe 'when setting #sql_package' do
|
22
|
+
it 'should be set to a string' do
|
23
|
+
subject.sql_package = 'testdata/test.dacpac'
|
24
|
+
expect(subject.sql_package).to be_a String
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe 'when setting #profile' do
|
29
|
+
it 'should be set to a string' do
|
30
|
+
subject.profile = '.'
|
31
|
+
expect(subject.profile).to be_a String
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe 'when setting #verify_deployment' do
|
36
|
+
it 'should be set to a Set' do
|
37
|
+
subject.verify_deployment
|
38
|
+
expect(subject.verify_deployment).to be_a Set
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe 'when setting #be_quiet' do
|
43
|
+
it 'should be set to a Set' do
|
44
|
+
subject.be_quiet
|
45
|
+
expect(subject.be_quiet).to be_a Set
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe 'when running with sql' do
|
51
|
+
let :cfg do
|
52
|
+
Albacore::SqlPackage::Config.new
|
53
|
+
end
|
54
|
+
|
55
|
+
include_context 'path testing'
|
56
|
+
|
57
|
+
let(:cmd) do
|
58
|
+
cmd = Albacore::SqlPackage::Cmd.new cfg.work_dir, 'SqlPackage', cfg.parameters
|
59
|
+
cmd.extend ShInterceptor
|
60
|
+
end
|
61
|
+
|
62
|
+
before do
|
63
|
+
cfg.action = 'Publish'
|
64
|
+
cfg.sql_package = 'testdata/test.dacpac'
|
65
|
+
cfg.profile = 'testdata/test.publish'
|
66
|
+
cfg.verify_deployment
|
67
|
+
cfg.be_quiet
|
68
|
+
cmd.execute
|
69
|
+
end
|
70
|
+
|
71
|
+
subject do
|
72
|
+
cmd
|
73
|
+
end
|
74
|
+
|
75
|
+
it do
|
76
|
+
expect(subject.executable).to eq('SqlPackage')
|
77
|
+
end
|
78
|
+
it do
|
79
|
+
expect(subject.parameters).to eq(%W|/Action:Publish /SourceFile:testdata/test.dacpac /Profile:testdata/test.publish /p:VerifyDeployment:True /Quiet:True|)
|
80
|
+
end
|
81
|
+
it do
|
82
|
+
expect(subject.is_mono_command?).to be false
|
83
|
+
end
|
84
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: albacore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henrik Feldt
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-05-
|
12
|
+
date: 2016-05-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -160,10 +160,13 @@ files:
|
|
160
160
|
- "./lib/albacore/task_types/asmver/vb.rb"
|
161
161
|
- "./lib/albacore/task_types/build.rb"
|
162
162
|
- "./lib/albacore/task_types/find_msbuild_versions.rb"
|
163
|
+
- "./lib/albacore/task_types/is_package.rb"
|
163
164
|
- "./lib/albacore/task_types/nugets.rb"
|
164
165
|
- "./lib/albacore/task_types/nugets_authentication.rb"
|
165
166
|
- "./lib/albacore/task_types/nugets_pack.rb"
|
166
167
|
- "./lib/albacore/task_types/nugets_restore.rb"
|
168
|
+
- "./lib/albacore/task_types/sql_cmd.rb"
|
169
|
+
- "./lib/albacore/task_types/sql_package.rb"
|
167
170
|
- "./lib/albacore/task_types/test_runner.rb"
|
168
171
|
- "./lib/albacore/tasks/README.md"
|
169
172
|
- "./lib/albacore/tasks/albasemver.rb"
|
@@ -191,6 +194,7 @@ files:
|
|
191
194
|
- spec/ext_teamcity_spec.rb
|
192
195
|
- spec/facts_spec.rb
|
193
196
|
- spec/fpm_app_spec_spec.rb
|
197
|
+
- spec/is_package_spec.rb
|
194
198
|
- spec/nuget_model_spec.rb
|
195
199
|
- spec/nugets_find_gem_exe_spec.rb
|
196
200
|
- spec/nugets_pack_spec.rb
|
@@ -216,6 +220,8 @@ files:
|
|
216
220
|
- spec/smoke_require_spec.rb
|
217
221
|
- spec/smoke_spec.rb
|
218
222
|
- spec/spec_helper.rb
|
223
|
+
- spec/sql_cmd_spec.rb
|
224
|
+
- spec/sql_package_spec.rb
|
219
225
|
- spec/support/Nuget/NuGet.exe
|
220
226
|
- spec/support/echo/FSharp.Core.dll
|
221
227
|
- spec/support/echo/FSharp.Core.xml
|
@@ -430,6 +436,7 @@ test_files:
|
|
430
436
|
- spec/ext_teamcity_spec.rb
|
431
437
|
- spec/facts_spec.rb
|
432
438
|
- spec/fpm_app_spec_spec.rb
|
439
|
+
- spec/is_package_spec.rb
|
433
440
|
- spec/nuget_model_spec.rb
|
434
441
|
- spec/nugets_find_gem_exe_spec.rb
|
435
442
|
- spec/nugets_pack_spec.rb
|
@@ -455,6 +462,8 @@ test_files:
|
|
455
462
|
- spec/smoke_require_spec.rb
|
456
463
|
- spec/smoke_spec.rb
|
457
464
|
- spec/spec_helper.rb
|
465
|
+
- spec/sql_cmd_spec.rb
|
466
|
+
- spec/sql_package_spec.rb
|
458
467
|
- spec/support/Nuget/NuGet.exe
|
459
468
|
- spec/support/echo/FSharp.Core.dll
|
460
469
|
- spec/support/echo/FSharp.Core.xml
|