-
Notifications
You must be signed in to change notification settings - Fork 0
/
rakefile.repo
59 lines (49 loc) · 1.2 KB
/
rakefile.repo
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
require 'rake/testtask'
require 'pp'
require 'yaml'
require 'rake/clean'
namespace :main do
desc "Testing rake here"
#run by command rake main:cleanup
task :cleanup do
puts "Cleaning up..."
[1,2,3].each do |a|
puts a
end
end
#run by command rake main:task_one
task :task_one do
puts "task one :)"
end
#run by command rake main:task_two
task :task_two do
puts "Task two :P"
end
#run by command rake main:task_three
task :task_three => [:task_one, :task_two] do
puts "I depend on task one and task two"
#Call task cleanup here
#namespace:task_name is important we cannot just have :task_name there and not have namespace even though it is in same name space
Rake::Task["main:cleanup"].invoke
end
#run by command rake main:foo.txt
#if this file foo.txt already exists then it wont get created.
task 'foo.txt' do
puts 'shall i make foo text'
touch "foo.txt"
end
end
#file task with dependencies
file "abc.txt" => dependencies do
#your code in here
touch abc.txt
end
#file task without dependencies
file "abc.txt" do
#your code in here
touch abc.txt
end
#invoking file task
task :fileTask => "abc.txt" do
#your code goes here
end