Add edit rakefile task
This commit is contained in:
parent
9cde0bd69f
commit
8c5f31daac
14
rake/edit.rake
Normal file
14
rake/edit.rake
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
desc "Open a task in your editor"
|
||||||
|
task :edit, :package do |t, args|
|
||||||
|
p "No package specified!" unless args.package
|
||||||
|
|
||||||
|
#prefix = __dir__
|
||||||
|
#path = "#{prefix}/#{args.package.gsub(":", "/").strip}.rake"
|
||||||
|
begin
|
||||||
|
path = Rake.application[args.package].actions.map(&:source_location).first.first
|
||||||
|
echo "Opening #{path}"
|
||||||
|
sh "$EDITOR #{path}"
|
||||||
|
rescue
|
||||||
|
error "No task found"
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue