Sha256: 07d701f5347229c658d7da1c8b74a9816f0eb1d30c768009fc2ae9e4d13f5d62

Contents?: true

Size: 1.64 KB

Versions: 10

Compression:

Stored size: 1.64 KB

Contents

module Sprout
  class RubyGenerator < Sprout::Generator::Base

    ##
    # The 3-part version for the new Ruby application.
    add_param :version, String, { :default => '0.0.0.pre' }

    ##
    # The name of the 'lib' directory - where your Ruby
    # files will be located.
    add_param :lib, String, { :default => 'lib' }

    ##
    # The name of the 'test' directory - where all tests
    # and fixtures will be located.
    add_param :test, String, { :default => 'test' }

    ##
    # The name of the 'unit' directory - where unit tests
    # will be located.
    add_param :unit, String, { :default => 'unit' }

    ##
    # The name of the 'fixtures' directory - where test
    # fixtures will be located.
    add_param :fixtures, String, { :default => 'fixtures' }

    ##
    # The name of the bin directory - where executables
    # will be located.
    add_param :bin, String, { :default => 'bin' }

    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'
          end
          template 'test_helper.rb', 'ruby_test_helper.rb'
        end

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
sprout-1.1.5.pre lib/sprout/generators/ruby/ruby_generator.rb
sprout-1.1.4.pre lib/sprout/generators/ruby/ruby_generator.rb
sprout-1.1.3.pre lib/sprout/generators/ruby/ruby_generator.rb
sprout-1.1.2.pre lib/sprout/generators/ruby/ruby_generator.rb
sprout-1.0.35.pre lib/sprout/generators/ruby/ruby_generator.rb
sprout-1.0.32.pre lib/sprout/generators/ruby/ruby_generator.rb
sprout-1.0.31.pre lib/sprout/generators/ruby/ruby_generator.rb
sprout-1.0.29.pre lib/sprout/generators/ruby/ruby_generator.rb
sprout-1.0.26.pre lib/sprout/generators/ruby/ruby_generator.rb
sprout-1.0.25.pre lib/sprout/generators/ruby/ruby_generator.rb