aboutsummaryrefslogtreecommitdiffstats
path: root/Rakefile
blob: c5647d25c53c6a14b9469e583670635f1b34b0e5 (plain)
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
desc "Builds todolist for release"

Envs = [
  {goos: "darwin", arch: "386"},
  {goos: "darwin", arch: "amd64"},
  {goos: "darwin", arch: "arm"},
  {goos: "linux", arch: "386"},
  {goos: "linux", arch: "amd64"},
  {goos: "windows", arch: "386"},
  {goos: "windows", arch: "amd64"}
]

Version = "0.3.1"

task :build do
  `rm -rf dist/#{Version}`
  Envs.each do |env|
    ENV["GOOS"] = env[:goos]
    ENV["GOARCH"] = env[:arch]
    puts "Building #{env[:goos]} #{env[:arch]}"
    `GOOS=#{env[:goos]} GOARCH=#{env[:arch]} go build -v -o dist/#{Version}/todolist`
    puts "Tarring #{env[:goos]} #{env[:arch]}"
    `tar -czvf dist/#{Version}/todolist_#{env[:goos]}_#{env[:arch]}.tar.gz dist/#{Version}/todolist`
    puts "Removing dist/#{Version}/todolist"
    `rm -rf dist/#{Version}/todolist`
  end
end