[rfdoc] 3 new revisions pushed by janne.piironen@gmail.com on 2014-03-13 11:54 GMT

0 views
Skip to first unread message

codesite...@google.com

unread,
Mar 13, 2014, 7:56:29 AM3/13/14
to rfdoc-...@googlegroups.com
3 new revisions:

Revision: ee02673aa8b3
Branch: default
Author: Janne Piironen <janne.p...@gmail.com>
Date: Wed Feb 19 12:21:01 2014 UTC
Log: Added basic functionality to upload multiple versions of a
library....
http://code.google.com/p/rfdoc/source/detail?r=ee02673aa8b3

Revision: ca31e78cdfe1
Branch: default
Author: Janne Piironen <janne.p...@gmail.com>
Date: Thu Feb 20 09:43:29 2014 UTC
Log: Fixed broken anchor in link to keyword....
http://code.google.com/p/rfdoc/source/detail?r=ca31e78cdfe1

Revision: 5fada9d7b875
Branch: default
Author: Janne Piironen <janne.p...@gmail.com>
Date: Mon Feb 24 10:15:07 2014 UTC
Log: Added commandline option for version override in uploader.py...
http://code.google.com/p/rfdoc/source/detail?r=5fada9d7b875

==============================================================================
Revision: ee02673aa8b3
Branch: default
Author: Janne Piironen <janne.p...@gmail.com>
Date: Wed Feb 19 12:21:01 2014 UTC
Log: Added basic functionality to upload multiple versions of a
library.

Update issue 19

Libraries are now considered to be the same if they have the same name and
same version identifier. If version differs from existing library with the
same name, a new version is created. All version numbers along with links
to them are shown both in the listing of libraries and in the detailed
library view.
http://code.google.com/p/rfdoc/source/detail?r=ee02673aa8b3

Modified:
/atest/lib/NameParser.py
/atest/libraries_listed.txt
/atest/library_details.txt
/atest/resources/library_information.txt
/atest/resources/rfdoc.txt
/atest/testdata/databases/libraries.db
/atest/update_documentation.txt
/atest/upload_documentation.txt
/src/rfdoc/rfdocapp/static/default.css
/src/rfdoc/rfdocapp/templates/base.html
/src/rfdoc/rfdocapp/templates/index.html
/src/rfdoc/rfdocapp/templates/library.html
/src/rfdoc/rfdocapp/views/index.py
/src/rfdoc/rfdocapp/views/library.py
/src/rfdoc/rfdocapp/views/upload.py
/src/rfdoc/urls.py

=======================================
--- /atest/lib/NameParser.py Wed Oct 14 10:51:05 2009 UTC
+++ /atest/lib/NameParser.py Wed Feb 19 12:21:01 2014 UTC
@@ -5,3 +5,6 @@

def get_library_name(library_name):
return library_name.split()[0]
+
+def get_library_version(library_name):
+ return library_name.split()[-1]
=======================================
--- /atest/libraries_listed.txt Tue Oct 15 14:24:32 2013 UTC
+++ /atest/libraries_listed.txt Wed Feb 19 12:21:01 2014 UTC
@@ -11,3 +11,8 @@
[Setup] Given some libraries exist in RFDoc
"main" page is open
Then "BuiltIn", "ExampleLibrary" and "SeleniumLibrary" are listed on
the main page
+
+Library Versions Are Listed On Main Page
+ [Setup] Given some libraries exist in RFDoc
+ "main" page is open
+ Then all versions are shown
=======================================
--- /atest/library_details.txt Tue Oct 15 14:41:52 2013 UTC
+++ /atest/library_details.txt Wed Feb 19 12:21:01 2014 UTC
@@ -7,11 +7,6 @@
[Setup] When user opens library with version information
Then library name, version and documentation are shown

