albacore 0.1.5 → 0.2.0.preview1
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +4 -0
- data/README.markdown +1 -1
- data/VERSION +1 -1
- data/install_dependencies.rb +2 -3
- data/lib/albacore.rb +1 -0
- data/lib/albacore/albacoremodel.rb +28 -0
- data/lib/albacore/assemblyinfo.rb +5 -4
- data/lib/albacore/config/assemblyinfoconfig.rb +21 -0
- data/lib/albacore/config/config.rb +14 -0
- data/lib/albacore/config/cscconfig.rb +33 -0
- data/lib/albacore/config/docuconfig.rb +25 -0
- data/lib/albacore/config/execconfig.rb +22 -0
- data/lib/albacore/config/msbuildconfig.rb +32 -0
- data/lib/albacore/config/mspecconfig.rb +21 -0
- data/lib/albacore/config/nantconfig.rb +22 -0
- data/lib/albacore/config/ncoverconsoleconfig.rb +22 -0
- data/lib/albacore/config/ncoverreportconfig.rb +22 -0
- data/lib/albacore/config/ndependconfig.rb +22 -0
- data/lib/albacore/config/netversion.rb +23 -0
- data/lib/albacore/config/nunitconfig.rb +20 -0
- data/lib/albacore/config/specflowreportconfig.rb +27 -0
- data/lib/albacore/config/sqlcmdconfig.rb +22 -0
- data/lib/albacore/config/unzipconfig.rb +22 -0
- data/lib/albacore/config/xbuildconfig.rb +22 -0
- data/lib/albacore/config/xunitconfig.rb +22 -0
- data/lib/albacore/config/zipconfig.rb +22 -0
- data/lib/albacore/csc.rb +31 -0
- data/lib/albacore/docu.rb +8 -6
- data/lib/albacore/exec.rb +9 -3
- data/lib/albacore/msbuild.rb +5 -12
- data/lib/albacore/mspectestrunner.rb +9 -7
- data/lib/albacore/nant.rb +5 -4
- data/lib/albacore/ncoverconsole.rb +6 -9
- data/lib/albacore/ncoverreport.rb +8 -6
- data/lib/albacore/ncoverreports/codecoveragebase.rb +4 -4
- data/lib/albacore/ncoverreports/cyclomaticcomplexity.rb +4 -4
- data/lib/albacore/ncoverreports/fullcoveragereport.rb +3 -3
- data/lib/albacore/ncoverreports/reportfilterbase.rb +4 -4
- data/lib/albacore/ncoverreports/summaryreport.rb +3 -3
- data/lib/albacore/ndepend.rb +12 -9
- data/lib/albacore/nunittestrunner.rb +9 -7
- data/lib/albacore/specflowreport.rb +62 -0
- data/lib/albacore/sqlcmd.rb +8 -6
- data/lib/albacore/support/attrmethods.rb +7 -8
- data/lib/albacore/support/logging.rb +8 -4
- data/lib/albacore/support/openstruct.rb +13 -0
- data/lib/albacore/support/runcommand.rb +24 -24
- data/lib/albacore/support/supportlinux.rb +23 -0
- data/lib/albacore/support/yamlconfig.rb +2 -10
- data/lib/albacore/unzip.rb +14 -12
- data/lib/albacore/xbuild.rb +6 -5
- data/lib/albacore/xunittestrunner.rb +8 -6
- data/lib/albacore/zipdirectory.rb +27 -6
- data/lib/rake/csctask.rb +3 -0
- data/lib/rake/specflowreporttask.rb +3 -0
- data/lib/rake/unziptask.rb +1 -1
- data/rakefile.rb +21 -54
- data/spec/albacoremodel_spec.rb +35 -0
- data/spec/assemblyinfo_spec.rb +17 -0
- data/spec/attrmethods_spec.rb +17 -1
- data/spec/config_spec.rb +19 -0
- data/spec/createtask_spec.rb +45 -4
- data/spec/csc_spec.rb +87 -0
- data/spec/csctask_spec.rb +1 -0
- data/spec/docu_spec.rb +43 -1
- data/spec/exec_spec.rb +16 -1
- data/spec/msbuild_spec.rb +30 -18
- data/spec/mspec_spec.rb +28 -0
- data/spec/nant_spec.rb +20 -12
- data/spec/ncoverconsole_spec.rb +25 -13
- data/spec/ncoverreport_spec.rb +31 -18
- data/spec/ndepend_spec.rb +23 -2
- data/spec/nunittestrunner_spec.rb +48 -0
- data/spec/runcommand_spec.rb +59 -32
- data/spec/specflowreport_spec.rb +146 -0
- data/spec/specflowreporttask_spec.rb +48 -0
- data/spec/sqlcmd_spec.rb +18 -5
- data/spec/support/SpecFlow/TechTalk.SpecFlow.dll +0 -0
- data/spec/support/SpecFlow/TestSolution.SpecFlow.dll +0 -0
- data/spec/support/SpecFlow/TestSolution.SpecFlow.pdb +0 -0
- data/spec/support/SpecFlow/TestSolution.dll +0 -0
- data/spec/support/SpecFlow/TestSolution.pdb +0 -0
- data/spec/support/SpecFlow/nunit.framework.dll +0 -0
- data/spec/support/TestSolution/TestSolution.5.0.ReSharper.user +27 -0
- data/spec/support/TestSolution/TestSolution.SpecFlow/OneFeature.feature +8 -0
- data/spec/support/TestSolution/TestSolution.SpecFlow/OneFeature.feature.cs +73 -0
- data/spec/support/TestSolution/TestSolution.SpecFlow/Properties/AssemblyInfo.cs +36 -0
- data/spec/support/TestSolution/TestSolution.SpecFlow/StepDefinition.cs +30 -0
- data/spec/support/TestSolution/TestSolution.SpecFlow/TestSolution.SpecFlow.csproj +84 -0
- data/spec/support/TestSolution/TestSolution.sln +6 -0
- data/spec/support/csc/File1.cs +9 -0
- data/spec/support/csc/File2.cs +9 -0
- data/spec/support/csc/output/ignorethis.txt +1 -0
- data/spec/support/msbuildtestdata.rb +3 -3
- data/spec/support/ncoverreporttestdata.rb +2 -2
- data/spec/support/spec_helper.rb +2 -1
- data/spec/support/yamlconfig/yaml_autoconfig_test.yml +1 -1
- data/spec/unzip_spec.rb +15 -0
- data/spec/xbuild_spec.rb +15 -0
- data/spec/xunit_spec.rb +16 -2
- data/spec/yamlconfig_spec.rb +7 -6
- data/spec/zip_spec.rb +50 -9
- data/watchrtesting.rb +8 -0
- metadata +99 -91
- data/lib/albacore/expandtemplates.rb +0 -81
- data/lib/albacore/plink.rb +0 -49
- data/lib/albacore/renamer.rb +0 -17
- data/lib/albacore/sftp.rb +0 -42
- data/lib/albacore/ssh.rb +0 -44
- data/lib/albacore/support/albacore_helper.rb +0 -1
- data/lib/albacore/support/globalconfig.rb +0 -6
- data/lib/rake/expandtemplatestask.rb +0 -3
- data/lib/rake/plinktask.rb +0 -3
- data/lib/rake/renametask.rb +0 -3
- data/lib/rake/sftptask.rb +0 -3
- data/lib/rake/sshtask.rb +0 -3
- data/spec/expandtemplates_spec.rb +0 -180
- data/spec/expandtemplatestask_spec.rb +0 -46
- data/spec/plink_spec.rb +0 -62
- data/spec/plinktask_spec.rb +0 -46
- data/spec/renametask_spec.rb +0 -32
- data/spec/sftp_spec.rb +0 -30
- data/spec/sftptask_spec.rb +0 -42
- data/spec/ssh_spec.rb +0 -47
- data/spec/sshtask_spec.rb +0 -40
- data/spec/support/expandtemplates/datafiles/multiplevalues.yml +0 -3
- data/spec/support/expandtemplates/datafiles/multitemplate-specificfile.yml +0 -11
- data/spec/support/expandtemplates/datafiles/multitemplate.yml +0 -4
- data/spec/support/expandtemplates/datafiles/sample.yml +0 -1
- data/spec/support/expandtemplates/datafiles/sample_with_include.yml +0 -2
- data/spec/support/expandtemplates/datafiles/template_specific_data_file_with_include.yml +0 -5
- data/spec/support/expandtemplates/datafiles/template_specific_include.yml +0 -3
- data/spec/support/expandtemplates/templates/multipleinstance.config +0 -4
- data/spec/support/expandtemplates/templates/multiplevalues.config +0 -1
- data/spec/support/expandtemplates/templates/sample.config +0 -1
- data/spec/support/expandtemplatestestdata.rb +0 -77
@@ -1,8 +1,8 @@
|
|
1
|
-
require 'albacore/
|
1
|
+
require 'albacore/albacoremodel'
|
2
2
|
|
3
3
|
module NCover
|
4
4
|
class SummaryReport
|
5
|
-
include
|
5
|
+
include AlbacoreModel
|
6
6
|
|
7
7
|
attr_accessor :output_path
|
8
8
|
|
@@ -19,4 +19,4 @@ module NCover
|
|
19
19
|
:Html
|
20
20
|
end
|
21
21
|
end
|
22
|
-
end
|
22
|
+
end
|
data/lib/albacore/ndepend.rb
CHANGED
@@ -1,18 +1,21 @@
|
|
1
|
-
require
|
1
|
+
require 'albacore/albacoremodel'
|
2
|
+
require 'albacore/config/ndependconfig'
|
3
|
+
|
2
4
|
class NDepend
|
3
|
-
|
5
|
+
include AlbacoreModel
|
4
6
|
include RunCommand
|
5
|
-
include
|
6
|
-
|
7
|
+
include Configuration::NDepend
|
8
|
+
|
9
|
+
attr_accessor :project_file
|
7
10
|
|
8
|
-
attr_accessor :path_to_command, :project_file
|
9
11
|
def initialize()
|
10
12
|
super()
|
13
|
+
update_attributes ndepend.to_hash
|
11
14
|
end
|
12
15
|
|
13
16
|
def run
|
14
|
-
return unless
|
15
|
-
result = run_command @
|
17
|
+
return unless check_command
|
18
|
+
result = run_command @command, create_parameters.join(" ")
|
16
19
|
failure_message = 'Command Failed. See Build Log For Detail'
|
17
20
|
fail_with_message failure_message if !result
|
18
21
|
end
|
@@ -23,10 +26,10 @@ class NDepend
|
|
23
26
|
return params
|
24
27
|
end
|
25
28
|
|
26
|
-
def
|
29
|
+
def check_command
|
27
30
|
return true if @project_file
|
28
31
|
fail_with_message 'A ndepend project file is required'
|
29
32
|
return false
|
30
33
|
end
|
31
34
|
|
32
|
-
end
|
35
|
+
end
|
@@ -1,22 +1,24 @@
|
|
1
|
-
require 'albacore/
|
1
|
+
require 'albacore/albacoremodel'
|
2
|
+
require 'albacore/config/nunitconfig'
|
2
3
|
|
3
4
|
class NUnitTestRunner
|
4
|
-
|
5
|
+
include AlbacoreModel
|
5
6
|
include RunCommand
|
6
|
-
include
|
7
|
+
include Configuration::NUnit
|
7
8
|
|
8
9
|
attr_array :assemblies, :options
|
9
10
|
|
10
|
-
def initialize(
|
11
|
-
@path_to_command = path_to_command
|
11
|
+
def initialize(command=nil)
|
12
12
|
@options=[]
|
13
13
|
@assemblies=[]
|
14
14
|
super()
|
15
|
+
update_attributes nunit.to_hash
|
16
|
+
@command = command unless command.nil?
|
15
17
|
end
|
16
18
|
|
17
19
|
def get_command_line
|
18
20
|
command_params = []
|
19
|
-
command_params << @
|
21
|
+
command_params << @command
|
20
22
|
command_params << get_command_parameters
|
21
23
|
commandline = command_params.join(" ")
|
22
24
|
@logger.debug "Build NUnit Test Runner Command Line: " + commandline
|
@@ -37,4 +39,4 @@ class NUnitTestRunner
|
|
37
39
|
failure_message = 'NUnit Failed. See Build Log For Detail'
|
38
40
|
fail_with_message failure_message if !result
|
39
41
|
end
|
40
|
-
end
|
42
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'albacore/albacoremodel'
|
2
|
+
require 'albacore/config/specflowreportconfig'
|
3
|
+
|
4
|
+
class SpecFlowReport
|
5
|
+
include AlbacoreModel
|
6
|
+
include RunCommand
|
7
|
+
include Configuration::SpecFlowReport
|
8
|
+
|
9
|
+
attr_array :projects, :options, :report
|
10
|
+
|
11
|
+
def initialize(command=nil, report=nil)
|
12
|
+
@options=[]
|
13
|
+
@projects =[]
|
14
|
+
super()
|
15
|
+
update_attributes specflowreport.to_hash
|
16
|
+
@command = command unless command.nil?
|
17
|
+
@report = report unless command.nil?
|
18
|
+
end
|
19
|
+
|
20
|
+
def get_command_line
|
21
|
+
command_params = []
|
22
|
+
command_params << @command
|
23
|
+
command_params << get_command_parameters
|
24
|
+
commandline = command_params.join(" ")
|
25
|
+
@logger.debug "Build SpecFlow Command Line: " + commandline
|
26
|
+
commandline
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_projects
|
30
|
+
if @projects.empty? then
|
31
|
+
failure_message = "SpecFlow Expects at list one project file"
|
32
|
+
@logger.debug failure_message
|
33
|
+
fail_with_message failure_message
|
34
|
+
else
|
35
|
+
@projects.map{|asm| "\"#{asm}\""}.join(' ')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def get_options
|
40
|
+
if @options.empty? then
|
41
|
+
"/xmlTestResult:TestResult.xml /out:specs.html"
|
42
|
+
else
|
43
|
+
@options.join(" ")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def get_command_parameters
|
48
|
+
command_params = []
|
49
|
+
command_params << @report
|
50
|
+
command_params << get_projects
|
51
|
+
command_params << get_options
|
52
|
+
command_params
|
53
|
+
end
|
54
|
+
|
55
|
+
def execute()
|
56
|
+
command_params = get_command_parameters
|
57
|
+
result = run_command "specflow.exe", command_params.join(" ")
|
58
|
+
|
59
|
+
failure_message = 'SpecFlow Failed. See Build Log For Detail. ' + command_params.join(" ")
|
60
|
+
fail_with_message failure_message if !result
|
61
|
+
end
|
62
|
+
end
|
data/lib/albacore/sqlcmd.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
require 'albacore/
|
1
|
+
require 'albacore/albacoremodel'
|
2
|
+
require 'albacore/config/sqlcmdconfig'
|
2
3
|
|
3
4
|
class SQLCmd
|
4
|
-
|
5
|
+
include AlbacoreModel
|
5
6
|
include RunCommand
|
6
|
-
include
|
7
|
+
include Configuration::SQLCmd
|
7
8
|
|
8
9
|
attr_accessor :server, :database, :username, :password
|
9
10
|
attr_array :scripts
|
@@ -14,6 +15,7 @@ class SQLCmd
|
|
14
15
|
@scripts=[]
|
15
16
|
@variables={}
|
16
17
|
super()
|
18
|
+
update_attributes sqlcmd.to_hash
|
17
19
|
end
|
18
20
|
|
19
21
|
def run
|
@@ -34,8 +36,8 @@ class SQLCmd
|
|
34
36
|
end
|
35
37
|
|
36
38
|
def check_command
|
37
|
-
return true if (!@
|
38
|
-
fail_with_message 'SQLCmd.
|
39
|
+
return true if (!@command.nil?)
|
40
|
+
fail_with_message 'SQLCmd.command cannot be nil.'
|
39
41
|
return false
|
40
42
|
end
|
41
43
|
|
@@ -55,4 +57,4 @@ class SQLCmd
|
|
55
57
|
vars.join(" ")
|
56
58
|
end
|
57
59
|
|
58
|
-
end
|
60
|
+
end
|
@@ -1,31 +1,30 @@
|
|
1
1
|
module AttrMethods
|
2
|
-
|
3
2
|
def attr_array(*names)
|
4
3
|
names.each do |n|
|
5
4
|
self.send :define_method, n do |*value|
|
6
5
|
if value.nil? || value.empty?
|
7
|
-
return instance_variable_get
|
6
|
+
return instance_variable_get("@#{n}")
|
8
7
|
else
|
9
|
-
|
8
|
+
self.send "#{n}=".to_sym, value.to_ary.flatten
|
10
9
|
end
|
11
10
|
end
|
12
11
|
self.send :define_method, "#{n}=" do |value|
|
13
|
-
instance_variable_set
|
12
|
+
instance_variable_set("@#{n}", value)
|
14
13
|
end
|
15
14
|
end
|
16
15
|
end
|
17
16
|
|
18
17
|
def attr_hash(*names)
|
19
|
-
|
18
|
+
names.each do |n|
|
20
19
|
self.send :define_method, n do |*value|
|
21
20
|
if value.nil? || value.empty?
|
22
|
-
instance_variable_get
|
21
|
+
instance_variable_get("@#{n}")
|
23
22
|
else
|
24
|
-
instance_variable_set
|
23
|
+
instance_variable_set("@#{n}", value[0])
|
25
24
|
end
|
26
25
|
end
|
27
26
|
self.send :define_method, "#{n}=" do |value|
|
28
|
-
instance_variable_set
|
27
|
+
instance_variable_set("@#{n}", value)
|
29
28
|
end
|
30
29
|
end
|
31
30
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'logger'
|
2
2
|
|
3
3
|
module Logging
|
4
|
-
|
5
4
|
attr_accessor :logger, :current_log_device
|
6
5
|
|
7
6
|
def initialize
|
@@ -15,6 +14,7 @@ module Logging
|
|
15
14
|
end
|
16
15
|
|
17
16
|
def log_level=(level)
|
17
|
+
@log_level = level
|
18
18
|
if (level == :verbose)
|
19
19
|
loglevel = Logger::DEBUG
|
20
20
|
else
|
@@ -22,13 +22,17 @@ module Logging
|
|
22
22
|
end
|
23
23
|
create_logger(@current_log_device, loglevel)
|
24
24
|
end
|
25
|
+
|
26
|
+
def log_level
|
27
|
+
@log_level
|
28
|
+
end
|
25
29
|
|
26
30
|
def create_logger(device, level)
|
27
31
|
@current_log_device = device
|
28
32
|
@logger = Logger.new(device)
|
29
33
|
|
30
|
-
level = Logger::DEBUG if Albacore
|
34
|
+
level = Logger::DEBUG if Albacore.configure.log_level == :verbose
|
31
35
|
@logger.level = level
|
36
|
+
@log_level = :verbose if level == Logger::DEBUG
|
32
37
|
end
|
33
|
-
|
34
|
-
end
|
38
|
+
end
|
@@ -1,48 +1,48 @@
|
|
1
|
-
require 'albacore/support/
|
2
|
-
require 'albacore/support/attrmethods.rb'
|
1
|
+
require 'albacore/support/attrmethods'
|
3
2
|
|
4
3
|
module RunCommand
|
5
4
|
extend AttrMethods
|
6
|
-
include Failure
|
7
5
|
|
8
|
-
attr_accessor :
|
6
|
+
attr_accessor :command, :working_directory
|
9
7
|
attr_array :parameters
|
10
8
|
|
11
9
|
def initialize
|
12
|
-
@
|
13
|
-
@command_directory = Dir.pwd
|
10
|
+
@working_directory = Dir.pwd
|
14
11
|
@parameters = []
|
15
12
|
super()
|
16
13
|
end
|
17
14
|
|
18
|
-
def run_command(
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
combine_parameters = Array.new(@parameters)
|
24
|
-
combine_parameters << command_parameters unless command_parameters.nil?
|
15
|
+
def run_command(name="Command Line", parameters=nil)
|
16
|
+
params = Array.new
|
17
|
+
params << parameters unless parameters.nil?
|
18
|
+
params << @parameters unless (@parameters.nil? || @parameters.length==0)
|
25
19
|
|
26
|
-
|
27
|
-
@logger.debug "Executing #{
|
20
|
+
cmd = get_command(params)
|
21
|
+
@logger.debug "Executing #{name}: #{cmd}"
|
28
22
|
|
29
|
-
set_working_directory
|
30
|
-
result = system
|
23
|
+
set_working_directory
|
24
|
+
result = system cmd
|
31
25
|
reset_working_directory
|
32
26
|
|
33
27
|
result
|
34
28
|
end
|
35
|
-
|
36
|
-
def
|
37
|
-
|
38
|
-
|
39
|
-
|
29
|
+
|
30
|
+
def get_command(params)
|
31
|
+
cmd = "\"#{@command}\""
|
32
|
+
cmd +=" #{params.join(' ')}" if params.length > 0
|
33
|
+
cmd
|
34
|
+
end
|
35
|
+
|
36
|
+
def combine_parameters(params1, params2)
|
37
|
+
combined = params1.collect
|
38
|
+
combined = combined.push(params2) unless params2.nil?
|
39
|
+
combined
|
40
40
|
end
|
41
41
|
|
42
42
|
def set_working_directory
|
43
43
|
@original_directory = Dir.pwd
|
44
|
-
return if @
|
45
|
-
Dir.chdir(@
|
44
|
+
return if @working_directory == @original_directory
|
45
|
+
Dir.chdir(@working_directory)
|
46
46
|
end
|
47
47
|
|
48
48
|
def reset_working_directory
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module SupportsLinuxEnvironment
|
2
|
+
attr_accessor :is_linux
|
3
|
+
|
4
|
+
def initialize
|
5
|
+
@is_linux = RUBY_PLATFORM.include? 'linux'
|
6
|
+
super()
|
7
|
+
end
|
8
|
+
|
9
|
+
def format_reference(reference)
|
10
|
+
"\"/reference:#{to_OS_format(reference)}\""
|
11
|
+
end
|
12
|
+
|
13
|
+
def format_path(path)
|
14
|
+
"\"#{to_OS_format(path)}\""
|
15
|
+
end
|
16
|
+
|
17
|
+
def to_OS_format(input)
|
18
|
+
formatted_input = @is_linux ? input : input.gsub("/", "\\")
|
19
|
+
formatted_input
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
|
@@ -7,20 +7,12 @@ module YAMLConfig
|
|
7
7
|
|
8
8
|
def load_config_by_task_name(task_name)
|
9
9
|
task_config = "#{task_name}.yml"
|
10
|
-
task_config = File.join(Albacore
|
10
|
+
task_config = File.join(Albacore.configure.yaml_config_folder, task_config) unless Albacore.configure.yaml_config_folder.nil?
|
11
11
|
configure(task_config) if File.exists?(task_config)
|
12
12
|
end
|
13
13
|
|
14
14
|
def configure(yml_file)
|
15
15
|
config = YAML::load(File.open(yml_file))
|
16
|
-
|
16
|
+
update_attributes config
|
17
17
|
end
|
18
|
-
|
19
|
-
def parse_config(config)
|
20
|
-
config.each do |key, value|
|
21
|
-
setter = "#{key}="
|
22
|
-
self.class.send(:attr_accessor, key) if !respond_to?(setter)
|
23
|
-
send setter, value
|
24
|
-
end
|
25
|
-
end
|
26
18
|
end
|
data/lib/albacore/unzip.rb
CHANGED
@@ -1,28 +1,30 @@
|
|
1
|
-
require 'albacore/
|
1
|
+
require 'albacore/albacoremodel'
|
2
2
|
require 'zip/zip'
|
3
3
|
require 'zip/zipfilesystem'
|
4
|
+
require 'albacore/config/unzipconfig'
|
4
5
|
include Zip
|
5
6
|
|
6
7
|
class Unzip
|
7
|
-
include
|
8
|
-
include
|
8
|
+
include AlbacoreModel
|
9
|
+
include Configuration::Unzip
|
9
10
|
|
10
|
-
attr_accessor :
|
11
|
+
attr_accessor :destination, :file
|
11
12
|
|
12
13
|
def initialize
|
13
14
|
super()
|
15
|
+
update_attributes unzip.to_hash
|
14
16
|
end
|
15
17
|
|
16
|
-
def
|
17
|
-
fail_with_message 'Zip File cannot be empty' if @
|
18
|
-
return if @
|
18
|
+
def execute()
|
19
|
+
fail_with_message 'Zip File cannot be empty' if @file.nil?
|
20
|
+
return if @file.nil?
|
19
21
|
|
20
|
-
Zip::ZipFile.open(@
|
21
|
-
|
22
|
-
out_path = File.join(@
|
22
|
+
Zip::ZipFile.open(@file) do |zip_f|
|
23
|
+
zip_f.each do |f|
|
24
|
+
out_path = File.join(@destination, f.name)
|
23
25
|
FileUtils.mkdir_p(File.dirname(out_path))
|
24
|
-
|
26
|
+
zip_f.extract(f, out_path) unless File.exist?(out_path)
|
25
27
|
end
|
26
28
|
end
|
27
29
|
end
|
28
|
-
end
|
30
|
+
end
|