Sha256: 9e19863a9ee4e38c5622848437651e03168c28ed1bae6b79cc55bc861f2e5008

Contents?: true

Size: 937 Bytes

Versions: 14

Compression:

Stored size: 937 Bytes

Contents

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

require 'generators/card'

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

      argument :set_pattern, required: true
      argument :anchors, required: true, type: :array
      class_option 'core', type: :boolean, aliases: '-c', default: false, group: :runtime,
       desc: 'create set files in Card gem'

      def create_files
        mod_path = if options.core?
            File.join Cardio.gem_root, 'mod', file_name
          else
            File.join 'mod', file_name
          end
        set_path  = File.join(mod_path, 'set', set_pattern, anchors[0..-2], "#{anchors.last}.rb")
        spec_path = File.join(mod_path, 'spec', 'set', set_pattern, anchors[0..-2], "#{anchors.last}_spec.rb" )
        template 'set_template.erb', set_path
        template 'set_spec_template.erb', spec_path
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
card-1.17.4 lib/generators/card/set/set_generator.rb
card-1.17.3 lib/generators/card/set/set_generator.rb
card-1.17.2 lib/generators/card/set/set_generator.rb
card-1.17.1 lib/generators/card/set/set_generator.rb
card-1.17.0 lib/generators/card/set/set_generator.rb
card-1.16.15 lib/generators/card/set/set_generator.rb
card-1.16.14 lib/generators/card/set/set_generator.rb
card-1.16.13 lib/generators/card/set/set_generator.rb
card-1.16.12 lib/generators/card/set/set_generator.rb
card-1.16.11 lib/generators/card/set/set_generator.rb
card-1.16.10 lib/generators/card/set/set_generator.rb
card-1.16.9 lib/generators/card/set/set_generator.rb
card-1.16.8 lib/generators/card/set/set_generator.rb
card-1.16.7 lib/generators/card/set/set_generator.rb