-Library Version Is Not Visible
- [Setup] When user opens library without version information
- Then library name and documentation are shown
- and no version information is shown
-
Library Initialization Is Visible
[Setup] When user opens library with initialization information
Then library initialization is shown
@@ -35,3 +30,7 @@
Keyword Documentation Can Contain Keyword-to-keyword Links
[Setup] When user opens library details
Then link exist from keyword documentation to another keyword
+
+Other versions are visible
+ [Setup] When user opens library with multiple versions
+ Then other versions are shown
=======================================
--- /atest/resources/library_information.txt Wed Oct 16 15:50:40 2013 UTC
+++ /atest/resources/library_information.txt Wed Feb 19 12:21:01 2014 UTC
@@ -10,7 +10,7 @@
[Arguments] @{libraries}
${regexp} = Set Variable <h2>Libraries</h2>\\s+<ul
class="libraries">\\s+
:FOR ${library} IN @{libraries}
- \ ${regexp} = Set Variable ${regexp}<li><a
href="/lib/${library}">${library}</a></li>\\s+
+ \ ${regexp} = Set Variable ${regexp}<li><a
href="/lib/${library}">${library}</a> \\( .* \\)</li>\\s+
${regexp} = Set Variable ${regexp}</ul>
${source} = Get source
Should match regexp ${source} ${regexp}
@@ -21,14 +21,14 @@
User Opens Library With Version Information
User opens library details

+User Opens Library With Multiple Versions
+ Navigate to library "ExampleLibrary"
+
Library Name, Version And Documentation Are Shown
Library name should be BuiltIn
Page should contain Version: 2.1
Page should contain An always available standard library with often
needed keywords.

-User Opens Library Without Version Information
- Navigate to library "ExampleLibrary"
-
Library Name And Documentation Are Shown
Library name should be ExampleLibrary
Page should contain First Library Doc
@@ -78,3 +78,13 @@
${source} = Get source
Should contain ${source} <a class="name" href="#GetLength">Get
Length</a>
Keyword should contain anchor ${source} Get Length
+
+Other Versions Are Shown
+ ${regexp} = Set Variable Other versions:\\s+<a
href="/lib/ExampleLibrary/3">3</a>\\s+
+ ${source} = Get source
+ Should match regexp ${source} ${regexp}
+
+All Versions Are Shown
+ ${regexp} = Set Variable \( <a href="/lib/ExampleLibrary/1">1</a> <a
href="/lib/ExampleLibrary/3">3</a> \)
+ ${source} = Get source
+ Should match regexp ${source} ${regexp}
=======================================
--- /atest/resources/rfdoc.txt Fri Dec 27 12:10:40 2013 UTC
+++ /atest/resources/rfdoc.txt Wed Feb 19 12:21:01 2014 UTC
@@ -48,6 +48,10 @@
Navigate to library "${name}"
Go to ${BASE URL}/lib/${name}
Title should be RFDoc | ${name}
+
+Navigate to versioned library "${name}" "${version}"
+ Go to ${BASE URL}/lib/${name}/${version}
+ Title should be RFDoc | ${name}

User uploads ${library}
${file} = Set Variable ${library.replace(' ', '_')}.xml
@@ -57,10 +61,16 @@
Choose File file ${TESTDATA PATH}${/}xmls${/}${file}
Click button Upload

-RFDoc contains ${library name with possible version}
- ${name} = Get library name ${library name with possible version}
- Navigate to library "${name}"
- @{keywords} = Set variable @{${library name with possible version}
KEYWORDS}
+RFDoc contains versioned library ${library name with version}
+ ${name} = Get library name ${library name with version}
+ ${version} = Get library version ${library name with version}
+ Navigate to versioned library "${name}" "${version}"
+ @{keywords} = Set variable @{${library name with version} KEYWORDS}
+ Library should contain keywords @{keywords}
+
+RFDoc contains library ${library name}
+ Navigate to library "${library name}"
+ @{keywords} = Set variable @{${library name} KEYWORDS}
Library should contain keywords @{keywords}

