-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrakefile.rb
111 lines (100 loc) · 3.58 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
require 'rake'
require 'albacore'
require 'fileutils'
PRODUCT_NAME = "FlipIt"
BASE_PATH = File.expand_path ""
SOURCE_PATH = "#{BASE_PATH}/src/"
OUTPUT_PATH = "#{BASE_PATH}/output/"
TESTS_PATH = "#{SOURCE_PATH}/#{PRODUCT_NAME}.Tests/bin/Release/"
TESTS_OUTPUT_PATH = "#{OUTPUT_PATH}/tests"
PACKAGE_OUTPUT_PATH = "#{OUTPUT_PATH}/package/"
PACKAGE_OUTPUT_LIB_PATH = "#{PACKAGE_OUTPUT_PATH}/lib/"
TEST_REPORT_PATH = "#{OUTPUT_PATH}/report"
COMMON_ASSEMBY_INFO_FILE = "#{SOURCE_PATH}/CommonAssemblyInfo.cs"
MSPEC_VERSION = "0.5.3.0"
VERSION = "0.1.0.1"
PACKAGE_PATH = "#{BASE_PATH}/package"
NUSPEC_FILENAME = "#{PRODUCT_NAME}.nuspec"
NUSPEC_PATH = "#{PACKAGE_PATH}/#{NUSPEC_FILENAME}"
task :default => [:standard]
task :standard => [:assemblyInfo,:build,:output,:test,:define_package]
task :package => [:standard,:create_package]
msbuild :build do |msb|
msb.properties :configuration => :Release
msb.targets :Clean, :Build
msb.verbosity = "minimal"
msb.solution = "#{SOURCE_PATH}/#{PRODUCT_NAME}.sln"
end
task :output do
FileUtils.rmtree OUTPUT_PATH
FileUtils.mkdir OUTPUT_PATH
FileUtils.mkdir TEST_REPORT_PATH
FileUtils.mkdir TESTS_OUTPUT_PATH
FileUtils.mkdir PACKAGE_OUTPUT_PATH
FileUtils.mkdir PACKAGE_OUTPUT_LIB_PATH
FileUtils.rmtree PACKAGE_PATH
FileUtils.mkdir PACKAGE_PATH
FileUtils.cp_r "#{TESTS_PATH}.", TESTS_OUTPUT_PATH
copy_files TESTS_PATH, PACKAGE_OUTPUT_LIB_PATH, PRODUCT_NAME, ["dll", "pdb", "xml"]
end
mspec :test do |mspec|
mspec.command = "lib/Machine.Specifications.#{MSPEC_VERSION}/tools/mspec.exe"
mspec.assemblies "#{TESTS_OUTPUT_PATH}/#{PRODUCT_NAME}.Tests.dll"
mspec.html_output = TEST_REPORT_PATH
end
desc "Assembly Version Info Generator"
assemblyinfo :assemblyInfo do |asm|
FileUtils.rm COMMON_ASSEMBY_INFO_FILE, :force => true
asm.output_file = COMMON_ASSEMBY_INFO_FILE
asm.title = PRODUCT_NAME
asm.company_name = "Lunaverse Software"
asm.product_name = PRODUCT_NAME
asm.version = VERSION
asm.file_version = VERSION
asm.copyright = "Copyright (c) 2011 Lunaverse Software"
end
desc "Create the FlipIt nuspec file"
nuspec :define_package do |nuspec|
version = "#{ENV['version']}"
nuspec.id = "FlipIt"
nuspec.version = version.length == 7 ? version : VERSION
nuspec.authors = "Tim Scott"
nuspec.owners = "Tim Scott"
nuspec.description = "A feature flipper. FlipIt provides a simple and flexible way to flip features in a .NET application."
nuspec.title = "FlipIt"
nuspec.language = "en-US"
nuspec.licenseUrl = "https://github.com/timscott/flipit/blob/master/LICENSE.TXT"
nuspec.projectUrl = "https://github.com/timscott/flipit/wiki"
nuspec.tags = "FeatureFlipper Deployment Settings Configuration"
nuspec.working_directory = PACKAGE_PATH
nuspec.output_file = NUSPEC_FILENAME
end
desc "Create the nuget package"
task :create_package do
execute_nuget "pack #{NUSPEC_PATH} -basepath #{PACKAGE_OUTPUT_PATH} -outputdirectory #{PACKAGE_PATH}"\
end
desc "Publish to nuget"
task :publish do
$stdout.sync = true
print "Are you sure? (Y/[N])? "
input = STDIN.gets.strip
if input.downcase == 'y'
execute_nuget "push #{PACKAGE_PATH}/#{PRODUCT_NAME}.#{VERSION}.nupkg"
end
end
def copy_files(from, to, filename, extensions)
extensions.each do |ext|
from_name = "#{from}#{filename}.#{ext}"
to_name = "#{to}#{filename}.#{ext}"
if File.exists? from_name
puts "Copying '#{from_name}' to '#{to_name}'"
FileUtils.cp from_name, to_name
end
end
end
def execute_nuget(parameters)
cmd = Exec.new
cmd.command = "tools/nuget.exe"
cmd.parameters = parameters
cmd.execute
end