Skip to content

Commit

Permalink
Use functions for info
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Aronoff committed Mar 5, 2016
1 parent 39c7310 commit 7a58a2d
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 20 deletions.
7 changes: 7 additions & 0 deletions CHANGES.md
Expand Up @@ -22,6 +22,13 @@

[codecov]: https://codecov.io

## *2.0.0-1* (March 5, 2016)

+ Fix a bug when the iterator is used to explode a string. Thanks to Alexey
Melnichuk for reporting the problem.
+ Change the information variables to functions. These serve the same purpose,
but don't use variable names that Lua explicitly warns users about.

Would you rather view the [documentation][d]?

[d]: /README.md
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
@@ -1,4 +1,4 @@
Copyright (c) 2012-2015, Peter Aronoff All rights reserved.
Copyright (c) 2012-2016, Peter Aronoff All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
14 changes: 7 additions & 7 deletions README.md
Expand Up @@ -70,16 +70,16 @@ and [many people have written their own][wiki].

## Varia

The module provides four informational fields that return strings. They should
be self-explanatory and are probably of little use to most people.
The module provides four informational functions that return strings. They
should be self-explanatory.

+ `_AUTHOR`
+ `version() -- 2.0.0-1`

+ `_VERSION`
+ `author() -- Peter Aronoff`

+ `_LICENSE`
+ `url() -- https://bitbucket.org/telemachus/split`

+ `_URL`
+ `license() -- BSD 3-Clause`

## Credits

Expand All @@ -92,7 +92,7 @@ All mistakes are mine. See [version history][c] for release details.

---

(c) 2012-2015 Peter Aronoff. BSD 3-Clause license; see [LICENSE.md][li] for
(c) 2012-2016 Peter Aronoff. BSD 3-Clause license; see [LICENSE.md][li] for
details.

[li]: /LICENSE.md
10 changes: 10 additions & 0 deletions doc/changes.html
Expand Up @@ -34,6 +34,16 @@ <h2><em>1.1.1-1</em> (December 5, 2015)</h2>
</ul>


<h2><em>2.0.0-1</em> (March 5, 2016)</h2>

<ul>
<li>Fix a bug when the iterator is used to explode a string. Thanks to Alexey
Melnichuk for reporting the problem.</li>
<li>Change the information variables to functions. These serve the same purpose,
but don&rsquo;t use variable names that Lua explicitly warns users about.</li>
</ul>


<p>Would you rather view the <a href="index.html">documentation</a>?</p>

<hr />
Expand Down
14 changes: 7 additions & 7 deletions doc/index.html
Expand Up @@ -85,14 +85,14 @@ <h2>Usage</h2>

<h2>Varia</h2>

<p>The module provides four informational fields that return strings. They should
be self-explanatory and are probably of little use to most people.</p>
<p>The module provides four informational functions that return strings. They
should be self-explanatory.</p>

<ul>
<li><p><code>_AUTHOR</code></p></li>
<li><p><code>_VERSION</code></p></li>
<li><p><code>_LICENSE</code></p></li>
<li><p><code>_URL</code></p></li>
<li><p><code>version() -- 2.0.0-1</code></p></li>
<li><p><code>author() -- Peter Aronoff</code></p></li>
<li><p><code>url() -- https://bitbucket.org/telemachus/split</code></p></li>
<li><p><code>license() -- BSD 3-Clause</code></p></li>
</ul>


Expand All @@ -105,7 +105,7 @@ <h2>Credits</h2>

<hr />

<p>&copy; 2012-2015 Peter Aronoff. BSD 3-Clause license; see <a href="license.html">the license</a> for
<p>&copy; 2012-2016 Peter Aronoff. BSD 3-Clause license; see <a href="license.html">the license</a> for
details.</p>
</body>
</html>
2 changes: 1 addition & 1 deletion doc/license.html
Expand Up @@ -8,7 +8,7 @@
<link rel="stylesheet" href="screen.css" media="screen,projection">
</head>
<body>
<p>Copyright &copy; 2012-2015, Peter Aronoff All rights reserved.</p>
<p>Copyright &copy; 2012-2016, Peter Aronoff All rights reserved.</p>

<p>Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:</p>
Expand Down
24 changes: 24 additions & 0 deletions split-2.0.0-1.rockspec
@@ -0,0 +1,24 @@
package = 'split'
version = '2.0.0-1'
source = {
url = 'https://bitbucket.org/telemachus/split/downloads/split-v2.0.0-1.tar.gz',
dir = 'split'
}
description = {
summary = 'String split function and iterator for Lua',
detailed = [[
A string split function and iterator for Lua since the string standard
library doesn't come with one.
]],
homepage = 'https://bitbucket.org/telemachus/split',
license = 'BSD 3-Clause',
maintainer = 'Peter Aronoff <telemachus@arpinum.org>'
}
dependencies = { 'lua >= 5.1' }
build = {
type = 'builtin',
modules = {
split = 'src/split.lua',
},
copy_directories = { 'doc' }
}
24 changes: 20 additions & 4 deletions src/split.lua
Expand Up @@ -109,11 +109,27 @@ local spliterator = function (str, delimiter)
return iter
end

local version = function ()
return '2.0.0-1'
end

local author = function ()
return 'Peter Aronoff'
end

local url = function ()
return 'https://bitbucket.org/telemachus/split'
end

local license = function ()
return 'BSD 3-Clause'
end

return {
split = split,
spliterator = spliterator,
_VERSION = "1.0-0-1",
_AUTHOR = "Peter Aronoff",
_URL = "https://bitbucket.org/telemachus/split",
_LICENSE = 'BSD 3-Clause',
version = version,
author = author,
url = url,
license = license,
}
12 changes: 12 additions & 0 deletions test/test-information-fields.lua
@@ -0,0 +1,12 @@
#!/usr/bin/env lua
local t = require 'tapered'
package.path = '../src/?.lua;' .. package.path
local split = require 'split'

t.is(split.version(), '2.0.0-1', 'version() returns 2.0.0-1')
t.is(split.author(), 'Peter Aronoff', 'author() returns Peter Aronoff')
t.is(split.url(), 'https://bitbucket.org/telemachus/split',
'url() returns https://bitbucket.org/telemachus/split')
t.is(split.license(), 'BSD 3-Clause', 'license() returns BSD 3-Clause')

t.done()

0 comments on commit 7a58a2d

Please sign in to comment.