lib/sdoc/github.rb in sdoc-0.3.20 vs lib/sdoc/github.rb in sdoc-0.4.0.rc.1

- old
+ new

@@ -1,10 +1,10 @@ module SDoc::GitHub def github_url(path) unless @github_url_cache.has_key? path @github_url_cache[path] = false - file = RDoc::TopLevel.find_file_named(path) + file = @store.find_file_named(path) if file base_url = repository_url(path) if base_url sha1 = commit_sha1(path) if sha1 @@ -14,11 +14,11 @@ end end end @github_url_cache[path] end - + protected def have_git? @have_git = system('git --version > /dev/null 2>&1') if @have_git.nil? @have_git @@ -31,11 +31,11 @@ `git log -1 --pretty=format:"commit %H" #{name}` end m = s.match(/commit\s+(\S+)/) m ? m[1] : false end - + def repository_url(path) return false unless have_git? s = Dir.chdir(File.join(base_dir, File.dirname(path))) do `git config --get remote.origin.url` end @@ -49,10 +49,10 @@ absolute_path[root.size..absolute_path.size] end def path_to_git_dir(path) while !path.empty? && path != '.' - if (File.exists? File.join(path, '.git')) + if (File.exists? File.join(path, '.git')) return path end path = File.dirname(path) end ''