Library should contain keywords [Arguments] @{keywords}
=======================================
--- /atest/testdata/databases/libraries.db Mon Oct 14 13:37:28 2013 UTC
+++ /atest/testdata/databases/libraries.db Wed Feb 19 12:21:01 2014 UTC
Binary file, no diff available.
=======================================
--- /atest/update_documentation.txt Tue Oct 15 14:24:32 2013 UTC
+++ /atest/update_documentation.txt Wed Feb 19 12:21:01 2014 UTC
@@ -5,13 +5,13 @@
*** Test Cases ***
Existing Library Is Not Overridden By Default
"upload" page is open
- When user uploads ExampleLibrary version 2
- Then error "ExampleLibrary already exists" is shown
- and RFDoc contains ExampleLibrary version 1
+ When user uploads ExampleLibrary version 1
+ Then error "ExampleLibrary version 1 already exists" is shown
+ and RFDoc contains versioned library ExampleLibrary version 1

User Can Update Library Documentation
"upload" page is open
When user selects "override" option
- and user uploads ExampleLibrary version 2
+ and user uploads ExampleLibrary version 1
Then notification "Successfully uploaded library ExampleLibrary" is
shown
- and RFDoc contains ExampleLibrary version 2
+ and RFDoc contains versioned library ExampleLibrary version 1
=======================================
--- /atest/upload_documentation.txt Tue Oct 15 14:24:32 2013 UTC
+++ /atest/upload_documentation.txt Wed Feb 19 12:21:01 2014 UTC
@@ -8,4 +8,4 @@
When user uploads BuiltIn
Then notification "Successfully uploaded library BuiltIn" is shown
and notification contains a link to BuiltIn
- and RFDoc contains BuiltIn
+ and RFDoc contains library BuiltIn
=======================================
--- /src/rfdoc/rfdocapp/static/default.css Wed Oct 16 15:50:40 2013 UTC
+++ /src/rfdoc/rfdocapp/static/default.css Wed Feb 19 12:21:01 2014 UTC
@@ -146,6 +146,18 @@
}

/* Library pages */
+
+#versions {
+ padding: 10px;
+ background-color: #eee;
+ width: auto;
+ max-width: 300px;
+ position: fixed;
+ bottom: 20px;
+ right: 20px;
+ z-index: 400;
+}
+
p.version {
font-size: 0.85em;
}
=======================================
--- /src/rfdoc/rfdocapp/templates/base.html Fri Dec 27 12:10:40 2013 UTC
+++ /src/rfdoc/rfdocapp/templates/base.html Wed Feb 19 12:21:01 2014 UTC
@@ -18,7 +18,7 @@
{% load staticfiles %}
<html>
<head>
- <title>RFDoc | {% block title %}{% endblock %}</title>
+ <title>RFDoc | {% block title %}{% endblock title %}</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="{% static 'default.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'print.css' %}"
media="print">
@@ -41,5 +41,6 @@
<a
href="http://code.google.com/p/robotframework/wiki/LibraryDocumentationTool"
title="Tool for generating library and resource file
documentations">libdoc.py</a>
</p>
</div>
+ {% block outside %}{% endblock outside %}
</body>
</html>
=======================================
--- /src/rfdoc/rfdocapp/templates/index.html Fri Dec 27 12:10:40 2013 UTC
+++ /src/rfdoc/rfdocapp/templates/index.html Wed Feb 19 12:21:01 2014 UTC
@@ -15,7 +15,7 @@

