Sha256: 4839c35dbd4ddfbf35f60ec658dbed9151beb4f3e82a8a39fc378b9f996b5ae9

Contents?: true

Size: 925 Bytes

Versions: 24

Compression:

Stored size: 925 Bytes

Contents

require_relative "./abstract_file_card"

class Card
  class FileCardCreator
    # Move javascript or coffeescript from the card database to a file.
    # It generates three files:
    #  1. a migration file that ensures the card has a codename and adds it to the
    #     script rule card.
    #  2. a script file with the source code
    #  3. a ruby file (=code rule) that ties the script file to the card
    class ScriptCard < AbstractFileCard
      @supported_types = %i[js coffee]
      @category = :script
      @default_rule_name = "*all+*script"

      private

      def source_file_ext
        @type == :coffee ? "js.coffee" : @type
      end

      def type_codename
        @type_codename ||=
          case @type
          when :js then :java_script
          when :coffee then :coffee_script
          end
      end

      def source_file_dir
        File.join "lib", "javascript"
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
card-1.104.2 lib/card/file_card_creator/script_card.rb
card-1.104.1 lib/card/file_card_creator/script_card.rb
card-1.104.0 lib/card/file_card_creator/script_card.rb
card-1.103.4 lib/card/file_card_creator/script_card.rb
card-1.103.3 lib/card/file_card_creator/script_card.rb
card-1.103.2 lib/card/tasks/card/file_card_creator/script_card.rb
card-1.103.1 lib/card/tasks/card/file_card_creator/script_card.rb
card-1.103.0 lib/card/tasks/card/file_card_creator/script_card.rb
card-1.101.7 lib/card/tasks/card/file_card_creator/script_card.rb
card-1.102.0 lib/card/tasks/card/file_card_creator/script_card.rb
card-1.101.6 lib/card/tasks/card/file_card_creator/script_card.rb
card-1.101.5 lib/card/tasks/card/file_card_creator/script_card.rb
card-1.101.4 lib/card/tasks/card/file_card_creator/script_card.rb
card-1.101.3 lib/card/tasks/card/file_card_creator/script_card.rb
card-1.101.2 lib/card/tasks/card/file_card_creator/script_card.rb
card-1.101.1 lib/card/tasks/card/file_card_creator/script_card.rb
card-1.101.0 lib/card/tasks/card/file_card_creator/script_card.rb
card-1.100.0 lib/card/tasks/card/file_card_creator/script_card.rb
card-1.99.6 lib/card/tasks/card/file_card_creator/script_card.rb
card-1.99.5 lib/card/tasks/card/file_card_creator/script_card.rb