@@ -13,7 +13,10 @@ def initialize(plan)
1313
1414 def generate
1515 gem_files . each_with_object ( [ ] ) do |( file , content ) , files |
16- next if file == "lib/#{ @gem_name } /customizations.rb" && should_skip_customizations?
16+ if persisted_file? ( file )
17+ say_status :skip , "Skipping #{ file } because it already exists" , :yellow unless @plan . quiet
18+ next
19+ end
1720
1821 create_file file , content
1922 files << file
@@ -26,8 +29,11 @@ def source
2629
2730 private
2831
32+ # rubocop:disable Metrics/AbcSize
2933 def gem_files
3034 Enumerator . new do |e |
35+ e . yield 'VERSION' , Views ::Client ::Version . new ( @plan ) . render
36+ e . yield 'CHANGELOG.md' , Views ::Client ::ChangelogMd . new . render
3137 e . yield "#{ @gem_name } .gemspec" , Views ::Client ::Gemspec . new ( @plan ) . render
3238 e . yield '.rubocop.yml' , Views ::Client ::RubocopYml . new ( @plan ) . render
3339
@@ -52,9 +58,13 @@ def rbs_files
5258 e . yield "sig/#{ @gem_name } /schema.rbs" , Views ::Client ::SchemaRbs . new ( @plan ) . render
5359 end
5460 end
61+ # rubocop:enable Metrics/AbcSize
5562
56- def should_skip_customizations?
57- Dir [ "#{ destination_root } /**/*" ] . any? { |f | f . include? ( '/customizations.rb' ) }
63+ def persisted_file? ( path )
64+ keep = %W[ lib/#{ @gem_name } /customizations.rb VERSION CHANGELOG.md ]
65+ return false unless keep . include? ( path )
66+
67+ File . exist? ( File . join ( destination_root , path ) )
5868 end
5969 end
6070 end
0 commit comments