Class: Octopress::Ink::Commands::Init

Inherits:
Object
  • Object
show all
Defined in:
lib/octopress-ink/commands/init.rb

Class Method Summary collapse

Class Method Details

.init_pluginObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/octopress-ink/commands/init.rb', line 23

def self.init_plugin
  settings = New.gem_settings(@options['path'])
  settings[:type] = @options['theme'] ? 'theme' : 'plugin'

  New.add_asset_dirs(settings)
  New.add_demo_files(settings)

  puts "\nTo finish setting up your Octopress Ink plugin:\n".bold
  puts "1. Add gem requirements to your gemspec:\n\n"
  puts New.dependencies(settings).sub("\n\n", "\n").yellow
  puts "2. Add an Octopress Ink plugin to your gem, making changes as necessary:\n\n"

  template = <<-HERE
require "octopress-ink"

Octopress::Ink.add_plugin({
#{New.indent(New.plugin_config(settings))}
})
  HERE

  puts template.yellow
end

.process_command(p) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/octopress-ink/commands/init.rb', line 5

def self.process_command(p)
  p.command(:init) do |c|
    c.syntax "init <PATH> [options]"
    c.description "Add Octopress Ink scaffolding to an existing gem based plugin."
    c.option "theme", "--theme", "Plugin will be a theme."

    c.action do |args, options|
      if args.empty?
        raise "Please provide a plugin name, e.g. my_awesome_plugin."
      else
        @options = options
        @options['path'] = args[0]
        init_plugin
      end
    end
  end
end