From 4800159347ac79a30180d778ac02ee24a181e41a Mon Sep 17 00:00:00 2001 From: Peter Melnichenko Date: Tue, 10 May 2016 16:31:16 +0300 Subject: 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. --- src/luarocks/build.lua | 10 +--------- src/luarocks/install.lua | 10 +--------- src/luarocks/util.lua | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 18 deletions(-) (limited to 'src') 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 ok, err = manif.update_manifest(name, version, nil, deps_mode) if err then return nil, err end - local license = "" - if rockspec.description and rockspec.description.license then - license = ("(license: "..rockspec.description.license..")") - end - - local root_dir = path.root_dir(cfg.rocks_dir) - util.printout(name.." "..version.." is now built and installed in "..root_dir.." "..license) - util.printout() - + util.announce_install(rockspec) util.remove_scheduled_function(rollback) return name, version 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) ok, err = manif.update_manifest(name, version, nil, deps_mode) if err then return nil, err end - local license = "" - if rockspec.description.license then - license = ("(license: "..rockspec.description.license..")") - end - - local root_dir = path.root_dir(cfg.rocks_dir) - util.printout() - util.printout(name.." "..version.." is now installed in "..root_dir.." "..license) - + util.announce_install(rockspec) util.remove_scheduled_function(rollback) return name, version 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) return "See '"..util.this_program(program or "luarocks")..' help'..(command and " "..command or "").."'." end +function util.announce_install(rockspec) + local cfg = require("luarocks.cfg") + local path = require("luarocks.path") + + local suffix = "" + if rockspec.description and rockspec.description.license then + suffix = " (license: "..rockspec.description.license..")" + end + + local root_dir = path.root_dir(cfg.rocks_dir) + util.printout(rockspec.name.." "..rockspec.version.." is now installed in "..root_dir..suffix) + util.printout() +end + -- from http://lua-users.org/wiki/SplitJoin -- by PhilippeLhoste function util.split_string(str, delim, maxNb) -- cgit v1.2.3-55-g6feb