instance method
add_source
Ruby on Rails 8.0.4
Since v3.0.20Signature
add_source(source, options = {}, &block)
Add the given source to Gemfile
If block is given, gem entries in block are wrapped into the source group.
add_source "http://gems.github.com/" add_source "http://gems.github.com/" do gem "rspec-rails" end
Parameters
-
sourcereq -
optionsopt = {} -
blockblock
Source
# File railties/lib/rails/generators/actions.rb, line 151
def add_source(source, options = {}, &block)
log :source, source
in_root do
if block
append_file_with_newline "Gemfile", "\nsource #{quote(source)} do", force: true
with_indentation(&block)
append_file_with_newline "Gemfile", "end", force: true
else
prepend_file "Gemfile", "source #{quote(source)}\n", verbose: false
end
end
end
Defined in railties/lib/rails/generators/actions.rb line 151
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Rails::Generators::Actions