forked from aws/aws-codedeploy-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
57 lines (50 loc) · 1.43 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
require 'rake'
require 'rake/testtask'
require 'rspec/core/rake_task'
require 'rubygems'
# Run all units tests in test/
desc "Run unit tests in test/"
Rake::TestTask.new(:test) do |t|
t.libs << ['test', 'lib', 'test/helpers']
test_files = FileList.new("test/**/*_test.rb")
t.test_files = test_files
t.verbose = true
end
task :default => [:version_tracking, :test]
task :release => [:version_tracking, :test]
desc "Run unit tests in spec/"
RSpec::Core::RakeTask.new(:spec)
task :test => :spec
begin
require 'cucumber'
require 'cucumber/rake/task'
desc = 'aws codedeploy agent integration tests'
Cucumber::Rake::Task.new('test-integration-aws-codedeploy-agent', desc) do |t|
t.cucumber_opts = "features -t ~@Ignore"
end
task 'test-integration' => 'test-integration-aws-codedeploy-agent'
rescue LoadError
desc 'aws codedeploy agent integration tests'
task 'test:integration' do
puts 'skipping aws-codedeploy-agent integration tests, cucumber not loaded'
end
end
# Version tracking
require 'fileutils'
task :version_tracking do
FileUtils.rm('.version') if File.exist?('.version')
File.open('.version', 'w+') {|file| file.write("agent_version: #{getAgentTrackingInfo}")}
FileUtils.chmod(0444, '.version')
end
def getAgentTrackingInfo
begin
commit_id = `git rev-parse HEAD`.chop!
tracking = "COMMIT_#{commit_id}"
rescue
tracking = "UNKNOWN_VERSION"
end
end
# Clean up
task :clean do
rm_rf 'deployment'
end