Sha256: 8e8a7753cb86fc8809c58ccb6d7b60b088e8cef2b2c5a2eae0eb196e42a38121
Contents?: true
Size: 783 Bytes
Versions: 1
Compression:
Stored size: 783 Bytes
Contents
module BoringGenerators module GeneratorHelper include Rails::Generators::Actions def app_ruby_version with_ruby_string = `grep "^ruby.*$" Gemfile` || `cat .ruby-version` # only keep 3.3.0 with_ruby_string.gsub(/[^\d\.]/, "").squish end def gem_installed?(gem_name) gem_regex = /^\s*gem\s*['"]#{gem_name}['"]/ File.read("Gemfile").match?(gem_regex) end def bundle_install Bundler.with_unbundled_env { run "bundle install" } end def check_and_install_gem(*args) gem_name, = args if gem_installed?(gem_name) say "#{gem_name} is already in the Gemfile, skipping it...", :yellow else gem *args unless gem_installed?(gem_name) end bundle_install end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
boring_generators-0.14.0 | lib/boring_generators/generator_helper.rb |