Class: Jekyll::ThemeBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll/theme_builder.rb

Defined Under Namespace

Classes: ERBRenderer

Constant Summary collapse

SCAFFOLD_DIRECTORIES =
%w(
  assets _layouts _includes _sass
).freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(theme_name, opts) ⇒ ThemeBuilder

Returns a new instance of ThemeBuilder.


11
12
13
14
15
# File 'lib/jekyll/theme_builder.rb', line 11

def initialize(theme_name, opts)
  @name = theme_name.to_s.tr(" ", "_").squeeze("_")
  @path = Pathname.new(File.expand_path(name, Dir.pwd))
  @code_of_conduct = !!opts["code_of_conduct"]
end

Instance Attribute Details

#code_of_conductObject (readonly)

Returns the value of attribute code_of_conduct


9
10
11
# File 'lib/jekyll/theme_builder.rb', line 9

def code_of_conduct
  @code_of_conduct
end

#nameObject (readonly)

Returns the value of attribute name


9
10
11
# File 'lib/jekyll/theme_builder.rb', line 9

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path


9
10
11
# File 'lib/jekyll/theme_builder.rb', line 9

def path
  @path
end

Instance Method Details

#create!Object


17
18
19
20
21
22
23
# File 'lib/jekyll/theme_builder.rb', line 17

def create!
  create_directories
  create_starter_files
  create_gemspec
  create_accessories
  initialize_git_repo
end

#user_emailObject


29
30
31
# File 'lib/jekyll/theme_builder.rb', line 29

def user_email
  @user_email ||= `git config user.email`.chomp
end

#user_nameObject


25
26
27
# File 'lib/jekyll/theme_builder.rb', line 25

def user_name
  @user_name ||= `git config user.name`.chomp
end