-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRakefile
61 lines (45 loc) · 1.09 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
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
require 'rubygems'
require 'bundler/setup'
require 'bundler/gem_tasks'
require 'rake'
require 'rake/testtask'
require 'rake/clean'
require 'rubocop/rake_task'
require 'cucumber/rake/task'
require 'fileutils'
CLOBBER.include('pkg')
CLEAN.include('build')
task :init do
FileUtils.mkdir_p 'build'
end
# Rubocop
RuboCop::RakeTask.new
# Installs the tasks for gem creation
Bundler::GemHelper.install_tasks
# Tests
Rake::TestTask.new do |t|
t.pattern = 'test/**/*_test.rb'
t.libs << 'test'
# TODO: Don't do this?
t.warning = false
end
# Cucumber acceptance test task
Cucumber::Rake::Task.new(:features)
# Builds the Go binary
task :build_binary do
require 'landrush-ip/version'
go_version = <<-DESC
package main
const Version string = "#{LandrushIp::VERSION}"
DESC
File.write('util/version.go', go_version)
go_version = ENV['GO_VERSION'] || '1.7'
sh "docker pull golang:#{go_version}"
sh "docker run --rm -v $(pwd)/util:/usr/src/landrush-ip -w /usr/src/landrush-ip golang:#{go_version} make"
end
task features: :init
task build: :build_binary
task default: [
:rubocop,
:test
]