-
Notifications
You must be signed in to change notification settings - Fork 0
/
rakefile.rb
58 lines (46 loc) · 2.07 KB
/
rakefile.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
require 'rake/clean'
require 'albacore'
SELF_PATH = File.dirname(__FILE__)
PATH_TO_MSBUILD = "C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\msbuild.exe"
# list of files and directories to clean, change to suit your liking
CLEAN.exclude("**/core","**/_sql")
CLEAN.include("*.cache", "*.xml", "*.suo", "**/obj", "**/bin", "*.nupkg")
##########################################
# CONFIGURE THIS STUFF ONLY
##########################################
$PROJECT_NAME = "Smokesignals" # this should reflect the name of your project
$VERSION_NUMBER = "1.5" # update this before running rake nuget:pack
$NUGET_OUTPUT_DIR = File.join(File.dirname(__FILE__), "/nuget")
task :default => :pack
desc "packs the project based on the existing conventions"
task :pack do |t|
Rake::Task["clean"].invoke
Rake::Task["assemblyinfo"].invoke
Rake::Task["build"].invoke("Release")
Dir.mkdir($NUGET_OUTPUT_DIR) unless File.directory?($NUGET_OUTPUT_DIR)
FileUtils.copy("#{$PROJECT_NAME}/bin/release/#{$PROJECT_NAME}.dll", "#{$NUGET_OUTPUT_DIR}/lib")
FileUtils.copy("Smokesignals.MvcExample/Public/css/messages.css", "#{$NUGET_OUTPUT_DIR}/content/Public/css")
Dir.glob('Smokesignals.MvcExample/Public/js/*.js').each do |f|
FileUtils.copy(f, "#{$NUGET_OUTPUT_DIR}/content/Public/js")
end
system("nuget pack #{$NUGET_OUTPUT_DIR}/#{$PROJECT_NAME}.nuspec -Version #{$VERSION_NUMBER}")
end
# builds all the .sln files in the directory
task :build, :config do |t, args|
desc "builds all of the .sln files in the current directory"
config = !args.config ? "Debug" : args.config
Dir.glob('*.sln') do |file|
puts "\nBuilding #{file}"
system("#{PATH_TO_MSBUILD} /v:q /p:Configuration=#{config}")
end
end
# Builds the AssemblyInfo.cs file for the project
assemblyinfo :assemblyinfo do |asm,args|
puts "Writing AssemblyInfo for #{args.project}"
asm.version = $VERSION_NUMBER
asm.company_name = $PROJECT_NAME
asm.product_name = $PROJECT_NAME
asm.title = $PROJECT_NAME
asm.description = $PROJECT_NAME
asm.output_file = "#{SELF_PATH}/#{$PROJECT_NAME}/Properties/AssemblyInfo.cs"
end