Sha256: 77cc937a764a27ccf90adad0aef3246a25351be7bd2bd42845f7c37b315d76ee

Contents?: true

Size: 942 Bytes

Versions: 10

Compression:

Stored size: 942 Bytes

Contents

# frozen_string_literal: true
require 'rails/generators'

class QaServer::AssetsGenerator < Rails::Generators::Base
  source_root File.expand_path('../templates', __FILE__)

  desc """
    This generator installs the qa_server CSS assets into your application
       """

  def banner
    say_status('info', 'GENERATING QA_SERVER ASSETS', :blue)
  end

  def inject_css
    say_status('info', '  -- adding qa_server css', :blue)
    copy_file "qa_server.scss", "app/assets/stylesheets/qa_server.scss"
  end

  def inject_js
    return if qa_server_javascript_installed?
    say_status('info', '  -- adding qa_server javascript', :blue)
    insert_into_file 'app/assets/javascripts/application.js', after: '//= require_tree .' do
      <<-JS.strip_heredoc

        //= require qa_server
      JS
    end
  end

private

  def qa_server_javascript_installed?
    IO.read("app/assets/javascripts/application.js").include?('qa_server')
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
qa_server-8.0.1 lib/generators/qa_server/assets_generator.rb
qa_server-7.9.2 lib/generators/qa_server/assets_generator.rb
qa_server-7.9.1 lib/generators/qa_server/assets_generator.rb
qa_server-7.9.0 lib/generators/qa_server/assets_generator.rb
qa_server-7.8.0 lib/generators/qa_server/assets_generator.rb
qa_server-7.7.1 lib/generators/qa_server/assets_generator.rb
qa_server-7.7.0 lib/generators/qa_server/assets_generator.rb
qa_server-7.6.0 lib/generators/qa_server/assets_generator.rb
qa_server-7.5.1 lib/generators/qa_server/assets_generator.rb
qa_server-7.5.0 lib/generators/qa_server/assets_generator.rb