Class: Sprout::RubyGenerator

Inherits:
Generator::Base show all
Defined in:
lib/sprout/generators/ruby/ruby_generator.rb

Constant Summary

Constant Summary

Constants included from Executable

Executable::DEFAULT_FILE_EXPRESSION, Executable::DEFAULT_PREFIX, Executable::DEFAULT_SHORT_PREFIX

Instance Attribute Summary (collapse)

Attributes inherited from Generator::Base

#destroy, #force, #input, #logger, #name, #path, #pkg_name, #pkg_version, #quiet, #show_template_paths, #templates

Attributes inherited from Executable::Base

#abort_on_failure, #default_prefix, #default_short_prefix, #executable, #param_hash, #params, #pkg_name, #pkg_version, #prerequisites, #rake_task_name

Instance Method Summary (collapse)

Methods inherited from Generator::Base

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

Methods inherited from Executable::Base

add_param, add_param_alias, #binary_path, #binary_path=, #create_outer_task, #default_file_expression, #execute, #execute_delegate, #from_hash, #initialize, #initialize_defaults, #library_added, #parse!, #parse_extra_options!, #parse_rake_task_arg, #prepare, set, static_default_value_collection, static_parameter_collection, #stderr, #stderr=, #stdout, #stdout=, #system_execute, #to_hash, #to_help, #to_rake, #to_shell, #update_rake_task_name_from_args

Methods included from Concern

#append_features, extended, #included

Constructor Details

This class inherits a constructor from Sprout::Executable::Base

Instance Attribute Details

- (Object) bin

The name of the bin directory - where executables will be located.



32
# File 'lib/sprout/generators/ruby/ruby_generator.rb', line 32

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

- (Object) fixtures

The name of the ‘fixtures’ directory - where test fixtures will be located.



27
# File 'lib/sprout/generators/ruby/ruby_generator.rb', line 27

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

- (Object) lib

The name of the ‘lib’ directory - where your Ruby files will be located.



12
# File 'lib/sprout/generators/ruby/ruby_generator.rb', line 12

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

- (Object) test

The name of the ‘test’ directory - where all tests and fixtures will be located.



17
# File 'lib/sprout/generators/ruby/ruby_generator.rb', line 17

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

- (Object) unit

The name of the ‘unit’ directory - where unit tests will be located.



22
# File 'lib/sprout/generators/ruby/ruby_generator.rb', line 22

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

- (Object) version

The 3-part version for the new Ruby application.



7
# File 'lib/sprout/generators/ruby/ruby_generator.rb', line 7

add_param :version, String, { :default => '0.0.0.pre' }

Instance Method Details

- (Object) manifest



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/sprout/generators/ruby/ruby_generator.rb', line 34

def manifest
  snake = input.snake_case

  directory snake do
    template 'Gemfile', 'ruby_gemfile'
    template 'Rakefile', 'ruby_rakefile'
    template "#{input.snake_case}.gemspec", 'ruby_gemspec'

    directory lib do
      template "#{snake}.rb", 'ruby_input.rb'
      directory snake do
        template 'base.rb', 'ruby_base.rb'
      end
    end

    directory test do
      directory fixtures
      directory unit do
        template "#{input.snake_case}_test.rb", 'ruby_test_case.rb'
        template 'test_helper.rb', 'ruby_test_helper.rb'
      end
    end

    directory bin do
      template input.dash_case, 'ruby_executable'
    end
  end
end