Sha256: bbdc2ed6f630fff9eb6dd39ade69460b0929c7fa9e74ec343fa9b6f42059079c
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
module Foobara module Generators module DomainMapperGenerator module Generators class GemfileGenerator < DomainMapperGenerator def applicable? gemfile_contents !~ /^\s*gem\s*["']foobara-domain-mapper-generator\b/ end def template_path "Gemfile" end def target_path "Gemfile" end def generate(_elements_to_generate) match = gemfile_contents.match(/^gem /) if match new_entry = 'gem "foobara-domain-mapper-generator", github: "foobara/domain-mapper-generator"' "#{match.pre_match}\n#{new_entry}\n#{match}#{match.post_match}" else # TODO: maybe print a warning and return the original Gemfile # :nocov: raise "Not sure how to inject foobara-domain-mapper-generator into the Gemfile" # :nocov: end end def gemfile_contents File.read(template_path) end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
foobara-domain-mapper-generator-0.0.2 | src/generators/gemfile_generator.rb |
foobara-domain-mapper-generator-0.0.1 | src/generators/gemfile_generator.rb |