Class: Bundler::CLI::Add
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/bundler/cli/add.rb |
Class Method Summary
- .new(options, gems) ⇒ Add constructor
Instance Attribute Summary
Instance Method Summary
- #run
- #inject_dependencies private
- #perform_bundle_install private
- #validate_options! private
Constructor Details
.new(options, gems) ⇒ Add
Instance Attribute Details
#gems (readonly)
[ GitHub ]# File 'lib/bundler/cli/add.rb', line 5
attr_reader :gems, :, :version
#options (readonly)
[ GitHub ]#version (readonly)
[ GitHub ]# File 'lib/bundler/cli/add.rb', line 5
attr_reader :gems, :, :version
Instance Method Details
#inject_dependencies (private)
[ GitHub ]# File 'lib/bundler/cli/add.rb', line 27
def inject_dependencies dependencies = gems.map {|g| Bundler::Dependency.new(g, version, ) } Injector.inject(dependencies, :conservative_versioning => [:version].nil?, # Perform conservative versioning only when version is not specified :optimistic => [:optimistic], :strict => [:strict]) end
#perform_bundle_install (private)
[ GitHub ]#run
[ GitHub ]# File 'lib/bundler/cli/add.rb', line 14
def run inject_dependencies perform_bundle_install unless ["skip-install"] end
#validate_options! (private)
# File 'lib/bundler/cli/add.rb', line 36
def raise InvalidOption, "You can not specify `--strict` and `--optimistic` at the same time." if [:strict] && [:optimistic] # raise error when no gems are specified raise InvalidOption, "Please specify gems to add." if gems.empty? version.to_a.each do |v| raise InvalidOption, "Invalid gem requirement pattern '#{v}'" unless Gem::Requirement::PATTERN =~ v.to_s end end