Class: Middleman::Presentation::Cli::CreateTheme

Inherits:
BaseGroup
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/middleman-presentation-core/cli/create_theme.rb

Overview

Create theme

Instance Method Summary collapse

Methods included from Shared

#assets_loader, #bower_path, #enable_debug_mode, included, #open_in_editor

Instance Method Details

#add_path_to_source_pathsObject



30
31
32
# File 'lib/middleman-presentation-core/cli/create_theme.rb', line 30

def add_path_to_source_paths
  source_paths << File.expand_path('../../../../templates', __FILE__)
end

#build_theme_nameObject



34
35
36
37
38
39
40
# File 'lib/middleman-presentation-core/cli/create_theme.rb', line 34

def build_theme_name
  new_name = []
  new_name << options[:prefix] unless options[:prefix].blank?
  new_name << name

  @theme_name = new_name.join('-')
end

#create_asset_directoriesObject



59
60
61
62
63
# File 'lib/middleman-presentation-core/cli/create_theme.rb', line 59

def create_asset_directories
  directory('presentation_theme/javascripts', File.join(theme_name, 'javascripts')) if options[:javascripts_directory]
  directory('presentation_theme/stylesheets', File.join(theme_name, 'stylesheets')) if options[:stylesheets_directory]
  directory('presentation_theme/images', File.join(theme_name, 'images')) if options[:images_directory]
end

#create_bower_config_fileObject



55
56
57
# File 'lib/middleman-presentation-core/cli/create_theme.rb', line 55

def create_bower_config_file
  template 'presentation_theme/bower.json.tt', File.join(theme_name, 'bower.json')
end

#create_theme_directoryObject



51
52
53
# File 'lib/middleman-presentation-core/cli/create_theme.rb', line 51

def create_theme_directory
  empty_directory theme_name
end

#create_variables_for_templatesObject



42
43
44
45
46
47
48
49
# File 'lib/middleman-presentation-core/cli/create_theme.rb', line 42

def create_variables_for_templates
  @author     = options[:author]
  @year       = options[:year]
  @license    = options[:license]
  @email      = options[:email]
  @version    = options[:version]
  @clean_css  = options[:clean_css]
end

#initialize_generatorObject



26
27
28
# File 'lib/middleman-presentation-core/cli/create_theme.rb', line 26

def initialize_generator
  enable_debug_mode
end

#initialize_gitObject



65
66
67
68
69
70
71
72
73
# File 'lib/middleman-presentation-core/cli/create_theme.rb', line 65

def initialize_git
  return unless options[:initialize_git]

  Dir.chdir(theme_name) do
    run 'git init'
    run 'git add -A .'
    run 'git commit -m Init'
  end
end