albacore 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +4 -4
- data/.bundle/config +2 -2
- data/.rvmrc +1 -1
- data/Gemfile +12 -12
- data/README.markdown +92 -68
- data/VERSION +1 -1
- data/lib/albacore.rb +9 -9
- data/lib/albacore/albacoretask.rb +50 -50
- data/lib/albacore/aspnetcompiler.rb +58 -58
- data/lib/albacore/assemblyinfo.rb +140 -140
- data/lib/albacore/assemblyinfolanguages/cppcliengine.rb +17 -0
- data/lib/albacore/assemblyinfolanguages/csharpengine.rb +18 -18
- data/lib/albacore/assemblyinfolanguages/vbnetengine.rb +18 -18
- data/lib/albacore/config/aspnetcompilerconfig.rb +29 -29
- data/lib/albacore/config/assemblyinfoconfig.rb +13 -13
- data/lib/albacore/config/config.rb +22 -22
- data/lib/albacore/config/cscconfig.rb +28 -28
- data/lib/albacore/config/docuconfig.rb +23 -23
- data/lib/albacore/config/execconfig.rb +15 -15
- data/lib/albacore/config/fluentmigratorrunnerconfig.rb +15 -15
- data/lib/albacore/config/msbuildconfig.rb +29 -29
- data/lib/albacore/config/mspectestrunnerconfig.rb +15 -15
- data/lib/albacore/config/mstesttestrunnerconfig.rb +15 -15
- data/lib/albacore/config/nantconfig.rb +15 -15
- data/lib/albacore/config/nchurnconfig.rb +15 -15
- data/lib/albacore/config/ncoverconsoleconfig.rb +15 -15
- data/lib/albacore/config/ncoverreportconfig.rb +15 -15
- data/lib/albacore/config/ndependconfig.rb +15 -15
- data/lib/albacore/config/netversion.rb +21 -21
- data/lib/albacore/config/nugetpackconfig.rb +3 -3
- data/lib/albacore/config/nugetpublishconfig.rb +19 -0
- data/lib/albacore/config/nugetpushconfig.rb +19 -0
- data/lib/albacore/config/nunittestrunnerconfig.rb +14 -14
- data/lib/albacore/config/specflowreportconfig.rb +24 -24
- data/lib/albacore/config/sqlcmdconfig.rb +15 -15
- data/lib/albacore/config/unzipconfig.rb +15 -15
- data/lib/albacore/config/vssgetconfig.rb +14 -0
- data/lib/albacore/config/xbuildconfig.rb +15 -15
- data/lib/albacore/config/xunittestrunnerconfig.rb +15 -15
- data/lib/albacore/config/zipdirectoryconfig.rb +15 -15
- data/lib/albacore/csc.rb +66 -62
- data/lib/albacore/docu.rb +41 -41
- data/lib/albacore/exec.rb +18 -18
- data/lib/albacore/fluentmigratorrunner.rb +51 -46
- data/lib/albacore/msbuild.rb +55 -55
- data/lib/albacore/mspectestrunner.rb +50 -50
- data/lib/albacore/mstesttestrunner.rb +43 -43
- data/lib/albacore/nant.rb +38 -38
- data/lib/albacore/nchurn.rb +74 -74
- data/lib/albacore/ncoverconsole.rb +68 -68
- data/lib/albacore/ncoverreport.rb +62 -62
- data/lib/albacore/ncoverreports/assemblyfilter.rb +9 -9
- data/lib/albacore/ncoverreports/branchcoverage.rb +9 -9
- data/lib/albacore/ncoverreports/classfilter.rb +9 -9
- data/lib/albacore/ncoverreports/codecoveragebase.rb +25 -25
- data/lib/albacore/ncoverreports/cyclomaticcomplexity.rb +23 -23
- data/lib/albacore/ncoverreports/documentfilter.rb +9 -9
- data/lib/albacore/ncoverreports/fullcoveragereport.rb +13 -13
- data/lib/albacore/ncoverreports/methodcoverage.rb +9 -9
- data/lib/albacore/ncoverreports/methodfilter.rb +9 -9
- data/lib/albacore/ncoverreports/namespacefilter.rb +9 -9
- data/lib/albacore/ncoverreports/reportfilterbase.rb +26 -26
- data/lib/albacore/ncoverreports/summaryreport.rb +18 -18
- data/lib/albacore/ncoverreports/symbolcoverage.rb +9 -9
- data/lib/albacore/ndepend.rb +33 -33
- data/lib/albacore/nugetpublish.rb +47 -0
- data/lib/albacore/nugetpush.rb +46 -0
- data/lib/albacore/nunittestrunner.rb +41 -41
- data/lib/albacore/nuspec.rb +133 -109
- data/lib/albacore/output.rb +99 -99
- data/lib/albacore/plink.rb +47 -47
- data/lib/albacore/specflowreport.rb +62 -62
- data/lib/albacore/sqlcmd.rb +80 -80
- data/lib/albacore/support/attrmethods.rb +33 -33
- data/lib/albacore/support/createtask.rb +50 -30
- data/lib/albacore/support/failure.rb +15 -15
- data/lib/albacore/support/logging.rb +38 -38
- data/lib/albacore/support/openstruct.rb +13 -13
- data/lib/albacore/support/runcommand.rb +45 -45
- data/lib/albacore/support/supportlinux.rb +23 -23
- data/lib/albacore/support/updateattributes.rb +13 -13
- data/lib/albacore/support/yamlconfig.rb +18 -18
- data/lib/albacore/unzip.rb +28 -28
- data/lib/albacore/vssget.rb +44 -0
- data/lib/albacore/xbuild.rb +54 -54
- data/lib/albacore/xunittestrunner.rb +52 -52
- data/lib/albacore/zipdirectory.rb +105 -105
- data/rakefile.rb +297 -297
- data/spec/albacoremodel_spec.rb +53 -53
- data/spec/assemblyinfo_spec.rb +541 -541
- data/spec/attrmethods_spec.rb +136 -136
- data/spec/config_spec.rb +34 -34
- data/spec/createtask_spec.rb +236 -236
- data/spec/csc_spec.rb +253 -253
- data/spec/docu_spec.rb +109 -109
- data/spec/exec_spec.rb +45 -45
- data/spec/fluentmigratorrunner_spec.rb +254 -185
- data/spec/msbuild_spec.rb +215 -215
- data/spec/mspec_spec.rb +28 -28
- data/spec/mstesttestrunner_spec.rb +142 -142
- data/spec/nant_spec.rb +110 -110
- data/spec/nchurn_spec.rb +75 -75
- data/spec/ncoverconsole_spec.rb +353 -353
- data/spec/ncoverreport_spec.rb +619 -619
- data/spec/ndepend_spec.rb +72 -72
- data/spec/nunittestrunner_spec.rb +122 -122
- data/spec/nuspec_spec.rb +78 -78
- data/spec/patches/docu_patch.rb +12 -12
- data/spec/patches/fail_patch.rb +8 -8
- data/spec/patches/system_patch.rb +20 -20
- data/spec/plink_spec.rb +62 -62
- data/spec/runcommand_spec.rb +94 -94
- data/spec/spec_helper.rb +17 -17
- data/spec/specflowreport_spec.rb +146 -146
- data/spec/sqlcmd_spec.rb +334 -334
- data/spec/support/assemblyinfotester.rb +51 -51
- data/spec/support/ironruby_validator.rb +26 -26
- data/spec/support/msbuildtestdata.rb +32 -32
- data/spec/support/nanttestdata.rb +33 -33
- data/spec/support/ncoverconsoletestdata.rb +19 -19
- data/spec/support/ncoverreporttestdata.rb +26 -26
- data/spec/support/nokogiri_validator.rb +15 -15
- data/spec/support/outputtestdata.rb +12 -12
- data/spec/support/ziptestdata.rb +12 -12
- data/spec/unzip_spec.rb +15 -15
- data/spec/xbuild_spec.rb +15 -15
- data/spec/xunit_spec.rb +168 -168
- data/spec/yamlconfig_spec.rb +49 -49
- data/spec/zip_spec.rb +104 -104
- data/watchrtesting.rb +8 -8
- metadata +15 -119
@@ -1,33 +1,33 @@
|
|
1
|
-
module AttrMethods
|
2
|
-
def attr_array(*names)
|
3
|
-
names.each do |n|
|
4
|
-
self.send :define_method, n do |*value|
|
5
|
-
if value.nil? || value.empty?
|
6
|
-
return instance_variable_get("@#{n}")
|
7
|
-
else
|
8
|
-
self.send "#{n}=".to_sym, value.to_ary.flatten
|
9
|
-
end
|
10
|
-
end
|
11
|
-
self.send :define_method, "#{n}=" do |value|
|
12
|
-
instance_variable_set("@#{n}", value)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def attr_hash(*names)
|
18
|
-
names.each do |n|
|
19
|
-
self.class_eval(<<-EOF, __FILE__, __LINE__)
|
20
|
-
def #{n}(*value)
|
21
|
-
if value.nil? || value.empty?
|
22
|
-
instance_variable_get("@#{n}")
|
23
|
-
else
|
24
|
-
instance_variable_set("@#{n}", value[0])
|
25
|
-
end
|
26
|
-
end
|
27
|
-
EOF
|
28
|
-
self.send :define_method, "#{n}=" do |value|
|
29
|
-
instance_variable_set("@#{n}", value)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
1
|
+
module AttrMethods
|
2
|
+
def attr_array(*names)
|
3
|
+
names.each do |n|
|
4
|
+
self.send :define_method, n do |*value|
|
5
|
+
if value.nil? || value.empty?
|
6
|
+
return instance_variable_get("@#{n}")
|
7
|
+
else
|
8
|
+
self.send "#{n}=".to_sym, value.to_ary.flatten
|
9
|
+
end
|
10
|
+
end
|
11
|
+
self.send :define_method, "#{n}=" do |value|
|
12
|
+
instance_variable_set("@#{n}", value)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def attr_hash(*names)
|
18
|
+
names.each do |n|
|
19
|
+
self.class_eval(<<-EOF, __FILE__, __LINE__)
|
20
|
+
def #{n}(*value)
|
21
|
+
if value.nil? || value.empty?
|
22
|
+
instance_variable_get("@#{n}")
|
23
|
+
else
|
24
|
+
instance_variable_set("@#{n}", value[0])
|
25
|
+
end
|
26
|
+
end
|
27
|
+
EOF
|
28
|
+
self.send :define_method, "#{n}=" do |value|
|
29
|
+
instance_variable_set("@#{n}", value)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -1,30 +1,50 @@
|
|
1
|
-
module Albacore
|
2
|
-
def self.create_task(taskname, taskclass)
|
3
|
-
# this style of creating tasks is not really what i
|
4
|
-
# want to do. but it's necessary for ruby 1.8.6
|
5
|
-
# because that version doesn't support the foo do |*args, &block|
|
6
|
-
# block signature. it supports *args, but not &block.
|
7
|
-
# so that limitation is worked around with string eval
|
8
|
-
Object.class_eval(<<-EOF, __FILE__, __LINE__)
|
9
|
-
def #{taskname}(name=:#{taskname}, *args, &configblock)
|
10
|
-
task name, *args do |t, task_args|
|
11
|
-
obj = #{taskclass}.new
|
12
|
-
obj.load_config_by_task_name(name) if obj.respond_to?(:load_config_by_task_name)
|
13
|
-
|
14
|
-
if !configblock.nil?
|
15
|
-
case configblock.arity
|
16
|
-
when 0
|
17
|
-
configblock.call
|
18
|
-
when 1
|
19
|
-
configblock.call(obj)
|
20
|
-
when 2
|
21
|
-
configblock.call(obj, task_args)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
obj.execute if obj.respond_to?(:execute)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
|
30
|
-
|
1
|
+
module Albacore
|
2
|
+
def self.create_task(taskname, taskclass)
|
3
|
+
# this style of creating tasks is not really what i
|
4
|
+
# want to do. but it's necessary for ruby 1.8.6
|
5
|
+
# because that version doesn't support the foo do |*args, &block|
|
6
|
+
# block signature. it supports *args, but not &block.
|
7
|
+
# so that limitation is worked around with string eval
|
8
|
+
Object.class_eval(<<-EOF, __FILE__, __LINE__)
|
9
|
+
def #{taskname}(name=:#{taskname}, *args, &configblock)
|
10
|
+
task name, *args do |t, task_args|
|
11
|
+
obj = #{taskclass}.new
|
12
|
+
obj.load_config_by_task_name(name) if obj.respond_to?(:load_config_by_task_name)
|
13
|
+
|
14
|
+
if !configblock.nil?
|
15
|
+
case configblock.arity
|
16
|
+
when 0
|
17
|
+
configblock.call
|
18
|
+
when 1
|
19
|
+
configblock.call(obj)
|
20
|
+
when 2
|
21
|
+
configblock.call(obj, task_args)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
obj.execute if obj.respond_to?(:execute)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def #{taskname}!(name=:#{taskname}, *args, &configblock)
|
30
|
+
task name, *args do |t, task_args|
|
31
|
+
obj = #{taskclass}.new
|
32
|
+
obj.load_config_by_task_name(name) if obj.respond_to?(:load_config_by_task_name)
|
33
|
+
|
34
|
+
if !configblock.nil?
|
35
|
+
case configblock.arity
|
36
|
+
when 0
|
37
|
+
configblock.call
|
38
|
+
when 1
|
39
|
+
configblock.call(obj)
|
40
|
+
when 2
|
41
|
+
configblock.call(obj, task_args)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
obj.execute if obj.respond_to?(:execute)
|
46
|
+
end.invoke
|
47
|
+
end
|
48
|
+
EOF
|
49
|
+
end
|
50
|
+
end
|
@@ -1,15 +1,15 @@
|
|
1
|
-
require 'albacore/support/logging'
|
2
|
-
|
3
|
-
module Failure
|
4
|
-
include Logging
|
5
|
-
|
6
|
-
def initialize
|
7
|
-
super()
|
8
|
-
end
|
9
|
-
|
10
|
-
def fail_with_message(msg)
|
11
|
-
@logger.fatal msg
|
12
|
-
fail msg
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
1
|
+
require 'albacore/support/logging'
|
2
|
+
|
3
|
+
module Failure
|
4
|
+
include Logging
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
super()
|
8
|
+
end
|
9
|
+
|
10
|
+
def fail_with_message(msg)
|
11
|
+
@logger.fatal msg
|
12
|
+
fail msg
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
@@ -1,38 +1,38 @@
|
|
1
|
-
require 'logger'
|
2
|
-
|
3
|
-
module Logging
|
4
|
-
attr_accessor :logger, :current_log_device
|
5
|
-
|
6
|
-
def initialize
|
7
|
-
create_logger(STDOUT, Logger::INFO)
|
8
|
-
super()
|
9
|
-
end
|
10
|
-
|
11
|
-
def log_device=(logdev)
|
12
|
-
level = @logger.level
|
13
|
-
create_logger(logdev, level)
|
14
|
-
end
|
15
|
-
|
16
|
-
def log_level=(level)
|
17
|
-
@log_level = level
|
18
|
-
if (level == :verbose)
|
19
|
-
loglevel = Logger::DEBUG
|
20
|
-
else
|
21
|
-
loglevel = Logger::INFO
|
22
|
-
end
|
23
|
-
create_logger(@current_log_device, loglevel)
|
24
|
-
end
|
25
|
-
|
26
|
-
def log_level
|
27
|
-
@log_level
|
28
|
-
end
|
29
|
-
|
30
|
-
def create_logger(device, level)
|
31
|
-
@current_log_device = device
|
32
|
-
@logger = Logger.new(device)
|
33
|
-
|
34
|
-
level = Logger::DEBUG if Albacore.configure.log_level == :verbose
|
35
|
-
@logger.level = level
|
36
|
-
@log_level = :verbose if level == Logger::DEBUG
|
37
|
-
end
|
38
|
-
end
|
1
|
+
require 'logger'
|
2
|
+
|
3
|
+
module Logging
|
4
|
+
attr_accessor :logger, :current_log_device
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
create_logger(STDOUT, Logger::INFO)
|
8
|
+
super()
|
9
|
+
end
|
10
|
+
|
11
|
+
def log_device=(logdev)
|
12
|
+
level = @logger.level
|
13
|
+
create_logger(logdev, level)
|
14
|
+
end
|
15
|
+
|
16
|
+
def log_level=(level)
|
17
|
+
@log_level = level
|
18
|
+
if (level == :verbose)
|
19
|
+
loglevel = Logger::DEBUG
|
20
|
+
else
|
21
|
+
loglevel = Logger::INFO
|
22
|
+
end
|
23
|
+
create_logger(@current_log_device, loglevel)
|
24
|
+
end
|
25
|
+
|
26
|
+
def log_level
|
27
|
+
@log_level
|
28
|
+
end
|
29
|
+
|
30
|
+
def create_logger(device, level)
|
31
|
+
@current_log_device = device
|
32
|
+
@logger = Logger.new(device)
|
33
|
+
|
34
|
+
level = Logger::DEBUG if Albacore.configure.log_level == :verbose
|
35
|
+
@logger.level = level
|
36
|
+
@log_level = :verbose if level == Logger::DEBUG
|
37
|
+
end
|
38
|
+
end
|
@@ -1,13 +1,13 @@
|
|
1
|
-
module OpenStructToHash
|
2
|
-
def to_hash
|
3
|
-
# from: http://snippets.dzone.com/posts/show/7312
|
4
|
-
h = @table
|
5
|
-
# handles nested structures
|
6
|
-
h.each do |k,v|
|
7
|
-
if v.class == OpenStruct
|
8
|
-
h[k] = v._to_hash
|
9
|
-
end
|
10
|
-
end
|
11
|
-
return h
|
12
|
-
end
|
13
|
-
end
|
1
|
+
module OpenStructToHash
|
2
|
+
def to_hash
|
3
|
+
# from: http://snippets.dzone.com/posts/show/7312
|
4
|
+
h = @table
|
5
|
+
# handles nested structures
|
6
|
+
h.each do |k,v|
|
7
|
+
if v.class == OpenStruct
|
8
|
+
h[k] = v._to_hash
|
9
|
+
end
|
10
|
+
end
|
11
|
+
return h
|
12
|
+
end
|
13
|
+
end
|
@@ -1,45 +1,45 @@
|
|
1
|
-
require 'albacore/support/attrmethods'
|
2
|
-
|
3
|
-
module Albacore
|
4
|
-
module RunCommand
|
5
|
-
extend AttrMethods
|
6
|
-
|
7
|
-
attr_accessor :command, :working_directory
|
8
|
-
attr_array :parameters
|
9
|
-
|
10
|
-
def initialize
|
11
|
-
@working_directory = Dir.pwd
|
12
|
-
@parameters = []
|
13
|
-
super()
|
14
|
-
end
|
15
|
-
|
16
|
-
def run_command(name="Command Line", parameters=nil)
|
17
|
-
begin
|
18
|
-
params = Array.new
|
19
|
-
params << parameters unless parameters.nil?
|
20
|
-
params << @parameters unless (@parameters.nil? || @parameters.length==0)
|
21
|
-
|
22
|
-
cmd = get_command(params)
|
23
|
-
@logger.debug "Executing #{name}: #{cmd}"
|
24
|
-
|
25
|
-
Dir.chdir(@working_directory) do
|
26
|
-
return system(cmd)
|
27
|
-
end
|
28
|
-
|
29
|
-
rescue Exception => e
|
30
|
-
puts "Error While Running Command Line Tool: #{e}"
|
31
|
-
raise
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def get_command(params)
|
36
|
-
executable = @command
|
37
|
-
unless command.nil?
|
38
|
-
executable = File.expand_path(@command) if File.exists?(@command)
|
39
|
-
end
|
40
|
-
cmd = "\"#{executable}\""
|
41
|
-
cmd +=" #{params.join(' ')}" if params.length > 0
|
42
|
-
cmd
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
1
|
+
require 'albacore/support/attrmethods'
|
2
|
+
|
3
|
+
module Albacore
|
4
|
+
module RunCommand
|
5
|
+
extend AttrMethods
|
6
|
+
|
7
|
+
attr_accessor :command, :working_directory
|
8
|
+
attr_array :parameters
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@working_directory = Dir.pwd
|
12
|
+
@parameters = []
|
13
|
+
super()
|
14
|
+
end
|
15
|
+
|
16
|
+
def run_command(name="Command Line", parameters=nil)
|
17
|
+
begin
|
18
|
+
params = Array.new
|
19
|
+
params << parameters unless parameters.nil?
|
20
|
+
params << @parameters unless (@parameters.nil? || @parameters.length==0)
|
21
|
+
|
22
|
+
cmd = get_command(params)
|
23
|
+
@logger.debug "Executing #{name}: #{cmd}"
|
24
|
+
|
25
|
+
Dir.chdir(@working_directory) do
|
26
|
+
return system(cmd)
|
27
|
+
end
|
28
|
+
|
29
|
+
rescue Exception => e
|
30
|
+
puts "Error While Running Command Line Tool: #{e}"
|
31
|
+
raise
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def get_command(params)
|
36
|
+
executable = @command
|
37
|
+
unless command.nil?
|
38
|
+
executable = File.expand_path(@command) if File.exists?(@command)
|
39
|
+
end
|
40
|
+
cmd = "\"#{executable}\""
|
41
|
+
cmd +=" #{params.join(' ')}" if params.length > 0
|
42
|
+
cmd
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -1,23 +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
|
-
|
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
|
+
|
@@ -1,13 +1,13 @@
|
|
1
|
-
module UpdateAttributes
|
2
|
-
def update_attributes(attrs)
|
3
|
-
attrs.each do |key, value|
|
4
|
-
setter = "#{key}="
|
5
|
-
send(setter, value) if respond_to?(setter)
|
6
|
-
@logger.warn "#{key} is not a settable attribute on #{self.class}" unless respond_to?(setter)
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
def <<(attrs)
|
11
|
-
update_attributes attrs
|
12
|
-
end
|
13
|
-
end
|
1
|
+
module UpdateAttributes
|
2
|
+
def update_attributes(attrs)
|
3
|
+
attrs.each do |key, value|
|
4
|
+
setter = "#{key}="
|
5
|
+
send(setter, value) if respond_to?(setter)
|
6
|
+
@logger.warn "#{key} is not a settable attribute on #{self.class}" unless respond_to?(setter)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def <<(attrs)
|
11
|
+
update_attributes attrs
|
12
|
+
end
|
13
|
+
end
|