class Bundler::Dependencies::CLI::Command
Constants
- RAILS_GEMS
Attributes
options[R]
Public Class Methods
new(options)
click to toggle source
# File lib/bundler/dependencies/cli/command.rb, line 10 def initialize(options) @options = options self.shell = Thor::Shell::Basic.new unless options.color? end
Public Instance Methods
output()
click to toggle source
# File lib/bundler/dependencies/cli/command.rb, line 16 def output to_s rescue Bundler::GemfileNotFound error("Could not locate Gemfile at #{SharedHelpers.pwd}.") end
Private Instance Methods
error(message)
click to toggle source
Calls superclass method
# File lib/bundler/dependencies/cli/command.rb, line 69 def error(message) message = shell.send(:prepare_message, message, :red, :bold) super(message) end
gems()
click to toggle source
# File lib/bundler/dependencies/cli/command.rb, line 61 def gems @gems ||= graph.without(*without) end
graph()
click to toggle source
# File lib/bundler/dependencies/cli/command.rb, line 31 def graph @graph ||= scanner.graph end
path()
click to toggle source
# File lib/bundler/dependencies/cli/command.rb, line 35 def path return options.path if valid_gemfile?(options.path) dir = path_dir(options.path) SharedHelpers.chdir(dir) if dir SharedHelpers.default_lockfile end
path_dir(path)
click to toggle source
# File lib/bundler/dependencies/cli/command.rb, line 43 def path_dir(path) return nil unless path Dir.exist?(options.path) ? options.path : File.dirname(options.path) end
scanner()
click to toggle source
# File lib/bundler/dependencies/cli/command.rb, line 27 def scanner @scanner ||= Scanner.new(path) end
valid_gemfile?(path)
click to toggle source
# File lib/bundler/dependencies/cli/command.rb, line 49 def valid_gemfile?(path) return false unless path && File.exist?(path) File.basename(path).end_with?('.lock', '.locked') end
warn(message)
click to toggle source
# File lib/bundler/dependencies/cli/command.rb, line 65 def warn(message) say(message, %i(bold yellow)) end
without()
click to toggle source
# File lib/bundler/dependencies/cli/command.rb, line 55 def without (options.without || []).tap do |gems| gems.concat(RAILS_GEMS) if options.without_rails? end end