<h2>Libraries</h2>
{% if libs %}<ul class="libraries">
- {% for lib in libs %}<li><a href="{% url 'library' lib.name|
urlencode %}">{{ lib.name }}</a></li>
+ {% for lib in libs %}<li><a href="{% url 'library' lib.name|
urlencode %}">{{ lib.name }}</a> ({% for version in lib.versions %} <a
href="{% url 'version' lib.name|urlencode version|urlencode %}">{{ version
}}</a>{% endfor %} )</li>
{% endfor %}</ul>{% else %}<p class="info">
No libraries in the system. Why don't you <a href="{%
url 'upload' %}">upload</a> one?
</p>{%endif %}
=======================================
--- /src/rfdoc/rfdocapp/templates/library.html Wed Oct 16 19:12:24 2013 UTC
+++ /src/rfdoc/rfdocapp/templates/library.html Wed Feb 19 12:21:01 2014 UTC
@@ -4,11 +4,9 @@
{% block title %}{{ lib.name }}{% endblock title %}
{% block content %}
<h2>{{ lib.name }}</h2>
- {% ifnotequal lib.version "<unknown>" %}
<p class="version">
<b>Version:</b> {{ lib.version }}
</p>
- {% endifnotequal %}
<h3 id="introduction">Introduction</h3>
<p class="libintro">{{ lib.doc|safe }}</p>
{% if lib.inits %}
@@ -49,3 +47,15 @@
<div class="hr"><hr /></div>
<p class="info">Altogether {{ lib.keywords|length }} keywords.</p>
{% endblock content %}
+{% block outside %}
+ <div id="versions">
+ Version: {{ lib.version }}
+ {% if versions %}
+ <br />Other versions:
+ {% for version in versions %}
+ <a href="{% url 'version' lib.name|urlencode version|
urlencode %}">{{ version }}</a>
+ {% endfor %}
+ {% endif %}
+ </div>
+{% endblock outside %}
+
=======================================
--- /src/rfdoc/rfdocapp/views/index.py Wed Oct 16 15:50:40 2013 UTC
+++ /src/rfdoc/rfdocapp/views/index.py Wed Feb 19 12:21:01 2014 UTC
@@ -19,7 +19,9 @@


