Class: Sprout::GeneratorGenerator

Inherits:
Sprout::Generator::Base show all
Defined in:
lib/sprout/generators/generator/generator_generator.rb

Constant Summary

Constants included from Executable

DEFAULT_FILE_EXPRESSION, DEFAULT_PREFIX, DEFAULT_SHORT_PREFIX

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from Sprout::Generator::Base

#default_search_paths, #directory, #execute, #file, #generator, inherited, #prepare_command, #resolve_template, #say, #template, #template_paths, #unexecute

Methods included from Concern

#append_features, extended, #included

Instance Attribute Details

- (String) bin

The name of the folder where binary or executable artifacts should be created by compiler tasks.

Returns:

  • (String)

    An instance of String



# File ''

add_param :bin, String, { :default => 'bin' }

- (String) extension

The default (primary) file extension for generated source files. This should hint at the project type.

Returns:

  • (String)

    An instance of String



# File ''

add_param :extension, String, { :default => '.as' }

- (String) fixtures

The name of the child folder of the test folder where fixtures should be generated.

Returns:

  • (String)

    An instance of String



# File ''

add_param :fixtures, String, { :default => 'fixtures' }

- (String) generators

The name of the folder where custom generators and templates will be found.

Returns:

  • (String)

    An instance of String



# File ''

add_param :generators, String, { :default => 'generators' }

- (String) lib

The name of the folder where external libraries will be installed.

Returns:

  • (String)

    An instance of String



# File ''

add_param :lib, String, { :default => 'lib' }

- (String) namespace

The default module that classes will be added to.

Returns:

  • (String)

    An instance of String



# File ''

add_param :namespace, String, { :default  => ''}

- (String) test

The name of the folder where tests should be generated.

Returns:

  • (String)

    An instance of String



# File ''

add_param :test, String, { :default => 'test' }

- (String) unit

The name of the child folder of the test folder where unit tests should be generated.

Returns:

  • (String)

    An instance of String



# File ''

add_param :unit, String, { :default => 'unit' }

- (String) vendor

The name of the folder where external source code should be placed.

Returns:

  • (String)

    An instance of String



# File ''

add_param :vendor, String, { :default => 'vendor' }

Instance Method Details

- (Object) manifest



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/sprout/generators/generator/generator_generator.rb', line 49

def manifest  
  directory bin do
    template "#{input.snake_case}", "generator_executable"
  end

  directory lib do
    #We need to add a folder with the same name as the module to be used in order to faux namespace our generators to avoid collisions from super classes
    directory namespace do
      directory generators do
        template "#{input.snake_case}_generator.rb", "generator_class.rb"
        directory "templates" do
          template "#{input.camel_case}#{extension}", "generator_template"
        end
      end
    end
  end

  directory test do
    directory unit do
      template "#{input.snake_case}_generator_test.rb", "generator_test.rb"
      template "test_helper.rb", "generator_test_helper.rb"
    end
    directory fixtures do
      directory "generators"
    end
  end
  
  #This should actually be moved to the library generator
  #directory vendor

end