Class: Ecstatic::Command

Inherits:
Thor
  • Object
show all
Includes:
Actions, Thor::Actions
Defined in:
lib/ecstatic/command.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Actions

#git

Class Method Details

.source_rootObject



6
7
8
# File 'lib/ecstatic/command.rb', line 6

def self.source_root
  File.expand_path('../templates', __FILE__)
end

Instance Method Details

#deployObject



36
37
38
39
40
41
42
# File 'lib/ecstatic/command.rb', line 36

def deploy
  Dir.chdir('gh-pages') do
    ensure_we_are_on_branch
    commit_changes_if_necessary &&
      push_changes
  end
end

#initObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ecstatic/command.rb', line 12

def init
  init_git_if_not_already
  directory 'site'
  copy_file '.gitignore'
  copy_file 'config.rb'

  if options.ghpages?
    empty_directory 'gh-pages'
    init_git_if_not_already('gh-pages')
    Dir.chdir('gh-pages') do
      git :checkout => '-b gh-pages'
    end
  end
end

#serverObject



28
29
30
31
32
33
# File 'lib/ecstatic/command.rb', line 28

def server
  Thread.new do
    Ecstatic::Watcher.watch!
  end
  Ecstatic::Server.run!
end