Skip to content

Commit f85f17f

Browse files
committed
Rake tasks for tagging the release, updating config.json version
1 parent e81de22 commit f85f17f

File tree

2 files changed

+42
-13
lines changed

2 files changed

+42
-13
lines changed

RakeFile

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,24 @@ module Platform
3232
JSON.parse(File.read(CONFIG))
3333
end
3434

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+
3541
end
3642

3743
NH_VERSION = Platform.config['build']['nh_precompiler_switch']
3844

39-
# Albacore.configure do |config|
40-
# config.log_level = :verbose
41-
# end
42-
4345
def get_version
4446
ENV['BUILD_NUMBER'] || Platform.config['default_version_number']
4547
end
4648

4749
task :default => ['ripple:restore', 'source:update_version', 'build:all']
4850

4951
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' ]
5553
end
5654

5755
namespace :ripple do
@@ -70,6 +68,7 @@ namespace :source do
7068

7169
commit_hash = `git log -1 --format="%H%"`
7270

71+
info.title = Platform.config['assembly_info']['title']
7372
info.version = info.file_version = get_version
7473
info.informational_version = Platform.config['version']
7574
info.company_name = 'http://fluentnhibernate.org'
@@ -78,7 +77,7 @@ namespace :source do
7877
info.copyright = "Copyright 2008-#{Time.new.year} James Gregory and contributors (Paul Batum, Hudson Akridge et al). All rights reserved."
7978
info.namespaces = ['System.Security']
8079

81-
puts "The new build number is #{info.version}"
80+
puts "The new version is #{info.version}"
8281
end
8382

8483
task :nhibernate_version, :nhibernate_version do |t,args|
@@ -144,6 +143,16 @@ namespace :docs do
144143
end
145144
end
146145

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+
147156
namespace :package do
148157
task :prepare_dist_directory do
149158
FileUtils.rm_rf 'dist'
@@ -212,13 +221,29 @@ namespace :package do
212221
nu.output = 'dist'
213222
end
214223

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+
215240
desc 'Create nuget spec and package'
216241
task :nuget => [:nuspec, :nupack]
217242

218243
desc 'Package everything (src, bin, docs, nuget)'
219244
task :all => [:source, :binaries, :docs, :nuget]
220245
end
221-
246+
222247
def update_xml(xml_path)
223248
#Open up the xml file
224249
xml_file = File.new(xml_path)

config.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
22
"framework_version": 3.5,
33
"default_version_number": "1.4.1.0",
4-
"version": "1.4.1-alpha",
4+
"assembly_info":
5+
{
6+
"version": "1.4.1-alpha",
7+
"title": "Fluent NHibernate for .NET 3.5"
8+
},
59
"build":
610
{
711
"nh_precompiler_switch": "3.x",
@@ -16,7 +20,7 @@
1620
{
1721
"id": "FluentNHibernate.Net35",
1822
"version": "1.4.1-alpha",
19-
"title": "FluentNHibernate for .Net 3.5",
23+
"title": "FluentNHibernate for .NET 3.5",
2024
"nhibernate_version_interval": "[3.3.1.4000,4.0)",
2125
"binaries_folder": "net35"
2226
}

0 commit comments

Comments
 (0)