forked from canton7/Simple.Migrations
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
36 lines (28 loc) · 1.07 KB
/
Rakefile
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
require 'json'
SIMPLEMIGRATIONS_DIR = 'src/Simple.Migrations'
UNIT_TESTS_DIR = 'src/Simple.Migrations.UnitTests'
ASSEMBLY_INFO = File.join(SIMPLEMIGRATIONS_DIR, 'Properties/AssemblyInfo.cs')
SIMPLEMIGRATIONS_JSON = File.join(SIMPLEMIGRATIONS_DIR, 'project.json')
SIMPLEMIGRATIONS_CSPROJ = File.join(SIMPLEMIGRATIONS_DIR, 'Simple.Migrations.csproj')
NUGET_DIR = File.join(File.dirname(__FILE__), 'NuGet')
desc "Create NuGet package"
task :package do
sh 'dotnet', 'pack', '--no-build', '--configuration=Release', "--output=\"#{NUGET_DIR}\"", '--include-symbols', SIMPLEMIGRATIONS_DIR
end
desc "Bump version number"
task :version, [:version] do |t, args|
version = args[:version]
content = IO.read(SIMPLEMIGRATIONS_CSPROJ)
content[/<VersionPrefix>(.+?)<\/VersionPrefix>/, 1] = version
File.open(SIMPLEMIGRATIONS_CSPROJ, 'w'){ |f| f.write(content) }
end
desc "Build the project for release"
task :build do
sh 'dotnet', 'build', '--configuration=Release', SIMPLEMIGRATIONS_DIR
end
desc "Run tests"
task :test do
Dir.chdir(UNIT_TESTS_DIR) do
sh 'dotnet', 'test'
end
end