~ubuntu-branches/ubuntu/intrepid/luarocks/intrepid

« back to all changes in this revision

Viewing changes to src/luarocks/path.lua

  • Committer: Bazaar Package Importer
  • Author(s): Enrico Tassi
  • Date: 2008-07-02 10:22:44 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080702102244-zenfv9wnv1f4zxzi
Tags: 0.6.0.2-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
84
84
   return fs.make_path(repo or cfg.rocks_dir, name, version, "lua")
85
85
end
86
86
 
 
87
--- Get the local installation directory for documentation of a package.
 
88
-- @param name string: The package name. 
 
89
-- @param version string: The package version.
 
90
-- @param repo string or nil: If given, specifies the local repository to use.
 
91
-- @return string: The resulting path -- does not guarantee that
 
92
-- the package (and by extension, the path) exists.
 
93
function doc_dir(name, version, repo)
 
94
   assert(type(name) == "string")
 
95
   assert(type(version) == "string")
 
96
   assert(not repo or type(repo) == "string")
 
97
 
 
98
   return fs.make_path(repo or cfg.rocks_dir, name, version, "doc")
 
99
end
 
100
 
87
101
--- Get the local installation directory for configuration files of a package.
88
102
-- @param name string: The package name. 
89
103
-- @param version string: The package version.
119
133
-- of rock, or nil if name could not be parsed
120
134
function parse_rock_name(rock_file)
121
135
   assert(type(rock_file) == "string")
122
 
   return fs.base_name(rock_file):match("(.*)-([^-]+-%d+)%.([^.]+)%.rock")
 
136
   return fs.base_name(rock_file):match("(.*)-([^-]+-%d+)%.([^.]+)%.rock$")
123
137
end
124
138
 
125
139
--- Extract name and version of a rockspec filename.
205
219
   vars.LIBDIR = lib_dir(name, version)
206
220
   vars.CONFDIR = conf_dir(name, version)
207
221
   vars.BINDIR = bin_dir(name, version)
 
222
   vars.DOCDIR = doc_dir(name, version)
208
223
   rockspec.variables = vars
209
224
end