Add task for generating ctags
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
536052e9bf
commit
fb054ae455
3
.gitignore
vendored
3
.gitignore
vendored
@ -47,3 +47,6 @@ dump.rdb
|
|||||||
|
|
||||||
/app/assets/builds/*
|
/app/assets/builds/*
|
||||||
!/app/assets/builds/.keep
|
!/app/assets/builds/.keep
|
||||||
|
|
||||||
|
# Ignore generated ctags
|
||||||
|
*.tags
|
||||||
|
29
lib/tasks/ctags.rake
Normal file
29
lib/tasks/ctags.rake
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
module Kosmos
|
||||||
|
class Ctags
|
||||||
|
def self.generate_app_tags
|
||||||
|
excludes = %w[.git gitno log tmp public].join(" --exclude ")
|
||||||
|
cmd = "ctags -R --languages=ruby --exclude #{excludes} ."
|
||||||
|
system cmd
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.generate_bundler_tags
|
||||||
|
runtime = ::Bundler::Runtime.new Dir.pwd, ::Bundler.definition
|
||||||
|
paths = runtime.specs.map(&:full_gem_path)
|
||||||
|
generate_tags(paths, "gems.tags")
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.generate_tags(paths, tag_file)
|
||||||
|
paths = paths.join(' ').strip
|
||||||
|
cmd = "find #{paths} -ignore_readdir_race -type f -name '*.rb' 2>/dev/null | ctags -f #{tag_file} -L -"
|
||||||
|
system cmd
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
namespace :ctags do
|
||||||
|
desc 'generate ctags'
|
||||||
|
task :create do
|
||||||
|
Kosmos::Ctags.generate_app_tags
|
||||||
|
Kosmos::Ctags.generate_bundler_tags
|
||||||
|
end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user