def index(request):
- libs = Library.objects.all().order_by('name')
+ libs = Library.objects.values('name').distinct()
+ for lib in libs:
+ lib['versions'] = [x.version for x in
Library.objects.filter(name=lib['name'])]
return render_to_response('index.html', {
'libs': libs,
'form': SearchForm()
=======================================
--- /src/rfdoc/rfdocapp/views/library.py Wed Oct 16 15:50:40 2013 UTC
+++ /src/rfdoc/rfdocapp/views/library.py Wed Feb 19 12:21:01 2014 UTC
@@ -13,17 +13,26 @@
# limitations under the License.

import re
-from django.shortcuts import render_to_response, get_object_or_404
-from django.utils.http import urlquote
+from django.shortcuts import render_to_response, get_list_or_404
+from django.http import Http404
+from django.utils.http import unquote

from rfdoc.rfdocapp import utils
from rfdoc.rfdocapp.models import Library


-def library(request, libname):
- lib = get_object_or_404(Library, name=libname)
+def library(request, libname, version=None):
+ libname = unquote(libname)
+ if version:
+ version = unquote(version)
+ lib = Library.objects.filter(name=libname, version=version).get()
+ else:
+ lib =
Library.objects.filter(name=libname).order_by('id')[0:1].get()
+ if not lib:
+ raise Http404('No library matches the given query.')
libdoc = LibraryDoc(lib)
- return render_to_response('library.html', {'lib': libdoc })
+ versions = [x.version for x in Library.objects.filter(name=libname) if
x.version != lib.version]
+ return render_to_response('library.html', {'lib': libdoc, 'versions':
versions})


class _DocHelper:
=======================================
--- /src/rfdoc/rfdocapp/views/upload.py Wed Oct 16 15:50:40 2013 UTC
+++ /src/rfdoc/rfdocapp/views/upload.py Wed Feb 19 12:21:01 2014 UTC
@@ -44,11 +44,11 @@
def parse_kw_spec(self, fileobj, override):
try:
libdata = LibraryData(fileobj)
- if Library.objects.filter(name=libdata.name):
+ if
Library.objects.filter(name=libdata.name).filter(version=libdata.version):
if not override:
- raise InvalidXmlError("Library %s already exists." %
libdata.name)
+ raise InvalidXmlError("Library %s version %s already
exists." % (libdata.name, libdata.version))
else:
- Library.objects.filter(name=libdata.name).delete()
+
Library.objects.filter(name=libdata.name).filter(version=libdata.version).delete()
lib = Library(name=libdata.name, doc=libdata.doc,
version=libdata.version)
lib.save()
for init in libdata.inits:
=======================================
--- /src/rfdoc/urls.py Fri Dec 27 12:10:40 2013 UTC
+++ /src/rfdoc/urls.py Wed Feb 19 12:21:01 2014 UTC
@@ -10,8 +10,8 @@
url(r'^admin/', include(admin.site.urls), name='admin'),
url(r'^upload/?$', views.upload, name='upload'),
url(r'^search/?$', views.search, name='search'),
- url(r'^lib/(.*)$', views.library, name='library'),
- url(r'^lib/(.*)/(.*)$', views.library, name='keyword'),
+ url(r'^lib/([^/]*)$', views.library, name='library'),
+ url(r'^lib/(.*)/(.*)$', views.library, name='version'),
url(r'^$', views.index, name='root')
)


==============================================================================
Revision: ca31e78cdfe1
Branch: default
Author: Janne Piironen <janne.p...@gmail.com>
Date: Thu Feb 20 09:43:29 2014 UTC
Log: Fixed broken anchor in link to keyword.

Update issue 18

The link had regressed to wrong format. Fixed the anchor and modified test
to verify it.
http://code.google.com/p/rfdoc/source/detail?r=ca31e78cdfe1

Modified:
/atest/resources/search.txt
/src/rfdoc/rfdocapp/templates/search.html

=======================================
--- /atest/resources/search.txt Mon Oct 14 08:29:19 2013 UTC
+++ /atest/resources/search.txt Thu Feb 20 09:43:29 2014 UTC
@@ -27,6 +27,6 @@
Page should contain element //td/a[text()='${name}']

Then search results contain keyword "Get Title" with link
to "SeleniumLibrary" and with documentation
- Page Should Contain Element //td/a[text()='Get Title']
+ Page Should Contain Element
//td/a[@href='/lib/SeleniumLibrary#GetTitle' and text()='Get Title']
Page Should Contain Element //td/a[text()='SeleniumLibrary']
Page Should Contain Returns title of current page.
=======================================
--- /src/rfdoc/rfdocapp/templates/search.html Fri Dec 27 12:10:40 2013 UTC
+++ /src/rfdoc/rfdocapp/templates/search.html Thu Feb 20 09:43:29 2014 UTC
@@ -12,7 +12,7 @@
<table class="keywords results">
{% for kw in kws %}
<tr>
- <td><a href="{% url 'keyword' kw.library.name|urlencode kw.name|
nospaces %}">{{ kw.name }}</a></td>
+ <td><a href="{% url 'library' kw.library.name|urlencode %}#{{
kw.name|nospaces }}">{{ kw.name }}</a></td>
<td><a href="{% url 'library' kw.library.name|urlencode %}">{{
kw.library.name }}</a></td>
<td>{{ kw.doc|first_line }}</td>
</tr>

==============================================================================
Revision: 5fada9d7b875
Branch: default
Author: Janne Piironen <janne.p...@gmail.com>
Date: Mon Feb 24 10:15:07 2014 UTC
Log: Added commandline option for version override in uploader.py

Update issue 21

Commandline option -v allows user to override the library version during
upload.
http://code.google.com/p/rfdoc/source/detail?r=5fada9d7b875

Modified:
/atest/uploader.txt
/tools/uploader.py

=======================================
--- /atest/uploader.txt Thu Dec 19 14:02:35 2013 UTC
+++ /atest/uploader.txt Mon Feb 24 10:15:07 2014 UTC
@@ -15,14 +15,14 @@
[Setup] Given no libraries exist in RFDoc
${rc} ${output}= Run With -u ${BASE URL} ${EXAMPLE LIBRARY SOURCE}
Should Print ${EXAMPLE LIBRARY SOURCE} Updated
- RFDoc contains example_lib
+ RFDoc contains library example_lib
Should Exit With 0

