forked from ollert/ollert
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
80 lines (64 loc) · 2.34 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
require 'rubygems'
require 'bundler'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
task :default => [:start]
desc "Start application based on environment"
task :start do
fork { exec "rerun --dir models,routes,utils,. --pattern *.{rb,js,coffee,ru,yml} -- foreman start -p 4000" }
fork { exec "grunt watch" }
Process.waitall
end
require 'mongoid'
desc "Open irb with an open connection to the database"
task :console do
Mongoid.load! "#{File.dirname(__FILE__)}/mongoid.yml", ENV['RACK_ENV'] || "development"
Dir.glob("#{File.dirname(__FILE__)}/models/*.rb").each do |file|
require file.chomp(File.extname(file))
end
require 'irb'
ARGV.clear
IRB.start
end
unless ENV['RACK_ENV'] == 'production'
require 'rspec/core/rake_task'
namespace :test do
RSpec::Core::RakeTask.new(:spec) do |r|
r.pattern = "test/**/*_spec.rb"
r.rspec_opts = '--color --format documentation --require ./test/spec/spec_helper --tag ~integration:true'
end
RSpec::Core::RakeTask.new(:integration) do |r|
r.pattern = "test/**/*_spec.rb"
r.rspec_opts = '--color --format documentation --require ./test/spec/spec_helper --tag integration:true'
end
desc 'Setup Integration'
task :setup do
require 'dotenv'
require 'launchy'
Dotenv.load
raise 'PUBLIC_KEY is not part of your .env' unless ENV['PUBLIC_KEY']
Launchy.open "https://trello.com/1/authorize?key=#{ENV['PUBLIC_KEY']}&scope=read%2Cwrite&name=OllertIntegrationTests&expiration=never&response_type=token"
puts "Copy the value shown to you after you choose to 'Allow' the Ollert Integration Tests application"
end
desc 'Run all JavaScript specs'
task :js do
system('npm test') or fail
end
desc "Run all Cucumber tests"
task :cukes do
ruby "-S cucumber -v -r #{File.dirname(__FILE__)}/test/features #{File.dirname(__FILE__)}/test/features"
end
desc "Run a single Cuke test"
task :cuke, [:feature] do |t, args|
ruby "-S cucumber -v -r #{File.dirname(__FILE__)}/test/features #{File.dirname(__FILE__)}/test/features/#{args[:feature]}.feature"
end
desc "Run spec tests and cukes"
task :all => [:spec, :integration, :js, :cukes] do
end
end
end