rake-dotnet 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +12 -0
- data/Rakefile +1 -1
- data/lib/rake_dotnet.rb +104 -69
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
=== 0.0.5 / 2009-04-03
|
2
|
+
|
3
|
+
* Support non-svn version-control. In this case, write today's date as YYYYMMDD into revision number of assembly version.
|
4
|
+
* Write ncover reports into out/reports/ncover, since there may be many, and there are some asset files too.
|
5
|
+
* Generate the {project}/Properties/AssemblyInfo.cs in place rather than making users add a link to the common one (friction)
|
6
|
+
* Generate the {project}/Properties/AssemblyInfo.cs from either a .template next-door, or the common template in {src_dir}
|
7
|
+
* Change the name of the AssemblyInfo template because if it ends in .cs msbuild assumes it should be compiled, which will then fail.
|
8
|
+
|
9
|
+
=== 0.0.4 / 2009-03-31
|
10
|
+
|
11
|
+
* Gem publishing snafu on my part.
|
12
|
+
|
1
13
|
=== 0.0.3 / 2009-03-30
|
2
14
|
|
3
15
|
* Bugfix release
|
data/Rakefile
CHANGED
@@ -5,7 +5,7 @@ require 'hoe'
|
|
5
5
|
require 'Pathname'
|
6
6
|
require 'rake/clean'
|
7
7
|
|
8
|
-
Hoe.new('rake-dotnet', '0.0.
|
8
|
+
Hoe.new('rake-dotnet', '0.0.5') 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'
|
data/lib/rake_dotnet.rb
CHANGED
@@ -78,65 +78,89 @@ verbose(VERBOSE)
|
|
78
78
|
|
79
79
|
|
80
80
|
module Rake
|
81
|
-
|
82
|
-
|
81
|
+
class AssemblyInfoTask < Rake::TaskLib
|
82
|
+
attr_accessor :product_name, :configuration, :company_name, :version
|
83
83
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
end
|
84
|
+
def initialize(params={})
|
85
|
+
@src_dir = params[:src_dir] || SRC_DIR
|
86
|
+
yield self if block_given?
|
87
|
+
define
|
88
|
+
end
|
90
89
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
90
|
+
def define
|
91
|
+
src_dir_regex = regexify(@src_dir)
|
92
|
+
rule(/#{src_dir_regex}\/[\w\.\d]+\/Properties\/AssemblyInfo.cs/) do |r|
|
93
|
+
nextdoor = Pathname.new(r.name + '.template')
|
94
|
+
common = Pathname.new(File.join(@src_dir, 'AssemblyInfo.cs.template'))
|
95
|
+
if (nextdoor.exist?)
|
96
|
+
generate(nextdoor, r.name)
|
97
|
+
elsif (common.exist?)
|
98
|
+
generate(common, r.name)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
desc 'Generate the AssemblyInfo.cs file from the template closest'
|
103
|
+
task :assembly_info do |t|
|
104
|
+
# for each project, invoke the rule
|
105
|
+
Dir.foreach(@src_dir) do |e|
|
106
|
+
asm_info = File.join(@src_dir, e, 'Properties', 'AssemblyInfo.cs')
|
107
|
+
if is_project e
|
108
|
+
Rake::FileTask[asm_info].invoke
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
self
|
114
|
+
end
|
106
115
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
116
|
+
def generate(template_file, destination)
|
117
|
+
content = template_file.read
|
118
|
+
token_replacements.each do |key, value|
|
119
|
+
content = content.gsub(/(\$\{#{key}\})/, value.to_s)
|
120
|
+
end
|
121
|
+
of = Pathname.new(destination)
|
122
|
+
of.delete if of.exist?
|
123
|
+
of.open('w') { |f| f.puts content }
|
124
|
+
end
|
125
|
+
|
126
|
+
def is_project entry
|
127
|
+
if (entry == '.' || entry == '..' || entry == '.svn')
|
128
|
+
return false
|
129
|
+
end
|
130
|
+
if (entry == 'AssemblyInfo.cs.template')
|
131
|
+
return false
|
132
|
+
end
|
133
|
+
#puts "#{entry} is directory? #{File.directory?(entry)}"
|
134
|
+
#return File.directory?(entry)
|
135
|
+
return true
|
136
|
+
end
|
137
|
+
|
138
|
+
def token_replacements
|
139
|
+
r = {}
|
140
|
+
r[:built_on] = Time.now
|
141
|
+
r[:product] = product_name
|
142
|
+
r[:configuration] = configuration
|
143
|
+
r[:company] = company_name
|
144
|
+
r[:version] = version
|
145
|
+
return r
|
146
|
+
end
|
147
|
+
|
148
|
+
def product_name
|
149
|
+
@product_name ||= 'NRWS rake_dotnet'
|
150
|
+
end
|
151
|
+
|
152
|
+
def configuration
|
153
|
+
@configuration ||= 'Debug'
|
154
|
+
end
|
155
|
+
|
156
|
+
def company_name
|
157
|
+
@company_name ||= 'NRWS'
|
158
|
+
end
|
159
|
+
|
160
|
+
def version
|
161
|
+
@version ||= Versioner.new.get
|
162
|
+
end
|
163
|
+
end
|
140
164
|
end
|
141
165
|
|
142
166
|
|
@@ -473,7 +497,7 @@ module Rake
|
|
473
497
|
|
474
498
|
@product_name = params[:product_name] || PRODUCT_NAME
|
475
499
|
@bin_dir = params[:bin_dir] || File.join(OUT_DIR, 'bin')
|
476
|
-
@report_dir = params[:report_dir] || File.join(OUT_DIR, 'reports')
|
500
|
+
@report_dir = params[:report_dir] || File.join(OUT_DIR, 'reports', 'ncover')
|
477
501
|
@deps = params[:deps] || []
|
478
502
|
tool_defaults = {:arch => 'x86'}
|
479
503
|
@ncover_options = tool_defaults.merge(params[:ncover_options] || {})
|
@@ -525,7 +549,7 @@ module Rake
|
|
525
549
|
task :ncover_summary => [:ncover_profile, ncover_summary_report_html]
|
526
550
|
|
527
551
|
task :clean_coverage do
|
528
|
-
rm_rf
|
552
|
+
rm_rf @report_dir
|
529
553
|
end
|
530
554
|
|
531
555
|
self
|
@@ -803,17 +827,28 @@ end
|
|
803
827
|
|
804
828
|
|
805
829
|
class Versioner
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
830
|
+
def initialize(template_file=nil)
|
831
|
+
tf = template_file || 'version.template.txt'
|
832
|
+
file = Pathname.new(tf)
|
833
|
+
@maj_min = file.read.chomp
|
834
|
+
end
|
835
|
+
|
836
|
+
def get
|
837
|
+
"#{@maj_min}.#{build}.#{revision}"
|
838
|
+
end
|
839
|
+
|
840
|
+
def build
|
841
|
+
ENV['BUILD_NUMBER'] || 0
|
842
|
+
end
|
843
|
+
|
844
|
+
def revision
|
845
|
+
if (Pathname.new('.svn').exist?)
|
846
|
+
SvnInfo.new(:path => '.').revision
|
847
|
+
else
|
848
|
+
now = Date.today
|
849
|
+
"#{now.to_s.gsub('-','')}"
|
850
|
+
end
|
851
|
+
end
|
817
852
|
end
|
818
853
|
|
819
854
|
|
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.0.
|
4
|
+
version: 0.0.5
|
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-03
|
12
|
+
date: 2009-04-03 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|