Sha256: 2131d6c73bb437daa7f1105d1d102663fef77ab58c44670c30035ec8331d8add

Contents?: true

Size: 950 Bytes

Versions: 40

Compression:

Stored size: 950 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

40 entries across 40 versions & 1 rubygems

Version Path
qa_server-7.4.0 lib/generators/qa_server/assets_generator.rb
qa_server-7.3.0 lib/generators/qa_server/assets_generator.rb
qa_server-7.2.1 lib/generators/qa_server/assets_generator.rb
qa_server-7.2.0 lib/generators/qa_server/assets_generator.rb
qa_server-7.1.3 lib/generators/qa_server/assets_generator.rb
qa_server-7.1.2 lib/generators/qa_server/assets_generator.rb
qa_server-7.1.1 lib/generators/qa_server/assets_generator.rb
qa_server-7.1.0 lib/generators/qa_server/assets_generator.rb
qa_server-7.0.0 lib/generators/qa_server/assets_generator.rb
qa_server-6.2.0 lib/generators/qa_server/assets_generator.rb
qa_server-6.1.0 lib/generators/qa_server/assets_generator.rb
qa_server-6.0.0 lib/generators/qa_server/assets_generator.rb
qa_server-5.5.1 lib/generators/qa_server/assets_generator.rb
qa_server-5.5.0 lib/generators/qa_server/assets_generator.rb
qa_server-5.4.0 lib/generators/qa_server/assets_generator.rb
qa_server-5.3.0 lib/generators/qa_server/assets_generator.rb
qa_server-5.2.1 lib/generators/qa_server/assets_generator.rb
qa_server-5.2.0 lib/generators/qa_server/assets_generator.rb
qa_server-5.1.0 lib/generators/qa_server/assets_generator.rb
qa_server-5.0.3 lib/generators/qa_server/assets_generator.rb