Sha256: cf4fc394b3b12d0e52ffc583442575413bad41229cd49a42f4b317f32a72fed5

Contents?: true

Size: 835 Bytes

Versions: 5

Compression:

Stored size: 835 Bytes

Contents

# -*- encoding : utf-8 -*-

require "generators/card"

class Card
  module Generators
    class FormatGenerator < NamedBase
      source_root File.expand_path("../templates", __FILE__)

      argument :module_name, required: true
      class_option "core", type: :boolean, aliases: "-c",
                           default: false, group: :runtime,
                           desc: "create format files in Card gem"

      def create_files
        template "format_template.erb", format_path
        template "format_spec_template.erb", format_path("spec")
      end

      def format_path modifier=nil
        suffix = modifier ? "_#{modifier}" : nil
        filename = "#{module_name}_format#{suffix}.rb"
        path_parts = [mod_path, modifier, "format", filename].compact
        File.join(*path_parts)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
card-1.20.4 lib/generators/card/format/format_generator.rb
card-1.20.3 lib/generators/card/format/format_generator.rb
card-1.20.2 lib/generators/card/format/format_generator.rb
card-1.20.1 lib/generators/card/format/format_generator.rb
card-1.20.0 lib/generators/card/format/format_generator.rb