From 8c5f31daaca6a121833257b449f75f3fdbfae91f Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 25 Oct 2014 16:38:36 -0400 Subject: [PATCH] Add edit rakefile task --- rake/edit.rake | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 rake/edit.rake diff --git a/rake/edit.rake b/rake/edit.rake new file mode 100644 index 00000000..4d3e9392 --- /dev/null +++ b/rake/edit.rake @@ -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