6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/generators/types_generator.rb', line 6
def create_types_file
types_path = 'app/models/type.rb'
if File.exist?(types_path)
content = File.read(types_path)
unless content.include?('include ServiceBase::Types')
new_content = content.sub(/module Type\s*\n/, "module Type\n include ServiceBase::Types\n")
File.write(types_path, new_content)
end
else
create_file types_path, <<~RUBY
module Type
include ServiceBase::Types
end
RUBY
end
end
|