@@ -32,26 +32,24 @@ module Platform
32
32
JSON.parse(File.read(CONFIG))
33
33
end
34
34
35
+ def self.update_config_version(arg)
36
+ current = self.config
37
+ current['assembly_info']['version'] = current['nuspec']['version'] = arg
38
+ File.write(CONFIG, JSON.pretty_generate(current.to_json))
39
+ end
40
+
35
41
end
36
42
37
43
NH_VERSION = Platform.config['build']['nh_precompiler_switch']
38
44
39
- # Albacore.configure do |config|
40
- # config.log_level = :verbose
41
- # end
42
-
43
45
def get_version
44
46
ENV['BUILD_NUMBER'] || Platform.config['default_version_number']
45
47
end
46
48
47
49
task :default => ['ripple:restore', 'source:update_version', 'build:all']
48
50
49
51
namespace :ci do
50
- task :run_ci_build => [
51
- 'build:all',
52
- 'docs:build',
53
- 'package:all',
54
- ]
52
+ task :run_ci_build => [ 'build:all', 'docs:build', 'package:all' ]
55
53
end
56
54
57
55
namespace :ripple do
@@ -70,6 +68,7 @@ namespace :source do
70
68
71
69
commit_hash = `git log -1 --format="%H%"`
72
70
71
+ info.title = Platform.config['assembly_info']['title']
73
72
info.version = info.file_version = get_version
74
73
info.informational_version = Platform.config['version']
75
74
info.company_name = 'http://fluentnhibernate.org'
@@ -78,7 +77,7 @@ namespace :source do
78
77
info.copyright = "Copyright 2008-#{Time.new.year} James Gregory and contributors (Paul Batum, Hudson Akridge et al). All rights reserved."
79
78
info.namespaces = ['System.Security']
80
79
81
- puts "The new build number is #{info.version}"
80
+ puts "The new version is #{info.version}"
82
81
end
83
82
84
83
task :nhibernate_version, :nhibernate_version do |t,args|
@@ -144,6 +143,16 @@ namespace :docs do
144
143
end
145
144
end
146
145
146
+ namespace :git do
147
+ desc "Updates the version and tags the release"
148
+ task :prep_release do |task|
149
+ current_version = Platform.config['assembly_info']['version']
150
+ sh "git add -A"
151
+ sh "git commit -m \"Updated version to #{current_version}\""
152
+ sh "git tag \"v#{current_version}\""
153
+ end
154
+ end
155
+
147
156
namespace :package do
148
157
task :prepare_dist_directory do
149
158
FileUtils.rm_rf 'dist'
@@ -212,13 +221,29 @@ namespace :package do
212
221
nu.output = 'dist'
213
222
end
214
223
224
+ task :new_version, :version do |cmd, args|
225
+ version_parts = /(\d{1,2}\.)(\d{1,2}\.)(\d{1,2})(\-*[a-zA-Z0-9]*)/.match(args[:version])
226
+ is_valid_version = version_parts.captures.count{|p| p.length > 0} == (args[:version].split(//).count{|c| ['.', '-'].include?(c)} + 1)
227
+ if !args[:version].to_s.empty? and is_valid_version
228
+ #Platform.update_config_version(args[:version])
229
+ ['ripple:restore', 'build:all', 'package:nuget', 'git:prep_release']
230
+ .each {|tk|
231
+ puts tk
232
+ #Rake.task[tk].reenable
233
+ #Rake.task[tk].reinvoke
234
+ }
235
+ else
236
+ puts "Please provide valid version number"
237
+ end
238
+ end
239
+
215
240
desc 'Create nuget spec and package'
216
241
task :nuget => [:nuspec, :nupack]
217
242
218
243
desc 'Package everything (src, bin, docs, nuget)'
219
244
task :all => [:source, :binaries, :docs, :nuget]
220
245
end
221
-
246
+
222
247
def update_xml(xml_path)
223
248
#Open up the xml file
224
249
xml_file = File.new(xml_path)
0 commit comments