Module: Capitate::CapExt::Docs

Included in:
Capistrano::Configuration
Defined in:
lib/capitate/cap_ext/docs.rb

Instance Method Summary collapse

Instance Method Details

Get link to github source, so we can refer to recipe code.

Options

recipe

Recipe path, probably use __FILE__

Examples

# In a lib/recipes/foo/foo.rb
link_to_source(__FILE__) => "http://github.com/gabriel/capitate/tree/master/lib/recipes/foo/foo.rb"


16
17
18
19
20
# File 'lib/capitate/cap_ext/docs.rb', line 16

def link_to_source(recipe_path)
  full_path = File.expand_path(recipe_path)
  project_path = File.expand_path(File.dirname(__FILE__) + "/../../../")
  "http://github.com/gabriel/capitate/tree/master#{full_path.sub(project_path, "")}"
end