diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2018-05-24 16:58:08 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-05-31 11:16:09 -0300 |
| commit | 2172b0531cce92975d165a4059af485823bd6b84 (patch) | |
| tree | dd72221522fc79eead18a2d8c73dab465243b38e /src | |
| parent | 9c48355ef7f5ed44cb1a6530c36f74732025520d (diff) | |
| download | luarocks-2172b0531cce92975d165a4059af485823bd6b84.tar.gz luarocks-2172b0531cce92975d165a4059af485823bd6b84.tar.bz2 luarocks-2172b0531cce92975d165a4059af485823bd6b84.zip | |
init: create rockspec only if none found in the root dir
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/cmd/init.lua | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/luarocks/cmd/init.lua b/src/luarocks/cmd/init.lua index 5c0116ce..9722dfdd 100644 --- a/src/luarocks/cmd/init.lua +++ b/src/luarocks/cmd/init.lua | |||
| @@ -55,9 +55,19 @@ function init.command(flags, name, version) | |||
| 55 | 55 | ||
| 56 | util.printout("Initializing project " .. name .. " ...") | 56 | util.printout("Initializing project " .. name .. " ...") |
| 57 | 57 | ||
| 58 | local ok, err = write_rockspec.command(flags, name, version or "dev", pwd) | 58 | local has_rockspec = false |
| 59 | if not ok then | 59 | for file in fs.dir() do |
| 60 | util.printerr(err) | 60 | if file:match("%.rockspec$") then |
| 61 | has_rockspec = true | ||
| 62 | break | ||
| 63 | end | ||
| 64 | end | ||
| 65 | |||
| 66 | if not has_rockspec then | ||
| 67 | local ok, err = write_rockspec.command(flags, name, version or "dev", pwd) | ||
| 68 | if not ok then | ||
| 69 | util.printerr(err) | ||
| 70 | end | ||
| 61 | end | 71 | end |
| 62 | 72 | ||
| 63 | util.printout("Adding entries to .gitignore ...") | 73 | util.printout("Adding entries to .gitignore ...") |
