Class: Octopress::Commands::Isolate

Inherits:
Octopress::Command show all
Defined in:
lib/octopress/commands/isolate.rb

Class Method Summary collapse

Methods inherited from Octopress::Command

inherited, #init_with_program, subclasses

Class Method Details

.init_with_program(p) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/octopress/commands/isolate.rb', line 4

def self.init_with_program(p)
  p.command(:isolate) do |c|
    c.syntax 'isolate <POST> [options]'
    c.description "Move all posts not matching selected post to _posts/_exile. Command accepts path to post or search string."
    CommandHelpers.add_common_options c

    c.action do |args, options|
      options['path'] = args.first

      if options['path'] && !File.exist?(options['path'])
        options['path'] = CommandHelpers.select_posts(options['path'], 'isolate')
      end

      isolate_post(options)
    end
  end

  p.command(:integrate) do |c|
    c.syntax 'integrate'
    c.description "Reintegrate posts from _posts/_exile."
    CommandHelpers.add_common_options c

    c.action do |args, options|
      integrate_posts(options)
    end
  end
end

.integrate_posts(options) ⇒ Object



36
37
38
# File 'lib/octopress/commands/isolate.rb', line 36

def self.integrate_posts(options)
  Octopress::Isolate.new(options).integrate
end

.isolate_post(options) ⇒ Object



32
33
34
# File 'lib/octopress/commands/isolate.rb', line 32

def self.isolate_post(options)
  Octopress::Isolate.new(options).isolate
end