Class: Middleman::Cli::Extension

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
middleman-cli/lib/middleman-cli/extension.rb

Overview

A thor task for creating new projects

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootString

Template files are relative to this file

Returns:

  • (String)

14
15
16
# File 'middleman-cli/lib/middleman-cli/extension.rb', line 14

def self.source_root
  File.join(File.dirname(__FILE__), 'templates')
end

Instance Method Details

#extensionObject

The extension task

Parameters:

  • name (String)

28
29
30
31
32
33
34
35
36
37
# File 'middleman-cli/lib/middleman-cli/extension.rb', line 28

def extension
  copy_file 'extension/gitignore', File.join(name, '.gitignore') unless options[:'skip-git']
  template 'extension/Rakefile', File.join(name, 'Rakefile')
  template 'extension/gemspec', File.join(name, "#{name}.gemspec")
  template 'extension/Gemfile', File.join(name, 'Gemfile')
  template 'extension/lib/lib.rb', File.join(name, 'lib', "#{name}.rb")
  template 'extension/lib/lib/extension.rb', File.join(name, 'lib', name, 'extension.rb')
  template 'extension/features/support/env.rb', File.join(name, 'features', 'support', 'env.rb')
  empty_directory File.join(name, 'fixtures')
end