Sha256: 5003f88807365ee8a4b51d6aa43dee2bbdc880f0ce2a9f0234d6eedafd990013
Contents?: true
Size: 1.05 KB
Versions: 19
Compression:
Stored size: 1.05 KB
Contents
# -*- encoding : utf-8 -*- module Cardio module Generators # generate set module files class SetGenerator < ModBase source_root File.expand_path("templates", __dir__) argument :set_pattern, required: true argument :anchors, required: true, type: :array class_option "spec-only", type: :boolean, default: false, group: :runtime, desc: "create only spec file" def create_files template "set_template.erb", set_path unless options["spec-only"] template "set_spec_template.erb", set_path("spec") end private def set_path modifier=nil suffix = modifier ? "_#{modifier}" : nil filename = "#{anchors.last}#{suffix}.rb" dirs = anchors[0..-2] path_parts = [mod_path, modifier, "set", set_pattern, dirs, filename] File.join(*path_parts.compact) end def module_class_string "Card::Set::#{set_pattern.camelize}::#{anchors.map(&:camelize).join '::'}" end end end end
Version data entries
19 entries across 19 versions & 1 rubygems