module EmberProj::GemHelper
Public Instance Methods
bundle_command(command)
click to toggle source
File railties/lib/rails/generators/app_base.rb, line 241
# File lib/generators/ember_proj/gem_helper.rb, line 8 def bundle_command(command) say_status :run, "bundle #{command}" # We are going to shell out rather than invoking Bundler::CLI.new(command) # because `rails new` loads the Thor gem and on the other hand bundler uses # its own vendored Thor, which could be a different version. Running both # things in the same process is a recipe for a night with paracetamol. # # We use backticks and #print here instead of vanilla #system because it # is easier to silence stdout in the existing test suite this way. The # end-user gets the bundler commands called anyway, so no big deal. # # Thanks to James Tucker for the Gem tricks involved in this call. print %x[#{Gem.ruby} -rubygems "#{ruby_gems}" #{command}] end
bundle_gems!()
click to toggle source
# File lib/generators/ember_proj/gem_helper.rb, line 3 def bundle_gems! bundle_command 'install' end
gemfile()
click to toggle source
# File lib/generators/ember_proj/gem_helper.rb, line 44 def gemfile @gemfile ||= File.open Rails.root.join('Gemfile'), 'r' end
gemfile_content()
click to toggle source
# File lib/generators/ember_proj/gem_helper.rb, line 40 def gemfile_content @gemfile_content ||= gemfile.read end
has_all_gems?(*names)
click to toggle source
# File lib/generators/ember_proj/gem_helper.rb, line 32 def has_all_gems? *names names.flatten.all? {|name| has_gem? name } end
has_any_gem?(*names)
click to toggle source
# File lib/generators/ember_proj/gem_helper.rb, line 28 def has_any_gem? *names names.flatten.any? {|name| has_gem? name } end
has_gem?(name)
click to toggle source
# File lib/generators/ember_proj/gem_helper.rb, line 36 def has_gem? name gemfile_content =~ /gem\s+('|")#{name}/ end
ruby_gems()
click to toggle source
# File lib/generators/ember_proj/gem_helper.rb, line 24 def ruby_gems Gem.bin_path('bundler', 'bundle') end