Method: Rails::Generators::Actions#github

Defined in:
railties/lib/rails/generators/actions.rb

#github(repo, options = {}, &block) ⇒ Object



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'railties/lib/rails/generators/actions.rb', line 125

def github(repo, options = {}, &block)
  str = [quote(repo)]
  str << quote(options) unless options.empty?
  str = str.join(", ")
  log :github, "github #{str}"

  in_root do
    if @indentation.zero?
      append_file_with_newline "Gemfile", "\ngithub #{str} do", force: true
    else
      append_file_with_newline "Gemfile", "#{indentation}github #{str} do", force: true
    end
    with_indentation(&block)
    append_file_with_newline "Gemfile", "#{indentation}end", force: true
  end
end