Sha256: 5123daaba27b541e02d6b668558daca8c7defd1795f0c4b26e09797194a0cf79

Contents?: true

Size: 653 Bytes

Versions: 14

Compression:

Stored size: 653 Bytes

Contents

require 'rails/generators'
module Hyper
  class Component < Rails::Generators::Base
    source_root File.expand_path('../templates', __FILE__)

    argument :components, type: :array
    def create_component_file
      self.components.each do |component|
        component_array = component.split('::')
        @modules = component_array[0..-2]
        @file_name = component_array.last
        @indent = 0
        template 'component_template.rb',
                 File.join('app/hyperloop/components',
                           @modules.map(&:downcase).join('/'),
                           "#{@file_name.underscore}.rb")
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
hyperloop-0.99.6 lib/generators/hyper/component_generator.rb
hyperloop-0.99.5 lib/generators/hyper/component_generator.rb
hyperloop-0.99.4 lib/generators/hyper/component_generator.rb
hyperloop-0.99.3 lib/generators/hyper/component_generator.rb
hyperloop-0.99.2 lib/generators/hyper/component_generator.rb
hyperloop-0.99.1 lib/generators/hyper/component_generator.rb
hyperloop-0.99.0 lib/generators/hyper/component_generator.rb
hyperloop-1.0.0.lap28 lib/generators/hyper/component_generator.rb
hyperloop-1.0.0.lap27 lib/generators/hyper/component_generator.rb
hyperloop-1.0.0.lap26 lib/generators/hyper/component_generator.rb
hyperloop-1.0.0.lap25 lib/generators/hyper/component_generator.rb
hyperloop-1.0.0.lap24 lib/generators/hyper/component_generator.rb
hyperloop-1.0.0.lap23 lib/generators/hyper/component_generator.rb
hyperloop-1.0.0.lap22 lib/generators/hyper/component_generator.rb