Sha256: 509e0cc72289b2cfd9939199e1689deeecbdbd2a7460eae6df3f29239ef5f363

Contents?: true

Size: 1.37 KB

Versions: 3

Compression:

Stored size: 1.37 KB

Contents

module Tay
  module CLI
    class Root < ::Thor
      desc 'new NAME', 'Create a new extension'
      method_option 'no-gitignore', :type => :boolean, :default => false,
        :banner => "Don\'t create a .gitignore file"
      method_option 'no-gemfile', :type => :boolean, :default => false,
        :banner => "Don\'t create a Gemfile file"
      method_option 'use-coffeescript', :type => :boolean, :default => false,
        :banner => "Use coffeescript"
      method_option 'use-haml', :type => :boolean, :default => false,
        :banner => "Use haml"
      def new(name)
        outdir = Pathname.new(Utils.filesystem_name(name))
        create_directory_structure(outdir)

        template('Gemfile', outdir.join('Gemfile')) unless options['no-gemfile']
        copy_file('gitignore', outdir.join('.gitignore')) unless options['no-gitignore']
        template('Tayfile', outdir.join('Tayfile'), {
          'name' => name
        }.merge(options))
      end

      protected

      def create_directory_structure(outdir)
        empty_directory(outdir)
        empty_directory(outdir.join('src'))
        empty_directory(outdir.join('src/assets'))
        empty_directory(outdir.join('src/html'))
        empty_directory(outdir.join('src/javascripts'))
        empty_directory(outdir.join('src/stylesheets'))
        empty_directory(outdir.join('src/templates'))
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tay-0.0.4 lib/tay/cli/new.rb
tay-0.0.3 lib/tay/cli/new.rb
tay-0.0.2 lib/tay/cli/new.rb