With one library XML given
[Setup] Given no libraries exist in RFDoc
${rc} ${output}= Run With -u ${BASE URL} ${EXAMPLE LIBRARY XML V1}
Should Print ${EXAMPLE LIBRARY XML V1} Updated
- RFDoc contains ExampleLibrary version 1
+ RFDoc contains versioned library ExampleLibrary version 1
Should Exit With 0

With multiple different files given
@@ -30,24 +30,24 @@
${rc} ${output}= Run With -u ${BASE URL} ${EXAMPLE LIBRARY XML V1}
${EXAMPLE LIBRARY SOURCE}
Should Print ${EXAMPLE LIBRARY XML V1} Updated
Should Print ${EXAMPLE LIBRARY SOURCE} Updated
- RFDoc contains ExampleLibrary version 1
- RFDoc contains example_lib
+ RFDoc contains versioned library ExampleLibrary version 1
+ RFDoc contains library example_lib
Should Exit With 0

With a directory given
[Setup] Given no libraries exist in RFDoc
${rc} ${output}= Run With -u ${BASE URL} ${TESTDATA PATH}${/}sources
Should Print ${EXAMPLE LIBRARY SOURCE} Updated
- RFDoc contains example_lib
+ RFDoc contains library example_lib
Should Exit With 0

-With newer version given
+With new version
[Setup] Given SeleniumLibrary exist in RFDoc
- Run Keyword And Expect Error * RFDoc contains ExampleLibrary version
2
+ Run Keyword And Expect Error * RFDoc contains versioned library
ExampleLibrary version 2
${rc} ${output}= Run With -u ${BASE URL} ${EXAMPLE LIBRARY XML V2}
Should Print ${EXAMPLE LIBRARY XML V2} Updated
- Run Keyword And Expect Error * RFDoc contains ExampleLibrary version
1
- RFDoc contains ExampleLibrary version 2
+ RFDoc contains versioned library ExampleLibrary version 1
+ RFDoc contains versioned library ExampleLibrary version 2
Should Exit With 0

With invalid arguments
=======================================
--- /tools/uploader.py Fri Dec 27 12:10:40 2013 UTC
+++ /tools/uploader.py Mon Feb 24 10:15:07 2014 UTC
@@ -53,7 +53,10 @@
xml_doc.write(xml_file.read())
else:
xml_doc.close = lambda: None
-
LibraryDocumentation(library).save(xml_doc, 'xml')
+ if self._options.lib_version:
+ LibraryDocumentation(library,
version=self._options.lib_version).save(xml_doc, 'xml')
+ else:
+
LibraryDocumentation(library).save(xml_doc, 'xml')
except DataError, e:
message = "Library not found" if 'ImportError' in
e.message else e.message
sys.stderr.write("Skipping '%s' due to an
error: %s.\n" %
@@ -121,15 +124,23 @@
def libraries(self):
return self._options.libraries

+ @property
+ def lib_version(self):
+ return self._options.lib_version
+
def _add_commandline_options(self):
- self._parser.add_option(
- '-u', '--url',
- dest='target_url',
- default=self.default_url,
- help="""Target RFDoc URL to update, e.g. '192.168.1.100:8000'
or
+ self._parser.add_option(
+ '-u', '--url',
+ dest='target_url',
+ default=self.default_url,
+ help="""Target RFDoc URL to update, e.g. '192.168.1.100:8000'
or
'my.server.com/rfdoc'. If this option is not given, '%s' is assumed
as target.""" % self.default_url
)
+ self._parser.add_option(
+ '-v', '--version',
+ dest='lib_version',
+ help="""Override library version""")

def _get_validated_options(self):
options, targets = self._parser.parse_args()
Reply all
Reply to author
Forward
0 new messages