Class: Eucalypt::Blog

Inherits:
Thor
  • Object
show all
Extended by:
List
Includes:
Helpers, Helpers::Gemfile, Helpers::Messages, Thor::Actions
Defined in:
lib/eucalypt/blog/helpers.rb,
lib/eucalypt/blog/namespaces/blog/cli/blog.rb

Defined Under Namespace

Modules: Helpers

Class Method Summary collapse

Instance Method Summary collapse

Methods included from List

help

Methods included from Helpers::Gemfile

check, #gemfile_add, include?

Class Method Details



39
40
41
# File 'lib/eucalypt/blog/namespaces/blog/cli/blog.rb', line 39

def self.banner(task, namespace = false, subcommand = true)
  basename + ' ' + task.formatted_usage(self, true, subcommand).split(':').join(' ')
end

Instance Method Details

#setupObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/eucalypt/blog/namespaces/blog/cli/blog.rb', line 18

def setup
  directory = File.expand_path('.')
  if Eucalypt.app? directory
    Out.setup 'Setting up blog environment...'

    gemfile_add(
      'Markdown and YAML front-matter parsing',
      {front_matter_parser: '0.2.0', rdiscount: '~> 2.2'},
      directory
    )

    generator = Eucalypt::Generators::Blog.new
    generator.destination_root = directory
    generator.helper
    generator.controller(route: options[:route])
    generator.views
  else
    Eucalypt::Error.wrong_directory
  end
end