lib/kitabu/generator.rb in kitabu-2.1.0 vs lib/kitabu/generator.rb in kitabu-3.0.0

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + module Kitabu # The Kitabu::Generator class will create a new book structure. # # ebook = Kitabu::Generator.new # ebook.destination_root = "/some/path/book-name" @@ -9,11 +11,11 @@ include Thor::Actions desc "Generate a new e-Book structure" def self.source_root - File.dirname(__FILE__) + "/../../templates" + "#{File.dirname(__FILE__)}/../../templates" end def copy_templates directory "templates", "templates" end @@ -62,15 +64,18 @@ inside destination_root do run "bundle install" end end - private - # Retrieve user's name using finger. - # Defaults to <tt>John Doe</tt>. - # - def full_name - name = `finger $USER 2> /dev/null | grep Login | colrm 1 46 2> /dev/null`.chomp - name.present? ? name.squish : "John Doe" + no_commands do + # Retrieve user's name using finger. + # Defaults to <tt>John Doe</tt>. + # + def full_name + name = + `finger $USER 2> /dev/null | grep Login | colrm 1 46 2> /dev/null` + .chomp + name.present? ? name.squish : "John Doe" + end end end end