-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathRakefile
More file actions
32 lines (26 loc) · 742 Bytes
/
Rakefile
File metadata and controls
32 lines (26 loc) · 742 Bytes
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
# frozen_string_literal: true
require "bundler/gem_tasks"
require "rake/testtask"
Rake::TestTask.new do |t|
t.test_files = FileList["test/**/*_test.rb"]
end
task default: :test
namespace :actions do
desc "list valid actions"
task :list do
# there are two distinct :action declarations we need to find
# the regular expressions below capture both
#
# [:action] = 'some.value'
# :action => 'some.value'
#
list = %x(grep '\\[\\?:action\\]\\?\\s\\+=' `find lib -name '*.rb'`).split("\n")
list.map! do |line|
m = /\A.*?\[?:action\]?\s+=>?\s+'(.*?)'.*\Z/.match line
m.nil? ? nil : m[1]
end
list.compact.sort.uniq.each do |action|
STDOUT.puts "- #{action}"
end
end
end