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
@@ -1,60 +1,60 @@
|
|
1
|
-
require 'rake/dsl_definition'
|
2
|
-
require 'physique/dsl'
|
3
|
-
require 'physique/tool_locator'
|
4
|
-
|
5
|
-
module Physique
|
6
|
-
class TasksBuilder
|
7
|
-
include Albacore::Logging
|
8
|
-
include Rake::DSL
|
9
|
-
include Physique::DSL
|
10
|
-
include Physique::ToolLocator
|
11
|
-
|
12
|
-
@subclasses = []
|
13
|
-
|
14
|
-
class << self
|
15
|
-
attr_reader :subclasses
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.inherited(subclass)
|
19
|
-
TasksBuilder.subclasses << subclass
|
20
|
-
end
|
21
|
-
|
22
|
-
attr_reader :solution
|
23
|
-
|
24
|
-
def self.build_tasks_for(solution)
|
25
|
-
TasksBuilder.subclasses.each do |builder_class|
|
26
|
-
builder_class.new.build_tasks_for solution
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def build_tasks_for(solution)
|
31
|
-
@solution = solution
|
32
|
-
build_tasks
|
33
|
-
end
|
34
|
-
|
35
|
-
def build_tasks
|
36
|
-
raise 'This method must be implemented in your subclass'
|
37
|
-
end
|
38
|
-
|
39
|
-
def ensure_output_location(path)
|
40
|
-
# Ensure output directory exists
|
41
|
-
FileUtils.mkdir_p path
|
42
|
-
end
|
43
|
-
|
44
|
-
def namespace(name, &block)
|
45
|
-
name = to_string_or_symbol(name)
|
46
|
-
Rake.application.in_namespace(name, &block)
|
47
|
-
end
|
48
|
-
|
49
|
-
def to_string_or_symbol(name)
|
50
|
-
name = name.to_s if name.kind_of?(Symbol)
|
51
|
-
name = name.to_str if name.respond_to?(:to_str)
|
52
|
-
unless name.kind_of?(String) || name.nil?
|
53
|
-
raise ArgumentError, 'Expected a String or Symbol for a namespace name'
|
54
|
-
end
|
55
|
-
name
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
1
|
+
require 'rake/dsl_definition'
|
2
|
+
require 'physique/dsl'
|
3
|
+
require 'physique/tool_locator'
|
4
|
+
|
5
|
+
module Physique
|
6
|
+
class TasksBuilder
|
7
|
+
include Albacore::Logging
|
8
|
+
include Rake::DSL
|
9
|
+
include Physique::DSL
|
10
|
+
include Physique::ToolLocator
|
11
|
+
|
12
|
+
@subclasses = []
|
13
|
+
|
14
|
+
class << self
|
15
|
+
attr_reader :subclasses
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.inherited(subclass)
|
19
|
+
TasksBuilder.subclasses << subclass
|
20
|
+
end
|
21
|
+
|
22
|
+
attr_reader :solution
|
23
|
+
|
24
|
+
def self.build_tasks_for(solution)
|
25
|
+
TasksBuilder.subclasses.each do |builder_class|
|
26
|
+
builder_class.new.build_tasks_for solution
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def build_tasks_for(solution)
|
31
|
+
@solution = solution
|
32
|
+
build_tasks
|
33
|
+
end
|
34
|
+
|
35
|
+
def build_tasks
|
36
|
+
raise 'This method must be implemented in your subclass'
|
37
|
+
end
|
38
|
+
|
39
|
+
def ensure_output_location(path)
|
40
|
+
# Ensure output directory exists
|
41
|
+
FileUtils.mkdir_p path
|
42
|
+
end
|
43
|
+
|
44
|
+
def namespace(name, &block)
|
45
|
+
name = to_string_or_symbol(name)
|
46
|
+
Rake.application.in_namespace(name, &block)
|
47
|
+
end
|
48
|
+
|
49
|
+
def to_string_or_symbol(name)
|
50
|
+
name = name.to_s if name.kind_of?(Symbol)
|
51
|
+
name = name.to_str if name.respond_to?(:to_str)
|
52
|
+
unless name.kind_of?(String) || name.nil?
|
53
|
+
raise ArgumentError, 'Expected a String or Symbol for a namespace name'
|
54
|
+
end
|
55
|
+
name
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
60
|
Gem.find_files('physique/task_builders/*.rb').each { |path| require path }
|
@@ -1,50 +1,50 @@
|
|
1
|
-
require 'map'
|
2
|
-
require 'albacore'
|
3
|
-
|
4
|
-
module Physique
|
5
|
-
module ToolLocator
|
6
|
-
include Albacore::Logging
|
7
|
-
|
8
|
-
@@registered_tools = {}
|
9
|
-
|
10
|
-
def register_tool(name, executable, nuget_package = nil, nuget_path = nil)
|
11
|
-
end
|
12
|
-
|
13
|
-
def lookup_tool(name, project, package_folder)
|
14
|
-
end
|
15
|
-
|
16
|
-
# Allows you to locate a tool on disk given a file specification. For example...
|
17
|
-
#
|
18
|
-
# locate_tool 'C:/Program Files/Microsoft SQL Server/**/Tools/Binn/SQLCMD.EXE'
|
19
|
-
#
|
20
|
-
# The tool sorts any matching executables in descending order to that the most recent version is returned. To
|
21
|
-
# change this behavior call the method with the reverse option.
|
22
|
-
#
|
23
|
-
# locate_tool 'C:/path/to/**/tool.exe', find_latest: false
|
24
|
-
#
|
25
|
-
# Throws a ToolNotFoundError if no tool could be found.
|
26
|
-
def locate_tool(paths, options = {})
|
27
|
-
# FileList only correctly handles forward-slashes, even on Windows
|
28
|
-
|
29
|
-
|
30
|
-
debug { "Extracting paths from the following pattern #{paths}" }
|
31
|
-
paths =
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
opts =
|
36
|
-
paths = paths.collect { |p| which(p) }.compact.sort
|
37
|
-
paths = paths.reverse if opts[:find_latest]
|
38
|
-
tool = paths.first
|
39
|
-
|
40
|
-
raise ToolNotFoundError, "Could not find tool in the following paths: \n #{paths}" if tool.nil?
|
41
|
-
tool
|
42
|
-
end
|
43
|
-
|
44
|
-
def which(exe)
|
45
|
-
Albacore::CrossPlatformCmd.which(exe) ? exe : nil;
|
46
|
-
end
|
47
|
-
|
48
|
-
class ToolNotFoundError < Exception; end
|
49
|
-
end
|
50
|
-
end
|
1
|
+
require 'map'
|
2
|
+
require 'albacore'
|
3
|
+
|
4
|
+
module Physique
|
5
|
+
module ToolLocator
|
6
|
+
include Albacore::Logging
|
7
|
+
|
8
|
+
@@registered_tools = {}
|
9
|
+
|
10
|
+
def register_tool(name, executable, nuget_package = nil, nuget_path = nil)
|
11
|
+
end
|
12
|
+
|
13
|
+
def lookup_tool(name, project, package_folder)
|
14
|
+
end
|
15
|
+
|
16
|
+
# Allows you to locate a tool on disk given a file specification. For example...
|
17
|
+
#
|
18
|
+
# locate_tool 'C:/Program Files/Microsoft SQL Server/**/Tools/Binn/SQLCMD.EXE'
|
19
|
+
#
|
20
|
+
# The tool sorts any matching executables in descending order to that the most recent version is returned. To
|
21
|
+
# change this behavior call the method with the reverse option.
|
22
|
+
#
|
23
|
+
# locate_tool 'C:/path/to/**/tool.exe', find_latest: false
|
24
|
+
#
|
25
|
+
# Throws a ToolNotFoundError if no tool could be found.
|
26
|
+
def locate_tool(paths, options = {})
|
27
|
+
# FileList only correctly handles forward-slashes, even on Windows
|
28
|
+
raise ToolNotFoundError, 'No tool paths provided' unless paths
|
29
|
+
|
30
|
+
debug { "Extracting paths from the following pattern #{paths}" }
|
31
|
+
paths = paths.gsub('\\', '/')
|
32
|
+
paths = FileList[paths] unless paths.respond_to?(:each)
|
33
|
+
|
34
|
+
debug { "Attempting to locate tool in the following paths #{paths}" }
|
35
|
+
opts = Map.options(options).apply :find_latest => true
|
36
|
+
paths = paths.collect { |p| which(p) }.compact.sort
|
37
|
+
paths = paths.reverse if opts[:find_latest]
|
38
|
+
tool = paths.first
|
39
|
+
|
40
|
+
raise ToolNotFoundError, "Could not find tool in the following paths: \n #{paths}" if tool.nil?
|
41
|
+
tool
|
42
|
+
end
|
43
|
+
|
44
|
+
def which(exe)
|
45
|
+
Albacore::CrossPlatformCmd.which(exe) || File.exists?(exe) ? exe : nil;
|
46
|
+
end
|
47
|
+
|
48
|
+
class ToolNotFoundError < Exception; end
|
49
|
+
end
|
50
|
+
end
|
data/lib/physique/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module Physique
|
2
|
-
VERSION = '0.
|
3
|
-
end
|
1
|
+
module Physique
|
2
|
+
VERSION = '0.4.0'
|
3
|
+
end
|
data/physique.gemspec
CHANGED
@@ -1,28 +1,29 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'physique/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = 'physique'
|
8
|
-
spec.version = Physique::VERSION
|
9
|
-
spec.authors = ['Robert Scaduto']
|
10
|
-
spec.email = ['rscaduto@thirdwave.it']
|
11
|
-
spec.description = %q{Beautiful builds for .NET projects}
|
12
|
-
spec.summary = %q{A conventional build framework supporting NUnit, FluentMigrator and Octopus Deploy}
|
13
|
-
spec.homepage = 'http://github.com/scardetto/physique'
|
14
|
-
spec.license = 'MIT'
|
15
|
-
|
16
|
-
spec.files = `git ls-files`.split($/)
|
17
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = ['lib']
|
20
|
-
|
21
|
-
spec.add_development_dependency 'bundler'
|
22
|
-
spec.add_development_dependency 'rspec', '2.14.1'
|
23
|
-
spec.
|
24
|
-
spec.add_dependency '
|
25
|
-
spec.add_dependency '
|
26
|
-
spec.add_dependency 'map', '~> 6.5'
|
27
|
-
spec.add_dependency '
|
28
|
-
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'physique/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'physique'
|
8
|
+
spec.version = Physique::VERSION
|
9
|
+
spec.authors = ['Robert Scaduto']
|
10
|
+
spec.email = ['rscaduto@thirdwave.it']
|
11
|
+
spec.description = %q{Beautiful builds for .NET projects}
|
12
|
+
spec.summary = %q{A conventional build framework supporting NUnit, FluentMigrator and Octopus Deploy}
|
13
|
+
spec.homepage = 'http://github.com/scardetto/physique'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler'
|
22
|
+
spec.add_development_dependency 'rspec', '2.14.1'
|
23
|
+
spec.add_development_dependency 'guard-rspec', '~> 4.3.1'
|
24
|
+
spec.add_dependency 'activesupport', '~> 4.1'
|
25
|
+
spec.add_dependency 'albacore', '~> 2.5'
|
26
|
+
spec.add_dependency 'map', '~> 6.5'
|
27
|
+
spec.add_dependency 'rake', '~> 10'
|
28
|
+
spec.add_dependency 'semver2', '~> 3.4'
|
29
|
+
end
|
@@ -1,40 +1,40 @@
|
|
1
|
-
require 'physique'
|
2
|
-
|
3
|
-
describe Physique::FluentMigratorConfig do
|
4
|
-
|
5
|
-
it 'should throw when config is missing required values' do
|
6
|
-
%w(instance= name= project= lang= scripts_dir=).each do |p|
|
7
|
-
expect {
|
8
|
-
default_config do |c|
|
9
|
-
c.send p, nil
|
10
|
-
end
|
11
|
-
}.to raise_error(ArgumentError)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'should default to the cs programming language' do
|
16
|
-
project_name = 'Test.Database'
|
17
|
-
opts = default_config
|
18
|
-
expect(opts.project_file).to eq("src/#{project_name}/#{project_name}.csproj")
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'should find full project path when specifying the name and language' do
|
22
|
-
project_name = 'Test.Database'
|
23
|
-
opts = default_config do |c|
|
24
|
-
c.lang = :vb
|
25
|
-
end
|
26
|
-
|
27
|
-
expect(opts.project_file).to eq("src/#{project_name}/#{project_name}.vbproj")
|
28
|
-
end
|
29
|
-
|
30
|
-
def default_config
|
31
|
-
config = Physique::FluentMigratorConfig.new.tap do |c|
|
32
|
-
c.instance = '(local)'
|
33
|
-
c.name = 'TestDatabase'
|
34
|
-
c.project = 'Test.Database'
|
35
|
-
|
36
|
-
yield c if block_given?
|
37
|
-
end
|
38
|
-
config.opts
|
39
|
-
end
|
1
|
+
require 'physique'
|
2
|
+
|
3
|
+
describe Physique::FluentMigratorConfig do
|
4
|
+
|
5
|
+
it 'should throw when config is missing required values' do
|
6
|
+
%w(instance= name= project= lang= scripts_dir=).each do |p|
|
7
|
+
expect {
|
8
|
+
default_config do |c|
|
9
|
+
c.send p, nil
|
10
|
+
end
|
11
|
+
}.to raise_error(ArgumentError)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should default to the cs programming language' do
|
16
|
+
project_name = 'Test.Database'
|
17
|
+
opts = default_config
|
18
|
+
expect(opts.project_file).to eq("src/#{project_name}/#{project_name}.csproj")
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should find full project path when specifying the name and language' do
|
22
|
+
project_name = 'Test.Database'
|
23
|
+
opts = default_config do |c|
|
24
|
+
c.lang = :vb
|
25
|
+
end
|
26
|
+
|
27
|
+
expect(opts.project_file).to eq("src/#{project_name}/#{project_name}.vbproj")
|
28
|
+
end
|
29
|
+
|
30
|
+
def default_config
|
31
|
+
config = Physique::FluentMigratorConfig.new.tap do |c|
|
32
|
+
c.instance = '(local)'
|
33
|
+
c.name = 'TestDatabase'
|
34
|
+
c.project = 'Test.Database'
|
35
|
+
|
36
|
+
yield c if block_given?
|
37
|
+
end
|
38
|
+
config.opts
|
39
|
+
end
|
40
40
|
end
|
data/spec/project_spec.rb
CHANGED
@@ -1,43 +1,43 @@
|
|
1
|
-
require 'physique/project_path_resolver'
|
2
|
-
|
3
|
-
Project = Physique::ProjectPathResolver
|
4
|
-
|
5
|
-
describe Project do
|
6
|
-
it 'should echo the path when full project file name is provided' do
|
7
|
-
project_name = 'test.csproj'
|
8
|
-
expect(resolve(project_name)).to eq(project_name)
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'should return the full path when partial project file name is provided' do
|
12
|
-
project_name = 'TestProject.Domain'
|
13
|
-
expect(resolve(project_name)).to eq("src/#{project_name}/#{project_name}.csproj")
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'should handle multiple languages' do
|
17
|
-
project_name = 'TestProject.Domain'
|
18
|
-
language = 'vb'
|
19
|
-
expect(resolve(project_name, language)).to eq("src/#{project_name}/#{project_name}.vbproj")
|
20
|
-
|
21
|
-
language = 'fs'
|
22
|
-
expect(resolve(project_name, language)).to eq("src/#{project_name}/#{project_name}.fsproj")
|
23
|
-
end
|
24
|
-
|
25
|
-
describe 'when overidding the default project dir' do
|
26
|
-
before do
|
27
|
-
Physique::ProjectPathResolver.project_dir = 'projects'
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'should return the full path when partial project file name is provided' do
|
31
|
-
project_name = 'TestProject.Domain'
|
32
|
-
expect(resolve(project_name)).to eq("projects/#{project_name}/#{project_name}.csproj")
|
33
|
-
end
|
34
|
-
|
35
|
-
after do
|
36
|
-
Project.project_dir = Project::DEFAULT_PROJECT_FOLDER
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def resolve(name, ext = 'cs')
|
41
|
-
Project.resolve(name, ext)
|
42
|
-
end
|
1
|
+
require 'physique/project_path_resolver'
|
2
|
+
|
3
|
+
Project = Physique::ProjectPathResolver
|
4
|
+
|
5
|
+
describe Project do
|
6
|
+
it 'should echo the path when full project file name is provided' do
|
7
|
+
project_name = 'test.csproj'
|
8
|
+
expect(resolve(project_name)).to eq(project_name)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should return the full path when partial project file name is provided' do
|
12
|
+
project_name = 'TestProject.Domain'
|
13
|
+
expect(resolve(project_name)).to eq("src/#{project_name}/#{project_name}.csproj")
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should handle multiple languages' do
|
17
|
+
project_name = 'TestProject.Domain'
|
18
|
+
language = 'vb'
|
19
|
+
expect(resolve(project_name, language)).to eq("src/#{project_name}/#{project_name}.vbproj")
|
20
|
+
|
21
|
+
language = 'fs'
|
22
|
+
expect(resolve(project_name, language)).to eq("src/#{project_name}/#{project_name}.fsproj")
|
23
|
+
end
|
24
|
+
|
25
|
+
describe 'when overidding the default project dir' do
|
26
|
+
before do
|
27
|
+
Physique::ProjectPathResolver.project_dir = 'projects'
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should return the full path when partial project file name is provided' do
|
31
|
+
project_name = 'TestProject.Domain'
|
32
|
+
expect(resolve(project_name)).to eq("projects/#{project_name}/#{project_name}.csproj")
|
33
|
+
end
|
34
|
+
|
35
|
+
after do
|
36
|
+
Project.project_dir = Project::DEFAULT_PROJECT_FOLDER
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def resolve(name, ext = 'cs')
|
41
|
+
Project.resolve(name, ext)
|
42
|
+
end
|
43
43
|
end
|