diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2011-09-17 11:50:56 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2011-09-17 11:50:56 -0300 |
commit | 59fb321e9fb2c5171919c6906c024093bde635ac (patch) | |
tree | 56c2fc4ed06cacedb15ce1eb73cef8bdd9fd8647 | |
parent | 03ccb924aba43e555078438596864d343e061269 (diff) | |
download | luarocks-59fb321e9fb2c5171919c6906c024093bde635ac.tar.gz luarocks-59fb321e9fb2c5171919c6906c024093bde635ac.tar.bz2 luarocks-59fb321e9fb2c5171919c6906c024093bde635ac.zip |
Since 'description' field is optional, functions should not assume it is always there. Closes #46.
-rw-r--r-- | src/luarocks/build.lua | 2 | ||||
-rw-r--r-- | src/luarocks/index.lua | 9 | ||||
-rw-r--r-- | src/luarocks/show.lua | 2 |
3 files changed, 7 insertions, 6 deletions
diff --git a/src/luarocks/build.lua b/src/luarocks/build.lua index 69f46fcc..af098f34 100644 --- a/src/luarocks/build.lua +++ b/src/luarocks/build.lua | |||
@@ -240,7 +240,7 @@ function build_rockspec(rockspec_file, need_to_fetch, minimal_mode) | |||
240 | if err then return nil, err end | 240 | if err then return nil, err end |
241 | 241 | ||
242 | local license = "" | 242 | local license = "" |
243 | if rockspec.description.license then | 243 | if rockspec.description and rockspec.description.license then |
244 | license = ("(license: "..rockspec.description.license..")") | 244 | license = ("(license: "..rockspec.description.license..")") |
245 | end | 245 | end |
246 | 246 | ||
diff --git a/src/luarocks/index.lua b/src/luarocks/index.lua index 570db431..01ce266a 100644 --- a/src/luarocks/index.lua +++ b/src/luarocks/index.lua | |||
@@ -143,14 +143,15 @@ function make_index(repo) | |||
143 | output = output .. index_package_end | 143 | output = output .. index_package_end |
144 | if latest_rockspec then | 144 | if latest_rockspec then |
145 | local rockspec = persist.load_into_table(dir.path(repo, latest_rockspec)) | 145 | local rockspec = persist.load_into_table(dir.path(repo, latest_rockspec)) |
146 | local descript = rockspec.description or {} | ||
146 | local vars = { | 147 | local vars = { |
147 | anchor = package, | 148 | anchor = package, |
148 | package = rockspec.package, | 149 | package = rockspec.package, |
149 | original = rockspec.source.url, | 150 | original = rockspec.source.url, |
150 | summary = rockspec.description.summary or "", | 151 | summary = descript.summary or "", |
151 | detailed = rockspec.description.detailed or "", | 152 | detailed = descript.detailed or "", |
152 | license = rockspec.description.license or "N/A", | 153 | license = descript.license or "N/A", |
153 | homepage = rockspec.description.homepage and ("| <a href="..rockspec.description.homepage..">project homepage</a>") or "", | 154 | homepage = descript.homepage and ("| <a href="..descript.homepage..">project homepage</a>") or "", |
154 | externaldependencies = format_external_dependencies(rockspec) | 155 | externaldependencies = format_external_dependencies(rockspec) |
155 | } | 156 | } |
156 | vars.detailed = vars.detailed:gsub("\n\n", "</p><p>"):gsub("%s+", " ") | 157 | vars.detailed = vars.detailed:gsub("\n\n", "</p><p>"):gsub("%s+", " ") |
diff --git a/src/luarocks/show.lua b/src/luarocks/show.lua index f968bec8..30b1d1c5 100644 --- a/src/luarocks/show.lua +++ b/src/luarocks/show.lua | |||
@@ -94,7 +94,7 @@ function run(...) | |||
94 | local rockspec, err = fetch.load_local_rockspec(rockspec_file) | 94 | local rockspec, err = fetch.load_local_rockspec(rockspec_file) |
95 | if not rockspec then return nil,err end | 95 | if not rockspec then return nil,err end |
96 | 96 | ||
97 | local descript = rockspec.description | 97 | local descript = rockspec.description or {} |
98 | local manifest, err = manif.load_manifest(repo_url) | 98 | local manifest, err = manif.load_manifest(repo_url) |
99 | if not manifest then return nil,err end | 99 | if not manifest then return nil,err end |
100 | local minfo = manifest.repository[name][version][1] | 100 | local minfo = manifest.repository[name][version][1] |