<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title type="text">Ural penguins - Сообщения с тегом github</title>
  <id>http://uralbash.ru/blog/tag/github/atom.xml</id>
  <updated>2012-04-12T18:55:00Z</updated>
  <link href="http://uralbash.ru/" />
  <link href="http://uralbash.ru/blog/tag/github/atom.xml" rel="self" />
  <generator uri="http://ablog.readthedocs.org" version="0.8.4">ABlog</generator>
  <entry xml:base="http://uralbash.ru/blog/tag/github/atom.xml">
    <title type="text">Хостим документацию Sphinx на github</title>
    <id>http://uralbash.ru/articles/2012/sphinx_github/</id>
    <updated>2012-04-12T18:55:00Z</updated>
    <published>2012-04-12T18:55:00Z</published>
    <link href="http://uralbash.ru/articles/2012/sphinx_github/" />
    <author>
      <name>Uralbash</name>
    </author>
    <content type="html">&lt;div class=&quot;section&quot; id=&quot;sphinx-github&quot;&gt;

&lt;p&gt;Немного допиленная версия этого
&lt;a class=&quot;reference external&quot; href=&quot;http://djangonaut.blogspot.com/2009/05/sphinx-documentation-github-pages-3.html&quot;&gt;http://djangonaut.blogspot.com/2009/05/sphinx-documentation-github-pages-3.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;По порядку:&lt;/p&gt;
&lt;ul class=&quot;simple&quot;&gt;
&lt;li&gt;создать репозитарий на &lt;a class=&quot;reference external&quot; href=&quot;https://github.com/&quot;&gt;github&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;добавить туда свой локальный репозитарий с проектом &lt;code class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Sphinx&lt;/span&gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;захостить репозитарий через сервис &lt;a class=&quot;reference external&quot; href=&quot;https://pages.github.com/&quot;&gt;Pages&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;поправить &lt;code class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Makefile&lt;/span&gt;&lt;/code&gt; в &lt;code class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;Sphinx&lt;/span&gt;&lt;/code&gt; проекте&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;highlight-make&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;docs_dir&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; doc
&lt;span class=&quot;nf&quot;&gt;ghdocs&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
 rm -rf &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;docs_dir&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;MAKE&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt; clean
 &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;MAKE&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt; html
 cp -r build/html &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;docs_dir&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt;
 mv &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;docs_dir&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt;/_static &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;docs_dir&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt;/static
 mv &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;docs_dir&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt;/_sources &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;docs_dir&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt;/sources
 perl -pi -e &lt;span class=&quot;s2&quot;&gt;&amp;quot;s/_sources/sources/g;&amp;quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;docs_dir&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt;/*.html
 perl -pi -e &lt;span class=&quot;s2&quot;&gt;&amp;quot;s/_static/static/g;&amp;quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;docs_dir&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt;/*.html
 git add .
 git commit -a -m &lt;span class=&quot;s2&quot;&gt;&amp;quot;Updates &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;project&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;.&amp;quot;&lt;/span&gt;
 git checkout gh-pages
 cp -rf &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;docs_dir&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt;/* .
 git add .
 git commit -a -m &lt;span class=&quot;s1&quot;&gt;&amp;#39;Updates $(project) documentation.&amp;#39;&lt;/span&gt;
 git checkout master
 rm -rf &lt;span class=&quot;k&quot;&gt;$(&lt;/span&gt;docs_dir&lt;span class=&quot;k&quot;&gt;)&lt;/span&gt;
 git push origin gh-pages
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Теперь при запуске &lt;code class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;make&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;ghdocs&lt;/span&gt;&lt;/code&gt; будет автоматом генерироваться новая
документация и пушаться на &lt;a class=&quot;reference external&quot; href=&quot;https://github.com/&quot;&gt;github&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Пример здесь &lt;a class=&quot;reference external&quot; href=&quot;http://uralbash.github.com/python-web-lectures/&quot;&gt;http://uralbash.github.com/python-web-lectures/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Для автоматической замены директорий &lt;code class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;_static&lt;/span&gt;&lt;/code&gt; и &lt;code class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;_sources&lt;/span&gt;&lt;/code&gt;, можно
установить модуль &lt;a class=&quot;reference external&quot; href=&quot;https://pypi.python.org/pypi/sphinxtogithub&quot;&gt;sphinxtogithub&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;highlight-bash&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;$ pip install sphinxtogithub
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;И добавить в проекте в &lt;code class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;config.py&lt;/span&gt;&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;literal-block-wrapper docutils container&quot; id=&quot;id1&quot;&gt;
&lt;div class=&quot;code-block-caption&quot;&gt;&lt;span class=&quot;caption-text&quot;&gt;config.py&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;highlight-python&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;extensions&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;sphinxtogithub&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;В этом случае нужно закомментировать в скрипте строчки:&lt;/p&gt;
&lt;p&gt;&lt;code class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mv&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;$(docs_dir)/_static&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;$(docs_dir)/static&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;и&lt;/p&gt;
&lt;p&gt;&lt;code class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;mv&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;$(docs_dir)/_sources&lt;/span&gt; &lt;span class=&quot;pre&quot;&gt;$(docs_dir)/sources&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Это необходимо делать потому-что &lt;a class=&quot;reference external&quot; href=&quot;https://github.com/&quot;&gt;github&lt;/a&gt; не понимает директории начинающиеся
с подчеркивания.&lt;/p&gt;
&lt;/div&gt;
</content>
  </entry>
</feed>
