albacore 0.1.5 → 0.2.0.preview1
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.
- 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,81 +0,0 @@
|
|
1
|
-
require 'albacore/support/albacore_helper'
|
2
|
-
require 'yaml'
|
3
|
-
|
4
|
-
class ExpandTemplates
|
5
|
-
extend AttrMethods
|
6
|
-
include YAMLConfig
|
7
|
-
include Logging
|
8
|
-
|
9
|
-
attr_accessor :data_file
|
10
|
-
attr_hash :expand_files
|
11
|
-
|
12
|
-
def initialize
|
13
|
-
@expand_files = {}
|
14
|
-
super()
|
15
|
-
end
|
16
|
-
|
17
|
-
def expand
|
18
|
-
return if @data_file.nil?
|
19
|
-
return if @expand_files.empty?
|
20
|
-
|
21
|
-
config = read_config(@data_file)
|
22
|
-
@expand_files.each { |template_file, output_file|
|
23
|
-
file_config = get_config_for_file config, template_file
|
24
|
-
expand_template template_file, output_file, file_config
|
25
|
-
}
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
def expand_template(template_file, output_file, config)
|
31
|
-
@logger.info "Parsing #{template_file} into #{output_file}"
|
32
|
-
|
33
|
-
template_data = ''
|
34
|
-
File.open(template_file, "r") {|f|
|
35
|
-
template_data = f.read
|
36
|
-
}
|
37
|
-
template_data
|
38
|
-
|
39
|
-
template_data.gsub!(/\#\{(.*?)\}/) {|match|
|
40
|
-
value = config[$1]
|
41
|
-
@logger.debug "Found \"\#{#{$1}}\": Replacing with \"#{value}\"."
|
42
|
-
value
|
43
|
-
}
|
44
|
-
|
45
|
-
File.open(output_file, "w") {|output|
|
46
|
-
output.write(template_data)
|
47
|
-
}
|
48
|
-
end
|
49
|
-
|
50
|
-
def read_config(file)
|
51
|
-
config = YAML::load(File.open(file, "r"))
|
52
|
-
if (config.include?("@include"))
|
53
|
-
include_file = File.join(File.dirname(file), config["@include"])
|
54
|
-
@logger.debug("Found @include directive. Loading additional data from #{include_file}")
|
55
|
-
config.reject!{|k,v| k == "@include"}
|
56
|
-
include_config = read_config(include_file)
|
57
|
-
config = deep_merge(include_config, config)
|
58
|
-
end
|
59
|
-
return config
|
60
|
-
end
|
61
|
-
|
62
|
-
def deep_merge(first, second)
|
63
|
-
# From: http://www.ruby-forum.com/topic/142809
|
64
|
-
# Author: Stefan Rusterholz
|
65
|
-
merger = proc { |key,v1,v2| Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2 }
|
66
|
-
first.merge(second, &merger)
|
67
|
-
end
|
68
|
-
|
69
|
-
def get_config_for_file(original_config, file)
|
70
|
-
filename = File.basename(file)
|
71
|
-
file_config = original_config[filename]
|
72
|
-
if file_config.nil?
|
73
|
-
@logger.debug "No config data found for #{filename}. Using local data."
|
74
|
-
new_config = original_config
|
75
|
-
else
|
76
|
-
@logger.debug "Found config data for #{filename}."
|
77
|
-
new_config = original_config.merge(file_config)
|
78
|
-
end
|
79
|
-
new_config
|
80
|
-
end
|
81
|
-
end
|
data/lib/albacore/plink.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
require 'albacore/support/albacore_helper'
|
2
|
-
|
3
|
-
class PLink
|
4
|
-
extend AttrMethods
|
5
|
-
include RunCommand
|
6
|
-
include YAMLConfig
|
7
|
-
include Logging
|
8
|
-
|
9
|
-
attr_accessor :host, :port, :user, :key, :verbose
|
10
|
-
attr_array :commands
|
11
|
-
|
12
|
-
def initialize()
|
13
|
-
@require_valid_command = false
|
14
|
-
@port = 22
|
15
|
-
@verbose = false
|
16
|
-
@commands = []
|
17
|
-
super()
|
18
|
-
end
|
19
|
-
|
20
|
-
def run()
|
21
|
-
return unless check_command
|
22
|
-
|
23
|
-
parameters = create_parameters
|
24
|
-
result = run_command "Plink", parameters.join(" ")
|
25
|
-
failure_message = 'Command Failed. See Build Log For Detail'
|
26
|
-
fail_with_message failure_message if !result
|
27
|
-
end
|
28
|
-
|
29
|
-
def create_parameters
|
30
|
-
parameters = []
|
31
|
-
parameters << "#{@user}@#{@host} -P #{@port} "
|
32
|
-
parameters << build_parameter("i", @key) unless @key.nil?
|
33
|
-
parameters << "-batch"
|
34
|
-
parameters << "-v" if @verbose
|
35
|
-
parameters << @commands
|
36
|
-
@logger.debug "PLink Parameters" + parameters.join(" ")
|
37
|
-
return parameters
|
38
|
-
end
|
39
|
-
|
40
|
-
def build_parameter(param_name, param_value)
|
41
|
-
"-#{param_name} #{param_value}"
|
42
|
-
end
|
43
|
-
|
44
|
-
def check_command
|
45
|
-
return true if @path_to_command
|
46
|
-
fail_with_message 'Plink.path_to_command cannot be nil.'
|
47
|
-
return false
|
48
|
-
end
|
49
|
-
end
|
data/lib/albacore/renamer.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'albacore/support/albacore_helper'
|
2
|
-
|
3
|
-
class Renamer
|
4
|
-
include YAMLConfig
|
5
|
-
include Failure
|
6
|
-
|
7
|
-
attr_accessor :actual_name, :target_name
|
8
|
-
|
9
|
-
def rename
|
10
|
-
if (@actual_name.nil? || @target_name.nil?)
|
11
|
-
fail "actual_name and target_name cannot be nil"
|
12
|
-
else
|
13
|
-
File.rename(@actual_name, @target_name)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
data/lib/albacore/sftp.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'albacore/support/albacore_helper'
|
2
|
-
require 'net/sftp'
|
3
|
-
|
4
|
-
class Sftp
|
5
|
-
extend AttrMethods
|
6
|
-
include YAMLConfig
|
7
|
-
include Logging
|
8
|
-
|
9
|
-
attr_accessor :server, :username, :password, :port, :key, :debug
|
10
|
-
attr_hash :upload_files
|
11
|
-
|
12
|
-
def initialize
|
13
|
-
@upload_files = {}
|
14
|
-
super()
|
15
|
-
end
|
16
|
-
|
17
|
-
def get_connection_options
|
18
|
-
options = {}
|
19
|
-
options[:verbose] = :debug if @debug == true
|
20
|
-
options[:password] = @password if @password
|
21
|
-
options[:port] = @port if @port
|
22
|
-
options[:keys] = [@key] if @key
|
23
|
-
options
|
24
|
-
end
|
25
|
-
|
26
|
-
def upload()
|
27
|
-
warn_about_key if @key
|
28
|
-
|
29
|
-
Net::SFTP.start(@server, @username, get_connection_options) do |sftp|
|
30
|
-
@logger.debug "Starting File Upload"
|
31
|
-
@upload_files.each {|local_file, remote_file|
|
32
|
-
@logger.debug "Uploading #{local_file} to #{remote_file}"
|
33
|
-
sftp.upload!(local_file, remote_file)
|
34
|
-
}
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def warn_about_key()
|
39
|
-
info.debug 'When using a key, you need an SSH-Agent running to manage the keys.'
|
40
|
-
info.debug 'On Windows, a recommended agent is called Pageant, downloadable from the Putty site.'
|
41
|
-
end
|
42
|
-
end
|
data/lib/albacore/ssh.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'albacore/support/albacore_helper'
|
2
|
-
require 'net/ssh'
|
3
|
-
|
4
|
-
class Ssh
|
5
|
-
extend AttrMethods
|
6
|
-
include YAMLConfig
|
7
|
-
include Logging
|
8
|
-
|
9
|
-
attr_accessor :server, :username, :password, :port, :key, :debug
|
10
|
-
attr_array :commands
|
11
|
-
|
12
|
-
def initialize
|
13
|
-
@commands = []
|
14
|
-
super()
|
15
|
-
end
|
16
|
-
|
17
|
-
def get_connection_options
|
18
|
-
options = {}
|
19
|
-
options[:verbose] = :debug if @debug == true
|
20
|
-
options[:password] = @password if @password
|
21
|
-
options[:port] = @port if @port
|
22
|
-
options[:keys] = [@key] if @key
|
23
|
-
options
|
24
|
-
end
|
25
|
-
|
26
|
-
def execute()
|
27
|
-
warn_about_key if @key
|
28
|
-
|
29
|
-
Net::SSH.start(@server, @username, get_connection_options) do |ssh|
|
30
|
-
@commands.each{|cmd|
|
31
|
-
@logger.info "Executing remote command: #{cmd}"
|
32
|
-
output = ssh.exec!(cmd)
|
33
|
-
@logger.info 'SSH output: '
|
34
|
-
@logger.info output
|
35
|
-
}
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def warn_about_key()
|
40
|
-
info.debug 'When using a key, you need an SSH-Agent running to manage the keys.'
|
41
|
-
info.debug 'On Windows, a recommended agent is called Pageant, downloadable from the Putty site.'
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
Dir.glob(File.join(File.dirname(__FILE__), '*.rb')).reject{|f| f == __FILE__}.each {|f| require f }
|
data/lib/rake/plinktask.rb
DELETED
data/lib/rake/renametask.rb
DELETED
data/lib/rake/sftptask.rb
DELETED
data/lib/rake/sshtask.rb
DELETED
@@ -1,180 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
|
2
|
-
require 'albacore/expandtemplates'
|
3
|
-
require 'expandtemplatestestdata'
|
4
|
-
|
5
|
-
shared_examples_for "prepping the sample templates" do
|
6
|
-
before :all do
|
7
|
-
@testdata = ExpandTemplatesTestData.new
|
8
|
-
@testdata.prep_sample_templates
|
9
|
-
|
10
|
-
@templates = ExpandTemplates.new
|
11
|
-
@templates.log_level = :verbose
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
describe ExpandTemplates, "when expanding a single value into multiple locations" do
|
16
|
-
it_should_behave_like "prepping the sample templates"
|
17
|
-
|
18
|
-
before :all do
|
19
|
-
@templates.expand_files @testdata.multipleinstance_template_file => @testdata.multipleinstance_template_file
|
20
|
-
@templates.data_file = @testdata.sample_data_file
|
21
|
-
@templates.expand
|
22
|
-
|
23
|
-
@output_file_data = @testdata.read_file(@testdata.multipleinstance_template_file)
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should replace the first location" do
|
27
|
-
@output_file_data.should include("first instance of 'the real value' is here.")
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should replace the second location" do
|
31
|
-
@output_file_data.should include("second instance of 'the real value' goes here.")
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe ExpandTemplates, "when expanding multiples value into multiple locations" do
|
36
|
-
it_should_behave_like "prepping the sample templates"
|
37
|
-
|
38
|
-
before :all do
|
39
|
-
@templates.expand_files @testdata.multiplevalues_template_file => @testdata.multiplevalues_output_file
|
40
|
-
@templates.data_file = @testdata.multiplevalues_data_file
|
41
|
-
@templates.expand
|
42
|
-
|
43
|
-
@output_file_data = @testdata.read_file(@testdata.multiplevalues_output_file)
|
44
|
-
end
|
45
|
-
|
46
|
-
it "should replace the values" do
|
47
|
-
@output_file_data.should include("this is a template file with multiple values")
|
48
|
-
end
|
49
|
-
|
50
|
-
it "should write to the specified output file" do
|
51
|
-
File.exist?(@testdata.multiplevalues_output_file).should be_true
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
describe ExpandTemplates, "when expanding a template file and specifying an output file" do
|
56
|
-
it_should_behave_like "prepping the sample templates"
|
57
|
-
|
58
|
-
before :all do
|
59
|
-
@templates.expand_files @testdata.sample_template_file => @testdata.sample_output_file
|
60
|
-
@templates.data_file = @testdata.sample_data_file
|
61
|
-
@templates.expand
|
62
|
-
|
63
|
-
@output_file_data = @testdata.read_file(@testdata.sample_output_file)
|
64
|
-
end
|
65
|
-
|
66
|
-
it "should replace the \#{value} placeholder with 'the real value'" do
|
67
|
-
@output_file_data.should include("the real value")
|
68
|
-
end
|
69
|
-
|
70
|
-
it "should write to the specified output file" do
|
71
|
-
File.exist?(@testdata.sample_output_file).should be_true
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
describe ExpandTemplates, "when expanding multiple template files" do
|
76
|
-
it_should_behave_like "prepping the sample templates"
|
77
|
-
|
78
|
-
before :all do
|
79
|
-
@templates.expand_files(
|
80
|
-
@testdata.multipleinstance_template_file => @testdata.multipleinstance_template_file,
|
81
|
-
@testdata.sample_template_file => @testdata.sample_output_file,
|
82
|
-
@testdata.multiplevalues_template_file => @testdata.multiplevalues_output_file
|
83
|
-
)
|
84
|
-
|
85
|
-
@templates.data_file = @testdata.multitemplate_data_file
|
86
|
-
@templates.expand
|
87
|
-
|
88
|
-
@output_file_data = @testdata.read_file(@testdata.multipleinstance_template_file)
|
89
|
-
end
|
90
|
-
|
91
|
-
it "should expand the first template right onto itself" do
|
92
|
-
@output_file_data.should include("first instance of 'the real value' is here.")
|
93
|
-
end
|
94
|
-
|
95
|
-
it "should expand the second template to the specified location" do
|
96
|
-
File.exist?(@testdata.sample_output_file).should be_true
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
describe ExpandTemplates, "when expanding template files and the data file contains entries for specific templates" do
|
101
|
-
it_should_behave_like "prepping the sample templates"
|
102
|
-
|
103
|
-
before :all do
|
104
|
-
@templates.expand_files(
|
105
|
-
@testdata.multipleinstance_template_file => @testdata.multipleinstance_template_file,
|
106
|
-
@testdata.sample_template_file => @testdata.sample_output_file,
|
107
|
-
@testdata.multiplevalues_template_file => @testdata.multiplevalues_output_file
|
108
|
-
)
|
109
|
-
@templates.data_file = @testdata.multitemplate_specificfile_data_file
|
110
|
-
@templates.expand
|
111
|
-
|
112
|
-
@multiinstance_file_data = @testdata.read_file(@testdata.multipleinstance_template_file)
|
113
|
-
@sample_file_data = @testdata.read_file(@testdata.sample_output_file)
|
114
|
-
end
|
115
|
-
|
116
|
-
it "should expand the specific template with the data specified for it" do
|
117
|
-
@multiinstance_file_data.should include("first instance of 'the real value' is here.")
|
118
|
-
@multiinstance_file_data.should include("b has a value of this is a second value")
|
119
|
-
end
|
120
|
-
|
121
|
-
it "should use the global data when data for a specific template is not found in that templates specific data" do
|
122
|
-
@multiinstance_file_data.should include("the value of a is a template file")
|
123
|
-
end
|
124
|
-
|
125
|
-
it "should not use the data from specified templates when the template name does not match" do
|
126
|
-
@sample_file_data.should include("this is not the right one!!!")
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
describe ExpandTemplates, "when including external data and specified placeholder is not found in local data" do
|
131
|
-
it_should_behave_like "prepping the sample templates"
|
132
|
-
|
133
|
-
before :all do
|
134
|
-
@templates.expand_files @testdata.multipleinstance_template_file => @testdata.multipleinstance_template_file
|
135
|
-
@templates.data_file = @testdata.sample_data_file_with_include
|
136
|
-
@templates.expand
|
137
|
-
|
138
|
-
@output_file_data = @testdata.read_file(@testdata.multipleinstance_template_file)
|
139
|
-
end
|
140
|
-
|
141
|
-
it "should use data from the included file" do
|
142
|
-
@output_file_data.should include("first instance of 'the real value' is here.")
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
describe ExpandTemplates, "when including external data and specified placeholder is found in local data" do
|
147
|
-
it_should_behave_like "prepping the sample templates"
|
148
|
-
|
149
|
-
before :all do
|
150
|
-
@templates.expand_files @testdata.multipleinstance_template_file => @testdata.multipleinstance_template_file
|
151
|
-
@templates.data_file = @testdata.sample_data_file_with_include
|
152
|
-
@templates.expand
|
153
|
-
|
154
|
-
@output_file_data = @testdata.read_file(@testdata.multipleinstance_template_file)
|
155
|
-
end
|
156
|
-
|
157
|
-
it "should use data from the local file" do
|
158
|
-
@output_file_data.should include("the value of a is data")
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
|
-
describe ExpandTemplates, "when when external data includes at least part of the data for a specific template" do
|
163
|
-
it_should_behave_like "prepping the sample templates"
|
164
|
-
|
165
|
-
before :all do
|
166
|
-
@templates.expand_files @testdata.multipleinstance_template_file => @testdata.multipleinstance_template_file
|
167
|
-
@templates.data_file = @testdata.template_specific_data_file_with_include
|
168
|
-
@templates.expand
|
169
|
-
|
170
|
-
@output_file_data = @testdata.read_file(@testdata.multipleinstance_template_file)
|
171
|
-
end
|
172
|
-
|
173
|
-
it "should use the external data that was supplied" do
|
174
|
-
@output_file_data.should include("the value of a is data")
|
175
|
-
end
|
176
|
-
|
177
|
-
it "should override the external data with template specific data from the local file" do
|
178
|
-
@output_file_data.should include("first instance of 'the real value' is here.")
|
179
|
-
end
|
180
|
-
end
|