Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 69 lines (58 sloc) 1.845 kb
bed360a rakefile skeleton
Patrick Bozeman authored
1 # Copyright (c) 2009-2012 VMware, Inc.
8dda4e7 @d One Rakefile
d authored
2 require "rspec/core/rake_task"
e99ba39 @d [ccng] Add CI Rake Task
d authored
3 require "ci/reporter/rake/rspec"
bed360a rakefile skeleton
Patrick Bozeman authored
4
e99ba39 @d [ccng] Add CI Rake Task
d authored
5 ENV['CI_REPORTS'] = File.join("spec", "artifacts", "reports")
6
7 namespace :spec do
8 desc "Run specs producing results for CI"
3b39ef4 @d [ccng] Coverage for CI
d authored
9 task :ci => ["ci:setup:rspec"] do
10 require "simplecov-rcov"
11 require "simplecov"
12 # RCov Formatter's output path is hard coded to be "rcov" under
13 # SimpleCov.coverage_path
14 SimpleCov.coverage_dir(File.join("spec", "artifacts"))
15 SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
16 SimpleCov.start do
17 add_filter "/spec/"
18 add_filter "/migrations/"
185b6f2 @d Miscellaneous fixes to enable CI
d authored
19 add_filter '/vendor\/bundle/'
3b39ef4 @d [ccng] Coverage for CI
d authored
20 RSpec::Core::Runner.disable_autorun!
21 end
185b6f2 @d Miscellaneous fixes to enable CI
d authored
22 exit RSpec::Core::Runner.run(['--fail-fast', '--backtrace', 'spec']).to_i
3b39ef4 @d [ccng] Coverage for CI
d authored
23 end
e99ba39 @d [ccng] Add CI Rake Task
d authored
24 end
bed360a rakefile skeleton
Patrick Bozeman authored
25
26 desc "Run specs"
8dda4e7 @d One Rakefile
d authored
27 RSpec::Core::RakeTask.new do |t|
28 t.rspec_opts = ["--format", "documentation", "--colour"]
29 end
bed360a rakefile skeleton
Patrick Bozeman authored
30
31 desc "Run specs with code coverage"
8dda4e7 @d One Rakefile
d authored
32 task :coverage do
33 require "simplecov"
34
35 SimpleCov.coverage_dir(File.join("spec", "artifacts", "coverage"))
36 SimpleCov.start do
37 add_filter "/spec/"
38 add_filter "/migrations/"
39 RSpec::Core::Runner.disable_autorun!
40 RSpec::Core::Runner.run(['.'])
bed360a rakefile skeleton
Patrick Bozeman authored
41 end
42 end
43
44 namespace :db do
45 # TODO: add migration support
46
47 desc "Create a Sequel migration in ./db/migrate"
48 task :create_migration do
dd74cd9 quote normalization.
Patrick Bozeman authored
49 name = ENV["NAME"]
bed360a rakefile skeleton
Patrick Bozeman authored
50 abort("no NAME specified. use `rake db:create_migration NAME=add_users`") if !name
51
52 migrations_dir = File.join("db", "migrations")
53 version = ENV["VERSION"] || Time.now.utc.strftime("%Y%m%d%H%M%S")
54 filename = "#{version}_#{name}.rb"
55 FileUtils.mkdir_p(migrations_dir)
56
dd74cd9 quote normalization.
Patrick Bozeman authored
57 open(File.join(migrations_dir, filename), "w") do |f|
bed360a rakefile skeleton
Patrick Bozeman authored
58 f.write <<-EOF
59 # Copyright (c) 2009-2012 VMware, Inc.
60
61 Sequel.migration do
62 change do
63 end
64 end
65 EOF
66 end
67 end
68 end
Something went wrong with that request. Please try again.