-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
91 lines (78 loc) · 2.14 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
81
82
83
84
85
86
87
88
89
90
91
require 'fileutils'
require 'bundler'
require 'rake/clean'
require 'rake/testtask'
require 'rubocop/rake_task'
require 'cucumber'
require 'cucumber/rake/task'
require 'rdoc/task'
gem 'rdoc' # we need the installed RDoc gem, not the system one
include Rake::DSL
def dump_load_path
puts $LOAD_PATH.join("\n")
found = nil
$LOAD_PATH.each do |path|
if File.exists?(File.join(path,"rspec"))
puts "Found rspec in #{path}"
if File.exists?(File.join(path,"rspec","core"))
puts "Found core"
if File.exists?(File.join(path,"rspec","core","rake_task"))
puts "Found rake_task"
found = path
else
puts "!! no rake_task"
end
else
puts "!!! no core"
end
end
end
if found.nil?
puts "Didn't find rspec/core/rake_task anywhere"
else
puts "Found in #{path}"
end
end
# Creates a sample file for testing in /tmp.
def reset_test_file(todo_file='test/todo.txt')
FileUtils.rm_rf '/tmp/todo-curses'
FileUtils.mkdir '/tmp/todo-curses'
FileUtils.cp todo_file, '/tmp/todo-curses/'
end
Bundler::GemHelper.install_tasks
Rake::TestTask.new do |t|
t.pattern = 'test/*.rb'
end
CUKE_RESULTS = 'results.html'
CLEAN << CUKE_RESULTS
Cucumber::Rake::Task.new(:features) do |t|
t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty --no-source -x"
t.fork = false
end
Rake::RDocTask.new do |rd|
rd.main = "README.rdoc"
rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
end
task :default => [:test,:features]
# Copies the roadmap file to /tmp and opens the app for it.
desc 'roadmap'
task :roadmap do
reset_test_file('project-management/todo.txt')
sh 'bundle exec bin/todo-curses /tmp/todo-curses/todo.txt'
end
# Reset the testing todo.txt file, if you have one.
desc 'reset'
task :reset do
reset_test_file
end
# Easy way to run the app for dev
desc 'run'
task :run do
reset_test_file unless File.file?('/tmp/todo-curses/todo.txt')
sh 'bundle exec bin/todo-curses /tmp/todo-curses/todo.txt'
end
# Easy way to rubocop the project
desc 'Lint Ruby'
RuboCop::RakeTask.new(:rubocop) do |t|
t.patterns = ['bin/**/*.rb', 'lib/**/*.rb']
end