rake-funnel 0.1.0.pre → 0.2.0.pre
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/rake/funnel/integration/teamcity/nunit_plugin.rb +3 -7
- data/lib/rake/funnel/support/binary_version_reader.rb +32 -0
- data/lib/rake/funnel/support/copier.rb +27 -0
- data/lib/rake/funnel/support/msbuild/build_tool.rb +13 -17
- data/lib/rake/funnel/support/{side_by_side_specs/remover.rb → specs_remover.rb} +2 -2
- data/lib/rake/funnel/support/zipper.rb +49 -0
- data/lib/rake/funnel/tasks/assembly_version.rb +17 -11
- data/lib/rake/funnel/tasks/bin_path.rb +17 -10
- data/lib/rake/funnel/tasks/copy.rb +13 -30
- data/lib/rake/funnel/tasks/environments.rb +36 -23
- data/lib/rake/funnel/tasks/msbuild.rb +21 -21
- data/lib/rake/funnel/tasks/msdeploy.rb +17 -24
- data/lib/rake/funnel/tasks/nunit.rb +17 -17
- data/lib/rake/funnel/tasks/paket.rb +15 -9
- data/lib/rake/funnel/tasks/quick_template.rb +14 -12
- data/lib/rake/funnel/tasks/side_by_side_specs.rb +16 -10
- data/lib/rake/funnel/tasks/timing.rb +16 -9
- data/lib/rake/funnel/tasks/zip.rb +14 -48
- data/lib/rake/funnel/version.rb +1 -1
- data/spec/rake/funnel/integration/teamcity/nunit_plugin_spec.rb +16 -18
- data/spec/rake/funnel/support/binary_version_reader_spec.rb +29 -0
- data/spec/rake/funnel/support/copier_spec.rb +58 -0
- data/spec/rake/funnel/support/{side_by_side_specs/example → specs_remover}/FooCode.cs +0 -0
- data/spec/rake/funnel/support/{side_by_side_specs/example → specs_remover}/FooSpecs.cs +0 -0
- data/spec/rake/funnel/support/{side_by_side_specs/example → specs_remover}/Sample.csproj +0 -0
- data/spec/rake/funnel/support/{side_by_side_specs/example → specs_remover}/Specs.cs +0 -0
- data/spec/rake/funnel/support/{side_by_side_specs/example → specs_remover}/subdir/BarCode.cs +0 -0
- data/spec/rake/funnel/support/{side_by_side_specs/example → specs_remover}/subdir/BarSpecs.cs +0 -0
- data/spec/rake/funnel/support/{side_by_side_specs/remover_spec.rb → specs_remover_spec.rb} +2 -2
- data/spec/rake/funnel/support/zipper_spec.rb +77 -0
- data/spec/rake/funnel/tasks/assembly_version_spec.rb +10 -19
- data/spec/rake/funnel/tasks/bin_path_spec.rb +19 -7
- data/spec/rake/funnel/tasks/copy_spec.rb +18 -73
- data/spec/rake/funnel/tasks/environments_spec.rb +59 -105
- data/spec/rake/funnel/tasks/msbuild_spec.rb +30 -30
- data/spec/rake/funnel/tasks/msdeploy_spec.rb +0 -23
- data/spec/rake/funnel/tasks/nunit_spec.rb +11 -13
- data/spec/rake/funnel/tasks/paket_spec.rb +3 -45
- data/spec/rake/funnel/tasks/quick_template_spec.rb +0 -27
- data/spec/rake/funnel/tasks/side_by_side_specs_spec.rb +3 -4
- data/spec/rake/funnel/tasks/zip_spec.rb +21 -101
- metadata +26 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 451750a7dd9a6f23c3cfa57c7be0214d1a4af806
|
4
|
+
data.tar.gz: 2f4cbb488c0a1fa453044e9a59eb8b180ee33492
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d087c8959125bfc8bfd20c186d19dbfef8726c5c15e9e2cdfe27c71d389ed682c95af8e5dff0cfab89f95079fd9fbff383b721ec68cd49de0120822cfc27263
|
7
|
+
data.tar.gz: 8d5fc064dfec98fa2ba725f4d90fdaa78851dfbf592a0d983e1da122602be7cb5678f9e32622ef2201b8225569e0d60bcb1f437d92375fe1169a2bb3b39dfe57
|
@@ -21,18 +21,14 @@ module Rake::Funnel::Integration::TeamCity
|
|
21
21
|
|
22
22
|
def read_version(executable)
|
23
23
|
nunit = Rake::Funnel::Support::Which.which(executable) || return
|
24
|
-
|
24
|
+
version = BinaryVersionReader.read_from(nunit)
|
25
25
|
|
26
|
-
version
|
27
|
-
if version.nil?
|
26
|
+
unless version.file_version
|
28
27
|
Rake.rake_output_message("Could read version from NUnit executable in #{nunit}")
|
29
28
|
return
|
30
29
|
end
|
31
30
|
|
32
|
-
[
|
33
|
-
nunit,
|
34
|
-
version[1].gsub(/\0/, '').split('.').take(3).join('.')
|
35
|
-
]
|
31
|
+
[nunit, version.file_version.split('.').take(3).join('.')]
|
36
32
|
end
|
37
33
|
|
38
34
|
def find_teamcity_addins(addins, version)
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Rake::Funnel::Support
|
2
|
+
class BinaryVersionReader
|
3
|
+
class << self
|
4
|
+
KNOWN_ATTRIBUTES = [:company_name, :file_description, :file_version, :legal_copyright, :product_name, :product_version, :assembly_version]
|
5
|
+
SEPARATOR = "\0"
|
6
|
+
TERMINATOR = "\0" * 3
|
7
|
+
|
8
|
+
def read_from(assembly)
|
9
|
+
binary = File.binread(assembly)
|
10
|
+
|
11
|
+
hash = KNOWN_ATTRIBUTES.map { |attr|
|
12
|
+
read_attribute(binary, attr)
|
13
|
+
}
|
14
|
+
.inject({}) { |memo, attr|
|
15
|
+
memo.merge(attr)
|
16
|
+
}
|
17
|
+
|
18
|
+
VersionInfo.new(hash)
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
def read_attribute(binary, attr)
|
23
|
+
binary_attr = attr.pascalize.gsub(/(.)/) { |match| match + SEPARATOR }
|
24
|
+
|
25
|
+
data = binary.match(/#{binary_attr}#{SEPARATOR}+(.*?)#{TERMINATOR}/)
|
26
|
+
return {} if data.nil?
|
27
|
+
|
28
|
+
{ "#{attr}" => data[1].gsub(/#{SEPARATOR}/, '') }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Rake::Funnel::Support
|
2
|
+
class Copier
|
3
|
+
class << self
|
4
|
+
def copy(files, target)
|
5
|
+
raise 'Target not defined' unless target
|
6
|
+
|
7
|
+
common_path = files.common_path
|
8
|
+
files.each do |source|
|
9
|
+
next if File.directory?(source)
|
10
|
+
|
11
|
+
target_path = target_path(source, common_path, target)
|
12
|
+
|
13
|
+
dir = File.dirname(target_path)
|
14
|
+
RakeFileUtils.mkdir_p(dir) unless File.directory?(dir)
|
15
|
+
|
16
|
+
RakeFileUtils.cp(source, target_path, { preserve: true })
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
def target_path(file, common_path, target)
|
22
|
+
target_relative = Pathname.new(file).relative_path_from(Pathname.new(common_path)).to_s
|
23
|
+
File.join(target, target_relative)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -2,26 +2,22 @@ module Rake::Funnel::Support::MSBuild
|
|
2
2
|
class BuildTool
|
3
3
|
class << self
|
4
4
|
def find
|
5
|
-
|
6
|
-
require 'win32/registry'
|
5
|
+
return 'xbuild' unless Rake::Win32.windows?
|
7
6
|
|
8
|
-
|
9
|
-
msbuild = nil
|
10
|
-
key = "SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\#{version}"
|
7
|
+
require 'win32/registry'
|
11
8
|
|
12
|
-
|
13
|
-
|
14
|
-
candidate = "#{reg['MSBuildToolsPath']}\\msbuild.exe"
|
15
|
-
msbuild = candidate if File.exists?(candidate)
|
16
|
-
end
|
17
|
-
rescue
|
18
|
-
end
|
9
|
+
%w(12.0 4.0 3.5 2.0).collect { |version|
|
10
|
+
key = "SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\#{version}"
|
19
11
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
12
|
+
begin
|
13
|
+
Win32::Registry::HKEY_LOCAL_MACHINE.open(key) do |reg|
|
14
|
+
candidate = File.join(reg['MSBuildToolsPath'] || '', 'msbuild.exe')
|
15
|
+
next candidate if File.exists?(candidate)
|
16
|
+
end
|
17
|
+
rescue
|
18
|
+
next
|
19
|
+
end
|
20
|
+
}.compact.first
|
25
21
|
end
|
26
22
|
end
|
27
23
|
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
require 'zip'
|
3
|
+
|
4
|
+
module Rake::Funnel::Support
|
5
|
+
class Zipper
|
6
|
+
class << self
|
7
|
+
def zip(files, target, zip_root = nil)
|
8
|
+
raise 'Target not defined' unless target
|
9
|
+
|
10
|
+
target_dir = File.dirname(target)
|
11
|
+
RakeFileUtils.mkdir_p(target_dir) unless File.directory?(target_dir)
|
12
|
+
|
13
|
+
configure_zip
|
14
|
+
create_zip(files || [], target, zip_root)
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
def configure_zip
|
19
|
+
::Zip.unicode_names = true
|
20
|
+
::Zip.default_compression = Zlib::BEST_COMPRESSION
|
21
|
+
end
|
22
|
+
|
23
|
+
def create_zip(files, target, zip_root)
|
24
|
+
::Zip::File.open(target, ::Zip::File::CREATE) do |zip|
|
25
|
+
common_path = files.common_path
|
26
|
+
|
27
|
+
files.each do |file|
|
28
|
+
zipped_file = get_zipped_path(common_path, file, zip_root)
|
29
|
+
|
30
|
+
entry = zip.add(zipped_file, file)
|
31
|
+
set_mtime(entry, file)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def get_zipped_path(common_path, file, zip_root)
|
37
|
+
file = Pathname.new(file).relative_path_from(Pathname.new(common_path)).to_s unless common_path.nil?
|
38
|
+
file = File.join(zip_root, file) unless zip_root.nil? || zip_root.empty?
|
39
|
+
file
|
40
|
+
end
|
41
|
+
|
42
|
+
# To work around this bug: https://github.com/rubyzip/rubyzip/issues/176
|
43
|
+
def set_mtime(entry, file)
|
44
|
+
entry.time = ::Zip::DOSTime.at(File.mtime(file))
|
45
|
+
entry.extra.delete('UniversalTime')
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -6,29 +6,35 @@ module Rake::Funnel::Tasks
|
|
6
6
|
|
7
7
|
attr_accessor :name, :language, :source, :source_args, :target_path
|
8
8
|
|
9
|
-
def initialize(
|
10
|
-
|
9
|
+
def initialize(*args, &task_block)
|
10
|
+
setup_ivars(args)
|
11
|
+
|
12
|
+
define(args, &task_block)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
def setup_ivars(args)
|
17
|
+
@name = args.shift || :version
|
18
|
+
|
11
19
|
@language = :cs
|
12
20
|
@source = :FromVersionFiles
|
13
21
|
@source_args = {}
|
14
22
|
@target_path = next_to_version_file
|
15
|
-
|
16
|
-
yield self if block_given?
|
17
|
-
define
|
18
23
|
end
|
19
24
|
|
20
|
-
|
21
|
-
|
22
|
-
desc 'Generate version info'
|
23
|
-
task name do
|
24
|
-
writer = AssemblyVersionWriter.new(source, source_args)
|
25
|
+
def define(args, &task_block)
|
26
|
+
desc 'Generate version info' unless Rake.application.last_description
|
25
27
|
|
28
|
+
task(name, *args) do |_, task_args|
|
29
|
+
task_block.call(*[self, task_args].slice(0, task_block.arity)) if task_block
|
30
|
+
|
31
|
+
writer = AssemblyVersionWriter.new(source, source_args)
|
26
32
|
writer.write(target_path, language)
|
27
33
|
end
|
28
34
|
end
|
29
35
|
|
30
36
|
def next_to_version_file
|
31
|
-
Proc.new { |language,
|
37
|
+
Proc.new { |language, _version_info, source| File.join(File.dirname(source), "VersionInfo.#{language}") }
|
32
38
|
end
|
33
39
|
end
|
34
40
|
end
|
@@ -4,17 +4,24 @@ module Rake::Funnel::Tasks
|
|
4
4
|
class BinPath < Rake::TaskLib
|
5
5
|
attr_accessor :name, :search_pattern
|
6
6
|
|
7
|
-
def initialize(
|
8
|
-
|
9
|
-
@search_pattern = %w(tools/* tools/*/bin packages/**/tools)
|
7
|
+
def initialize(*args, &task_block)
|
8
|
+
setup_ivars(args)
|
10
9
|
|
11
|
-
|
12
|
-
define
|
10
|
+
define(args, &task_block)
|
13
11
|
end
|
14
12
|
|
15
13
|
private
|
16
|
-
def
|
17
|
-
|
14
|
+
def setup_ivars(args)
|
15
|
+
@name = args.shift || :bin_path
|
16
|
+
@search_pattern = %w(tools/* tools/*/bin packages/**/tools)
|
17
|
+
end
|
18
|
+
|
19
|
+
def define(args, &task_block)
|
20
|
+
desc 'Add local binaries to PATH environment variable' unless Rake.application.last_description
|
21
|
+
|
22
|
+
task(name, *args) do |_, task_args|
|
23
|
+
task_block.call(*[self, task_args].slice(0, task_block.arity)) if task_block
|
24
|
+
|
18
25
|
Rake.rake_output_message 'Added the following paths to the PATH environment variable:'
|
19
26
|
add_pattern_to_path_environment.each do |p|
|
20
27
|
Rake.rake_output_message " - #{p}"
|
@@ -25,10 +32,10 @@ module Rake::Funnel::Tasks
|
|
25
32
|
end
|
26
33
|
|
27
34
|
def add_pattern_to_path_environment
|
28
|
-
|
35
|
+
paths = Dir[*search_pattern].map { |path| File.expand_path(path) }.sort
|
29
36
|
|
30
|
-
ENV['PATH'] = ([] <<
|
31
|
-
|
37
|
+
ENV['PATH'] = ([] << paths << ENV['PATH']).flatten.join(File::PATH_SEPARATOR)
|
38
|
+
paths
|
32
39
|
end
|
33
40
|
end
|
34
41
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'rake/clean'
|
2
1
|
require 'rake/tasklib'
|
3
2
|
|
4
3
|
module Rake::Funnel::Tasks
|
@@ -7,34 +6,27 @@ module Rake::Funnel::Tasks
|
|
7
6
|
|
8
7
|
attr_accessor :name, :source, :target
|
9
8
|
|
10
|
-
def initialize(
|
11
|
-
|
9
|
+
def initialize(*args, &task_block)
|
10
|
+
setup_ivars(args)
|
12
11
|
|
13
|
-
|
14
|
-
@target = nil
|
15
|
-
|
16
|
-
yield self if block_given?
|
17
|
-
define
|
12
|
+
define(args, &task_block)
|
18
13
|
end
|
19
14
|
|
20
15
|
private
|
21
|
-
def
|
22
|
-
|
16
|
+
def setup_ivars(args)
|
17
|
+
@name = args.shift || :copy
|
23
18
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
files.each do |source|
|
29
|
-
next if File.directory?(source)
|
19
|
+
@source = []
|
20
|
+
@target = nil
|
21
|
+
end
|
30
22
|
|
31
|
-
|
23
|
+
def define(args, &task_block)
|
24
|
+
desc 'Copy files' unless Rake.application.last_description
|
32
25
|
|
33
|
-
|
34
|
-
|
26
|
+
task(name, *args) do |_, task_args|
|
27
|
+
task_block.call(*[self, task_args].slice(0, task_block.arity)) if task_block
|
35
28
|
|
36
|
-
|
37
|
-
end
|
29
|
+
Copier.copy(files, target)
|
38
30
|
end
|
39
31
|
|
40
32
|
self
|
@@ -43,14 +35,5 @@ module Rake::Funnel::Tasks
|
|
43
35
|
def files
|
44
36
|
Finder.new(source, self, 'No files found.').all_or_default
|
45
37
|
end
|
46
|
-
|
47
|
-
def target_path(file)
|
48
|
-
target_relative = Pathname.new(file).relative_path_from(Pathname.new(common_path)).to_s
|
49
|
-
File.join(target, target_relative)
|
50
|
-
end
|
51
|
-
|
52
|
-
def common_path
|
53
|
-
@common_path ||= files.common_path
|
54
|
-
end
|
55
38
|
end
|
56
39
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'configatron'
|
1
2
|
require 'rake/tasklib'
|
2
3
|
|
3
4
|
Dir["#{File.dirname(__FILE__)}/environments_support/*.rb"].each do |path|
|
@@ -8,36 +9,42 @@ module Rake::Funnel::Tasks
|
|
8
9
|
class Environments < Rake::TaskLib
|
9
10
|
include Rake::Funnel::Support::Environments
|
10
11
|
|
11
|
-
attr_accessor :base_dir, :default_env, :default_config, :local_config, :customizer
|
12
|
+
attr_accessor :base_dir, :store, :default_env, :default_config, :local_config, :customizer
|
12
13
|
|
13
|
-
def initialize
|
14
|
+
def initialize(*args, &task_block)
|
15
|
+
setup_ivars(args)
|
16
|
+
|
17
|
+
define(args, &task_block)
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
def setup_ivars(_args)
|
22
|
+
@store = configatron
|
14
23
|
@default_env = nil
|
15
24
|
@default_config = 'default'
|
16
25
|
@local_config = 'local'
|
17
26
|
@base_dir = 'config'
|
18
|
-
|
19
|
-
yield self if block_given?
|
20
|
-
define
|
21
|
-
default_environment_setup
|
22
|
-
|
23
|
-
self
|
24
27
|
end
|
25
28
|
|
26
|
-
|
27
|
-
|
29
|
+
def define(args, &task_block)
|
30
|
+
task_block.call(*[self].slice(0, task_block.arity)) if task_block
|
31
|
+
|
28
32
|
environments.each do |env|
|
29
33
|
desc "Configure for the #{env[:name]} environment"
|
30
|
-
|
31
|
-
|
34
|
+
|
35
|
+
task(env[:name], *args) do |_, task_args|
|
36
|
+
Loader.load_configuration(env, store, customizer)
|
32
37
|
end
|
33
38
|
end
|
39
|
+
|
40
|
+
default_environment_setup
|
34
41
|
end
|
35
42
|
|
36
43
|
def environments
|
37
|
-
default = File.join(
|
38
|
-
local = File.join(
|
44
|
+
default = File.join(base_dir, config_ext(default_config))
|
45
|
+
local = File.join(base_dir, config_ext(local_config))
|
39
46
|
|
40
|
-
Dir[File.join(
|
47
|
+
Dir[File.join(base_dir, config_ext('*'))]
|
41
48
|
.reject { |config| config == default || config == local }
|
42
49
|
.map do |config|
|
43
50
|
{
|
@@ -56,19 +63,25 @@ module Rake::Funnel::Tasks
|
|
56
63
|
end
|
57
64
|
|
58
65
|
def default_environment_setup
|
59
|
-
return unless
|
66
|
+
return unless default_env
|
60
67
|
|
61
|
-
|
62
|
-
if
|
63
|
-
|
68
|
+
top_level_envs = top_level_env_tasks
|
69
|
+
if top_level_envs.empty?
|
70
|
+
task = Rake.application.current_scope.path_with_task_name(default_env)
|
71
|
+
prepend_task(task)
|
72
|
+
else
|
73
|
+
top_level_envs.each do |task|
|
74
|
+
Rake.application.top_level_tasks.delete(task)
|
75
|
+
prepend_task(task)
|
76
|
+
end
|
64
77
|
end
|
78
|
+
end
|
65
79
|
|
66
|
-
|
67
|
-
|
68
|
-
end
|
80
|
+
def prepend_task(task)
|
81
|
+
Rake.application.top_level_tasks.unshift(task)
|
69
82
|
end
|
70
83
|
|
71
|
-
def
|
84
|
+
def top_level_env_tasks
|
72
85
|
expect_user_defined = environments.map { |env| Rake.application.current_scope.path_with_task_name(env[:name]) }
|
73
86
|
Rake.application.top_level_tasks.select { |t| expect_user_defined.include?(t) }
|
74
87
|
end
|
@@ -5,41 +5,41 @@ module Rake::Funnel::Tasks
|
|
5
5
|
include Rake::Funnel::Support
|
6
6
|
include Rake::Funnel::Support::MSBuild
|
7
7
|
|
8
|
-
attr_accessor :name, :project_or_solution, :args, :search_pattern
|
8
|
+
attr_accessor :name, :msbuild, :project_or_solution, :args, :search_pattern
|
9
9
|
|
10
|
-
def initialize(
|
11
|
-
|
12
|
-
@args = {}
|
13
|
-
@search_pattern = %w(**/*.sln)
|
14
|
-
|
15
|
-
yield self if block_given?
|
16
|
-
define
|
17
|
-
end
|
10
|
+
def initialize(*args, &task_block)
|
11
|
+
setup_ivars(args)
|
18
12
|
|
19
|
-
|
20
|
-
@_msbuild || BuildTool.find
|
21
|
-
end
|
22
|
-
|
23
|
-
def msbuild=(value)
|
24
|
-
@_msbuild = value
|
13
|
+
define(args, &task_block)
|
25
14
|
end
|
26
15
|
|
27
16
|
def project_or_solution
|
28
|
-
Finder.new(@
|
17
|
+
Finder.new(@project_or_solution || search_pattern, self, 'No projects or more than one project found.')
|
29
18
|
end
|
30
19
|
|
31
20
|
def project_or_solution=(value)
|
32
|
-
@
|
21
|
+
@project_or_solution = value
|
33
22
|
end
|
34
23
|
|
35
24
|
private
|
36
|
-
def
|
37
|
-
|
38
|
-
|
25
|
+
def setup_ivars(args)
|
26
|
+
@name = args.shift || :compile
|
27
|
+
|
28
|
+
@msbuild = BuildTool.find
|
29
|
+
@args = {}
|
30
|
+
@search_pattern = %w(**/*.sln)
|
31
|
+
end
|
32
|
+
|
33
|
+
def define(args, &task_block)
|
34
|
+
desc 'Compile MSBuild projects' unless Rake.application.last_description
|
35
|
+
|
36
|
+
task(name, *args) do |_, task_args|
|
37
|
+
task_block.call(*[self, task_args].slice(0, task_block.arity)) if task_block
|
38
|
+
|
39
39
|
cmd = [
|
40
40
|
msbuild,
|
41
41
|
project_or_solution.single,
|
42
|
-
*Mapper.new(:MSBuild).map(args)
|
42
|
+
*Mapper.new(:MSBuild).map(@args)
|
43
43
|
]
|
44
44
|
|
45
45
|
sh(*cmd)
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'rake/clean'
|
2
1
|
require 'rake/tasklib'
|
3
2
|
|
4
3
|
module Rake::Funnel::Tasks
|
@@ -6,29 +5,31 @@ module Rake::Funnel::Tasks
|
|
6
5
|
include Rake::Funnel::Support
|
7
6
|
include Rake::Funnel::Support::MSDeploy
|
8
7
|
|
9
|
-
attr_accessor :name, :msdeploy, :
|
8
|
+
attr_accessor :name, :msdeploy, :args, :log_file
|
10
9
|
|
11
|
-
def initialize(
|
12
|
-
|
13
|
-
@msdeploy = 'msdeploy'
|
14
|
-
@args = {}
|
10
|
+
def initialize(*args, &task_block)
|
11
|
+
setup_ivars(args)
|
15
12
|
|
16
|
-
|
17
|
-
define
|
13
|
+
define(args, &task_block)
|
18
14
|
end
|
19
15
|
|
20
|
-
|
21
|
-
|
16
|
+
private
|
17
|
+
def setup_ivars(args)
|
18
|
+
@name = args.shift || :msdeploy
|
19
|
+
|
20
|
+
@msdeploy = 'msdeploy'
|
21
|
+
@args = {}
|
22
|
+
@log_file = "#{@name}.log"
|
22
23
|
end
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
def define(args, &task_block)
|
26
|
+
desc 'Deploy application' unless Rake.application.last_description
|
27
|
+
|
28
|
+
task(name, *args) do |_, task_args|
|
29
|
+
task_block.call(*[self, task_args].slice(0, task_block.arity)) if task_block
|
27
30
|
|
28
|
-
desc "Deploy #{deploy_source(args)}"
|
29
|
-
task @name do
|
30
31
|
mapper = Mapper.new(:MSDeploy)
|
31
|
-
cmd = [quote(msdeploy), mapper.map(args)]
|
32
|
+
cmd = [quote(msdeploy), mapper.map(@args)]
|
32
33
|
.flatten
|
33
34
|
.join(' ')
|
34
35
|
|
@@ -40,14 +41,6 @@ module Rake::Funnel::Tasks
|
|
40
41
|
self
|
41
42
|
end
|
42
43
|
|
43
|
-
def deploy_source(args)
|
44
|
-
source = (args || {}).fetch(:source, {})
|
45
|
-
path = source.first
|
46
|
-
return if path.nil?
|
47
|
-
|
48
|
-
Pathname.new(path[1]).relative_path_from(Pathname.new('.').realpath) rescue path[1]
|
49
|
-
end
|
50
|
-
|
51
44
|
def quote(value)
|
52
45
|
value = value.gsub(/"/, '""') if value.kind_of?(String)
|
53
46
|
return %Q{"#{value}"} if value =~ /\s/
|
@@ -4,35 +4,35 @@ module Rake::Funnel::Tasks
|
|
4
4
|
class NUnit < Rake::TaskLib
|
5
5
|
include Rake::Funnel::Support
|
6
6
|
|
7
|
-
attr_accessor :name, :files, :args
|
7
|
+
attr_accessor :name, :nunit, :files, :args
|
8
8
|
|
9
|
-
def initialize(
|
10
|
-
|
11
|
-
@args = {}
|
12
|
-
@files = %w(build/specs/**/*.dll build/specs/**/*.exe)
|
9
|
+
def initialize(*args, &task_block)
|
10
|
+
setup_ivars(args)
|
13
11
|
|
14
|
-
|
15
|
-
define
|
12
|
+
define(args, &task_block)
|
16
13
|
end
|
17
14
|
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
private
|
16
|
+
def setup_ivars(args)
|
17
|
+
@name = args.shift || :test
|
21
18
|
|
22
|
-
|
23
|
-
@
|
19
|
+
@nunit = 'nunit-console.exe'
|
20
|
+
@args = {}
|
21
|
+
@files = %w(build/specs/**/*.dll build/specs/**/*.exe)
|
24
22
|
end
|
25
23
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
task
|
24
|
+
def define(args, &task_block)
|
25
|
+
desc "Test #{test_assemblies.all_or_default.join(', ')}" unless Rake.application.last_description
|
26
|
+
|
27
|
+
task(name, *args) do |_, task_args|
|
28
|
+
task_block.call(*[self, task_args].slice(0, task_block.arity)) if task_block
|
29
|
+
|
30
30
|
Rake::Funnel::Integration::TeamCity::NUnitPlugin.setup(nunit)
|
31
31
|
|
32
32
|
cmd = [
|
33
33
|
*Mono.invocation(nunit),
|
34
34
|
*test_assemblies.all,
|
35
|
-
*Mapper.new(:NUnit).map(args)
|
35
|
+
*Mapper.new(:NUnit).map(@args)
|
36
36
|
]
|
37
37
|
|
38
38
|
sh(*cmd)
|
@@ -6,23 +6,29 @@ module Rake::Funnel::Tasks
|
|
6
6
|
|
7
7
|
attr_accessor :name, :paket, :paket_args, :bootstrapper, :bootstrapper_args
|
8
8
|
|
9
|
-
def initialize(
|
10
|
-
|
9
|
+
def initialize(*args, &task_block)
|
10
|
+
setup_ivars(args)
|
11
|
+
|
12
|
+
define(args, &task_block)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
def setup_ivars(args)
|
17
|
+
@name = args.shift || :paket
|
11
18
|
|
12
19
|
@paket = File.join('.paket', 'paket.exe')
|
13
20
|
@paket_args = 'restore'
|
14
21
|
|
15
22
|
@bootstrapper = File.join('.paket', 'paket.bootstrapper.exe')
|
16
23
|
@bootstrapper_args = nil
|
17
|
-
|
18
|
-
yield self if block_given?
|
19
|
-
define
|
20
24
|
end
|
21
25
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
task
|
26
|
+
def define(args, &task_block)
|
27
|
+
desc 'Restore packages' unless Rake.application.last_description
|
28
|
+
|
29
|
+
task(name, *args) do |_, task_args|
|
30
|
+
task_block.call(*[self, task_args].slice(0, task_block.arity)) if task_block
|
31
|
+
|
26
32
|
sh(*bootstrapper_cmd) unless File.exist?(paket)
|
27
33
|
sh(*paket_cmd)
|
28
34
|
end
|