rake-dotnet 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 0.1.3 / 2009-06-23
2
+
3
+ * NEW: MSBuild - support for building VB.NET and WiX projects
4
+ * NEW: AssemblyInfo - support for generating AssemblyInfo.vb into {project}/My Project/ (which I hope is the by-convention place)
5
+
1
6
  === 0.1.2 / 2009
2
7
 
3
8
  * NEW: NCover: Generate the full-coverage report
data/Manifest.txt CHANGED
@@ -2,6 +2,6 @@ History.txt
2
2
  Manifest.txt
3
3
  README.markdown
4
4
  README.txt
5
- Rakefile
5
+ Rakefile.rb
6
6
  lib/rake_dotnet.rb
7
7
  test/test_rake_dotnet.rb
@@ -5,7 +5,7 @@ require 'hoe'
5
5
  require 'Pathname'
6
6
  require 'rake/clean'
7
7
 
8
- Hoe.new('rake-dotnet', '0.1.2') do |p|
8
+ Hoe.new('rake-dotnet', '0.1.3') do |p|
9
9
  p.author = 'Peter Mounce'
10
10
  p.description = 'Making a .NET build-automation dev\'s life easier, one angle-bracket at a time'
11
11
  p.email = 'pete@neverrunwithscissors.com'
@@ -32,6 +32,7 @@ file generated_library do |f|
32
32
  gl.close unless gl.closed?
33
33
  end
34
34
 
35
+ desc 'Generate the concatenated library'
35
36
  task :generate_lib => generated_library
36
37
 
37
38
  task :check_manifest => generated_library
data/lib/rake_dotnet.rb CHANGED
@@ -82,6 +82,7 @@ CLEAN.exclude('**/core') # core files are a Ruby/*nix thing - dotNET developers
82
82
  CLEAN.include("#{SRC_DIR}/**/obj")
83
83
  CLEAN.include("#{SRC_DIR}/**/bin")
84
84
  CLEAN.include("#{SRC_DIR}/**/AssemblyInfo.cs")
85
+ CLEAN.include("#{SRC_DIR}/**/AssemblyInfo.vb")
85
86
  CLOBBER.include(OUT_DIR)
86
87
 
87
88
  VERBOSE = ENV['VERBOSE'] ? ENV['VERBOSE'] : false
@@ -112,14 +113,23 @@ module Rake
112
113
  end
113
114
  end
114
115
 
