lib/bundler/audit/scanner.rb in bundler-audit-0.8.0 vs lib/bundler/audit/scanner.rb in bundler-audit-0.9.0
- old
+ new
@@ -10,11 +10,11 @@
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with bundler-audit. If not, see <http://www.gnu.org/licenses/>.
+# along with bundler-audit. If not, see <https://www.gnu.org/licenses/>.
#
require 'bundler'
require 'bundler/audit/configuration'
require 'bundler/audit/database'
@@ -29,10 +29,13 @@
require 'uri'
require 'yaml'
module Bundler
module Audit
+ #
+ # Scans a `Gemfile.lock` for security issues.
+ #
class Scanner
# The advisory database
#
# @return [Database]
@@ -61,10 +64,13 @@
# Alternative name for the `Gemfile.lock` file.
#
# @param [Database] database
# The database to scan against.
#
+ # @param [String] config_dot_file
+ # The file name of the bundler-audit config file.
+ #
# @raise [Bundler::GemfileLockNotFound]
# The `gemfile_lock` file could not be found within the `root`
# directory.
#
def initialize(root=Dir.pwd,gemfile_lock='Gemfile.lock',database=Database.new,config_dot_file='.bundler-audit.yml')
@@ -77,10 +83,10 @@
raise(Bundler::GemfileLockNotFound,"Could not find #{gemfile_lock.inspect} in #{@root.inspect}")
end
@lockfile = LockfileParser.new(File.read(gemfile_lock_path))
- config_dot_file_full_path = File.join(@root,config_dot_file)
+ config_dot_file_full_path = File.absolute_path(config_dot_file, @root)
@config = if File.exist?(config_dot_file_full_path)
Configuration.load(config_dot_file_full_path)
else
Configuration.new