-
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from thombashi/develop
Develop
- Loading branch information
Showing
26 changed files
with
158 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,70 @@ | ||
#!/usr/bin/env python | ||
# encoding: utf-8 | ||
|
||
""" | ||
.. codeauthor:: Tsuyoshi Hombashi <[email protected]> | ||
""" | ||
|
||
import os | ||
import os.path | ||
import sys | ||
|
||
import readmemaker | ||
|
||
VERSION = "0.4.0" | ||
|
||
PROJECT_NAME = "tcconfig" | ||
OUTPUT_DIR = ".." | ||
README_WORK_DIR = "." | ||
DOC_PAGE_DIR = os.path.join(README_WORK_DIR, "pages") | ||
|
||
|
||
def get_usage_file_path(filename): | ||
return os.path.join(DOC_PAGE_DIR, "usage", filename) | ||
def write_examples(maker): | ||
maker.set_indent_level(0) | ||
maker.write_chapter("Usage") | ||
|
||
maker.inc_indent_level() | ||
maker.write_chapter("Set traffic control (``tcset`` command)") | ||
maker.write_example_file(os.path.join("tcset", "description.txt")) | ||
maker.write_example_file(os.path.join("tcset", "basic_usage.rst")) | ||
|
||
def write_line_list(f, line_list): | ||
f.write("\n".join(line_list)) | ||
f.write("\n" * 2) | ||
maker.write_example_file(os.path.join("tcdel", "header.rst")) | ||
maker.write_example_file(os.path.join("tcdel", "usage.rst")) | ||
|
||
maker.write_example_file(os.path.join("tcshow", "header.rst")) | ||
maker.write_example_file(os.path.join("tcshow", "usage.rst")) | ||
|
||
def write_usage_file(f, filename): | ||
write_line_list(f, [ | ||
line.rstrip() | ||
for line in | ||
open(get_usage_file_path(filename)).readlines() | ||
maker.write_chapter("For more information") | ||
maker.write_line_list([ | ||
"More examples are available at ", | ||
"http://%s.readthedocs.org/en/latest/pages/usage/index.html" % ( | ||
PROJECT_NAME), | ||
]) | ||
|
||
|
||
def write_examples(f): | ||
write_line_list(f, [ | ||
"Usage", | ||
"=====", | ||
]) | ||
def main(): | ||
maker = readmemaker.ReadmeMaker(PROJECT_NAME, OUTPUT_DIR) | ||
maker.examples_dir_name = u"usage" | ||
|
||
write_usage_file(f, os.path.join("tcset", "header.rst")) | ||
write_line_list(f, [ | ||
line.rstrip().replace("^", "~") | ||
for line in | ||
open(get_usage_file_path( | ||
os.path.join("tcset", "basic_usage.rst"))).readlines() | ||
maker.write_introduction_file("badges.txt") | ||
|
||
maker.inc_indent_level() | ||
maker.write_chapter("Summary") | ||
maker.write_introduction_file("summary.txt") | ||
maker.write_introduction_file("feature.txt") | ||
maker.write_line_list([ | ||
".. image:: docs/gif/tcset_example.gif", | ||
]) | ||
|
||
write_usage_file(f, os.path.join("tcdel", "header.rst")) | ||
write_usage_file(f, os.path.join("tcdel", "usage.rst")) | ||
write_examples(maker) | ||
|
||
write_usage_file(f, os.path.join("tcshow", "header.rst")) | ||
write_usage_file(f, os.path.join("tcshow", "usage.rst")) | ||
maker.write_file( | ||
maker.doc_page_root_dir_path.joinpath("installation.rst")) | ||
|
||
write_line_list(f, [ | ||
"For more information", | ||
"--------------------", | ||
"More examples are available at ", | ||
"http://tcconfig.readthedocs.org/en/latest/pages/usage/index.html", | ||
"", | ||
maker.set_indent_level(0) | ||
maker.write_chapter("Documentation") | ||
maker.write_line_list([ | ||
"http://%s.readthedocs.org/en/latest/" % (PROJECT_NAME), | ||
]) | ||
|
||
return 0 | ||
|
||
def main(): | ||
with open(os.path.join(OUTPUT_DIR, "README.rst"), "w") as f: | ||
write_line_list(f, [ | ||
line.rstrip() for line in | ||
open(os.path.join(DOC_PAGE_DIR, "introduction.rst")).readlines() | ||
]) | ||
write_line_list(f, [ | ||
".. image:: docs/gif/tcset_example.gif", | ||
]) | ||
|
||
write_examples(f) | ||
|
||
write_line_list(f, [ | ||
line.rstrip() for line in | ||
open(os.path.join(DOC_PAGE_DIR, "installation.rst")).readlines() | ||
]) | ||
|
||
write_line_list(f, [ | ||
"Documentation", | ||
"=============", | ||
"", | ||
"http://tcconfig.readthedocs.org/en/latest/" | ||
]) | ||
|
||
if __name__ == '__main__': | ||
sys.exit(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.. image:: https://img.shields.io/pypi/pyversions/tcconfig.svg | ||
:target: https://pypi.python.org/pypi/tcconfig | ||
.. image:: https://travis-ci.org/thombashi/tcconfig.svg?branch=master | ||
:target: https://travis-ci.org/thombashi/tcconfig |
Oops, something went wrong.