116
+ rule(/#{src_dir_regex}\/[\w\.\d]+\/My Project\/AssemblyInfo.vb/) do |r|
117
+ dir = Pathname.new(r.name).dirname
118
+ mkdir_p dir
119
+ nextdoor = Pathname.new(r.name + '.template')
120
+ common = Pathname.new(File.join(@src_dir, 'AssemblyInfo.vb.template'))
121
+ if (nextdoor.exist?)
122
+ generate(nextdoor, r.name)
123
+ elsif (common.exist?)
124
+ generate(common, r.name)
125
+ end
126
+ end
127
+
115
128
  desc 'Generate the AssemblyInfo.cs file from the template closest'
116
129
  task :assembly_info do |t|
117
- # for each project, invoke the rule
118
- Dir.foreach(@src_dir) do |e|
119
- asm_info = File.join(@src_dir, e, 'Properties', 'AssemblyInfo.cs')
120
- if is_project e
121
- Rake::FileTask[asm_info].invoke
122
- end
130
+ Pathname.new(@src_dir).entries.each do |e|
131
+ asm_info = asm_info_to_generate(e)
132
+ Rake::FileTask[asm_info].invoke unless asm_info.nil?
123
133
  end
124
134
  end
125
135
 
@@ -136,16 +146,24 @@ module Rake
136
146
  of.open('w') { |f| f.puts content }
137
147
  end
138
148
 
139
- def is_project entry
140
- if (entry == '.' || entry == '..' || entry == '.svn')
141
- return false
149
+ def asm_info_to_generate pn_entry
150
+ if (pn_entry == '.' || pn_entry == '..' || pn_entry == '.svn')
151
+ return nil
142
152
  end
143
- if (entry == 'AssemblyInfo.cs.template')
144
- return false
153
+ if (pn_entry == 'AssemblyInfo.cs.template' || pn_entry == 'AssemblyInfo.vb.template')
154
+ return nil
145
155
  end
146
- #puts "#{entry} is directory? #{File.directory?(entry)}"
147
- #return File.directory?(entry)
148
- return true
156
+
157
+ proj = FileList.new("#{@src_dir}/#{pn_entry}/*.*proj").first
158
+ return nil if proj.nil?
159
+
160
+ proj_ext = Pathname.new(proj).extname
161
+ path = case proj_ext
162
+ when '.csproj' then File.join(@src_dir, pn_entry, 'Properties', 'AssemblyInfo.cs')
163
+ when '.vbproj' then File.join(@src_dir, pn_entry, 'My Project', 'AssemblyInfo.vb')
164
+ else nil
165
+ end
166
+ return path
149
167
  end
150
168
 
151
169
  def token_replacements
@@ -426,11 +444,13 @@ module Rake
426
444
  attr_accessor :src_dir, :verbosity, :working_dir
427
445
 
428
446
  def initialize(params={})
447
+ #TODO: Support for arbitrary properties, not just configuration. For example, TreatWarningsAsErrors, WarningLevel.
429
448
  @configuration = params[:configuration] || CONFIGURATION
430
449
  @src_dir = params[:src_dir] || SRC_DIR
431
450
  @verbosity = params[:verbosity] || MSBUILD_VERBOSITY || 'm'
432
451
  @working_dir = params[:working_dir] || '.'
433
452
  @deps = params[:deps] || []
453
+ @buildable_projects = ['.csproj','.vbproj','.wixproj']
434
454
 
435
455
  yield self if block_given?
436
456
  define
@@ -441,7 +461,7 @@ module Rake
441
461
  rule(/#{src_dir_regex}\/[\w\.]+\/bin\/#{@configuration}\/[\w\.]+\.(?:dll|exe)/) do |r|
442
462
  pn = Pathname.new(r.name)
443
463
  name = pn.basename.to_s.sub('.dll', '')
444
- project = File.join(@src_dir, name, name + '.csproj')
464
+ project = FileList.new("#{@src_dir}/#{name}/#{name}.*proj").first
445
465
  mb = MsBuild.new(project, {:Configuration => @configuration}, ['Build'], verbosity, @working_dir)
446
466
  mb.run
447
467
  end
@@ -450,7 +470,7 @@ module Rake
450
470
  rule(/#{src_dir_regex}\/[\w\.]+\/bin\/[\w\.]+\.dll/) do |r|
451
471
  pn = Pathname.new(r.name)
452
472
  name = pn.basename.to_s.sub('.dll', '')
453
- project = File.join(@src_dir, name, name + '.csproj')
473
+ project = FileList.new("#{@src_dir}/#{name}/#{name}.*proj").first
454
474
  mb = MsBuild.new(project, {:Configuration => @configuration}, ['Build'], verbosity, @working_dir)
455
475
  mb.run
456
476
  end
@@ -463,7 +483,7 @@ module Rake
463
483
  pn = Pathname.new(p)
464
484
  # TODO: Figure out which type of project we are so we can invoke the correct rule, with the correct output extension
465
485
  dll = File.join(pn.dirname, 'bin', @configuration, pn.basename.sub(pn.extname, '.dll'))
466
- Rake::FileTask[dll].invoke
486
+ Rake::FileTask[dll].invoke if @buildable_projects.include?(pn.extname)
467
487
  end
468
488
  end
469
489
 
@@ -472,7 +492,7 @@ module Rake
472
492
  end
473
493
 
474
494
  self
475
- end
495
+ end
476
496
 
477
497
  def src_dir_regex
478
498
  regexify(@src_dir)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake-dotnet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter MouncePeter Mounce
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-02 00:00:00 +01:00
12
+ date: 2009-06-23 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -47,7 +47,7 @@ files:
47
47
  - Manifest.txt
48
48
  - README.markdown
49
49
  - README.txt
50
- - Rakefile
50
+ - Rakefile.rb
51
51
  - lib/rake_dotnet.rb
52
52
  - test/test_rake_dotnet.rb
53
53
  has_rdoc: true