16
17
18
19
20
21
22
|
# File 'lib/generators/grape_swagger_rails_themes/install_generator.rb', line 16
def copy_grape_swagger_rails_templates
download = open('https://raw.githubusercontent.com/ruby-grape/grape-swagger-rails/master/app/views/grape_swagger_rails/application/index.html.erb')
create_file "app/views/grape_swagger_rails/application/index.html.erb", download.read
insert_into_file "app/views/grape_swagger_rails/application/index.html.erb", '<%= stylesheet_link_tag "swagger-ui-themes/themes/#{GrapeSwaggerRails.options.theme_version}/theme-#{::GrapeSwaggerRails.options.theme}.css" unless ::GrapeSwaggerRails.options.theme == "default" %>', after: "<%= stylesheet_link_tag 'grape_swagger_rails/application.css' %>"
insert_into_file "config/initializers/assets.rb", "\nRails.application.config.assets.precompile += %w( swagger-ui-themes/themes/2.x/*.css swagger-ui-themes/themes/3.x/*.css )", after: "Rails.application.config.assets.paths << Rails.root.join('node_modules')"
end
|