albacore 0.2.0.preview2 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. data/.rvmrc +1 -0
  2. data/Gemfile +11 -0
  3. data/Gemfile.lock +43 -0
  4. data/README.markdown +1 -0
  5. data/VERSION +1 -1
  6. data/lib/albacore/albacoretask.rb +32 -25
  7. data/lib/albacore/aspnetcompiler.rb +58 -0
  8. data/lib/albacore/assemblyinfo.rb +1 -1
  9. data/lib/albacore/config/aspnetcompilerconfig.rb +29 -0
  10. data/lib/albacore/csc.rb +2 -2
  11. data/lib/albacore/docu.rb +3 -2
  12. data/lib/albacore/exec.rb +2 -2
  13. data/lib/albacore/msbuild.rb +2 -2
  14. data/lib/albacore/mspectestrunner.rb +3 -3
  15. data/lib/albacore/nant.rb +2 -2
  16. data/lib/albacore/ncoverconsole.rb +2 -2
  17. data/lib/albacore/ncoverreport.rb +2 -2
  18. data/lib/albacore/ndepend.rb +2 -2
  19. data/lib/albacore/nunittestrunner.rb +2 -2
  20. data/lib/albacore/plink.rb +47 -0
  21. data/lib/albacore/specflowreport.rb +2 -2
  22. data/lib/albacore/sqlcmd.rb +2 -2
  23. data/lib/albacore/support/attrmethods.rb +9 -8
  24. data/lib/albacore/support/runcommand.rb +37 -35
  25. data/lib/albacore/unzip.rb +1 -1
  26. data/lib/albacore/xbuild.rb +2 -2
  27. data/lib/albacore/xunittestrunner.rb +3 -3
  28. data/lib/albacore/zipdirectory.rb +1 -1
  29. data/rakefile.rb +1 -6
  30. data/spec/albacoremodel_spec.rb +3 -3
  31. data/spec/assemblyinfo_spec.rb +3 -3
  32. data/spec/attrmethods_spec.rb +21 -1
  33. data/spec/config_spec.rb +2 -2
  34. data/spec/createtask_spec.rb +4 -4
  35. data/spec/csc_spec.rb +1 -1
  36. data/spec/docu_spec.rb +1 -1
  37. data/spec/exec_spec.rb +1 -1
  38. data/spec/msbuild_spec.rb +1 -1
  39. data/spec/mspec_spec.rb +1 -1
  40. data/spec/nant_spec.rb +1 -1
  41. data/spec/ncoverconsole_spec.rb +2 -7
  42. data/spec/ncoverreport_spec.rb +5 -5
  43. data/spec/ndepend_spec.rb +1 -1
  44. data/spec/nunittestrunner_spec.rb +1 -1
  45. data/spec/plink_spec.rb +62 -0
  46. data/spec/runcommand_spec.rb +3 -3
  47. data/spec/{support/spec_helper.rb → spec_helper.rb} +2 -1
  48. data/spec/specflowreport_spec.rb +1 -1
  49. data/spec/sqlcmd_spec.rb +3 -3
  50. data/spec/unzip_spec.rb +1 -1
  51. data/spec/xbuild_spec.rb +1 -1
  52. data/spec/xunit_spec.rb +1 -1
  53. data/spec/yamlconfig_spec.rb +8 -8
  54. data/spec/zip_spec.rb +1 -1
  55. metadata +98 -62
  56. data/install_dependencies.rb +0 -32
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm 1.9.2@albacore --create
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source 'http://rubygems.org'
2
+
3
+ group :development do
4
+ gem 'rake', '0.8.7'
5
+ gem 'rubyzip', '0.9.4'
6
+ gem 'jeweler', '1.4.0'
7
+ gem 'rspec', '1.2.9'
8
+ gem 'derickbailey-notamock', '0.0.1'
9
+ gem 'jekyll', '0.8.0'
10
+ gem 'watchr', '0.7'
11
+ end
@@ -0,0 +1,43 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ classifier (1.3.3)
5
+ fast-stemmer (>= 1.0.0)
6
+ derickbailey-notamock (0.0.1)
7
+ rspec (>= 1.2.9)
8
+ directory_watcher (1.3.2)
9
+ fast-stemmer (1.0.0)
10
+ gemcutter (0.6.1)
11
+ git (1.2.5)
12
+ jekyll (0.8.0)
13
+ classifier (>= 1.3.1)
14
+ directory_watcher (>= 1.1.1)
15
+ liquid (>= 1.9.0)
16
+ maruku (>= 0.5.9)
17
+ jeweler (1.4.0)
18
+ gemcutter (>= 0.1.0)
19
+ git (>= 1.2.5)
20
+ rubyforge (>= 2.0.0)
21
+ json_pure (1.4.6)
22
+ liquid (2.2.2)
23
+ maruku (0.6.0)
24
+ syntax (>= 1.0.0)
25
+ rake (0.8.7)
26
+ rspec (1.2.9)
27
+ rubyforge (2.0.4)
28
+ json_pure (>= 1.1.7)
29
+ rubyzip (0.9.4)
30
+ syntax (1.0.0)
31
+ watchr (0.7)
32
+
33
+ PLATFORMS
34
+ x86-mingw32
35
+
36
+ DEPENDENCIES
37
+ derickbailey-notamock (= 0.0.1)
38
+ jekyll (= 0.8.0)
39
+ jeweler (= 1.4.0)
40
+ rake (= 0.8.7)
41
+ rspec (= 1.2.9)
42
+ rubyzip (= 0.9.4)
43
+ watchr (= 0.7)
@@ -92,6 +92,7 @@ Many thanks for contributions to albacore are due (in alphabetical order):
92
92
  * [Mark Wilkins](http://github.com/markwilk): VB.NET Language Generator For The AssemblyInfo Task
93
93
  * [Mike Nichols](http://github.com/mnichols): XUnit contributions, bug reports, etc
94
94
  * [Nils Jonsson](http://github.com/njonsson): AssemblyInfo corrections, rakefile corrections
95
+ * [Prabir Shrestha](http://github.com/prabirshrestha): Bug fixes for xunit test runner, etc.
95
96
  * [Sean Biefeld](http://github.com/seanbiefeld): MSpecTestRunner for NCoverConsole
96
97
  * [Steven Harman](http://github.com/stevenharman): Primary contributor. Nant task, issue tickets, disucssions, and much much more.
97
98
  * [Steven Johnson](http://github.com/2020steve): Expand Templates (deprecated task) supplimental data, etc
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0.preview2
1
+ 0.2.2
@@ -7,36 +7,43 @@ require 'albacore/support/updateattributes'
7
7
  require 'albacore/support/createtask'
8
8
  require 'albacore/config/config'
9
9
 
10
- module AlbacoreTask
11
- include Failure
12
- include Logging
13
- include YAMLConfig
14
- include UpdateAttributes
10
+ module Albacore
11
+ module Task
12
+ include Failure
13
+ include Logging
14
+ include YAMLConfig
15
+ include UpdateAttributes
15
16
 
16
- def self.included(mod)
17
- mod.extend AttrMethods
18
- self.create_rake_task mod
19
- self.include_config mod, caller[0]
20
- end
17
+ def self.included(mod)
18
+ mod.extend AttrMethods
19
+ self.create_rake_task mod
20
+ self.include_config mod, caller[0]
21
+ end
21
22
 
22
- def self.include_config(mod, calledby)
23
- dir = File.dirname(calledby)
24
- configfile = File.join(dir, "config", "#{mod.name.downcase}config.rb")
25
- require configfile if File.exist?(configfile)
26
- end
23
+ def self.include_config(mod, calledby)
24
+ dir = clean_dirname(calledby)
25
+ configfile = File.expand_path(File.join(dir, "config", "#{mod.name.downcase}config.rb"))
26
+ require configfile if File.exist?(configfile)
27
+ end
27
28
 
28
- def self.create_rake_task(mod)
29
- if mod.class == Class
30
- tasknames = Array.new
29
+ def self.clean_dirname(file)
30
+ last = file.rindex "/"
31
+ file[0..last]
32
+ end
31
33
 
32
- if mod.const_defined?("TaskName")
33
- tasknames << eval("#{mod}::TaskName")
34
- else
35
- tasknames << mod.name.downcase
36
- end
34
+ def self.create_rake_task(mod)
35
+ if mod.class == Class
36
+ tasknames = Array.new
37
+
38
+ if mod.const_defined?("TaskName")
39
+ tasknames << eval("#{mod}::TaskName")
40
+ else
41
+ tasknames << mod.name.downcase
42
+ end
37
43
 
38
- tasknames.flatten.each do |taskname|
39
- Albacore.create_task taskname, mod
44
+ tasknames.flatten.each do |taskname|
45
+ Albacore.create_task taskname, mod
46
+ end
40
47
  end
41
48
  end
42
49
  end
@@ -0,0 +1,58 @@
1
+ require 'albacore/albacoretask'
2
+ require 'albacore/config/aspnetcompilerconfig'
3
+ require 'albacore/support/supportlinux'
4
+
5
+ class AspNetCompiler
6
+ include Albacore::Task
7
+ include Albacore::RunCommand
8
+ include Configuration::AspNetCompiler
9
+ include SupportsLinuxEnvironment
10
+
11
+ # http://msdn.microsoft.com/en-us/library/ms164291.aspx
12
+
13
+ attr_accessor :clean, # Optional Boolean parameter. If this parameter is true, the precompiled application will be built clean. Any previously compiled components will be recompiled. The default value is false. This parameter corresponds to the -c switch on aspnet_compiler.exe.
14
+ #:allow_partially_trusted_callers, # Optional Boolean parameter. If this parameter is true, the strong-name assembly will allow partially trusted callers.
15
+ :debug, # Optional Boolean parameter. If this parameter is true, debug information (.PDB file) is emitted during compilation. The default value is false. This parameter corresponds to the -d switch on aspnet_compiler.exe.
16
+ :delay_sign, # Optional Boolean parameter. If this parameter is true, the assembly is not fully signed when created.
17
+ :fixed_names, # Optional Boolean parameter. If this parameter is true, the compiled assemblies will be given fixed names.
18
+ :force, # Optional Boolean parameter. If this parameter is true, the task will overwrite the target directory if it already exists. Existing contents are lost. The default value is false. This parameter corresponds to the -f switch on aspnet_compiler.exe.
19
+ #:key_container, # Optional String parameter. Specifies a strong name key container.
20
+ #:key_file, # Optional String parameter. Specifies the physical path to the strong name key file..
21
+ #:metabase_path, # Optional String parameter. Specifies the full IIS metabase path of the application. This parameter cannot be combined with the VirtualPath or PhysicalPath parameters. This parameter corresponds to the -m switch on aspnet_compiler.exe.
22
+ :physical_path, # Optional String parameter. Specifies the physical path of the application to be compiled. If this parameter is missing, the IIS metabase is used to locate the application. This parameter corresponds to the -p switch on aspnet_compiler.exe.
23
+ #:target_framework_moniker, # Optional String parameter. Specifies the TargetFrameworkMoniker indicating which .NET Framework version of aspnet_compiler.exe should be used. Only accepts .NET Framework monikers.
24
+ :target_path, # Optional String parameter. Specifies the physical path to which the application is compiled. If not specified, the application is precompiled in-place.
25
+ :updateable, # Optional Boolean parameter. If this parameter is true, the precompiled application will be updateable. The default value is false. This parameter corresponds to the -u switch on aspnet_compiler.exe.
26
+ :virtual_path # Optional String parameter. The virtual path of the application to be compiled. If PhysicalPath specified, the physical path is used to locate the application. Otherwise, the IIS metabase is used, and the application is assumed to be in the default site. This parameter corresponds to the -v switch on aspnet_compiler.exe.
27
+
28
+ def initialize
29
+ @clean = false
30
+ @debug = false
31
+ @delay_sign = false
32
+ @fixed_names = false
33
+ @force = false
34
+ @updateable = false
35
+ @virtual_path = '/'
36
+ super()
37
+ update_attributes aspnetcompiler.to_hash
38
+ end
39
+
40
+ def execute
41
+ params = []
42
+ params << "-v #{@virtual_path}" unless @virtual_path.nil?
43
+ params << "-p #{format_path(@physical_path)}" unless @physical_path.nil?
44
+ params << "-c" if @clean
45
+ params << "-delaysign" if @delay_sign
46
+ params << "-fixednames" if @fixed_names
47
+ params << "-d" if @debug
48
+ params << "-u" if @updateable
49
+ params << "-f" if @force
50
+ params << format_path(@target_path) unless @target_path.nil?
51
+
52
+ result = run_command "AspNetCompiler", params
53
+
54
+ failure_message = 'AspNetCompiler Failed. See Build Log For Detail'
55
+ fail_with_message failure_message if !result
56
+ end
57
+
58
+ end
@@ -3,7 +3,7 @@ require 'albacore/assemblyinfolanguages/csharpengine'
3
3
  require 'albacore/assemblyinfolanguages/vbnetengine'
4
4
 
5
5
  class AssemblyInfo
6
- include AlbacoreTask
6
+ include Albacore::Task
7
7
 
8
8
  attr_accessor :version, :title, :description, :output_file, :custom_attributes
9
9
  attr_accessor :copyright, :com_visible, :com_guid, :company_name, :product_name
@@ -0,0 +1,29 @@
1
+ require 'ostruct'
2
+ require 'albacore/config/netversion'
3
+ require 'albacore/support/openstruct'
4
+
5
+ module Configuration
6
+ module AspNetCompiler
7
+ include Configuration::NetVersion
8
+ include Albacore::Configuration
9
+
10
+ def self.aspnetcompilerconfig
11
+ @config ||= OpenStruct.new.extend(OpenStructToHash).extend(AspNetCompiler)
12
+ end
13
+
14
+ def aspnetcompiler
15
+ @config ||= AspNetCompiler.aspnetcompilerconfig
16
+ yield(@config) if block_given?
17
+ @config
18
+ end
19
+
20
+ def self.included(mod)
21
+ self.aspnetcompilerconfig.use :net40
22
+ end
23
+
24
+ def use(netversion)
25
+ netversion = :net20 if netversion == :net35 # since .net 3.5 doesn't have aspnet_compiler use .net 2.0
26
+ self.command = File.join(get_net_version(netversion), "aspnet_compiler.exe")
27
+ end
28
+ end
29
+ end
@@ -3,8 +3,8 @@ require 'albacore/config/cscconfig'
3
3
  require 'albacore/support/supportlinux'
4
4
 
5
5
  class CSC
6
- include AlbacoreTask
7
- include RunCommand
6
+ include Albacore::Task
7
+ include Albacore::RunCommand
8
8
  include Configuration::CSC
9
9
  include SupportsLinuxEnvironment
10
10
 
@@ -1,8 +1,9 @@
1
1
  require 'albacore/albacoretask'
2
+ require 'albacore/config/docuconfig'
2
3
 
3
4
  class Docu
4
- include AlbacoreTask
5
- include RunCommand
5
+ include Albacore::Task
6
+ include Albacore::RunCommand
6
7
  include Configuration::Docu
7
8
 
8
9
  attr_accessor :output_location
@@ -1,8 +1,8 @@
1
1
  require 'albacore/albacoretask'
2
2
 
3
3
  class Exec
4
- include AlbacoreTask
5
- include RunCommand
4
+ include Albacore::Task
5
+ include Albacore::RunCommand
6
6
 
7
7
  def initialize
8
8
  super()
@@ -2,8 +2,8 @@ require 'albacore/albacoretask'
2
2
  require 'albacore/config/msbuildconfig.rb'
3
3
 
4
4
  class MSBuild
5
- include AlbacoreTask
6
- include RunCommand
5
+ include Albacore::Task
6
+ include Albacore::RunCommand
7
7
  include Configuration::MSBuild
8
8
 
9
9
  attr_accessor :solution, :verbosity
@@ -2,8 +2,8 @@ require 'albacore/albacoretask'
2
2
 
3
3
  class MSpecTestRunner
4
4
  TaskName = :mspec
5
- include AlbacoreTask
6
- include RunCommand
5
+ include Albacore::Task
6
+ include Albacore::RunCommand
7
7
 
8
8
  attr_accessor :html_output
9
9
  attr_array :assemblies, :options
@@ -45,6 +45,6 @@ class MSpecTestRunner
45
45
  end
46
46
 
47
47
  def build_html_output
48
- "--html #{@html_output}"
48
+ "--html \"#{@html_output}\""
49
49
  end
50
50
  end
@@ -1,8 +1,8 @@
1
1
  require 'albacore/albacoretask'
2
2
 
3
3
  class NAnt
4
- include AlbacoreTask
5
- include RunCommand
4
+ include Albacore::Task
5
+ include Albacore::RunCommand
6
6
 
7
7
  attr_accessor :build_file
8
8
  attr_array :targets
@@ -1,8 +1,8 @@
1
1
  require 'albacore/albacoretask'
2
2
 
3
3
  class NCoverConsole
4
- include AlbacoreTask
5
- include RunCommand
4
+ include Albacore::Task
5
+ include Albacore::RunCommand
6
6
 
7
7
  attr_accessor :testrunner
8
8
  attr_array :cover_assemblies, :exclude_assemblies, :coverage, :exclude_attributes
@@ -2,8 +2,8 @@ Dir.glob(File.join(File.expand_path(File.dirname(__FILE__)), 'ncoverreports/*.rb
2
2
  require 'albacore/albacoretask'
3
3
 
4
4
  class NCoverReport
5
- include AlbacoreTask
6
- include RunCommand
5
+ include Albacore::Task
6
+ include Albacore::RunCommand
7
7
 
8
8
  attr_array :coverage_files, :reports, :required_coverage, :filters
9
9
 
@@ -1,8 +1,8 @@
1
1
  require 'albacore/albacoretask'
2
2
 
3
3
  class NDepend
4
- include AlbacoreTask
5
- include RunCommand
4
+ include Albacore::Task
5
+ include Albacore::RunCommand
6
6
 
7
7
  attr_accessor :project_file
8
8
 
@@ -2,8 +2,8 @@ require 'albacore/albacoretask'
2
2
 
3
3
  class NUnitTestRunner
4
4
  TaskName = :nunit
5
- include AlbacoreTask
6
- include RunCommand
5
+ include Albacore::Task
6
+ include Albacore::RunCommand
7
7
 
8
8
  attr_array :assemblies, :options
9
9
 
@@ -0,0 +1,47 @@
1
+ require 'albacore/albacoretask'
2
+
3
+ class PLink
4
+ include Albacore::Task
5
+ include Albacore::RunCommand
6
+
7
+ attr_accessor :host, :port, :user, :key, :verbose
8
+ attr_array :commands
9
+
10
+ def initialize()
11
+ @require_valid_command = false
12
+ @port = 22
13
+ @verbose = false
14
+ @commands = []
15
+ super()
16
+ end
17
+
18
+ def run()
19
+ return unless check_command
20
+
21
+ parameters = create_parameters
22
+ result = run_command "Plink", parameters.join(" ")
23
+ failure_message = 'Command Failed. See Build Log For Detail'
24
+ fail_with_message failure_message if !result
25
+ end
26
+
27
+ def create_parameters
28
+ parameters = []
29
+ parameters << "#{@user}@#{@host} -P #{@port} "
30
+ parameters << build_parameter("i", @key) unless @key.nil?
31
+ parameters << "-batch"
32
+ parameters << "-v" if @verbose
33
+ parameters << @commands
34
+ @logger.debug "PLink Parameters" + parameters.join(" ")
35
+ return parameters
36
+ end
37
+
38
+ def build_parameter(param_name, param_value)
39
+ "-#{param_name} #{param_value}"
40
+ end
41
+
42
+ def check_command
43
+ return true if @command
44
+ fail_with_message 'Plink.path_to_command cannot be nil.'
45
+ return false
46
+ end
47
+ end
@@ -2,8 +2,8 @@ require 'albacore/albacoretask'
2
2
  require 'albacore/config/specflowreportconfig'
3
3
 
4
4
  class SpecFlowReport
5
- include AlbacoreTask
6
- include RunCommand
5
+ include Albacore::Task
6
+ include Albacore::RunCommand
7
7
  include Configuration::SpecFlowReport
8
8
 
9
9
  attr_array :projects, :options, :report
@@ -1,8 +1,8 @@
1
1
  require 'albacore/albacoretask'
2
2
 
3
3
  class SQLCmd
4
- include AlbacoreTask
5
- include RunCommand
4
+ include Albacore::Task
5
+ include Albacore::RunCommand
6
6
 
7
7
  attr_accessor :server, :database, :username, :password, :trusted_connection, :batch_abort
8
8
  attr_array :scripts
@@ -16,17 +16,18 @@ module AttrMethods
16
16
 
17
17
  def attr_hash(*names)
18
18
  names.each do |n|
19
- self.send :define_method, n do |*value|
20
- if value.nil? || value.empty?
21
- instance_variable_get("@#{n}")
22
- else
23
- instance_variable_set("@#{n}", value[0])
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
24
26
  end
25
- end
26
- self.send :define_method, "#{n}=" do |value|
27
+ EOF
28
+ self.send :define_method, "#{n}=" do |value|
27
29
  instance_variable_set("@#{n}", value)
28
30
  end
29
31
  end
30
32
  end
31
-
32
33
  end