Sha256: 3d5fb6ec6b760ec1d14f04218ef6cabfa5d84b81423203f455e7c0829bed90ed

Contents?: true

Size: 965 Bytes

Versions: 29

Compression:

Stored size: 965 Bytes

Contents

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

require "generators/card"

class Card
  module Generators
    class ModGenerator < NamedBase
      class_option "core",
                   type: :boolean, aliases: "-c",
                   default: false, group: :runtime,
                   desc: "create mod Card gem"

      def create_mod_tree
        create_empty_tree mod_path => { lib:    [:javascript, :stylesheets],
                                        public: [:assets],
                                        set:    [] }
      end

      private

      def create_empty_tree structure
        return unless structure.present?
        if structure.is_a?(Hash)
          structure.each_pair do |k, v|
            empty_directory k.to_s
            inside k.to_s do
              create_empty_tree v
            end
          end
        else
          Array.wrap(structure).each do |v|
            empty_directory v.to_s
          end
        end
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
card-1.101.4 lib/generators/card/mod/mod_generator.rb
card-1.101.3 lib/generators/card/mod/mod_generator.rb
card-1.101.2 lib/generators/card/mod/mod_generator.rb
card-1.101.1 lib/generators/card/mod/mod_generator.rb
card-1.101.0 lib/generators/card/mod/mod_generator.rb
card-1.100.0 lib/generators/card/mod/mod_generator.rb
card-1.99.6 lib/generators/card/mod/mod_generator.rb
card-1.99.5 lib/generators/card/mod/mod_generator.rb
card-1.99.4 lib/generators/card/mod/mod_generator.rb
card-1.99.3 lib/generators/card/mod/mod_generator.rb
card-1.99.2 lib/generators/card/mod/mod_generator.rb
card-1.99.1 lib/generators/card/mod/mod_generator.rb
card-1.99.0 lib/generators/card/mod/mod_generator.rb
card-1.98.3 lib/generators/card/mod/mod_generator.rb
card-1.98.2 lib/generators/card/mod/mod_generator.rb
card-1.98.1 lib/generators/card/mod/mod_generator.rb
card-1.98.0 lib/generators/card/mod/mod_generator.rb
card-1.97.0.1 lib/generators/card/mod/mod_generator.rb
card-1.97.0 lib/generators/card/mod/mod_generator.rb
card-1.96.8 lib/generators/card/mod/mod_generator.rb