lib/manpages/install.rb in manpages-0.3.2 vs lib/manpages/install.rb in manpages-0.4.0
- old
+ new
@@ -1,37 +1,33 @@
module Manpages
-
class Install
-
def initialize(gem_spec, gem_dir, target_dir)
@gem_spec = gem_spec
@gem_dir = gem_dir
@target_dir = target_dir
end
def install_manpages
- link_manpages if GemVersion.new(@gem_spec).is_latest?
+ link_manpages if GemVersion.new(@gem_spec).latest?
end
- private
+ private
def link_manpages
ManFiles.new(@gem_dir, @target_dir).manpages.each do |file|
link_manpage(file)
end
end
def link_manpage(file)
man_target_file = ManFiles.new(@gem_dir, @target_dir).man_file_path(file)
- return if File.exist? man_target_file
+ return if man_target_file.exist?
begin
- FileUtils.mkdir_p(File.dirname(man_target_file))
+ FileUtils.mkdir_p(man_target_file.dirname)
FileUtils.ln_s(file, man_target_file, force: true)
- rescue => e
+ rescue
puts "Problems creating symlink #{man_target_file}"
end
end
-
end
-
end