Class: Hyde::App

Inherits:
Thor
  • Object
show all
Defined in:
lib/hyde/app.rb

Instance Method Summary collapse

Instance Method Details

#new(dir = '.') ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/hyde/app.rb', line 9

def new(dir = '.')
  dir = File.expand_path(dir)
  skeleton = File.join(File.expand_path(File.dirname(__FILE__)), '..', '..', 'skeletons', 'new')

  files = Rake::FileList[File.join(skeleton, '*'), File.join(skeleton, '.*')].exclude(/\.\.?$/)
  FileUtils.mkdir_p dir
  FileUtils.cp_r files, dir

  `git init #{dir}`
  `env GIT_DIR=#{File.join(dir, '.git')} git remote add origin [email protected]:#{File.basename(dir)}.git`

  puts <<-EOS

  Initialized new app in #{dir}

  Now run:
    bundle install
    bundle exec jekyll --server

  and point your browser to http://localhost:4000

  For maximum justice, install the LiveReload extension for your browser.

  Then, run:
    bundle exec guard

  EOS
end