watson-ruby icon indicating copy to clipboard operation
watson-ruby copied to clipboard

Not sure if I should use the open/read/write or Fileutils.cp [lib/watson/config.rb]

Open nhmood opened this issue 11 years ago • 0 comments

filename : lib/watson/config.rb line # : 171 tag : review md5 : 0a12ea7e18c69f84fd01bb67bc743921

    # [review] - Not sure if I should use the open/read/write or Fileutils.cp

        # Identify method entry
        debug_print "#{ self.class } : #{ __method__ }\n"

        # Generate full path since File doesn't care about the LOAD_PATH
        # [review] - gsub uses (.?)+ to grab anything after lib (optional), better regex? 
        _full_path = __dir__.gsub(/\/lib(.?)+/, '') + "/" + "assets/defaultConf"
        debug_print "Full path to defaultConf (in gem): #{ _full_path }\n"

        # Check to make sure we can access the default file
        if !Watson::FS.check_file(_full_path)
            print "Unable to open #{ _full_path }\n"
            print "Cannot create default, exiting...\n"
            return false
        else

nhmood avatar Nov 21 '13 16:11 nhmood