diff options
| author | Peter Melnichenko <mpeterval@gmail.com> | 2016-05-10 16:31:16 +0300 |
|---|---|---|
| committer | Peter Melnichenko <mpeterval@gmail.com> | 2016-05-10 16:46:37 +0300 |
| commit | 4800159347ac79a30180d778ac02ee24a181e41a (patch) | |
| tree | 518eef29dfe391dafaafd079a9e02a6271d00af0 /src | |
| parent | 6beb0ef346cc7fd097a4736a7b27755a84165287 (diff) | |
| download | luarocks-4800159347ac79a30180d778ac02ee24a181e41a.tar.gz luarocks-4800159347ac79a30180d778ac02ee24a181e41a.tar.bz2 luarocks-4800159347ac79a30180d778ac02ee24a181e41a.zip | |
Use same messages for installing binary and source rocks
Move successful installation announcement into an util function.
Don't print that the rock was "built": sometimes there is nothing to
build (pure Lua rocks), and for C rocks compilation commands are printed
already.
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/build.lua | 10 | ||||
| -rw-r--r-- | src/luarocks/install.lua | 10 | ||||
| -rw-r--r-- | src/luarocks/util.lua | 14 |
3 files changed, 16 insertions, 18 deletions
diff --git a/src/luarocks/build.lua b/src/luarocks/build.lua index bdc3b57a..38a269dd 100644 --- a/src/luarocks/build.lua +++ b/src/luarocks/build.lua | |||
| @@ -332,15 +332,7 @@ function build.build_rockspec(rockspec_file, need_to_fetch, minimal_mode, deps_m | |||
| 332 | ok, err = manif.update_manifest(name, version, nil, deps_mode) | 332 | ok, err = manif.update_manifest(name, version, nil, deps_mode) |
| 333 | if err then return nil, err end | 333 | if err then return nil, err end |
| 334 | 334 | ||
| 335 | local license = "" | 335 | util.announce_install(rockspec) |
| 336 | if rockspec.description and rockspec.description.license then | ||
| 337 | license = ("(license: "..rockspec.description.license..")") | ||
| 338 | end | ||
| 339 | |||
| 340 | local root_dir = path.root_dir(cfg.rocks_dir) | ||
| 341 | util.printout(name.." "..version.." is now built and installed in "..root_dir.." "..license) | ||
| 342 | util.printout() | ||
| 343 | |||
| 344 | util.remove_scheduled_function(rollback) | 336 | util.remove_scheduled_function(rollback) |
| 345 | return name, version | 337 | return name, version |
| 346 | end | 338 | end |
diff --git a/src/luarocks/install.lua b/src/luarocks/install.lua index ae162b86..8960c102 100644 --- a/src/luarocks/install.lua +++ b/src/luarocks/install.lua | |||
| @@ -98,15 +98,7 @@ function install.install_binary_rock(rock_file, deps_mode) | |||
| 98 | ok, err = manif.update_manifest(name, version, nil, deps_mode) | 98 | ok, err = manif.update_manifest(name, version, nil, deps_mode) |
| 99 | if err then return nil, err end | 99 | if err then return nil, err end |
| 100 | 100 | ||
| 101 | local license = "" | 101 | util.announce_install(rockspec) |
| 102 | if rockspec.description.license then | ||
| 103 | license = ("(license: "..rockspec.description.license..")") | ||
| 104 | end | ||
| 105 | |||
| 106 | local root_dir = path.root_dir(cfg.rocks_dir) | ||
| 107 | util.printout() | ||
| 108 | util.printout(name.." "..version.." is now installed in "..root_dir.." "..license) | ||
| 109 | |||
| 110 | util.remove_scheduled_function(rollback) | 102 | util.remove_scheduled_function(rollback) |
| 111 | return name, version | 103 | return name, version |
| 112 | end | 104 | end |
diff --git a/src/luarocks/util.lua b/src/luarocks/util.lua index c06c8354..a92297ce 100644 --- a/src/luarocks/util.lua +++ b/src/luarocks/util.lua | |||
| @@ -505,6 +505,20 @@ function util.see_help(command, program) | |||
| 505 | return "See '"..util.this_program(program or "luarocks")..' help'..(command and " "..command or "").."'." | 505 | return "See '"..util.this_program(program or "luarocks")..' help'..(command and " "..command or "").."'." |
| 506 | end | 506 | end |
| 507 | 507 | ||
| 508 | function util.announce_install(rockspec) | ||
| 509 | local cfg = require("luarocks.cfg") | ||
| 510 | local path = require("luarocks.path") | ||
| 511 | |||
| 512 | local suffix = "" | ||
| 513 | if rockspec.description and rockspec.description.license then | ||
| 514 | suffix = " (license: "..rockspec.description.license..")" | ||
| 515 | end | ||
| 516 | |||
| 517 | local root_dir = path.root_dir(cfg.rocks_dir) | ||
| 518 | util.printout(rockspec.name.." "..rockspec.version.." is now installed in "..root_dir..suffix) | ||
| 519 | util.printout() | ||
| 520 | end | ||
| 521 | |||
| 508 | -- from http://lua-users.org/wiki/SplitJoin | 522 | -- from http://lua-users.org/wiki/SplitJoin |
| 509 | -- by PhilippeLhoste | 523 | -- by PhilippeLhoste |
| 510 | function util.split_string(str, delim, maxNb) | 524 | function util.split_string(str, delim, maxNb) |
